/* Clair Global brand fonts. Self-hosted from /static/fonts so the admin UI
   keeps its identity even when the IdP/CDN egress is restricted. */
@font-face {
  font-family: "Roboto";
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/Roboto-Light.ttf") format("truetype");
}
@font-face {
  font-family: "Roboto";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/Roboto-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Roboto";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/Roboto-Medium.ttf") format("truetype");
}
@font-face {
  font-family: "Roboto";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/Roboto-Bold.ttf") format("truetype");
}
@font-face {
  font-family: "Roboto Mono";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/RobotoMono-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Roboto Mono";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/RobotoMono-Medium.ttf") format("truetype");
}
@font-face {
  font-family: "Droid Sans";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/DroidSans-Bold.ttf") format("truetype");
}

:root {
  /* Brand palette (Clair Global Brand Guide v4.2) */
  --brand-blue: #15a3d5;        /* Patch of Blue — primary */
  --brand-blue-dark: #036880;   /* Blue Suede — secondary */
  --brand-blue-deep: #034b58;   /* Dazzling Blue — deep accent */
  --brand-ink: #2b2b2b;         /* Paint it Black */
  --brand-ink-muted: #696868;   /* Grey Seal */
  --brand-border: #cfcccc;      /* Silver Springs */
  --brand-bg: #f7f7f7;          /* White Satin */

  /* Semantic tokens (used everywhere else in this stylesheet) */
  --bg: var(--brand-bg);
  --surface: #ffffff;
  --surface-muted: #fafbfc;
  --ink: var(--brand-ink);
  --ink-muted: var(--brand-ink-muted);
  --accent: var(--brand-blue);
  --accent-strong: var(--brand-blue-dark);
  --accent-deep: var(--brand-blue-deep);
  --accent-soft: rgba(21, 163, 213, 0.12);
  /* Used for sub-headers + active tab labels. Light mode = deep brand blue
     for contrast on white surfaces; dark mode override below makes it
     readable on dark surfaces. */
  --accent-text: var(--brand-blue-dark);
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --success: #2c7a4e;
  --success-soft: #e6f7ee;
  --warn: #b07a00;
  --warn-soft: #fff5da;
  --border: #e3e1e1;
  --border-strong: var(--brand-border);
  --shadow: 0 1px 2px rgba(43, 43, 43, 0.04), 0 8px 24px rgba(43, 43, 43, 0.06);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  /* Typography tokens */
  --font-sans: "Roboto", "Helvetica Neue", "Arial", sans-serif;
  --font-mono: "Roboto Mono", "SF Mono", "Menlo", "Consolas", monospace;
  --font-display: "Droid Sans", "Roboto", sans-serif;
}

/* Dark theme — keeps the brand blue accent but flips background/ink. */
[data-theme="dark"] {
  --bg: #181a1c;
  --surface: #232629;
  --surface-muted: #1f2225;
  --ink: #e9eaeb;
  --ink-muted: #a4a8ad;
  --accent: #3fb6e0;            /* slightly lifted blue for contrast on dark */
  --accent-strong: #15a3d5;
  --accent-soft: rgba(63, 182, 224, 0.18);
  --danger: #e57766;
  --danger-soft: rgba(229, 119, 102, 0.16);
  --success: #6dc28d;
  --success-soft: rgba(109, 194, 141, 0.16);
  --warn: #d4a849;
  --warn-soft: rgba(212, 168, 73, 0.16);
  --border: #34383c;
  --border-strong: #4a4f54;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.5);
  /* Brand Blue Suede is too dark on a dark surface — lift to Patch of Blue. */
  --accent-text: #5cc7e8;
}

/* Theme toggle button in the header. */
.theme-toggle {
  width: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f3f3f3;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: inline;
}

[data-theme="dark"] .theme-toggle .icon-moon,
:root:not([data-theme="dark"]) .theme-toggle .icon-sun {
  display: none;
}

* {
  box-sizing: border-box;
}

body.admin-body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  /* Prevent Firefox/Mac subpixel-antialiasing recalculation on hover,
     which causes text to visibly jitter when color or background changes. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.01em;
}

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
}

/* Sub-headings / accent labels — Droid Sans Bold caps tracked wide,
   per the Clair brand guide. */
.section > .section-header h2,
.card-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--accent-text);
}

/* Numerals and identifiers — Roboto Mono per brand guide. */
.stat-value,
code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
}

.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
}

.admin-header {
  /* Solid brand-ink base with a thin brand-blue accent strip at the bottom.
     Subtle and unmistakably Clair without the gradient washiness. */
  background: var(--brand-ink);
  color: #f3f3f3;
  border-bottom: 2px solid var(--brand-blue);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.admin-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

@media (max-width: 900px) {
  .admin-header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-search {
    max-width: none;
  }
}
.admin-search {
  flex: 1 1 auto;
  max-width: 420px;
  position: relative;
}

.admin-search input[type="search"] {
  width: 100%;
  padding: 7px 12px;
  border-radius: 14px;
  border: 1px solid #4a4a4a;
  background: #3b3b3b;
  color: #f3f3f3;
  font-size: 12px;
}

.admin-search input[type="search"]::placeholder {
  color: #b8bdc4;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Brand lockup: official Clair Global SVG logo + 'NAC Admin' product tag.
   Two logo variants are shipped (white, black) and swapped via the
   .brand-logo-light/.brand-logo-dark classes depending on the surrounding
   surface (dark header → white logo, light card → black logo). */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
  display: block;
}

/* On a dark surface (admin header) we want the white logo; on a light
   surface (login page in light mode) we want the black logo. The pair of
   classes lets the template ship both <img>s and CSS picks the right one. */
.brand-logo-light { display: none; }
.brand-logo-dark  { display: block; }

.on-dark .brand-logo-light { display: block; }
.on-dark .brand-logo-dark  { display: none; }

[data-theme="dark"] .brand-logo-light { display: block; }
[data-theme="dark"] .brand-logo-dark  { display: none; }

.brand-text-stack {
  display: inline-flex;
  flex-direction: column;
  line-height: 1;
  gap: 4px;
  border-left: 1px solid currentColor;
  padding-left: 12px;
  opacity: 0.45;
}

.brand-lockup:hover .brand-text-stack { opacity: 0.7; }

.brand-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 11px;
  text-transform: uppercase;
}

.brand-product {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.08em;
  opacity: 0.75;
  text-transform: uppercase;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-meta {
  text-align: right;
}

.user-label {
  font-size: 11px;
  text-transform: uppercase;
  color: #bfc3c9;
  letter-spacing: 0.08em;
}

.user-name {
  font-size: 15px;
  font-weight: 600;
}

.admin-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-crumbs {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.admin-crumbs-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 4px 28px;
  font-size: 10px;
  color: var(--ink-muted);
}

.admin-crumbs .crumb {
  color: var(--ink-muted);
  text-decoration: none;
}

.admin-crumbs .current {
  color: var(--ink);
  font-weight: 600;
}

.admin-tabs ol {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  list-style: none;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.admin-tabs .tab-item {
  position: relative;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 2px 11px;
  text-decoration: none;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color 120ms ease, border-color 120ms ease;
}

.admin-tab.is-active {
  color: var(--accent-text);
  border-color: var(--accent);
}

.admin-tab:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}

.tab-icon {
  width: 7px;
  height: 7px;
  fill: #a7adb6;
}

.admin-tab.is-active .tab-icon {
  fill: var(--accent);
}

.admin-submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 20;
}

.admin-submenu.is-open {
  display: block;
}

.admin-subtab {
  width: 100%;
  justify-content: flex-start;
  padding: 8px 10px;
  border-radius: 8px;
  border-bottom: none;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.admin-subtab:hover {
  background: var(--surface-muted);
}

.tab-item.has-submenu:focus-within .admin-submenu {
  display: block;
}
.admin-main {
  padding: 24px 28px 64px;
}

.admin-container {
  max-width: 1280px;
  margin: 0 auto;
}

.section {
  margin-bottom: 40px;
  display: none;
}

.section.is-active {
  display: block;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.action-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stat-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.stat-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
}

.stat-pill.pill-ok {
  background: var(--success-soft);
  border-color: rgba(44, 122, 78, 0.25);
  color: var(--success);
}

.stat-pill.pill-error {
  background: var(--danger-soft);
  border-color: rgba(192, 57, 43, 0.25);
  color: var(--danger);
}

.stat-pill.pill-warn {
  background: var(--warn-soft);
  border-color: rgba(176, 122, 0, 0.25);
  color: var(--warn);
}

.section-search-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-search-form input[type="search"] {
  width: 220px;
  max-width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.section-search-form .button {
  width: auto;
  padding: 7px 12px;
  font-size: 12px;
}

.section-filter-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-filter-form select {
  width: 180px;
  max-width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.section-filter-form .button {
  width: auto;
  padding: 7px 12px;
  font-size: 12px;
}

.table-filters th {
  background: #f4f5f7;
  border-top: 1px solid var(--border);
}

.table-filters input[type="search"],
.table-filters select {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.table-filters .button {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
}

.manual-fields,
.derived-fields {
  margin-top: 12px;
}

.derived-fields p {
  margin: 4px 0;
}

.warning-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff4d6;
  border: 1px solid #f1d38b;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.card-grid.two {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-header h3 {
  margin: 0;
}

/* Settings layout: sticky left sidebar + scrollable content area.
   On narrow screens (<880px) the sidebar collapses to a horizontal
   tab bar above the content. */
.settings-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
}

.settings-tab {
  width: 100%;
  margin: 0;
  background: transparent;
  border: 1px solid transparent;
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-radius: var(--radius-sm);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.settings-tab:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.settings-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: rgba(21, 163, 213, 0.3);
}

.settings-content {
  min-width: 0;
}

.settings-panel {
  display: none;
}

.settings-panel.is-active {
  display: block;
}

.settings-panel > .card,
.settings-panel > form > .card,
.settings-group {
  margin-bottom: 16px;
}

.settings-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.settings-group-title {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  color: var(--accent-text);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 880px) {
  .settings-shell {
    grid-template-columns: 1fr;
  }
  .settings-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .settings-tab {
    width: auto;
  }
}

/* Dashboard overview — KPI tiles + activity feeds */
.overview-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.overview-hero h1 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 24px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.overview-hero .muted {
  font-size: 13px;
  margin: 0;
}

.overview-health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(44, 122, 78, 0.25);
}

.overview-health.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(176, 122, 0, 0.25);
}

.overview-health.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(192, 57, 43, 0.25);
}

.overview-health::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.kpi.kpi-ok::before    { background: var(--success); }
.kpi.kpi-warn::before  { background: var(--warn); }
.kpi.kpi-error::before { background: var(--danger); }
.kpi.kpi-muted::before { background: var(--border-strong); }

.kpi-label {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.kpi-value {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-value .kpi-value-sub {
  font-size: 13px;
  color: var(--ink-muted);
}

.kpi-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.kpi-meta .stat-pill {
  font-size: 10px;
  padding: 2px 8px;
}

.kpi-foot {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 8px;
  margin-bottom: 0;
}

/* Activity feed cards (audit + sync side-by-side) */
.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.activity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.activity-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.activity-card-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  color: var(--accent-text);
  margin: 0;
}

.activity-card-header .muted {
  font-size: 12px;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item .activity-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.activity-item .activity-body {
  min-width: 0;
  word-break: break-word;
}

.activity-item .activity-actor,
.activity-item .activity-node {
  font-weight: 500;
  color: var(--ink);
}

.activity-item .activity-target {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.activity-item .activity-status {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
}

.activity-status.status-ok,
.activity-status.status-success {
  background: var(--success-soft);
  color: var(--success);
}

.activity-status.status-error,
.activity-status.status-failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.activity-status.status-warn,
.activity-status.status-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.activity-empty {
  padding: 24px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
}

.status-ok {
  color: #1b7f3b;
  font-weight: 600;
}

.status-bad {
  color: #b73a2a;
  font-weight: 600;
}

.status-pending {
  color: #6b6f76;
  font-weight: 600;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
}

.status-summary {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-summary strong {
  font-weight: 700;
  margin-left: 4px;
}

.device-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4b5563;
}

.live-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.status-synced {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(44, 122, 78, 0.25);
}

.status-pending {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(176, 122, 0, 0.25);
}

.status-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(192, 57, 43, 0.25);
}

.status-unknown {
  background: var(--surface-muted);
  color: var(--ink-muted);
  border-color: var(--border-strong);
}

.card.narrow {
  max-width: 420px;
}

/* Login page — standalone full-viewport layout */
.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  /* Subtle brand-aligned radial gradients per the Clair brand guide
     ("subtle radial gradients of core colors create interest when applied
      to backgrounds"). Kept very low contrast so the card stays the focus. */
  background:
    radial-gradient(ellipse 60% 40% at 18% 12%, rgba(21, 163, 213, 0.18), transparent 70%),
    radial-gradient(ellipse 70% 50% at 85% 90%, rgba(3, 75, 88, 0.16), transparent 75%),
    var(--bg);
}

[data-theme="dark"] .login-shell {
  background:
    radial-gradient(ellipse 60% 40% at 18% 12%, rgba(21, 163, 213, 0.18), transparent 70%),
    radial-gradient(ellipse 70% 50% at 85% 90%, rgba(3, 75, 88, 0.32), transparent 75%),
    var(--bg);
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  color: var(--ink);
}

.login-brand .brand-logo {
  height: 36px;
}

.login-brand .brand-wordmark {
  font-size: 12px;
}

.login-brand .brand-product {
  font-size: 11px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  text-align: center;
}

.login-card .login-sub {
  text-align: center;
  color: var(--ink-muted);
  margin: 0 0 20px;
  font-size: 14px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-card form label {
  font-size: 13px;
  font-weight: 500;
  margin-top: 6px;
}

.login-card form input[type="text"],
.login-card form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
}

.login-card form input[type="text"]:focus,
.login-card form input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 120, 212, 0.18);
}

.login-card form button[type="submit"] {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.login-card form button[type="submit"]:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.login-sso-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  transition: background 120ms ease;
}

.login-sso-btn:hover {
  background: var(--accent-strong);
}

.login-collapse {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

.login-collapse > summary {
  cursor: pointer;
  list-style: none;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
  padding: 8px;
  user-select: none;
}

.login-collapse > summary::-webkit-details-marker {
  display: none;
}

.login-collapse > summary::after {
  content: " ▾";
  font-size: 11px;
  color: var(--ink-muted);
}

.login-collapse[open] > summary::after {
  content: " ▴";
}

.login-collapse[open] > summary {
  margin-bottom: 8px;
}

.login-messages {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-messages .message {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}

.login-messages .message.error {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5b8b1;
}

.login-messages .message.success {
  background: #e6f7ee;
  color: #2c7a4e;
  border: 1px solid #a3dabd;
}

.card h1,
.card h2,
.card h3 {
  margin-top: 0;
}

.stat {
  display: grid;
  gap: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
}

.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--ink-muted);
}

.stat-meta {
  color: var(--ink-muted);
  font-size: 13px;
}

form label {
  display: block;
  margin-top: 12px;
  font-weight: 600;
  font-size: 13px;
}

input,
textarea,
button {
  width: 100%;
  padding: 9px 12px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  width: 100%;
  padding: 9px 12px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
  font-weight: 500;
  letter-spacing: 0.01em;
}

button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

button.danger:hover {
  background: #a93226;
  border-color: #a93226;
}

.button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  background: var(--accent);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  border: 1px solid var(--accent);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.01em;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.button:hover,
a.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button:focus-visible,
a.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button.ghost,
a.ghost,
.button.ghost,
a.button.ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink);
  width: auto;
  padding: 8px 14px;
}

button.ghost:hover,
a.ghost:hover,
.button.ghost:hover,
a.button.ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* In the dark header, ghost buttons need to invert. */
.admin-header button.ghost,
.admin-header a.ghost,
.admin-header .button.ghost {
  border-color: rgba(255, 255, 255, 0.25);
  color: #f3f3f3;
}

.admin-header button.ghost:hover,
.admin-header a.ghost:hover,
.admin-header .button.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  color: #ffffff;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.checkbox input {
  width: auto;
  margin: 0;
}

fieldset[disabled] {
  opacity: 0.65;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 14px;
  margin: 12px 0 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
}

.permission-matrix {
  display: grid;
  gap: 6px;
  margin: 12px 0 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
}

.permission-row {
  display: grid;
  grid-template-columns: 1fr 90px 90px;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
}

.permission-row.header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-top: 0;
  padding-bottom: 0;
}

.permission-row .checkbox {
  margin: 0;
  justify-content: center;
}

.permission-row .muted {
  font-size: 12px;
}

#role-preset {
  max-width: 320px;
}

.setting-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  margin: 8px 0 6px;
}

.setting-preview img {
  max-height: 46px;
  max-width: 160px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 4px;
  object-fit: contain;
}

.public-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f4f4f6;
  padding: 18px;
  background-size: cover;
  background-position: center;
}

.public-preview-canvas {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.public-preview-banner img {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 10px;
}

.public-preview-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
}

.public-preview-mark {
  background: #ffffff;
  color: #141414;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
}

.public-preview-mark img {
  height: 22px;
  width: auto;
  display: block;
}

.public-preview-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.public-preview-title span {
  font-size: 12px;
  opacity: 0.75;
}

.preview-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .preview-grid {
    grid-template-columns: 1fr;
  }
}

.public-preview-body {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
}

.preview-signin-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
}

.preview-field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.preview-field label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--ink-muted);
}

.preview-input {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
}

.preview-button {
  width: 100%;
  padding: 10px 14px;
  background: var(--accent);
  color: #ffffff;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  font-weight: 600;
}

.portal-preview {
  --preview-banner: #141414;
  --preview-banner-text: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f4f4f6;
  padding: 18px;
  background-size: cover;
  background-position: center;
}

.portal-preview-canvas {
  max-width: 500px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.portal-preview-banner img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 12px;
  box-shadow: var(--shadow);
}

.portal-preview-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 50px rgba(20, 20, 40, 0.12);
}

.portal-preview-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--preview-banner);
  color: var(--preview-banner-text);
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 14px;
}

.portal-preview-mark {
  background: #ffffff;
  color: #141414;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 28px;
}

.portal-preview-mark img {
  height: 20px;
  width: auto;
  display: block;
}

.portal-preview-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portal-preview-title-wrap span {
  font-size: 12px;
  opacity: 0.75;
}

.portal-preview-form .preview-field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.portal-preview-form .preview-field label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--ink-muted);
}

.portal-preview-form .preview-input {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
}

@media (max-width: 720px) {
  .portal-preview {
    padding: 12px;
  }
  .portal-preview-canvas {
    max-width: 100%;
    gap: 12px;
  }
  .portal-preview-banner img {
    max-height: 120px;
    padding: 8px;
    border-radius: 14px;
  }
  .portal-preview-card {
    padding: 14px;
    border-radius: 14px;
  }
  .portal-preview-card-header {
    padding: 10px 12px;
    border-radius: 12px;
  }
}

.hero-preview p {
  margin: 0 0 8px;
}

.hero-preview p:last-child {
  margin-bottom: 0;
}

.setting-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
}

.setting-actions input[type="file"] {
  width: auto;
  padding: 6px 0;
  border: none;
}

.upload-field {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-muted);
  margin: 12px 0;
}

.upload-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.upload-actions {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #ffffff;
}

.upload-actions input[type="file"] {
  width: 100%;
  padding: 6px 0;
  border: none;
}

.file-name {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-actions.is-dragover {
  border-color: var(--accent);
  background: #eef4ff;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-button svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.icon-button.icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  justify-content: center;
}

.icon-button.icon-only svg {
  width: 16px;
  height: 16px;
}

.button.icon-only {
  position: relative;
}

.button.icon-only::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: 110%;
  transform: translate(-50%, 0);
  background: #1f1f1f;
  color: #fff;
  font-size: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

.button.icon-only:hover::after,
.button.icon-only:focus-visible::after {
  opacity: 1;
}
.upload-actions .button {
  width: auto;
  padding: 8px 14px;
}

.button.ghost.danger,
button.ghost.danger {
  color: var(--danger);
  border-color: rgba(192, 57, 43, 0.4);
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 16px;
}

.grid-form .form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.list li {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-muted);
}

.list-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.list-title {
  font-weight: 700;
}

.list-meta {
  color: var(--ink-muted);
  font-size: 13px;
}

.list-actions form {
  margin: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-actions input {
  flex: 1 1 auto;
}

.input-actions .icon-btn {
  flex: 0 0 auto;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.row button,
.row .button {
  width: auto;
}

.stack > label:first-of-type {
  margin-top: 0;
}

.stack small {
  display: block;
  margin-top: 4px;
}

.muted {
  color: var(--ink-muted);
}

.search-hit {
  background: #fff2a8;
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.12);
  padding: 6px 0;
  display: none;
  z-index: 20;
}

.search-suggest.is-open {
  display: block;
}

.suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
}

.suggest-item:hover {
  background: #f2f4f8;
}

.suggest-meta {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.focus-row {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

.admin-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.message {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--warn-soft);
  border: 1px solid rgba(176, 122, 0, 0.25);
  color: var(--warn);
  font-size: 13px;
}

.message.success {
  background: var(--success-soft);
  border-color: rgba(44, 122, 78, 0.25);
  color: var(--success);
}

.message.error {
  background: var(--danger-soft);
  border-color: rgba(192, 57, 43, 0.25);
  color: var(--danger);
}

@media (max-width: 720px) {
  .admin-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-tabs ol {
    gap: 8px;
  }

  .admin-tab {
    padding: 10px 2px 8px;
  }
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-header h3 {
  margin: 0;
}

.itemlist {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.itemlist th,
.itemlist td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: left;
}

.itemlist thead th {
  background: var(--surface-muted);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border-strong);
}

.itemlist tbody tr {
  background: var(--surface);
  transition: background 120ms ease;
}

.itemlist tbody tr:hover:not(.edit-row) {
  background: var(--accent-soft);
}

.itemlist tbody tr:last-child td {
  border-bottom: none;
}

.itemlist .actions {
  white-space: nowrap;
  text-align: right;
}

/* Identifiers / MAC / accreditation IDs read better in mono. */
.itemlist td[data-col="accreditation"],
.itemlist td[data-col="mac"],
.itemlist td:first-of-type:not(.check) code {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.table-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  font-size: 0;
  line-height: 0;
}

.icon-btn svg {
  width: 14px;
  height: 14px;
  fill: var(--ink-muted);
  display: block;
}

.icon-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: 110%;
  transform: translate(-50%, 0);
  background: #1f1f1f;
  color: #fff;
  font-size: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

.icon-btn:hover::after,
.icon-btn:focus-visible::after {
  opacity: 1;
}

.icon-btn:hover {
  border-color: #c7ccd4;
}

.icon-btn.danger {
  border-color: rgba(192, 57, 43, 0.3);
  background: rgba(192, 57, 43, 0.08);
}

.icon-btn.danger svg {
  fill: var(--danger);
}

.edit-row {
  display: none;
  background: #f8f8fb;
  box-shadow: inset 0 1px 0 var(--border);
}

.edit-row:target {
  display: table-row;
}

.edit-row td {
  padding: 16px;
}

.details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.button.ghost,
a.button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}

.button.ghost:hover,
a.button.ghost:hover {
  background: #f0f1f3;
}

/* Branded confirmation dialog (replaces window.confirm() prompts).
   Native <dialog> element styled to match the rest of the admin UI;
   ESC-to-cancel and backdrop-click-to-cancel both work via JS. */
.nac-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: min(480px, 92vw);
  width: 100%;
  border-radius: var(--radius-lg);
  color: var(--ink);
}

.nac-dialog::backdrop {
  background: rgba(15, 17, 19, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.nac-dialog[open] {
  animation: nac-dialog-pop 140ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes nac-dialog-pop {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.nac-dialog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 24px 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.nac-dialog-title {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  color: var(--accent-text);
  margin-bottom: 10px;
}

.nac-dialog-message {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 22px;
  white-space: pre-line;
}

.nac-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.nac-dialog-actions .button {
  width: auto;
  min-width: 96px;
  padding: 9px 18px;
}

/* Make sure the dialog stays brand-aligned in dark mode. */
[data-theme="dark"] .nac-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

/* Pagination toolbar that sits below each .itemlist. Pagination hides
   off-page rows by setting data-pg-page="hide"; the !important display
   rule keeps those rows hidden even if a filter handler later toggles the
   row's inline display style back to "". */
tr[data-pg-page="hide"] {
  display: none !important;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 6px 4px;
  font-size: 12px;
  color: var(--ink-muted);
  flex-wrap: wrap;
}

.pagination-info {
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pagination .pagination-size {
  width: auto;
  margin: 0;
  padding: 5px 10px;
  font-size: 12px;
  background: var(--surface);
}

.pagination-btn {
  width: auto;
  margin: 0;
  padding: 4px 12px;
  font-size: 14px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  line-height: 1.2;
}

.pagination-btn:not(:disabled):hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-page {
  font-family: var(--font-mono);
  min-width: 64px;
  text-align: center;
  font-size: 12px;
  color: var(--ink);
}

/* ── Dashboard overview ─────────────────────────────────────────────── */
.overview-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.overview-hero h1 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 24px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.overview-hero .muted {
  font-size: 13px;
  margin: 0;
}

.overview-health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(44, 122, 78, 0.25);
}

.overview-health.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(176, 122, 0, 0.25);
}

.overview-health.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(192, 57, 43, 0.25);
}

.overview-health::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.quick-actions .button {
  font-size: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.kpi.kpi-ok::before    { background: var(--success); }
.kpi.kpi-warn::before  { background: var(--warn); }
.kpi.kpi-error::before { background: var(--danger); }
.kpi.kpi-muted::before { background: var(--border-strong); }

.kpi-label {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-value {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-value-sub {
  font-size: 13px;
  color: var(--ink-muted);
  font-family: var(--font-sans);
}

.kpi-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.kpi-meta .stat-pill {
  font-size: 10px;
  padding: 2px 8px;
}

.kpi-foot {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 8px 0 0;
}

/* Mini progress bar in tile (e.g. devices synced ratio) */
.kpi-bar {
  display: flex;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--border);
  margin-top: 10px;
}

.kpi-bar > span {
  display: block;
  height: 100%;
}

.kpi-bar .seg-ok    { background: var(--success); }
.kpi-bar .seg-warn  { background: var(--warn); }
.kpi-bar .seg-error { background: var(--danger); }

/* Activity feed cards (Audit + Sync side-by-side) */
.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.activity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.activity-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.activity-card-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  color: var(--accent-text);
  margin: 0;
}

.activity-card-header a {
  font-size: 11px;
  color: var(--ink-muted);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.activity-card-header a:hover { color: var(--accent-strong); }

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-item {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 9px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.activity-item:last-child { border-bottom: none; }

.activity-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.activity-body {
  min-width: 0;
  word-break: break-word;
}

.activity-actor,
.activity-node {
  font-weight: 500;
  color: var(--ink);
}

.activity-action {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}

.activity-target {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.activity-status {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.activity-status.status-ok,
.activity-status.status-success { background: var(--success-soft); color: var(--success); }

.activity-status.status-error,
.activity-status.status-failed  { background: var(--danger-soft); color: var(--danger); }

.activity-status.status-warn,
.activity-status.status-pending { background: var(--warn-soft); color: var(--warn); }

.activity-empty {
  padding: 24px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
}

/* ── Stats panels (overview) ────────────────────────────────────────── */
.stats-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.stats-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(21, 163, 213, 0.04), transparent);
}

.stats-panel-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--accent-text);
  margin: 0;
}

.stats-panel-body {
  padding: 18px 20px;
}

.stats-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stat-headline {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}

.stat-headline-value {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.stat-headline-label {
  font-size: 12px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat-tile {
  position: relative;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}

.stat-tile::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 2px;
  background: var(--border-strong);
}

.stat-tile.is-ok::before    { background: var(--success); }
.stat-tile.is-warn::before  { background: var(--warn); }
.stat-tile.is-error::before { background: var(--danger); }

.stat-tile-label {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 10px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.stat-tile-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.1;
}

.stat-tile-foot {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 4px;
}

.stat-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border);
  margin-top: 10px;
}

.stat-bar > span { display: block; height: 100%; }
.stat-bar .seg-ok    { background: var(--success); }
.stat-bar .seg-warn  { background: var(--warn); }
.stat-bar .seg-error { background: var(--danger); }
.stat-bar .seg-muted { background: var(--border-strong); }

.stat-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-muted);
}

.stat-bar-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.stat-bar-legend .dot-ok    { background: var(--success); }
.stat-bar-legend .dot-warn  { background: var(--warn); }
.stat-bar-legend .dot-error { background: var(--danger); }
.stat-bar-legend .dot-muted { background: var(--border-strong); }

.stat-foot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 24px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.stat-foot-grid > div { display: flex; flex-direction: column; gap: 2px; }
.stat-foot-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.stat-foot-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--border);
  color: var(--ink-muted);
}
.health-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
.health-pill.is-ok    { background: var(--success-soft); color: var(--success); }
.health-pill.is-warn  { background: var(--warn-soft);    color: var(--warn); }
.health-pill.is-error { background: var(--danger-soft);  color: var(--danger); }

.stat-pairs {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0 0 14px;
}

.stat-pairs dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  align-self: center;
}

.stat-pairs dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
}

.stat-pairs dd.stat-negative { color: var(--danger); }

.stat-mini-list-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
  margin: 6px 0 6px;
}

.stat-mini-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-mini-list li {
  display: grid;
  grid-template-columns: 80px 80px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.stat-mini-list li:last-child { border-bottom: none; }

.stat-mini-list time {
  font-family: var(--font-mono);
  color: var(--ink-muted);
  font-size: 11px;
}

.stat-mini-msg {
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-panel-actions {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  gap: 8px;
}

.stats-sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.stats-sub-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.stats-sub-foot {
  font-size: 12px;
  color: var(--ink-muted);
  margin-left: auto;
}

.stat-rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-rank-list li { display: flex; flex-direction: column; gap: 4px; }

.stat-rank-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.stat-rank-label {
  font-family: var(--font-sans);
  color: var(--ink);
}

.stat-rank-count {
  font-family: var(--font-mono);
  color: var(--ink-muted);
}

.stat-rank-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.stat-rank-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* "Pending DOB" — distinct from the regular pending-sync segment.
   These records aren't in NAC yet (EW Connect knows about them but no
   DOB is on file), so they should read visually as upstream-blocked,
   not as ISE-side pending. Use a softer warm tone to differentiate. */
.stat-bar .seg-pending-dob { background: #d97706; }
.stat-bar-legend .dot-pending-dob { background: #d97706; }

/* Issues page bulk-ack toolbar.
   Flat flex layout: [Ack selected] [Ack all open] [..........note..........]
   Buttons size to their content (flex: 0 0 auto + nowrap), the note
   grows to fill the remainder. When the row gets too narrow, items
   wrap as units in the same source order — buttons stay side by side,
   note drops to its own line beneath. No nested wrapper, no inner
   wrapping that ends up stacking the two buttons vertically. */
.bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(21, 163, 213, 0.04), transparent);
}

.bulk-toolbar > .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.bulk-toolbar .bulk-note {
  flex: 1 1 220px;
  min-width: 180px;
  font-size: 13px;
  padding: 7px 10px;
}

.bulk-count {
  display: inline-flex;
  min-width: 20px;
  height: 18px;
  padding: 0 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-family: var(--font-mono);
  font-size: 11px;
  align-items: center;
  justify-content: center;
}

.issue-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* Bigger, more legible checkboxes for the issues table — the default
   ~13 px native control is too small for a click target on a list this
   dense. Applies inside the issues table only so we don't disturb the
   smaller dashboard tables. */
#issues-table th.check,
#issues-table td.check {
  width: 44px;
  text-align: center;
  padding-left: 14px;
}

#issues-table input[type="checkbox"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: var(--accent);
  vertical-align: middle;
}

/* The per-row Ack/Reopen forms get moved into td.actions by JS at load
   time. Right-align so the button hugs the right edge of the row and
   stays inside the cell on narrower viewports. */
#issues-table td.actions {
  text-align: right;
  white-space: nowrap;
  padding-right: 18px;
}

#issues-table .issue-row-form {
  display: inline-flex;
  margin: 0;
}

/* Inline toggle sitting in a table-tools row. Used on the
   accreditation list for "Re-fetch on delete" — visually quiet, but
   distinct enough that operators notice it before pressing Delete. */
.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
  white-space: nowrap;
}

.toggle-inline input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.toggle-inline:hover {
  border-color: var(--accent);
  color: var(--ink);
}
