/* TESCOM Connect admin console (MyRADIUS)
   Palette: rack slate (navigation), fibre aqua (primary action),
   Access-Accept green / Access-Reject red for results. System fonts only
   (the Content-Security-Policy allows no external font sources). */

:root {
  --rack: #1c2a39;
  --rack-2: #26384b;
  --rack-text: #c9d4df;
  --paper: #f3f5f8;
  --surface: #ffffff;
  --ink: #16202b;
  --muted: #5b6b7c;
  --line: #d6dde5;
  --fibre: #0a7f8c;
  --fibre-dark: #07636d;
  --accept: #1f7a47;
  --reject: #b42318;
  --info: #255f99;
  --radius-s: 4px;
  --radius-m: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Ubuntu, Cantarell, "Noto Sans", sans-serif;
  --space: 1rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; font-family: var(--font); font-size: 0.9375rem; line-height: 1.55; color: var(--ink); background: var(--paper); }
a { color: var(--fibre-dark); }
a:hover { color: var(--rack); }
:focus-visible { outline: 3px solid var(--fibre); outline-offset: 2px; }
h1, h2 { line-height: 1.25; margin: 0 0 0.5rem; }
h2 { font-size: 1.0625rem; font-weight: 650; }
p { margin: 0 0 0.75rem; max-width: 72ch; }
.muted { color: var(--muted); }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 0.5rem 0.75rem; z-index: 10; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- brand (official TESCOM logo, shown unmodified) ----------
   The artwork has its own light background, so on the dark sidebar and sign-in
   panel it reads as a logo tile; only the corners are rounded by CSS. */
.brand-logo, .login-logo { display: block; height: auto; max-width: 100%; border-radius: 8px; }

/* ---------- authenticated shell ---------- */
.shell { display: grid; grid-template-columns: 15.5rem 1fr; min-height: 100vh; }
.sidebar { background: var(--rack); color: var(--rack-text); padding: 1.25rem 0.75rem; }
.sidebar .brand { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; padding: 0 0.5rem 1.25rem; color: #fff; text-decoration: none; }
.sidebar .brand-logo { width: 132px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.05rem; letter-spacing: 0.01em; }
.brand-text span { font-size: 0.78rem; color: var(--rack-text); }
.nav-group { margin: 1.1rem 0.5rem 0.35rem; font-size: 0.78rem; color: #8ea1b3; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 0.45rem 0.6rem; border-radius: var(--radius-s); color: var(--rack-text); text-decoration: none; }
.sidebar a:hover { background: var(--rack-2); color: #fff; }
.sidebar a[aria-current="page"] { background: var(--rack-2); color: #fff; box-shadow: inset 3px 0 0 var(--fibre); }

.frame { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1.5rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.page-title { font-size: 1.2rem; margin: 0; flex: 1; }
.account { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 0.5rem; }
.who-name { font-weight: 600; }
.account-link { font-size: 0.875rem; }
.signout { margin: 0; }
.menu-toggle { display: none; }
.topbar-logo { display: none; width: 84px; height: auto; border-radius: 6px; }  /* phones only: sidebar is collapsed */
.content { padding: 1.5rem; max-width: 96rem; width: 100%; }
.content:focus { outline: none; }

/* role badges: shape differs, not only colour */
.role { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; border: 1px solid; }
.role-super_admin { color: #6b2c91; border-color: #c9a6de; background: #f6effb; }
.role-admin { color: var(--info); border-color: #a9c4e0; background: #eef4fa; }
.role-viewer { color: var(--muted); border-color: var(--line); background: #f4f6f8; }

/* ---------- content blocks ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.panel-narrow { max-width: 34rem; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.25rem; }
.split { margin-bottom: 1.25rem; }
.split .panel { margin-bottom: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.ticks { margin: 0; padding-left: 1.2rem; }
.ticks li { margin-bottom: 0.25rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }

/* ---------- alerts ---------- */
.alert { border-radius: var(--radius-s); padding: 0.65rem 0.85rem; border: 1px solid; border-left-width: 4px; }
.alert p, .alert ul { margin: 0; }
.alert ul { padding-left: 1.2rem; margin-top: 0.25rem; }
.alert-error { color: var(--reject); background: #fdf1f0; border-color: #f0b9b3; border-left-color: var(--reject); }
.alert-ok { color: var(--accept); background: #eef8f2; border-color: #a9d8bc; border-left-color: var(--accept); }
.alert-info { color: var(--info); background: #eef4fa; border-color: #a9c4e0; border-left-color: var(--info); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field-label { font-weight: 600; font-size: 0.875rem; }
.field-hint { font-size: 0.8rem; color: var(--muted); }
input[type="text"], input[type="password"], input[type="email"] {
  font: inherit; padding: 0.55rem 0.7rem; border: 1px solid #b7c3cf; border-radius: var(--radius-s);
  background: #fff; color: var(--ink); width: 100%;
}
input:focus-visible { outline: 3px solid rgba(10, 127, 140, 0.35); border-color: var(--fibre); outline-offset: 0; }
.check { display: flex; gap: 0.5rem; align-items: center; font-size: 0.9rem; }
.check input { width: 1rem; height: 1rem; accent-color: var(--fibre); }

.btn { text-decoration: none; display: inline-block; font: inherit; font-weight: 600; border-radius: var(--radius-s); padding: 0.55rem 1rem; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: var(--fibre); color: #fff; }
.btn-primary:hover { background: var(--fibre-dark); }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--ink); padding: 0.35rem 0.75rem; }
.btn-quiet:hover { border-color: var(--muted); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.7; cursor: progress; }

/* ---------- tables, lists, filters ---------- */
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.cell-clip { max-width: 13rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prewrap { white-space: pre-wrap; }
.sub { display: block; font-size: 0.8rem; color: var(--muted); }
.crumbs { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.75rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.panel-flush { padding: 0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.panel .table-wrap { border: 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: #f8fafc; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }

.toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.filters { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.field-inline { min-width: 10rem; }
.clear-link { font-size: 0.875rem; align-self: center; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: flex-end; padding: 0.75rem 0; font-size: 0.875rem; }

/* status badges: text always states the status; colour only reinforces it */
.badge { display: inline-block; padding: 0.05rem 0.5rem; border-radius: var(--radius-s); font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--line); background: #f4f6f8; color: var(--muted); white-space: nowrap; }
.badge-active, .badge-accept { color: var(--accept); border-color: #a9d8bc; background: #eef8f2; }
.badge-expiring { color: #8a5a00; border-color: #e8cf94; background: #fdf6e3; }
.badge-expired, .badge-reject { color: var(--reject); border-color: #f0b9b3; background: #fdf1f0; }
.badge-disabled, .badge-deleted { color: var(--muted); border-color: var(--line); background: #f1f3f5; }
.badge-deleted { text-decoration: line-through; }

/* dashboard figures */
.counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 1rem; margin: 0.5rem 0 0; }
.counts > div { border-left: 3px solid var(--line); padding-left: 0.75rem; }
.counts dt { color: var(--muted); font-size: 0.875rem; }
.counts dd { margin: 0; font-size: 1.75rem; font-weight: 650; line-height: 1.2; }
.counts dd.accept { color: var(--accept); }
.counts dd.reject { color: var(--reject); }
.counts-two { grid-template-columns: repeat(2, minmax(6rem, 1fr)); }
.count-note { font-size: 0.8rem; color: #8a5a00; margin: 0.25rem 0 0; }
.big-figure { font-size: 1.75rem; font-weight: 650; margin: 0.25rem 0; }
.big-figure span { font-size: 0.95rem; font-weight: 400; color: var(--muted); }
.empty { color: var(--muted); margin: 0; }
.empty-state { text-align: left; }

/* detail pages */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.detail-name { font-size: 1.15rem; font-weight: 650; margin-bottom: 0.25rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.radius-rows { list-style: none; margin: 0; padding: 0; font-size: 0.875rem; }
.radius-rows li { padding: 0.3rem 0; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }

/* forms */
.form-grid { display: grid; gap: 1.25rem; max-width: 52rem; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
legend { font-weight: 650; font-size: 1rem; padding: 0; margin-bottom: 0.5rem; }
.field-wide { grid-column: 1 / -1; }
.optional { font-weight: 400; color: var(--muted); }
.field-error { color: var(--reject); font-size: 0.8rem; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--reject); }
input[type="search"], input[type="tel"], input[type="datetime-local"], input[type="date"], select, textarea {
  font: inherit; padding: 0.5rem 0.65rem; border: 1px solid #b7c3cf; border-radius: var(--radius-s); background: #fff; color: var(--ink); width: 100%;
}
input[readonly] { background: #f1f3f5; color: var(--muted); }
textarea { resize: vertical; }
.form-actions { display: flex; gap: 1rem; align-items: center; }
code { font-size: 0.85em; background: #eef1f4; padding: 0.05rem 0.3rem; border-radius: 3px; }

.btn-danger { background: var(--reject); color: #fff; }
.btn-danger:hover { background: #8f1c13; }
.btn-danger-quiet { background: transparent; border-color: #f0b9b3; color: var(--reject); padding: 0.35rem 0.75rem; text-decoration: none; }
.btn-quiet { text-decoration: none; display: inline-block; }
.danger-zone { border-color: #f0b9b3; }
.danger-zone ul { margin: 0; padding-left: 1.2rem; }

/* ---------- sign-in page ---------- */
.bare { min-height: 100vh; }
.login { display: grid; grid-template-columns: minmax(18rem, 26rem) 1fr; min-height: 100vh; }
.login-context { background: var(--rack); color: var(--rack-text); padding: 2.5rem 2rem; display: flex; flex-direction: column; }
.login-logo { width: 176px; margin-bottom: 1.1rem; }
.login-brand { color: #fff; font-size: 1.45rem; font-weight: 700; margin: 0 0 0.25rem; }
.login-tagline-sub { display: block; margin-top: 0.15rem; color: #9fb0c1; }
.login-tagline { font-size: 0.9rem; margin-bottom: 2.5rem; }

/* The request path: the one distinctive element. A vertical "cable" with a
   node per hop; the database node shows where the portal plugs in. */
.request-path { list-style: none; margin: 0; padding: 0 0 0 1.5rem; }
/* one cable segment from each node to the next; none after the last node */
.request-path li:not(:last-child)::after {
  content: ""; position: absolute; left: calc(-1.025rem - 1px); top: 1.25rem; bottom: -0.3rem;
  width: 2px; background: #3d556d;
}
.request-path li { position: relative; padding: 0 0 1.4rem 0.9rem; display: flex; flex-direction: column; }
.request-path li::before {
  content: ""; position: absolute; left: -1.5rem; top: 0.3rem; width: 0.95rem; height: 0.95rem;
  border-radius: 50%; background: var(--rack); border: 2px solid #6f8ba5;
}
.hop { color: #fff; font-weight: 600; }
.hop-note { font-size: 0.85rem; color: #9fb0c1; }
.request-path .hop-db::before { border-color: var(--fibre); background: var(--fibre); }
.portal-tap {
  margin-top: 0.6rem; align-self: flex-start; font-size: 0.8rem; color: #d9f3f5;
  border: 1px dashed var(--fibre); border-radius: var(--radius-s); padding: 0.2rem 0.55rem;
}

.login-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.login-form { width: 100%; max-width: 23rem; display: flex; flex-direction: column; gap: 1rem; }
.login-form h1 { font-size: 1.6rem; margin: 0; }
.login-lede { color: var(--muted); margin: 0; }
.login-foot { font-size: 0.8rem; color: var(--muted); margin: 0; text-align: center; }

.bare-message { max-width: 34rem; margin: 15vh auto; padding: 0 1.25rem; }

/* ---------- responsive ---------- */
@media (max-width: 52rem) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.open { display: block; }
  .topbar-logo { display: block; }
  .menu-toggle { display: inline-block; font: inherit; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-s); padding: 0.35rem 0.7rem; }
  .topbar { flex-wrap: wrap; padding: 0.75rem 1rem; }
  .account { width: 100%; justify-content: space-between; }
  .content { padding: 1rem; }
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-context { padding: 1.25rem; }
  .login-tagline { margin-bottom: 0; }
  .request-path { display: none; }  /* keep the form above the fold on phones */
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* dashboard overview: attention line, figure tiles, 7-day trend */
.attention { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0 0 1.25rem; padding: 0.7rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accept); border-radius: var(--radius-m); }
.attention-on { border-left-color: var(--reject); background: #fdf1f0; border-color: #f0b9b3; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.tile { display: flex; flex-direction: column; gap: 0.15rem; padding: 1rem 1.25rem; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-top: 3px solid var(--fibre); border-radius: var(--radius-m); text-decoration: none; }
a.tile:hover, a.tile:focus-visible { border-color: var(--fibre); color: var(--ink); box-shadow: 0 2px 8px rgba(22, 32, 43, 0.08); }
.tile-label { color: var(--muted); font-size: 0.875rem; }
.tile-figure { font-size: 2rem; font-weight: 650; line-height: 1.15; }
.tile-note { color: var(--muted); font-size: 0.8rem; }
.tile-bad { color: var(--reject); font-weight: 600; }
.trend { display: block; width: 100%; max-width: 46rem; height: auto; margin-top: 0.5rem; }
.trend-axis { stroke: var(--line); stroke-width: 1; }
.trend-hit { fill: transparent; }
.trend-bar { fill: var(--fibre); opacity: 0.55; }
.trend-bar.trend-today { opacity: 1; }
.trend g:hover .trend-bar { opacity: 1; fill: var(--fibre-dark); }
.trend-value { fill: var(--ink); font-size: 13px; font-weight: 600; }
.trend-label { fill: var(--muted); font-size: 12px; }
.trend-label-today { fill: var(--ink); font-weight: 600; }

/* new TESCOM wordmark (transparent background, wider than the old tile) */
.brand-logo, .login-logo, .topbar-logo { border-radius: 0; }
.sidebar .brand-logo { width: 190px; }
.login-logo { width: 230px; }
.topbar-logo { width: 110px; }

/* guest portal design (Sites) */
.portal-logo-current { display: block; max-width: 220px; max-height: 80px; padding: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-s); }
input[type="color"] { width: 4rem; height: 2.4rem; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; }

/* guest list: date + hour filters */
.date-hour { display: flex; gap: 0.35rem; }
.date-hour select { width: auto; }

/* Wi-Fi QR poster panel (Sites) */
.qr-panel { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.qr-small { border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; padding: 4px; }
