/* ===========================================================================
   COMPASS — change management console
   Same dark "ops console" system as Beacon (Space Grotesk / JetBrains Mono,
   panel + form + table conventions) with its own accent: a steel-blue
   "compass needle" instead of Beacon's ember, plus status/risk/type pills
   for the change workflow.
   =========================================================================== */

:root {
  --ink:        #0e1218;   /* page */
  --panel:      #161c26;   /* raised surface */
  --panel-2:    #1c232f;   /* inputs / nested */
  --line:       #28303d;   /* hairlines */
  --text:       #e7ecf3;
  --muted:      #8b97a8;

  --accent:      #3fa9f5;   /* brand — compass needle blue */
  --accent-soft: #7cc4ff;

  --ok:         #2fb87a;
  --warning:    #f5a524;
  --critical:   #e5484d;
  --offline:    #6b7280;

  --risk-low:      var(--ok);
  --risk-medium:   var(--warning);
  --risk-high:     #ff8a3d;
  --risk-critical: var(--critical);

  --type-standard:  #6b7280;
  --type-normal:    var(--accent);
  --type-emergency: var(--critical);

  --radius:     12px;
  --shadow:     0 6px 24px rgba(0,0,0,.35);

  /* surfaces/text that differ between themes (see the light palette below) */
  --glow:          #182231;               /* page background highlight */
  --topbar-bg:     rgba(14,18,24,.7);
  --on-accent:     #06121c;               /* text on accent / ok / critical buttons */
  --on-ok:         #06231a;
  --on-critical:   #2a0607;
  --ok-hover:      #45d996;
  --critical-hover:#ff6167;
  --critical-text: #ffb3b5;               /* error text on a tinted background */
  --focus-ring:    rgba(63,169,245,.18);
  --card-shadow:   0 20px 60px rgba(0,0,0,.4);
  color-scheme: dark;                     /* native controls, scrollbars, date pickers */
}

/* Light theme - <html data-theme="light">, chosen per account from the account
   menu (top right). 'auto' follows the device's setting: the same palette,
   applied when the browser reports a light preference. Status/brand hues are
   deepened so they keep enough contrast as text on white. The two blocks must
   stay identical. */
:root[data-theme="light"] {
  --ink: #eef2f7; --panel: #ffffff; --panel-2: #f4f6fa; --line: #d8dfe9;
  --text: #142033; --muted: #5a6679;
  --accent: #1d7ad0; --accent-soft: #1565b0;
  --ok: #188454; --warning: #9a6a00; --critical: #c9302f; --offline: #6b7280;
  --risk-high: #c25a12; --type-standard: #5b6472;
  --shadow: 0 6px 20px rgba(20,30,50,.08);
  --glow: #ffffff; --topbar-bg: rgba(255,255,255,.82);
  --on-accent: #ffffff; --on-ok: #ffffff; --on-critical: #ffffff;
  --ok-hover: #1f9d63; --critical-hover: #e0413f; --critical-text: #a3232a;
  --focus-ring: rgba(29,122,208,.22); --card-shadow: 0 20px 50px rgba(20,30,50,.14);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --ink: #eef2f7; --panel: #ffffff; --panel-2: #f4f6fa; --line: #d8dfe9;
    --text: #142033; --muted: #5a6679;
    --accent: #1d7ad0; --accent-soft: #1565b0;
    --ok: #188454; --warning: #9a6a00; --critical: #c9302f; --offline: #6b7280;
    --risk-high: #c25a12; --type-standard: #5b6472;
    --shadow: 0 6px 20px rgba(20,30,50,.08);
    --glow: #ffffff; --topbar-bg: rgba(255,255,255,.82);
    --on-accent: #ffffff; --on-ok: #ffffff; --on-critical: #ffffff;
    --ok-hover: #1f9d63; --critical-hover: #e0413f; --critical-text: #a3232a;
    --focus-ring: rgba(29,122,208,.22); --card-shadow: 0 20px 50px rgba(20,30,50,.14);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 70% -10%, var(--glow) 0%, var(--ink) 55%);
  color: var(--text);
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.muted { color: var(--muted); }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent);
  background: radial-gradient(circle at 35% 30%, rgba(63,169,245,.22), transparent 70%);
  box-shadow: 0 0 10px 1px rgba(63,169,245,.35);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-sep { width: 1px; height: 22px; background: var(--line); }
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: .04em; }
.brand-tag  { color: var(--muted); font-size: 13px; }

.nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-link {
  color: var(--muted); text-decoration: none;
  padding: 7px 14px; border-radius: 8px; font-size: 14px; font-weight: 500;
}
.nav-link:hover { color: var(--text); background: var(--panel); }
.nav-link.is-active { color: var(--text); background: var(--panel); box-shadow: inset 0 -2px 0 var(--accent); }

.wrap { max-width: 1160px; margin: 0 auto; padding: 28px; }

/* ---- flash ---- */
.flash {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 8px; margin-bottom: 22px;
}

/* ---- summary strip ---- */
.summary {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  justify-content: space-between; margin-bottom: 26px;
}
.summary-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.stat b { color: var(--text); font-size: 16px; }
.stat::before { content: ""; width: 9px; height: 9px; border-radius: 50%; }
.stat--draft::before       { background: var(--offline); }
.stat--submitted::before   { background: var(--warning); }
.stat--approved::before    { background: var(--ok); }
.stat--rejected::before    { background: var(--critical); }
.stat--in-progress::before { background: var(--accent); }
.stat--implemented::before { background: var(--ok); }
.stat--closed::before      { background: var(--offline); }
.stat--mine::before        { background: var(--accent-soft); }

a.stat { text-decoration: none; cursor: pointer; transition: opacity .15s, border-color .15s; }
a.stat:hover { border-color: var(--muted); }
a.stat.is-off { opacity: .38; }
a.stat.is-off b { color: var(--muted); }
.filter-reset { color: var(--accent-soft); text-decoration: none; }
.filter-reset:hover { text-decoration: underline; }
.summary-meta { font-size: 13px; color: var(--muted); }

/* ---- dashboard cards ---- */
.dash-grid {
  display: grid; gap: 16px; margin-bottom: 30px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.dash-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.dash-card h3 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.dash-card .big { font-size: 32px; font-weight: 700; font-family: "JetBrains Mono", monospace; }
.dash-card .big.accent { color: var(--accent-soft); }
.dash-card .big.warn { color: var(--warning); }
.dash-card p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.dash-card a.dash-link { color: var(--accent-soft); text-decoration: none; font-size: 13px; }
.dash-card a.dash-link:hover { text-decoration: underline; }

.section-title { font-size: 16px; margin: 30px 0 12px; }

/* ---- admin pages ---- */
.page-head { margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; font-size: 24px; }
.page-head-text { flex: 1; min-width: 240px; }

.cols { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.cols--wide { grid-template-columns: 1fr; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 20px; }
.panel h2 { margin: 0 0 16px; font-size: 16px; }
.panel--narrow { max-width: 460px; }

/* ---- forms ---- */
.form { display: flex; flex-direction: column; gap: 13px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.form-row { display: flex; gap: 13px; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 160px; }
.form-row label.narrow { flex: 0 0 140px; }
.form input, .form select, .form textarea {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 9px 11px; font: inherit; font-size: 14px;
  width: 100%; min-width: 0;
}
.form textarea { resize: vertical; min-height: 64px; }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring);
}
.form .check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.form .check input { width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent); border: none; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 8px; text-decoration: none;
}
.btn:hover { background: var(--accent-soft); }
.btn--ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn--ghost:hover { color: var(--text); background: var(--panel-2); }
.btn--ok { background: var(--ok); color: var(--on-ok); }
.btn--ok:hover { background: var(--ok-hover); }
.btn--danger { background: var(--critical); color: var(--on-critical); }
.btn--danger:hover { background: var(--critical-hover); }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:hover { background: var(--panel-2); }
.table .num { text-align: right; }
.row-actions { display: flex; align-items: center; gap: 14px; justify-content: flex-end; }
.row-actions a { color: var(--accent-soft); text-decoration: none; font-size: 13px; }
.row-actions form { margin: 0; }
.link-danger { background: none; border: none; color: var(--critical); cursor: pointer; font: inherit; font-size: 13px; padding: 0; }
.link-danger:hover { text-decoration: underline; }

/* ---- pills (status / risk / type) ---- */
.pill { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.pill--draft       { background: rgba(139,151,168,.15); color: var(--muted); }
.pill--submitted   { background: rgba(245,165,36,.15);  color: var(--warning); }
.pill--approved    { background: rgba(47,184,122,.15);  color: var(--ok); }
.pill--rejected    { background: rgba(229,72,77,.15);   color: var(--critical); }
.pill--in-progress { background: rgba(63,169,245,.15);  color: var(--accent-soft); }
.pill--implemented { background: rgba(47,184,122,.15);  color: var(--ok); }
.pill--backed-out  { background: rgba(229,72,77,.15);   color: var(--critical); }
.pill--closed      { background: rgba(139,151,168,.15); color: var(--muted); }
.pill--cancelled   { background: rgba(139,151,168,.15); color: var(--muted); text-decoration: line-through; }

.pill--risk-low      { background: rgba(47,184,122,.15); color: var(--ok); }
.pill--risk-medium   { background: rgba(245,165,36,.15); color: var(--warning); }
.pill--risk-high     { background: rgba(255,138,61,.16); color: var(--risk-high); }
.pill--risk-critical { background: rgba(229,72,77,.15);  color: var(--critical); }

.pill--type-standard  { background: rgba(107,114,128,.18); color: var(--type-standard); }
.pill--type-normal    { background: rgba(63,169,245,.15);  color: var(--accent-soft); }
.pill--type-emergency { background: rgba(229,72,77,.15);   color: var(--critical); }

/* ---- change detail ---- */
.change-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.change-ref { font-family: "JetBrains Mono", monospace; color: var(--muted); font-size: 14px; }
.change-title { margin: 4px 0 10px; font-size: 22px; }
.change-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.change-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .change-grid { grid-template-columns: 1fr; } .cols { grid-template-columns: 1fr; } }

.field-block { margin-bottom: 18px; }
.field-block h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.field-block p, .field-block div.text { margin: 0; white-space: pre-wrap; font-size: 14px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; color: var(--text); text-decoration: none; }
.tag:hover { border-color: var(--accent); }

/* approval progress */
.approval-box { display: flex; flex-direction: column; gap: 8px; }
.approval-bar { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.approval-bar-fill { height: 100%; background: var(--ok); border-radius: 999px; transition: width .2s; }
.approval-count { font-size: 13px; color: var(--muted); }
.approval-votes { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.approval-vote { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.approval-vote .v-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.approval-vote .v-dot.approved { background: var(--ok); }
.approval-vote .v-dot.rejected { background: var(--critical); }

/* ---- timeline (change history) ---- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { position: relative; padding: 0 0 20px 24px; border-left: 2px solid var(--line); }
.timeline-item:last-child { border-color: transparent; padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -6px; top: 2px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--panel);
}
.timeline-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.timeline-meta b { color: var(--text); font-weight: 600; }
.timeline-note { font-size: 14px; white-space: pre-wrap; }
.timeline-empty { color: var(--muted); font-size: 13px; }

/* checklist box (link devices/systems/sites/brands to a change) */
.check-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: var(--panel-2);
}
.check-list label { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; padding: 4px 0; }
.check-list label input { width: auto; }
.check-list-empty { color: var(--muted); font-size: 13px; padding: 6px 0; }

/* ---- schedule view ---- */
.schedule-day { margin-bottom: 26px; }
.schedule-date { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.schedule-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; text-decoration: none; color: var(--text);
}
.schedule-item:hover { border-color: var(--accent); }
.schedule-item.risk-high, .schedule-item.risk-critical { border-left-color: var(--critical); }
.schedule-time { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--muted); flex: 0 0 110px; }
.schedule-title { flex: 1; min-width: 0; font-weight: 600; }
.schedule-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-weight: 400; }

/* ---- empty state ---- */
.empty { text-align: center; padding: 60px 20px; }
.empty h2 { margin: 0 0 8px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto 18px; }

/* ---- settings: sub-nav, manage cards ---- */
.subnav {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 22px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.subnav-link {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 6px 13px; border-radius: 8px;
}
.subnav-link:hover { color: var(--text); background: var(--panel); }
.subnav-link.is-active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }

.field-hint { display: block; font-size: 12px; margin-top: 2px; }
.flag {
  font-family: "Space Grotesk", sans-serif; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  background: rgba(245,165,36,.15); color: var(--warning);
  padding: 2px 6px; border-radius: 5px; vertical-align: middle;
}
.flag--danger, .flag--critical { background: rgba(220,53,69,.15); color: var(--critical); }
.flag--warning { background: rgba(245,165,36,.15); color: var(--warning); }
.flag--ok { background: rgba(47,184,122,.15); color: var(--ok); }
.flag--muted, .flag--unmonitored { background: var(--panel-2); color: var(--muted); }

/* ---- Settings > Developer (tabs, banner) ---- */
.page-tabs { display: flex; gap: 2px; margin: 0 0 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.page-tab {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 9px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.page-tab:hover { color: var(--text); }
.page-tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab-intro { margin: 0 0 18px; }
.migration-banner {
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 16px; margin-bottom: 22px; font-size: 14px;
}
.migration-banner a { margin-left: 8px; font-weight: 600; color: var(--accent-soft); }
.migration-banner--error { border-color: var(--critical); background: rgba(229,72,77,.10); }
.migration-banner--warn  { border-color: var(--warning);  background: rgba(245,165,36,.10); }
.link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 0; text-decoration: none; }
.link:hover { text-decoration: underline; }
.chip {
  display: inline-flex; align-items: center; padding: 6px 13px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  text-decoration: none; font-size: 13px;
}
.chip--on { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.manage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.manage-grid--hub { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.manage-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px 16px; text-decoration: none; color: var(--text);
  transition: border-color .15s, color .15s;
}
.manage-card:hover { border-color: var(--accent); color: var(--accent-soft); }
.manage-card svg { width: 30px; height: 30px; color: var(--accent-soft); }
.manage-card:hover svg { color: var(--accent); }
.manage-card-title { font-weight: 600; font-size: 14px; color: var(--text); }
.manage-card:hover .manage-card-title { color: var(--text); }

/* approval rules matrix */
.rules-table th, .rules-table td { text-align: center; }
.rules-table td input { width: 64px; text-align: center; margin: 0 auto; }
.rules-table .rules-row-label { text-align: left; font-weight: 600; }

/* ---- login + auth ---- */
.login-body {
  min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 600px at 50% -10%, rgba(63,169,245,.10), transparent), var(--ink);
}
.login-card {
  width: 380px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 30px 28px; box-shadow: var(--card-shadow);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-brand .brand-name { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 22px; letter-spacing: .5px; }
.login-tag { margin: 4px 0 20px; font-size: 13px; }
.login-error {
  background: rgba(229,72,77,.12); border: 1px solid rgba(229,72,77,.4); color: var(--critical-text);
  padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}
.login-form .btn.login-submit { width: 100%; justify-content: center; margin-top: 4px; }
.login-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 18px 0 14px; }
.login-or span { white-space: nowrap; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-ms { width: 100%; justify-content: center; display: inline-flex; align-items: center; gap: 9px; }
.login-sso { text-align: center; }
.ms-logo { width: 16px; height: 16px; display: block; }
.login-logo { display: inline-flex; margin-bottom: 18px; color: var(--accent); }
.login-logo svg { width: 42px; height: 42px; }

/* current user menu: click the pill for theme / sign out */
.nav-account { position: relative; margin-left: 10px; font-size: 13px; line-height: 1; }
.nav-user {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2);
  color: var(--text); white-space: nowrap; font: inherit; cursor: pointer;
}
.nav-user:hover { border-color: var(--muted); }
.nav-user-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px 1px rgba(47,184,122,.6); }
.nav-role { color: var(--muted); font-weight: 400; }
.nav-caret { width: 13px; height: 13px; opacity: .6; margin-left: 1px; }
.account-dropdown[hidden] { display: none; }
.account-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; min-width: 220px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 4px;
}
.account-dropdown-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 2px 6px 4px; }
.theme-toggle { display: flex; gap: 6px; margin-bottom: 6px; }
.theme-toggle form { flex: 1; margin: 0; }
.theme-opt {
  width: 100%; padding: 6px 0; font: 500 13px "Space Grotesk", sans-serif; cursor: pointer;
  color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px;
}
.theme-opt:hover { color: var(--text); }
.theme-opt.is-active { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.account-dropdown-item {
  display: block; padding: 7px 6px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: 13.5px;
}
.account-dropdown-item:hover { background: var(--panel-2); }
.account-dropdown-item--danger:hover { color: var(--critical); }

/* generic fieldset (device as-built groups, etc.) */
.fields { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 12px; margin: 2px 0; }
.fields legend { padding: 0 6px; font-size: 13px; color: var(--muted); }

/* documents list (device attachments) */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; }
.doc-item a { color: var(--accent-soft); text-decoration: none; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-item .doc-meta { font-size: 12px; color: var(--muted); flex: none; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
  .wrap { padding: 18px; }
  .cols { grid-template-columns: 1fr; }
}
