/* ==========================================================================
   POP Telecom BSS — design system + application shell
   Tokens, sidebar (grouped nav / icon rail / mobile drawer), page head,
   shared components (.card .btn .pill .field tables dialogs toasts …),
   light + dark themes, motion, print. Framework-free.
   Load order on legacy pages: app.css + page <style> → THIS → pop_legacy.css
   ========================================================================== */

/* ---- 1. Tokens ---------------------------------------------------------- */
:root {
  /* colour scale — light. Brand: POP pink, plum ink, warm off-white canvas */
  --bg:            #F6F2EC;
  --surface:       #FFFFFF;
  --surface-2:     #F6F1F3;
  --surface-3:     #EDE4EA;      /* pressed / selected */
  --line:          #E6DCE4;
  --line-soft:     #F0E8EE;
  --line-strong:   #D2C3D0;
  --text:          #2C1336;
  --text-muted:    #5E4B67;
  --text-faint:    #6F5D78;
  --brand:         #EC1A61;      /* pure POP pink — logo mark, decoration only */
  --accent:        #D6135A;      /* pink fills (AA with white text) */
  --accent-hover:  #B3124A;
  --accent-ink:    #B3124A;      /* pink for text / links on light */
  --accent-fg:     #FFFFFF;      /* text on an accent fill */
  --accent-soft:   #FCE7EF;      /* pink tint (selected rows, active nav) */
  --accent-ring:   rgba(236, 26, 97, .28);
  --success:       #11703A; --success-bg: #DFF5E6;
  --warn:          #9A5B00; --warn-bg:    #FDF0D5;
  --danger:        #C0262E; --danger-bg:  #FDE5E6;
  --info:          #5B3A8C; --info-bg:    #EFE7F5;

  /* status pills: tickets */
  --st-new:        #5B3A8C; --st-new-bg:        #EFE7F5;
  --st-pending:    #9A5B00; --st-pending-bg:    #FDF0D5;
  --st-awaiting:   #4A3F55; --st-awaiting-bg:   #EAE5EC;
  --st-escalated:  #B91C1C; --st-escalated-bg:  #FDE5E6;
  --st-resolved:   #11703A; --st-resolved-bg:   #DFF5E6;
  --st-reopened:   #A0420C; --st-reopened-bg:   #FFE9D6;
  --st-high:       #A0420C; --st-high-bg:       #FFE9D6;
  --st-low:        #5A4D63; --st-low-bg:        #EFEAF2;

  /* sidebar (deep plum in both themes) */
  --side:          #1F0D27;
  --side-2:        #2E1A39;      /* hover */
  --side-3:        #170820;      /* submenu band */
  --side-line:     rgba(255,255,255,.08);
  --nav-text:      #CFC2D6;
  --nav-bright:    #FFFFFF;
  --nav-faint:     #A08FAA;
  --nav-accent:    #FF5C93;

  /* legacy aliases (older CSS / pages still reference these) */
  --canvas:        var(--bg);
  --accent-deep:   var(--accent-hover);
  --pink:          var(--accent);
  --plum:          var(--text);
  --green:         var(--success); --green-bg: var(--success-bg);
  --amber:         var(--warn);    --amber-bg: var(--warn-bg);
  --red:           var(--danger);  --red-bg:   var(--danger-bg);

  /* spacing (8px grid) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --gutter:        24px;
  --sidebar-w:     256px;
  --rail-w:        64px;

  /* radii */
  --radius-xs: 4px; --radius-sm: 6px; --radius: 10px; --radius-lg: 14px; --radius-full: 999px;

  /* shadows — subtle, plum-tinted */
  --shadow-1: 0 1px 2px rgba(44, 19, 54, .05);
  --shadow:   0 1px 2px rgba(44, 19, 54, .05), 0 4px 12px rgba(44, 19, 54, .05);
  --shadow-2: 0 4px 16px rgba(44, 19, 54, .10), 0 1px 3px rgba(44, 19, 54, .06);
  --shadow-3: 0 16px 48px rgba(44, 19, 54, .18), 0 2px 6px rgba(44, 19, 54, .07);

  /* typography */
  --font:      -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-xs: 11px; --fs-sm: 12px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 16px; --fs-xl: 18px; --fs-2xl: 22px; --fs-3xl: 28px;
  --lh: 1.5;

  /* motion */
  --dur: 160ms; --dur-slow: 240ms; --speed: 160ms;
  --ease: cubic-bezier(.2, 0, 0, 1);

  /* density (overridden by html[data-density="compact"]) */
  --td-y: 11px; --td-x: 16px; --card-pad: 18px;
  color-scheme: light;
}

[data-theme="dark"] {
  /* plum-tinted darks, softened pink */
  --bg:            #150A1B;
  --surface:       #1E1026;
  --surface-2:     #281A31;
  --surface-3:     #34253E;
  --line:          #3B2A46;
  --line-soft:     #2F203A;
  --line-strong:   #4E3B5A;
  --text:          #F2EAF3;
  --text-muted:    #BBAAC3;
  --text-faint:    #A08FAA;
  --brand:         #FF5C93;
  --accent:        #FF5C93;
  --accent-hover:  #FF7BA8;
  --accent-ink:    #FF7BA8;
  --accent-fg:     #1A0A20;
  --accent-soft:   #3D1A30;
  --accent-ring:   rgba(255, 92, 147, .35);
  --success:       #4ADE80; --success-bg: #163A25;
  --warn:          #FBBF24; --warn-bg:    #3D2A10;
  --danger:        #F87171; --danger-bg:  #43201F;
  --info:          #C9A9F2; --info-bg:    #34214A;
  --st-new:        #C9A9F2; --st-new-bg:        #34214A;
  --st-pending:    #FBBF24; --st-pending-bg:    #3D2A10;
  --st-awaiting:   #CFC2D6; --st-awaiting-bg:   #34253E;
  --st-escalated:  #FCA5A5; --st-escalated-bg:  #43201F;
  --st-resolved:   #4ADE80; --st-resolved-bg:   #163A25;
  --st-reopened:   #FDBA74; --st-reopened-bg:   #3E2612;
  --st-high:       #FDBA74; --st-high-bg:       #3E2612;
  --st-low:        #C4B6CB; --st-low-bg:        #2E2038;
  --side:          #120618;
  --side-2:        #211027;
  --side-3:        #0C0311;
  --side-line:     rgba(255,255,255,.07);
  --nav-text:      #CFC2D6;
  --nav-bright:    #FFFFFF;
  --nav-faint:     #A08FAA;
  --nav-accent:    #FF7BA8;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3);
  --shadow:   0 1px 2px rgba(0,0,0,.35), 0 4px 12px rgba(0,0,0,.25);
  --shadow-2: 0 4px 16px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
  --shadow-3: 0 16px 48px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.35);
  color-scheme: dark;
}

html[data-density="compact"]) */
  --td-y: 11px; --td-x: 16px; --card-pad: 18px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg:            #0F1116;
  --surface:       #171A21;
  --surface-2:     #1F232C;
  --surface-3:     #272C37;
  --line:          #2A2F3A;
  --line-soft:     #232833;
  --line-strong:   #3A4150;
  --text:          #E9EBEF;
  --text-muted:    #A3AAB7;
  --text-faint:    #8B92A0;
  --accent:        #6B95FF;
  --accent-hover:  #86A9FF;
  --accent-fg:     #0B1020;
  --accent-soft:   #1B2540;
  --accent-ring:   rgba(107, 149, 255, .35);
  --success:       #4ADE80; --success-bg: #14301F;
  --warn:          #FBBF24; --warn-bg:    #3A2A0A;
  --danger:        #F87171; --danger-bg:  #3E1A1C;
  --info:          #7EA6FF; --info-bg:    #1B2540;
  --st-new:        #8FB0FF; --st-new-bg:        #1B2540;
  --st-pending:    #FBBF24; --st-pending-bg:    #3A2A0A;
  --st-awaiting:   #C3CBD8; --st-awaiting-bg:   #2A313D;
  --st-escalated:  #FCA5A5; --st-escalated-bg:  #3E1A1C;
  --st-resolved:   #4ADE80; --st-resolved-bg:   #14301F;
  --st-reopened:   #FDBA74; --st-reopened-bg:   #3B2410;
  --st-high:       #FDBA74; --st-high-bg:       #3B2410;
  --st-low:        #B8BFCB; --st-low-bg:        #262B35;
  --side:          #0C0E12;
  --side-2:        #171A21;
  --side-3:        #080A0D;
  --side-line:     rgba(255,255,255,.07);
  --nav-text:      #B8BEC9;
  --nav-bright:    #FFFFFF;
  --nav-faint:     #8A919E;
  --nav-accent:    #86A9FF;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3);
  --shadow:   0 1px 2px rgba(0,0,0,.35), 0 4px 12px rgba(0,0,0,.25);
  --shadow-2: 0 4px 16px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
  --shadow-3: 0 16px 48px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.35);
  color-scheme: dark;
}

html[data-density="compact"] { --td-y: 6px; --td-x: 12px; --card-pad: 14px; }

/* ---- 2. Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent-ink); }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }
::selection { background: var(--accent-soft); color: var(--text); }
h1, h2, h3, h4 { font-family: var(--font); color: var(--text); letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: var(--fs-2xl); font-weight: 700; }
h2 { font-size: var(--fs-xl); font-weight: 700; }
h3 { font-size: var(--fs-lg); font-weight: 600; }
code, kbd, pre, .mono { font-family: var(--font-mono); }
.tnum, td, .is-num, .n, .num { font-variant-numeric: tabular-nums; }
table { font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-4) 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* Page content fade-in (opacity only — no layout shift) */
@keyframes popFadeIn { from { opacity: 0; } to { opacity: 1; } }
.pop-main { animation: popFadeIn var(--dur-slow) var(--ease) both; }

/* ---- 3. Sidebar ---------------------------------------------------------- */
.pop-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  position: sticky;
  top: 0;
  background: var(--side);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  z-index: 40;
  border-right: 1px solid var(--side-line);
  transition: width var(--dur-slow) var(--ease), min-width var(--dur-slow) var(--ease);
}

.pop-side-top {
  display: flex; align-items: center; gap: 4px;
  padding-right: 8px;
  border-bottom: 1px solid var(--side-line);
  flex-shrink: 0;
  min-height: 65px;
}
.pop-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 8px 14px 16px;
  color: var(--nav-bright);
  text-decoration: none;
  flex: 1; min-width: 0;
}
.pop-brand > span:not(.pop-brand-mark) { min-width: 0; flex: 1; }
.pop-brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--brand);
  color: var(--accent-fg);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -.02em;
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.pop-brand-name  { font-size: 14px; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.pop-brand-sub   { font-size: 11px; color: var(--nav-faint); letter-spacing: .04em; white-space: nowrap; }

/* rail toggle (lives at the right of the brand row) */
.pop-rail-btn {
  width: 28px; height: 28px; flex-shrink: 0; margin-left: auto;
  border: 0; border-radius: 7px; background: none; color: var(--nav-faint); cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--dur), color var(--dur);
}
.pop-rail-btn:hover { background: var(--side-2); color: var(--nav-bright); }
.pop-rail-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--dur-slow) var(--ease); }

.pop-nav {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--side-2) transparent;
}
.pop-nav::-webkit-scrollbar { width: 4px; }
.pop-nav::-webkit-scrollbar-thumb { background: var(--side-2); border-radius: 2px; }
.pop-nav ul { list-style: none; margin: 0; padding: 0; }
.pop-nav > ul > li + li { margin-top: 1px; }

.pop-nav-section {
  padding: 16px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--nav-faint);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pop-nav > ul > .pop-nav-section:first-child { padding-top: 6px; }

.pop-nav a, .pop-nav button {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 12px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--nav-text);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.pop-nav a > span, .pop-nav button > span:not(.pop-chev) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-nav a:hover, .pop-nav button:hover,
.pop-nav button[aria-expanded="true"] {
  background: var(--side-2);
  color: var(--nav-bright);
}
.pop-nav a.is-active {
  color: var(--nav-bright);
  background: rgba(255,255,255,.08);
  font-weight: 600;
}
/* active accent bar */
.pop-nav a.is-active::before {
  content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--nav-accent);
}
.pop-nav a.is-active svg { color: var(--nav-accent); opacity: 1; }
.pop-nav svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  opacity: .85;
}
.pop-nav .pop-chev { margin-left: auto; width: 14px; height: 14px; opacity: .55; transition: transform var(--dur-slow) var(--ease); flex-shrink: 0; }
.pop-nav .pop-chev svg { width: 14px; height: 14px; }
.pop-nav button[aria-expanded="true"] .pop-chev { transform: rotate(180deg); }

/* Submenu band */
.pop-sub {
  display: none;
  padding: 2px 0 4px;
  position: relative;
}
.pop-sub::before { content: ""; position: absolute; left: 21px; top: 4px; bottom: 6px; width: 1px; background: var(--side-line); }
.pop-sub.is-open { display: block; animation: popFadeIn var(--dur) var(--ease); }
.pop-sub a {
  padding: 6px 10px 6px 34px;
  font-size: 13px;
  font-weight: 500;
  color: var(--nav-faint);
}
.pop-sub a:hover { color: var(--nav-bright); background: var(--side-2); }
.pop-sub a.is-active { color: var(--nav-bright); background: rgba(255,255,255,.08); font-weight: 600; }
.pop-sub a.is-active::before { left: 20px; top: 9px; bottom: 9px; width: 3px; }
.pop-sub svg { width: 15px; height: 15px; }

/* Sidebar footer: user card, tools row, sign out */
.pop-side-foot {
  flex-shrink: 0;
  padding: 10px 8px 10px;
  border-top: 1px solid var(--side-line);
  background: var(--side);
}
.pop-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  color: inherit; text-decoration: none;
  margin-bottom: 6px;
  transition: background var(--dur);
}
.pop-user:hover { background: var(--side-2); }
.pop-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #6D2A8A);
  color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.pop-user-name  { font-size: 13px; font-weight: 600; color: var(--nav-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-user-email { font-size: 11px; color: var(--nav-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-user-gear  { margin-left: auto; width: 14px; height: 14px; stroke: var(--nav-faint); fill: none; stroke-width: 1.8; flex-shrink: 0; }

.pop-side-foot .pop-foot-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0; border-radius: 8px;
  background: none;
  color: var(--nav-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.pop-side-foot .pop-foot-link:hover { background: var(--side-2); color: var(--nav-bright); }
.pop-side-foot .pop-foot-link svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.pop-side-foot form { margin: 0; }
.pop-side-foot .pop-signout { color: var(--nav-text); }
.pop-side-foot .pop-signout:hover { color: #FCA5A5; background: rgba(248,113,113,.10); }
.pop-theme-moon, .pop-density-ico { display: inline-flex; }
.pop-theme-sun { display: none; }
[data-theme="dark"] .pop-theme-sun  { display: inline-flex; }
[data-theme="dark"] .pop-theme-moon { display: none; }

/* Tools row: icon buttons (bell, theme, density, shortcuts, sign out) */
.pop-foot-tools {
  display: flex; align-items: center; gap: 2px;
}
.pop-foot-tools > * { flex: 1 1 0; min-width: 0; }
.pop-foot-tools .pop-live { position: static; }
.pop-foot-tools .pop-foot-link { justify-content: center; padding: 8px 4px; width: 100%; }
.pop-foot-tools .pop-foot-link > span:not(.pop-live-badge):not(.pop-theme-moon):not(.pop-theme-sun):not(.pop-density-ico) { display: none; }
.pop-foot-tools .pop-live-badge {
  position: absolute; top: 1px; left: calc(50% + 3px); right: auto; margin: 0;
  min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; padding: 0 4px;
  box-shadow: 0 0 0 2px var(--side);
}
.pop-foot-tools .pop-live-bell.is-open { background: var(--side-2); color: var(--nav-bright); }

/* ---- Icon rail (collapsed sidebar) --------------------------------------- */
@media (min-width: 1024px) {
  html[data-rail="1"] .pop-sidebar { width: var(--rail-w); min-width: var(--rail-w); }
  html[data-rail="1"] .pop-side-top { flex-direction: column; padding: 12px 0 10px; gap: 6px; }
  html[data-rail="1"] .pop-brand { padding: 0; justify-content: center; flex: none; }
  html[data-rail="1"] .pop-brand > span:not(.pop-brand-mark) { display: none; }
  html[data-rail="1"] .pop-rail-btn { margin: 0; }
  html[data-rail="1"] .pop-rail-btn svg { transform: rotate(180deg); }
  html[data-rail="1"] .pop-nav { padding: 8px 10px; }
  html[data-rail="1"] .pop-nav-section { height: 1px; padding: 0; margin: 8px 6px; background: var(--side-line); overflow: hidden; color: transparent; font-size: 0; }
  html[data-rail="1"] .pop-nav > ul > .pop-nav-section:first-child { display: none; }
  html[data-rail="1"] .pop-nav a, html[data-rail="1"] .pop-nav button { justify-content: center; padding: 10px 0; gap: 0; }
  html[data-rail="1"] .pop-nav a > span, html[data-rail="1"] .pop-nav button > span { display: none; }
  html[data-rail="1"] .pop-nav a.is-active::before { left: -10px; }
  html[data-rail="1"] .pop-nav svg { width: 20px; height: 20px; }
  html[data-rail="1"] .pop-sub::before { display: none; }
  html[data-rail="1"] .pop-sub { background: var(--side-3); border-radius: 8px; margin: 2px 0 4px; padding: 3px 0; }
  html[data-rail="1"] .pop-sub a { padding: 8px 0; }
  html[data-rail="1"] .pop-sub svg { width: 17px; height: 17px; }
  html[data-rail="1"] .pop-sub a.is-active::before { left: -10px; }
  html[data-rail="1"] .pop-side-foot { padding: 8px 6px; }
  html[data-rail="1"] .pop-user { justify-content: center; padding: 6px 0; }
  html[data-rail="1"] .pop-user > span:not(.pop-avatar), html[data-rail="1"] .pop-user-gear { display: none; }
  html[data-rail="1"] .pop-foot-tools { flex-direction: column; gap: 2px; }
  html[data-rail="1"] .pop-foot-tools > * { flex: none; width: 100%; }
  html[data-rail="1"] .pop-foot-tools .pop-live-badge { left: auto; right: 6px; }
  html[data-rail="1"] .pop-avatar { width: 30px; height: 30px; }
}

/* ---- 4. Content ---------------------------------------------------------- */
.pop-main {
  flex: 1;
  min-width: 0;
  padding: var(--gutter);
}
.pop-page-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px 16px;
  margin: 0 0 20px;
  min-height: 40px;
}
.pop-page-head > div:first-child { min-width: 0; }
.pop-page-head h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.pop-page-head .pop-page-sub { margin: 3px 0 0; color: var(--text-muted); font-size: 13px; }
.pop-page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Topbar — only visible on small screens */
.pop-topbar { display: none; }
.pop-topbar-search { display: none; }

/* ---- 5. Cards ------------------------------------------------------------ */
.pop-card, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card { padding: var(--card-pad); }
.pop-card + .pop-card { margin-top: 16px; }
.pop-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: var(--fs-md);
}
.pop-card-head h2, .pop-card-head h3 { margin: 0; font-size: var(--fs-md); }
.pop-card-body { padding: var(--card-pad); }
.pop-card-body.is-flush { padding: 0; }
.pop-card-note { padding: 12px 18px; color: var(--text-muted); font-size: 12px; border-top: 1px solid var(--line-soft); }
.card > p.lead, .lead { color: var(--text-muted); }

/* Page heading block used by legacy pages */
.phead { display: flex; align-items: flex-end; gap: 16px; margin: 0 0 18px; flex-wrap: wrap; }
.phead .t { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; font-family: var(--font); line-height: 1.2; color: var(--text); }
.phead .s, .phead .sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.phead .sp { flex: 1; }

/* ---- 6. Buttons ---------------------------------------------------------- */
.pop-btn, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1.4;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: background var(--dur), border-color var(--dur), color var(--dur), box-shadow var(--dur), transform var(--dur);
}
.pop-btn:hover, .btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.pop-btn:active, .btn:active { transform: translateY(1px); box-shadow: none; }
.pop-btn:disabled, .btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.pop-btn svg, .btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pop-btn-primary, .btn-primary, .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pop-btn-primary:hover, .btn-primary:hover, .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.pop-btn-quiet { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-ghost, .pop-btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); box-shadow: none; }
.btn-ghost:hover, .pop-btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-danger, .pop-btn-danger { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.btn-danger:hover, .pop-btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-success { background: var(--success-bg); border-color: transparent; color: var(--success); }
.btn-success:hover { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.btn-warn:hover { background: var(--warn); color: #fff; border-color: var(--warn); }
.btn-open { background: var(--info-bg); border-color: transparent; color: var(--info); }
.btn-open:hover { background: var(--info); color: #fff; border-color: var(--info); }
.btn-muted { background: var(--surface-2); border-color: transparent; color: var(--text-muted); }
.btn-muted:hover { background: var(--surface-3); color: var(--text); }
.btn-secondary { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); }
.pop-btn-sm, .btn-sm, .btn.small, .btn-small { padding: 4px 10px; font-size: 12px; border-radius: 5px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btnrow, .actrow { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- 7. Pills / badges --------------------------------------------------- */
.pop-badge, .pill, .badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; line-height: 1.5;
  white-space: nowrap;
  background: var(--surface-2); color: var(--text-muted);
  text-transform: capitalize;
  border: 0;
}
.pop-badge { border-radius: var(--radius-xs); text-transform: none; }
.pop-badge-ok,   .pill.ok,   .badge-ok,   .pill.ontime { background: var(--success-bg); color: var(--success); }
.pop-badge-warn, .pill.warn, .badge-warn, .pill.due    { background: var(--warn-bg); color: var(--warn); }
.pop-badge-bad,  .pill.bad,  .badge-bad                { background: var(--danger-bg); color: var(--danger); }
.pop-badge-muted,.pill.mut,  .badge-muted              { background: var(--surface-2); color: var(--text-muted); }
.pill.info, .badge-info { background: var(--info-bg); color: var(--info); }
/* ticket status */
.pill.new, .pill.open                      { background: var(--st-new-bg);       color: var(--st-new); }
.pill.pending                              { background: var(--st-pending-bg);   color: var(--st-pending); }
.pill.awaiting, .pill.awaiting_engineer    { background: var(--st-awaiting-bg);  color: var(--st-awaiting); }
.pill.escalated                            { background: var(--st-escalated-bg); color: var(--st-escalated); }
.pill.resolved, .pill.closed               { background: var(--st-resolved-bg);  color: var(--st-resolved); }
.pill.reopened                             { background: var(--st-reopened-bg);  color: var(--st-reopened); font-weight: 700; }
/* priority */
.pill.low, .pill.normal                    { background: var(--st-low-bg);       color: var(--st-low); }
.pill.high                                 { background: var(--st-high-bg);      color: var(--st-high); }
.pill.urgent                               { background: var(--st-escalated-bg); color: var(--st-escalated); font-weight: 700; }
.pill.overdue                              { background: var(--danger); color: #fff; }
/* dot variant */
.pill.has-dot::before, .pill-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- 8. Forms ------------------------------------------------------------ */
.field, .pop-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-muted); }
.field label, .pop-field label, .field > label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.pop-field input, .pop-field select, .pop-field textarea,
.field input, .field select, .field textarea,
.input, .select, .textarea {
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 7px 10px; min-width: 0;
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.pop-field input { min-width: 160px; }
.pop-field select { min-width: 160px; }
.pop-field input:focus, .pop-field select:focus, .pop-field textarea:focus,
.field input:focus, .field select:focus, .field textarea:focus,
.input:focus, .select:focus, .textarea:focus,
.wrap input:focus, .wrap select:focus, .wrap textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
.field.is-error input, .field.is-error select, .field.is-error textarea, .input.is-error, input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent);
}
.field .error, .field-error { color: var(--danger); font-size: 12px; }
.pop-field select, .field select, .select, select.pop-select {
  padding-right: 30px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236F7684' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); opacity: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.hint { color: var(--text-muted); font-size: 12px; }
.pop-filters { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 14px; }
.pop-filter-summary { color: var(--text-muted); font-size: 13px; padding-bottom: 8px; }
.pop-filter-summary strong { color: var(--text); }

/* Browser autofill forces its own light background; keep fields themed */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
  box-shadow: 0 0 0 1000px var(--surface) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
}

/* ---- 9. Tables ----------------------------------------------------------- */
.pop-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pop-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.pop-table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; white-space: nowrap;
  padding: 9px var(--td-x);
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.pop-table td { padding: var(--td-y) var(--td-x); border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
.pop-table td.is-wrap { white-space: normal; }
.pop-table tbody tr:last-child td { border-bottom: 0; }
.pop-table tbody tr { transition: background var(--dur); }
.pop-table tbody tr:hover td { background: var(--surface-2); }
.pop-table tbody tr.is-selected td { background: var(--accent-soft); }
.pop-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.pop-table .is-empty td { color: var(--text-muted); padding: 22px 16px; text-align: center; }
.pop-table a { color: var(--text); font-weight: 600; text-decoration: none; }
.pop-table a:hover { color: var(--accent-ink); }
/* Generic tables inside cards (legacy pages) */
.card table, .pop-card table, .table-wrap table { width: 100%; border-collapse: separate; border-spacing: 0; }
.card thead th, .pop-card thead th, .table-wrap thead th, .pop-card-body.is-flush thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: 9px var(--td-x); border-bottom: 1px solid var(--line); text-align: left;
}
.card td, .pop-card td, .table-wrap td { padding: var(--td-y) var(--td-x); border-bottom: 1px solid var(--line-soft); }
.card tbody tr:hover td, .pop-card tbody tr:hover td, .table-wrap tbody tr:hover td { background: var(--surface-2); }
.card tbody tr:last-child td, .pop-card tbody tr:last-child td, .table-wrap tbody tr:last-child td { border-bottom: 0; }

/* ---- 10. Small bits ------------------------------------------------------ */
.pop-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.pop-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-1); transition: box-shadow var(--dur), transform var(--dur); }
a.pop-stat:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.pop-stat-label { font-size: 13px; color: var(--text-muted); }
.pop-stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.pop-stat-delta { font-size: 12px; margin-top: 4px; color: var(--text-muted); }
.pop-stat-delta.is-up { color: var(--success); }
.pop-stat-delta.is-down { color: var(--danger); }

/* Flash / alert boxes */
.notice, .flash, .alert, .dc-flash, .pop-alert {
  display: block;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin: 0 0 14px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
}
.notice.ok, .flash.ok, .alert-success, .pop-alert-ok, .dc-flash.is-ok, .notice-success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.notice.bad, .flash.err, .flash.bad, .alert-danger, .pop-alert-bad, .dc-flash.is-bad, .notice-error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.notice.warn, .flash.warn, .alert-warn, .pop-alert-warn, .notice-warning { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice.info, .alert-info, .pop-alert-info, .notice-info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.notice a, .flash a { color: inherit; font-weight: 600; }

/* Tabs */
.pop-tabs, .tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 18px; }
.pop-tabs a, .tabs a, .tabs button, .tab {
  padding: 9px 14px; color: var(--text-muted); text-decoration: none; font-size: 13.5px; font-weight: 500;
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; cursor: pointer;
  transition: color var(--dur), border-color var(--dur);
}
.pop-tabs a:hover, .tabs a:hover, .tabs button:hover, .tab:hover { color: var(--text); }
.pop-tabs a[aria-current="page"], .tabs .is-active, .tabs [aria-selected="true"], .tab.is-active, .tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .count, .tab .count { margin-left: 6px; font-size: 11px; padding: 0 6px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-muted); }

/* Segmented control */
.pop-seg, .seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-1); }
.pop-seg button, .seg a, .seg button { border: 0; background: var(--surface); color: var(--text-muted); padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background var(--dur), color var(--dur); }
.pop-seg button + button, .seg a + a { border-left: 1px solid var(--line); }
.pop-seg button:hover, .seg a:hover { color: var(--text); background: var(--surface-2); }
.pop-seg button[aria-pressed="true"], .seg a.on, .seg .is-active { background: var(--accent); color: var(--accent-fg); }

/* Progress bars */
.progress, .pop-progress { height: 6px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; }
.progress > *, .pop-progress > * { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width var(--dur-slow) var(--ease); }
.progress.is-ok > *, .pop-progress.is-ok > * { background: var(--success); }
.progress.is-warn > *, .pop-progress.is-warn > * { background: var(--warn); }
.progress.is-bad > *, .pop-progress.is-bad > * { background: var(--danger); }

/* Skeleton loaders */
@keyframes popSkel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel {
  display: block; border-radius: var(--radius-sm); min-height: 1em;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: popSkel 1.4s ease infinite;
  color: transparent !important; pointer-events: none;
}
.skel-text { height: 12px; margin: 6px 0; }
.skel-title { height: 18px; width: 40%; margin: 8px 0 12px; }
.skel-circle { border-radius: 50%; width: 32px; height: 32px; }

/* Empty states */
.empty, .pop-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 40px 20px; color: var(--text-muted); gap: 6px;
}
.empty .ic, .pop-empty-icon { font-size: 26px; opacity: .7; margin-bottom: 4px; }
.empty .ic svg, .pop-empty-icon svg { width: 36px; height: 36px; stroke: var(--text-faint); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.empty .t, .pop-empty-title { font-size: 15px; font-weight: 600; color: var(--text); }
.empty .s, .pop-empty-sub { font-size: 13px; max-width: 420px; }
.empty .btn, .pop-empty .btn, .pop-empty .pop-btn { margin-top: 10px; }

/* Keyboard hints */
kbd, .kbd {
  display: inline-block; font-family: var(--font-mono); font-size: 11px; line-height: 1;
  padding: 3px 6px; border-radius: 4px; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px;
  vertical-align: middle;
}

/* Tooltip (rendered by pop_layout.js for [data-tip]) */
.pop-tip {
  position: fixed; z-index: 120; pointer-events: none;
  max-width: 260px; padding: 5px 9px; border-radius: 6px;
  background: #15181E; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.35;
  box-shadow: var(--shadow-2);
  opacity: 0; transform: translateY(2px);
  transition: opacity var(--dur), transform var(--dur);
}
[data-theme="dark"] .pop-tip { background: #F3F4F6; color: #15181E; }
.pop-tip.is-on { opacity: 1; transform: none; }
.pop-tip kbd { margin-left: 6px; background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.2); color: inherit; }
[data-theme="dark"] .pop-tip kbd { background: rgba(0,0,0,.08); border-color: rgba(0,0,0,.15); }

/* Dropdown menus */
.pop-menu, .menu {
  position: absolute; z-index: 60; min-width: 180px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  animation: popMenuIn var(--dur) var(--ease);
}
@keyframes popMenuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pop-menu[hidden], .menu[hidden] { display: none; }
.pop-menu a, .pop-menu button, .menu a, .menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border: 0; border-radius: 6px; background: none;
  color: var(--text); font: inherit; font-size: 13px; text-align: left; text-decoration: none; cursor: pointer;
}
.pop-menu a:hover, .pop-menu button:hover, .menu a:hover, .menu button:hover { background: var(--surface-2); }
.pop-menu hr, .menu hr { margin: 4px 0; }
.pop-menu .is-danger, .menu .is-danger { color: var(--danger); }

/* Dialogs (native <dialog>) */
dialog, .pop-dialog {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text);
  padding: 0; max-width: min(560px, calc(100vw - 32px)); width: 100%;
  box-shadow: var(--shadow-3);
}
dialog[open] { animation: popDialogIn var(--dur-slow) var(--ease); }
dialog::backdrop { background: rgba(10, 12, 18, .55); backdrop-filter: blur(2px); }
@keyframes popDialogIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.pop-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.pop-dialog-head h2 { margin: 0; font-size: var(--fs-lg); }
.pop-dialog-body { padding: 18px 20px; }
.pop-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.pop-dialog-x { width: 30px; height: 30px; border: 0; border-radius: 6px; background: none; color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.pop-dialog-x:hover { background: var(--surface-2); color: var(--text); }

/* Shortcuts cheat-sheet */
.pop-kbd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.pop-kbd-grid > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.pop-kbd-grid > div span:last-child { display: flex; gap: 4px; }
.pop-kbd-grid > h4 { grid-column: 1 / -1; margin: 10px 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.pop-kbd-grid > h4:first-child { margin-top: 0; }
@media (max-width: 560px) { .pop-kbd-grid { grid-template-columns: 1fr; } }

/* Toasts (shared look — pop_live / pop_telephony extend this) */
.pop-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.pop-toast, .toast {
  pointer-events: auto;
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-3);
  font-size: 13px;
  animation: popToastIn var(--dur-slow) var(--ease);
}
.pop-toast.is-ok, .toast-success, .toast.ok { border-left-color: var(--success); }
.pop-toast.is-bad, .toast-error, .toast.err { border-left-color: var(--danger); }
.pop-toast.is-warn, .toast-warn { border-left-color: var(--warn); }
@keyframes popToastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Callouts */
.callout { display: flex; gap: 10px; align-items: center; background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.callout a { color: inherit; font-weight: 600; }

/* Avatars */
.av, .avatar { display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text); font-weight: 600; }

/* ---- 11. Responsive: drawer under 1024px --------------------------------- */
@media (max-width: 1023px) {
  body { display: block; }

  .pop-topbar {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 30;
    height: 56px; padding: 0 8px 0 6px;
    background: var(--side); color: #fff;
    border-bottom: 1px solid var(--side-line);
  }
  .pop-topbar .pop-brand-mark { width: 30px; height: 30px; font-size: 13px; }
  .pop-topbar-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
  .pop-menu-btn, .pop-topbar-search {
    width: 40px; height: 40px; flex-shrink: 0;
    border: 0; border-radius: 8px;
    background: none; color: #fff; cursor: pointer;
    display: grid; place-items: center;
  }
  .pop-menu-btn svg, .pop-topbar-search svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .pop-topbar-search svg { width: 20px; height: 20px; }
  .pop-menu-btn:hover, .pop-topbar-search:hover { background: rgba(255,255,255,.08); }
  .pop-topbar .pop-live-topbell { margin-left: 0; }

  .pop-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(300px, 86vw); min-width: 0;
    transform: translateX(-100%);
    transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow);
    box-shadow: none;
    border-right: 0;
  }
  .pop-rail-btn { display: none; }
  body.nav-open .pop-sidebar { transform: none; box-shadow: 8px 0 30px rgba(0,0,0,.3); }
  body.nav-open { overflow: hidden; }
  /* backdrop */
  body::after {
    content: ""; position: fixed; inset: 0; z-index: 39;
    background: rgba(10,12,18,.5); backdrop-filter: blur(1px);
    opacity: 0; pointer-events: none; transition: opacity var(--dur-slow);
  }
  body.nav-open::after { opacity: 1; pointer-events: auto; }

  .pop-main { padding: 16px; }
  .pop-page-head { margin-bottom: 14px; }
  .pop-page-head h1 { font-size: 20px; }
  .pop-card-body { padding: 14px; }
  .pop-table th, .pop-table td { padding-left: 12px; padding-right: 12px; }
  .pop-field input, .pop-field select { min-width: 0; width: 100%; }
  .pop-field { flex: 1 1 140px; }
  .pop-page-actions { width: 100%; }
  .pop-page-actions > * { flex: 1 1 auto; }
}

@media (max-width: 480px) {
  .pop-stat-value { font-size: 22px; }
  .pop-main { padding: 12px; }
}

/* ---- 12. Auth pages (sign in / 2FA) --------------------------------------- */
body.pop-auth {
  display: grid; place-items: center; padding: 24px;
  position: relative; isolation: isolate; overflow-x: hidden;
  background: var(--bg);
}
body.pop-auth::before, body.pop-auth::after {
  content: ""; position: fixed; z-index: -1; border-radius: 50%; filter: blur(90px); opacity: .5;
  animation: popAuthFloat 18s ease-in-out infinite alternate;
}
body.pop-auth::before { width: 60vmax; height: 60vmax; left: -20vmax; top: -25vmax; background: radial-gradient(circle at 30% 30%, var(--brand), transparent 60%); }
body.pop-auth::after  { width: 55vmax; height: 55vmax; right: -20vmax; bottom: -25vmax; background: radial-gradient(circle at 70% 70%, #6D2A8A, transparent 60%); animation-delay: -9s; }
[data-theme="dark"] body.pop-auth::before, [data-theme="dark"] body.pop-auth::after { opacity: .3; }
@keyframes popAuthFloat { from { transform: translate(0, 0) scale(1); } to { transform: translate(6vmax, 4vmax) scale(1.12); } }
.pop-auth-box { width: 100%; max-width: 400px; animation: popAuthIn .4s var(--ease) both; }
@keyframes popAuthIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.pop-auth-brand { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.pop-auth-brand .pop-brand-mark { width: 48px; height: 48px; border-radius: 14px; font-size: 22px; background: linear-gradient(135deg, var(--brand), #6D2A8A); color: #fff; box-shadow: 0 8px 24px var(--accent-ring); }
.pop-auth-box .card, .pop-auth-box main { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); padding: 28px; }
.pop-auth-box h1 { font-size: 20px; margin: 0 0 4px; font-weight: 700; letter-spacing: -.02em; }
.pop-auth-box .lead { color: var(--text-muted); margin: 0 0 16px; font-size: 13px; }
.pop-auth-box .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pop-auth-box .field label { font-size: 13px; font-weight: 600; color: var(--text); }
.pop-auth-box input { font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); transition: border-color var(--dur), box-shadow var(--dur); }
.pop-auth-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.pop-auth-box .actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 0; border-top: 0; }
.pop-auth-box .spacer { display: none; }
.pop-auth-box .btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; border-radius: var(--radius-sm); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; border: 1px solid transparent; }
.pop-auth-box .btn-primary { background: var(--accent); color: var(--accent-fg); width: 100%; font-size: 14px; box-shadow: 0 4px 12px var(--accent-ring); }
.pop-auth-box .btn-primary:hover { background: var(--accent-hover); }
.pop-auth-box .btn-ghost { background: none; color: var(--text-muted); border-color: var(--line); width: auto; }
.pop-auth-box .btn-ghost:hover { color: var(--text); }
.pop-auth-box .notice { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.pop-auth-box .hint { font-size: 12px; color: var(--text-muted); margin: 14px 0 0; text-align: center; }
.pop-auth-box .brand { display: none; }   /* legacy brand row inside the body — replaced by .pop-auth-brand */
.pop-auth-box .center-card { max-width: none; margin: 0; }

/* ---- 13. Print ------------------------------------------------------------ */
@media print {
  body { display: block; background: #fff; color: #000; }
  .pop-sidebar, .pop-topbar, .pop-page-actions, .pop-gsearch, .pop-live-toasts, .pop-tel-stack, .pop-tip, #idleveil, #idlebox, .pop-foot-tools { display: none !important; }
  .pop-main { padding: 0; animation: none; }
  .pop-card, .card, .pop-stat, .pop-panel { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .pop-table th, .card thead th { position: static; }
  a { color: inherit; text-decoration: none; }
  .btn, .pop-btn { display: none; }
}
