/* ============================================================
   Shovler Admin — Design System v3
   All sizes in rem. Sidebar responds to theme.
   Base: 1rem = 16px (browser default, no px override on body)
   ============================================================ */

:root {
  /* Brand */
  --brand:        #2563eb;
  --brand-light:  #3b82f6;
  --brand-dark:   #1d4ed8;

  /* Content surface (light) */
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --border:       #e2e8f0;
  --shadow:       0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.04);

  /* Text */
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-subtle:  #94a3b8;

  /* Accents */
  --success:      #16a34a;
  --success-bg:   #f0fdf4;
  --danger:       #dc2626;
  --danger-bg:    #fef2f2;
  --warning:      #d97706;
  --warning-bg:   #fffbeb;
  --purple:       #7c3aed;
  --purple-bg:    #f5f3ff;

  /* Sidebar — LIGHT */
  --sidebar-bg:           #ffffff;
  --sidebar-border:       #e2e8f0;
  --sidebar-text:         #64748b;
  --sidebar-text-hover:   #0f172a;
  --sidebar-hover:        #f1f5f9;
  --sidebar-active-bg:    #eff6ff;
  --sidebar-active-text:  #2563eb;
  --sidebar-group-label:  #94a3b8;
  --sidebar-logo-text:    #0f172a;
  --sidebar-logo-sub:     #94a3b8;
  --sidebar-footer-border:#e2e8f0;
  --sidebar-w:            15.5rem;

  /* Layout */
  --radius:       0.75rem;
  --radius-sm:    0.5rem;
  --admin-break:  768px;

  /* Legacy aliases */
  --snow-bg:      var(--bg);
  --snow-surface: var(--surface);
  --snow-border:  var(--border);
  --ice:          var(--brand-light);
  --ice-deep:     var(--brand);
  --frost-text:   var(--text);
  --frost-muted:  var(--text-muted);
  --flake:        var(--surface);
}

/* ── Dark mode ────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0d1117;
  --surface:      #161b22;
  --surface-2:    #21262d;
  --border:       #30363d;
  --shadow:       0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);

  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --text-subtle:  #484f58;

  --success-bg:   #0d2a14;
  --danger-bg:    #2d0e0e;
  --warning-bg:   #1e1508;
  --purple-bg:    #1a1133;

  /* Sidebar — DARK */
  --sidebar-bg:           #0d1117;
  --sidebar-border:       #21262d;
  --sidebar-text:         #8b949e;
  --sidebar-text-hover:   #e6edf3;
  --sidebar-hover:        #161b22;
  --sidebar-active-bg:    rgba(37,99,235,0.18);
  --sidebar-active-text:  #79b8ff;
  --sidebar-group-label:  #3d444d;
  --sidebar-logo-text:    #e6edf3;
  --sidebar-logo-sub:     #484f58;
  --sidebar-footer-border:#21262d;

  /* Legacy */
  --snow-bg:      var(--bg);
  --snow-surface: var(--surface);
  --snow-border:  var(--border);
  --flake:        var(--surface);
  --frost-text:   var(--text);
  --frost-muted:  var(--text-muted);
  --ice-deep:     var(--brand-light);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;       /* 16px browser default — all children use rem */
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
  -webkit-font-smoothing: antialiased;
}

#app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 1px 0 0 var(--sidebar-border);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;          /* sidebar itself does NOT scroll */
  transition: background 0.2s, border-color 0.2s;
}

/* Logo zone */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1rem 0.875rem;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 0.375rem;
  flex-shrink: 0;
}

.sidebar-logo img {
  width: 2.125rem;
  height: 2.125rem;
  object-fit: contain;
  border-radius: 0.55rem;
  background: transparent;
  padding: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.sidebar-logo-text {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--sidebar-logo-text);
  letter-spacing: -0.01em;
}

.sidebar-logo-sub {
  font-size: 0.625rem;
  color: var(--sidebar-logo-sub);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 0.0625rem;
}

#sidebar h1 { display: none; }

#sidebar nav {
  flex: 1;
  padding: 0 0.5rem;
  overflow-y: auto;       /* only nav area scrolls */
  overflow-x: hidden;
  min-height: 0;          /* required for flex children to shrink */
}

#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.46875rem 0.75rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9375rem;
  border-radius: var(--radius-sm);
  border-left: none;
  transition: background 0.12s, color 0.12s;
  margin-bottom: 0.0625rem;
}

#sidebar nav a:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-hover);
}

#sidebar nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

/* ── Heroicons in nav ───────────────────────────────────────── */
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.12s;
}
.nav-icon-sm {
  width: 15px;
  height: 15px;
  opacity: 0.5;
}
a:hover .nav-icon, a.active .nav-icon,
a:hover .nav-icon-sm, a.active .nav-icon-sm { opacity: 1; }

/* ── Dashboard top link ─────────────────────────────────────── */
#sidebar nav .nav-top-link {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--sidebar-text);
  margin-bottom: 0.25rem;
}
#sidebar nav .nav-top-link:hover { color: var(--sidebar-text-hover); }
#sidebar nav .nav-top-link.active {
  color: var(--sidebar-active-text);
  background: var(--sidebar-active-bg);
}

/* ── Heroicons in nav ───────────────────────────────────────── */
.nav-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.12s;
  color: inherit;
}
.nav-icon-sm {
  width: 0.9375rem;
  height: 0.9375rem;
  opacity: 0.45;
}
a:hover .nav-icon, a.active .nav-icon,
a:hover .nav-icon-sm, a.active .nav-icon-sm,
.nav-top-link:hover .nav-icon, .nav-top-link.active .nav-icon { opacity: 1; }

/* ── Collapsible nav groups ─────────────────────────────────── */
#sidebar .nav-group { margin: 0 0 0.0625rem 0; }

#sidebar .nav-label-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem 0.375rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sidebar-group-label);
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
  text-align: left;
  margin-top: 0.4rem;
}
#sidebar .nav-label-toggle:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}
#sidebar .nav-label-toggle .nav-icon {
  width: 0.875rem;
  height: 0.875rem;
  opacity: 0.4;
}

.nav-chevron {
  margin-left: auto;
  width: 0.875rem !important;
  height: 0.875rem !important;
  opacity: 0.3;
  transition: transform 0.2s ease, opacity 0.15s;
  flex-shrink: 0;
}

#sidebar .nav-group.is-open .nav-label-toggle {
  color: var(--sidebar-active-text);
}
#sidebar .nav-group.is-active .nav-label-toggle {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  box-shadow: inset 3px 0 0 var(--brand);
}
#sidebar .nav-group.is-open .nav-label-toggle .nav-icon { opacity: 0.9; }
#sidebar .nav-group.is-open .nav-chevron {
  transform: rotate(90deg);
  opacity: 0.75;
}

.nav-group-links { display: none; padding: 0 0 0.25rem; }
.nav-group.is-open .nav-group-links { display: block; }

#sidebar .nav-link {
  padding-left: 1.875rem;
  font-size: 0.9375rem;
  color: var(--sidebar-text);
  gap: 0.5rem;
}
#sidebar .nav-link:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-hover);
}
#sidebar .nav-link.active {
  color: var(--sidebar-active-text);
  background: var(--sidebar-active-bg);
  box-shadow: inset 3px 0 0 var(--brand);
  font-weight: 700;
}

#sidebar .nav-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sidebar-group-label);
  padding: 0.25rem 0.75rem;
}

.sidebar-footer {
  padding: 0.75rem 0.75rem 1rem;
  border-top: 1px solid var(--sidebar-footer-border);
  flex-shrink: 0;           /* never shrinks — always visible at bottom */
  transition: border-color 0.2s;
  background: var(--sidebar-bg);  /* cover any nav content scrolling behind it */
}

#main-wrap {
  flex: 1;
  min-width: 0;    /* critical: prevents flex children from overflowing */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  transition: background 0.2s;
}

#topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  box-shadow: 0 1px 0 var(--border);
  transition: background 0.2s, border-color 0.2s;
}

#topbar .topbar-inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}

#topbar .title {
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

/* Dark mode toggle */
.btn-darkmode {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.3125rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}
.btn-darkmode:hover { background: var(--border); color: var(--text); }
.dm-icon { width: 1rem; height: 1rem; }

/* Dashboard card icon */
.dash-card-icon {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--text-muted);
  opacity: 0.6;
  flex-shrink: 0;
}

#topbar #auth-status {
  font-size: 0.78rem;
  max-width: min(14rem, 38vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-menu-btn {
  display: none;
  flex-shrink: 0;
  padding: 0.35rem 0.55rem;
  min-width: 2.5rem;
  font-size: 1.25rem;
  line-height: 1;
}

.admin-sidebar-backdrop {
  display: none;
}

#main {
  padding: 1.5rem;
  overflow: auto;
  flex: 1;
  min-width: 0;   /* prevent grid blowout inside flex */
  box-sizing: border-box;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  transition: background 0.2s, border-color 0.2s;
}

.card h2 {
  margin: 0 0 0.875rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.46875rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
  white-space: nowrap;
  font-family: inherit;
}

.btn:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn-sm {
  padding: 0.3125rem 0.6875rem;
  font-size: 0.8125rem;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-export {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
  white-space: nowrap;
}
.btn-export:hover { background: #15803d; border-color: #15803d; }

input, select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4375rem 0.625rem;
  font-size: 0.9375rem;
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  color: var(--text);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--surface-2);
}
label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

label {
  display: block;
  font-size: 0.75rem;
  color: var(--frost-muted);
  margin-bottom: 0.2rem;
}

.form-row {
  margin-bottom: 0.65rem;
  max-width: 22rem;
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

table.data,
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  color: var(--text);
}

table.data th,
table.data td,
table.data-table th,
table.data-table td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

table.data th:last-child,  table.data td:last-child,
table.data-table th:last-child, table.data-table td:last-child {
  border-right: none;
}

table.data thead th,
table.data-table thead th {
  background: var(--surface-2);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-sort-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  padding: 0;
  text-transform: inherit;
}

.table-sort-btn:hover {
  color: var(--brand);
  text-decoration: underline;
}

table.data tbody tr:hover td,
table.data-table tbody tr:hover td {
  background: var(--surface-2);
}

table.data tbody tr:last-child td,
table.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Dark mode table */
[data-theme="dark"] table.data tbody tr:hover td,
[data-theme="dark"] table.data-table tbody tr:hover td {
  background: var(--surface-2);
}

.pager {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.small { font-size: 0.8125rem; }

.err {
  color: var(--danger);
  font-size: 0.875rem;
}

.ok {
  color: var(--success);
}

#login-screen {
  max-width: 36rem;
  margin: 3rem auto;
  padding: 0 1rem;
}

.login-card {
  max-width: 26.25rem;
  margin: 2rem auto;
}

.login-conn-info {
  max-width: 32.5rem;
  margin: 0 auto 2rem;
}

#login-screen .card h2 {
  text-align: center;
}

@media (max-width: 768px) {
  .admin-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .admin-sidebar-backdrop.is-visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(26, 61, 92, 0.38);
    z-index: 998;
    -webkit-tap-highlight-color: transparent;
  }

  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 999;
    width: min(var(--sidebar-w), min(18rem, 88vw));
    transform: translateX(-100%);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: none;
    border-right: 1px solid var(--snow-border);
  }

  #sidebar.is-open {
    transform: translateX(0);
    box-shadow: 8px 0 36px var(--shadow);
  }

  #main-wrap {
    width: 100%;
    min-width: 0;
  }

  #main {
    padding: 0.85rem;
    min-width: 0;
  }

  #topbar {
    padding: 0.55rem 0.85rem;
  }

  #topbar #auth-status {
    max-width: 100%;
    flex: 1 1 100%;
    order: 3;
    white-space: normal;
    margin-top: 0.15rem;
  }

  #login-screen {
    margin: 1rem auto;
    padding: 0 0.75rem;
  }

  .login-card,
  .login-conn-info {
    max-width: none;
    margin-bottom: 1rem;
  }

  .form-row {
    max-width: none;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .toast-stack {
    left: 0.65rem;
    right: 0.65rem;
    max-width: none;
    top: auto;
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    flex-direction: column-reverse;
  }

  .chart-card canvas {
    max-height: 220px;
  }

  .trend-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  #topbar .title {
    font-size: 0.95rem;
  }

  .btn,
  .btn-ghost {
    font-size: 0.78rem;
  }

  table.data {
    font-size: 0.72rem;
  }

  table.data th,
  table.data td {
    padding: 0.35rem 0.4rem;
  }
}

.hidden {
  display: none !important;
}

.a-link {
  color: var(--ice-deep);
  cursor: pointer;
  text-decoration: underline;
}

code.inline {
  background: rgba(126, 184, 224, 0.25);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78rem;
}

.small {
  font-size: 0.78rem;
}

.toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 22rem;
  pointer-events: none;
}

.toast {
  background: var(--snow-surface);
  border: 1px solid var(--ice);
  border-left: 4px solid var(--ice-deep);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: 0 8px 28px var(--shadow);
  opacity: 0;
  transform: translateX(120%);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast strong {
  display: block;
  color: var(--ice-deep);
  margin-bottom: 0.25rem;
}

.toast-body {
  font-size: 0.85rem;
  color: var(--frost-text);
}

.dash-intro h2 { margin-top: 0; }

/* KPI grid */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.375rem 1.125rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s, background 0.2s, border-color 0.2s;
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 0.1875rem;
  background: var(--metric-accent, var(--brand));
  border-radius: var(--radius) var(--radius) 0 0;
}

.metric-card--blue   { --metric-accent: #2563eb; }
.metric-card--green  { --metric-accent: #16a34a; }
.metric-card--red    { --metric-accent: #dc2626; }
.metric-card--purple { --metric-accent: #7c3aed; }

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.metric-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--metric-accent, var(--brand)) 12%, transparent);
  color: var(--metric-accent, var(--brand));
}
.metric-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
}

.metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.metric-sub {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.metric-sub-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.metric-sub-item .sub-label {
  font-size: 0.6875rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric-sub-item .sub-val {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.metric-trend {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.1875rem 0.4375rem;
  border-radius: 9999px;
}
.metric-trend.up   { color: var(--success); background: var(--success-bg); }
.metric-trend.down { color: var(--danger);  background: var(--danger-bg); }
.metric-trend.flat { color: var(--text-subtle); background: var(--surface-2); }

.chart-card canvas { max-height: 18rem; }

.trend-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.trend-chart-grid h3 {
  margin: 0 0 0.5rem;
  color: var(--text);
  font-size: 0.95rem;
}

.snow-widget-card h2 {
  margin-top: 0;
}

.snow-widget-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.snow-widget-toolbar .snow-place-field {
  flex: 1;
  min-width: 10rem;
}

.snow-widget-toolbar label {
  width: 100%;
  margin-bottom: 0;
}

.snow-widget-meta {
  font-size: 0.78rem;
  margin-bottom: 0.5rem;
}

.snow-widget-row--alert td {
  background: rgba(126, 184, 224, 0.35) !important;
  font-weight: 600;
}

@media (max-width: 768px) {
  .snow-widget-toolbar .btn {
    width: 100%;
  }
}

.dash-secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
  width: 100%;
}

@media (max-width: 900px) {
  .dash-secondary-grid { grid-template-columns: 1fr; }
}

.insight-chat-card h2 {
  margin-top: 0;
}

.insight-chat-thread {
  max-height: min(24rem, 55vh);
  overflow-y: auto;
  border: 1px solid var(--snow-border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.55);
  -webkit-overflow-scrolling: touch;
}

.insight-bubble {
  margin-bottom: 0.6rem;
  padding: 0.5rem 0.75rem 0.4rem;
  border-radius: 12px;
  border-left: 3px solid var(--ice-deep);
  background: var(--snow-surface);
  box-shadow: 0 2px 8px var(--shadow);
}

.insight-bubble--clickable {
  cursor: pointer;
  transition: box-shadow 0.18s ease, border-left-color 0.18s ease, transform 0.12s ease;
}

.insight-bubble--clickable:hover {
  box-shadow: 0 6px 18px var(--shadow);
  border-left-color: var(--ice);
}

.insight-bubble--clickable:focus {
  outline: 2px solid var(--ice-deep);
  outline-offset: 2px;
}

.insight-bubble--clickable:active {
  transform: scale(0.998);
}

.insight-bubble:last-child {
  margin-bottom: 0;
}

.insight-bubble-meta {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--frost-muted);
  margin-bottom: 0.3rem;
}

.insight-bubble-body {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--frost-text);
}

.insight-bubble-hint {
  display: block;
  margin-top: 0.45rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--snow-border);
  font-size: 0.72rem;
  opacity: 0.88;
}

.insight-chat-composer {
  margin-top: 0.85rem;
}

.insight-composer-shell {
  border: 1px solid var(--border);
  border-radius: 1.65rem;
  padding: 0.32rem 0.4rem 0.32rem 1rem;
  background: var(--flake);
  box-shadow: 0 2px 16px rgba(26, 61, 92, 0.09);
}

.insight-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
}

.insight-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  min-height: 2.4rem;
  max-height: 9rem;
  padding: 0.55rem 0.2rem 0.45rem;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: none;
  width: auto;
  max-width: none;
}

.insight-chat-input:focus {
  outline: none;
}

.insight-chat-input::placeholder {
  color: var(--frost-muted);
  opacity: 0.85;
}

.insight-chat-input--locked {
  cursor: text;
  color: var(--frost-text);
  opacity: 0.94;
}

.insight-send-btn {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  min-width: 2.4rem;
  border-radius: 999px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.08rem;
  background: var(--ice-deep);
  color: var(--flake);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, opacity 0.15s ease;
}

.insight-send-btn--locked {
  opacity: 0.45;
  background: linear-gradient(145deg, #8aa8be 0%, #7a9aad 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.insight-send-btn--locked:hover {
  filter: brightness(1.07);
  opacity: 0.62;
  transform: scale(1.03);
}

.insight-send-btn:not(.insight-send-btn--locked):hover {
  filter: brightness(1.08);
  transform: scale(1.04);
}

.insight-send-icon {
  display: block;
  margin-left: 1px;
  margin-top: 1px;
}

.insight-composer-hint {
  margin: 0.35rem 0.75rem 0.15rem;
  padding: 0;
  line-height: 1.35;
}

@media (max-width: 768px) {
  .insight-composer-shell {
    border-radius: 1.35rem;
    padding-left: 0.85rem;
  }
}

@media (max-width: 768px) {
  body.admin-sidebar-open {
    overflow: hidden;
  }
}

/* Admin user profile (#user/:id) — full main width + responsive */
.user-profile-card {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.user-profile-card .form-row {
  max-width: none;
}

.user-profile-card .table-wrap {
  max-width: 100%;
}

.user-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--snow-border);
}

.user-actions-bar__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.user-profile-header {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.user-profile-avatar {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  border: 3px solid var(--snow-border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-profile-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ice-deep);
  letter-spacing: 0.02em;
}

.user-profile-main {
  flex: 1;
  min-width: 0;
}

.user-profile-name {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  color: var(--frost-text);
}

.user-profile-meta {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.user-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.user-profile-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 0.35rem;
}

.user-profile-badge--danger {
  background: rgba(197, 48, 48, 0.12);
  color: var(--danger);
  border: 1px solid rgba(197, 48, 48, 0.35);
}

.user-profile-badge--muted {
  background: rgba(90, 122, 148, 0.15);
  color: var(--frost-muted);
  border: 1px solid var(--snow-border);
}

.user-profile-ratings {
  font-size: 0.82rem;
  line-height: 1.55;
  margin-bottom: 0.85rem;
}

/* 5-star rating (empty = cool gray, fill = gold) */
.rating-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  flex-shrink: 0;
  vertical-align: middle;
  font-size: 1.2rem;
  line-height: 1;
}

.rating-stars__cell {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.rating-stars__empty {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--border);
  opacity: 0.92;
  pointer-events: none;
  line-height: 1;
  user-select: none;
}

.rating-stars__fill-track {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  overflow: hidden;
  max-width: 100%;
  line-height: 1;
  box-sizing: border-box;
}

.rating-stars__fill {
  display: block;
  width: 1em;
  height: 1em;
  color: var(--warning);
  text-shadow: 0 1px 0 rgba(255, 230, 150, 0.5), 0 -1px 0 rgba(139, 90, 0, 0.2);
  line-height: 1;
  user-select: none;
}

.profile-rating-row {
  margin-bottom: 0.65rem;
}

.profile-rating-row:last-child {
  margin-bottom: 0;
}

.profile-rating-label {
  display: block;
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--frost-muted);
  margin-bottom: 0.35rem;
}

.profile-rating-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.profile-rating-meta {
  font-size: 0.82rem;
  line-height: 1.4;
}

.profile-rating-num {
  font-weight: 600;
  color: var(--frost-text);
}

.profile-rating-counts {
  margin: 0.6rem 0 0;
  font-size: 0.82rem;
}

/* Admin user profile — comment timeline & direct messages */
.ue-comments-wrap,
.ue-messages-wrap {
  margin: 0.75rem 0;
}

.comment-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.comment-timeline-item {
  margin: 0;
  padding: 0;
}

.comment-timeline-card {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--snow-border);
  background: var(--surface);
  box-shadow: 0 4px 14px var(--shadow);
  border-left: 4px solid var(--ice);
}

.comment-timeline-icon {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  border-radius: 0.55rem;
  background: rgba(126, 184, 224, 0.2);
  border: 1px solid rgba(126, 184, 224, 0.45);
}

.comment-timeline-inner {
  flex: 1;
  min-width: 0;
}

.comment-timeline-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.35rem;
}

.comment-timeline-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ice-deep);
  background: rgba(74, 144, 194, 0.15);
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
}

.comment-timeline-when {
  font-size: 0.72rem;
}

.comment-timeline-meta-extra {
  margin: 0 0 0.4rem;
}

.comment-timeline-item--legacy .comment-timeline-card {
  border-left-color: var(--frost-muted);
  background: rgba(90, 122, 148, 0.06);
}

.comment-timeline-item--kind-user_banned .comment-timeline-card {
  border-left-color: var(--danger);
  background: var(--danger-bg);
}

.comment-timeline-item--kind-user_unbanned .comment-timeline-card {
  border-left-color: var(--success);
}

.comment-timeline-item--kind-user_soft_deleted .comment-timeline-card,
.comment-timeline-item--kind-user_deleted_permanent .comment-timeline-card {
  border-left-color: var(--warning);
  background: var(--warning-bg);
}

.comment-timeline-item--kind-feedback_submitted .comment-timeline-card {
  border-left-color: var(--purple);
  background: var(--purple-bg);
}

.comment-timeline-item--kind-premium_enabled .comment-timeline-card {
  border-left-color: var(--warning);
}

.comment-timeline-item--kind-premium_disabled .comment-timeline-card {
  border-left-color: var(--text-subtle);
}

.comment-timeline-item--kind-account_activated .comment-timeline-card {
  border-left-color: var(--success);
}

.comment-timeline-item--kind-account_deactivated .comment-timeline-card {
  border-left-color: var(--danger);
}

.comment-timeline-item--kind-duty_on .comment-timeline-card {
  border-left-color: var(--success);
}

.comment-timeline-item--kind-duty_off .comment-timeline-card {
  border-left-color: var(--text-subtle);
}

.comment-timeline-item--kind-admin_note .comment-timeline-card {
  border-left-color: var(--ice-deep);
}

.comment-timeline-body {
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-timeline-add {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--snow-border);
}

.comment-timeline-add label {
  font-weight: 600;
  font-size: 0.8rem;
}

.dm-thread {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0.75rem 0;
  max-height: min(420px, 55vh);
  overflow-y: auto;
  padding: 0.25rem 0.15rem;
}

.dm-bubble {
  max-width: min(100%, 26rem);
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--snow-border);
  background: rgba(255, 255, 255, 0.75);
}

.dm-bubble--admin {
  align-self: flex-end;
  margin-left: 15%;
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  border-color: rgba(74, 144, 194, 0.4);
}

.dm-bubble--user {
  align-self: flex-start;
  margin-right: 15%;
}

.dm-bubble-meta {
  font-size: 0.68rem;
  margin-bottom: 0.25rem;
}

.dm-bubble-body {
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.dm-composer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--snow-border);
}

.dm-composer label {
  font-weight: 600;
  font-size: 0.8rem;
}

.user-profile-location {
  font-size: 0.88rem;
  padding: 0.75rem 1rem;
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--snow-border);
}

.user-profile-location strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--frost-muted);
}

.profile-tabs {
  margin-top: 0.5rem;
}

.profile-tab-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--snow-border);
  padding-bottom: 0.35rem;
}

.profile-tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--frost-muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 0.45rem;
  cursor: pointer;
  font-family: inherit;
}

.profile-tab-btn:hover {
  background: rgba(126, 184, 224, 0.15);
  color: var(--frost-text);
}

.profile-tab-btn.is-active {
  background: rgba(126, 184, 224, 0.28);
  border-color: var(--snow-border);
  color: var(--ice-deep);
  font-weight: 600;
}

.profile-tab-panel {
  display: none;
}

.profile-tab-panel.is-active {
  display: block;
}

.profile-tab-title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  color: var(--ice-deep);
}

.ue-chat-detail {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--snow-border);
}

.muted.small {
  font-size: 0.78rem;
}

@media (max-width: 768px) {
  .user-profile-card {
    padding: 0.85rem 1rem;
    margin-left: 0;
    margin-right: 0;
  }

  .user-actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .user-actions-bar > .btn.btn-ghost:first-child {
    align-self: flex-start;
  }

  .user-actions-bar__btns {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .user-actions-bar__btns .btn {
    min-width: 0;
    padding: 0.45rem 0.4rem;
    font-size: 0.72rem;
    text-align: center;
    line-height: 1.25;
  }

  .user-profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
  }

  .user-profile-main {
    width: 100%;
  }

  .user-profile-meta {
    font-size: 0.82rem;
  }

  .user-profile-badges {
    justify-content: center;
  }

  .user-profile-ratings {
    text-align: left;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
  }

  .user-profile-location {
    width: 100%;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
  }

  .profile-tab-buttons {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0.3rem;
    padding-bottom: 0.45rem;
    margin: 0 -0.15rem;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .profile-tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
  }

  .profile-tab-title {
    font-size: 0.92rem;
  }

  .ue-chat-detail .table-wrap {
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .user-actions-bar__btns {
    grid-template-columns: 1fr;
  }

  .user-actions-bar__btns .btn {
    font-size: 0.78rem;
    padding: 0.5rem 0.65rem;
  }

  .user-profile-avatar {
    width: 4.75rem;
    height: 4.75rem;
  }

.user-profile-name {
  font-size: 1.15rem;
}

.user-profile-ratings,
.user-profile-location {
  max-width: none;
}
}

/* Modern user profile console */
.user-profile-console {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 96rem;
  margin: 0 auto;
}

.profile-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.profile-action-row__buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profile-hero-card,
.profile-console-card,
.profile-metric-card {
  background: var(--panel-bg, #fff);
  border: 1px solid var(--snow-border, #dfe7f1);
  border-radius: 0.75rem;
  box-shadow: var(--snow-shadow, 0 8px 22px rgba(15, 23, 42, 0.08));
}

.profile-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(19rem, 24rem);
  gap: 1rem;
  padding: 1.25rem;
}

.profile-hero-left {
  display: flex;
  gap: 1rem;
  min-width: 0;
}

.profile-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
}

.profile-avatar-wrap .user-profile-avatar {
  margin: 0;
}

.profile-status-dot {
  position: absolute;
  right: 0.2rem;
  bottom: 0.2rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  background: #10b981;
  border: 2px solid #fff;
}

.profile-hero-copy {
  min-width: 0;
}

.profile-hero-kicker,
.profile-card-head p,
.profile-metric-card span,
.profile-info-item span {
  color: var(--frost-muted, #6b7d93);
}

.profile-hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.profile-hero-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.profile-hero-title-row .user-profile-name {
  margin: 0;
}

.profile-role-chip,
.profile-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.profile-role-chip {
  background: #eef4ff;
  color: #2563eb;
  border-color: #d6e5ff;
}

.profile-status-chip--ok {
  background: #e8f8ef;
  color: #087b4d;
  border-color: #bdebd2;
}

.profile-status-chip--danger {
  background: #fff0f0;
  color: #c53030;
  border-color: #ffd0d0;
}

.profile-status-chip--muted {
  background: #f3f6fa;
  color: #63758b;
  border-color: #dfe7f1;
}

.profile-status-chip--info {
  background: #f5efff;
  color: #6d3bd1;
  border-color: #dfd0ff;
}

.profile-meta-line {
  margin: 0.45rem 0 0;
  color: var(--frost-muted, #6b7d93);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.profile-rating-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 1rem;
}

.profile-rating-chip {
  border: 1px solid var(--snow-border, #dfe7f1);
  border-radius: 0.6rem;
  padding: 0.75rem;
  background: #f8fbff;
}

.profile-rating-chip span,
.profile-rating-chip small {
  display: block;
  color: var(--frost-muted, #6b7d93);
  font-size: 0.78rem;
}

.profile-rating-chip strong {
  display: block;
  margin: 0.25rem 0;
}

.profile-manage-card {
  border-left: 1px solid var(--snow-border, #dfe7f1);
  padding-left: 1rem;
}

.profile-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.profile-card-head h3 {
  margin: 0;
  font-size: 1rem;
}

.profile-card-head p {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}

.profile-switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.profile-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--snow-border, #dfe7f1);
  border-radius: 0.6rem;
  background: #f8fbff;
  font-weight: 700;
}

.profile-switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.profile-switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 2.4rem;
  height: 1.3rem;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.15s ease;
}

.profile-switch-track::after {
  content: "";
  position: absolute;
  top: 0.16rem;
  left: 0.16rem;
  width: 0.98rem;
  height: 0.98rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease;
}

.profile-switch-row input:checked + .profile-switch-track {
  background: #2563eb;
}

.profile-switch-row input:checked + .profile-switch-track::after {
  transform: translateX(1.08rem);
}

.profile-save-message {
  margin: 0.8rem 0 0;
}

.profile-metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.profile-metric-card {
  padding: 0.9rem;
}

.profile-metric-card span,
.profile-metric-card small {
  display: block;
}

.profile-metric-card span {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.profile-metric-card strong {
  display: block;
  margin: 0.3rem 0 0.1rem;
  font-size: 1.55rem;
  color: var(--brand, #2563eb);
}

.profile-metric-card small {
  color: var(--frost-muted, #6b7d93);
  font-size: 0.76rem;
}

.profile-console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(20rem, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.profile-console-card {
  padding: 1rem;
  min-width: 0;
}

.profile-console-card--wide {
  grid-column: 1 / -1;
}

.profile-info-grid,
.profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.profile-info-grid--single {
  grid-template-columns: 1fr;
}

.profile-info-item {
  padding: 0.75rem;
  border: 1px solid var(--snow-border, #dfe7f1);
  border-radius: 0.55rem;
  background: #f8fbff;
  min-width: 0;
}

.profile-info-item span {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.profile-info-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.profile-form-grid {
  margin-top: 0.85rem;
}

.profile-checkline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  color: var(--frost-muted, #6b7d93);
  font-weight: 700;
}

.profile-location-map {
  min-height: 8rem;
  border-radius: 0.65rem;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(16, 185, 129, 0.12)),
    repeating-linear-gradient(45deg, rgba(100, 116, 139, 0.08) 0 1px, transparent 1px 18px);
  border: 1px solid var(--snow-border, #dfe7f1);
  display: flex;
  align-items: flex-end;
  padding: 0.85rem;
  color: var(--frost-text, #0f172a);
  font-weight: 800;
  margin-bottom: 0.85rem;
}

.profile-console-card .table-wrap {
  margin-top: 0.5rem;
}

.profile-console-card .data {
  min-width: 42rem;
}

@media (max-width: 1180px) {
  .profile-hero-card,
  .profile-console-grid {
    grid-template-columns: 1fr;
  }

  .profile-manage-card {
    border-left: 0;
    border-top: 1px solid var(--snow-border, #dfe7f1);
    padding-left: 0;
    padding-top: 1rem;
  }

  .profile-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .profile-hero-left,
  .profile-action-row {
    align-items: flex-start;
  }

  .profile-hero-left {
    flex-direction: column;
  }

  .profile-action-row__buttons,
  .profile-card-head {
    width: 100%;
  }

  .profile-rating-chips,
  .profile-switch-grid,
  .profile-metric-grid,
  .profile-info-grid,
  .profile-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Profile mockup refinement */
.user-profile-console--compact {
  width: min(100%, 106rem);
  max-width: none;
  margin: 0;
  gap: 0.9rem;
}

.user-profile-console--compact .profile-action-row {
  padding: 0;
}

.user-profile-console--compact .profile-action-row__buttons .btn {
  min-height: 2.25rem;
  padding: 0.55rem 0.9rem;
}

.user-profile-console--compact .profile-hero-card {
  grid-template-columns: minmax(0, 1fr) 17rem;
  min-height: 9.6rem;
  padding: 1.25rem 1.35rem;
  align-items: start;
}

.user-profile-console--compact .profile-hero-left {
  align-items: flex-start;
}

.user-profile-console--compact .user-profile-avatar {
  width: 4.2rem;
  height: 4.2rem;
}

.user-profile-console--compact .user-profile-name {
  font-size: 1.35rem;
  line-height: 1.1;
}

.user-profile-console--compact .profile-meta-line {
  font-size: 0.82rem;
  margin-top: 0.35rem;
}

.user-profile-console--compact .profile-rating-chips {
  max-width: 24rem;
  margin-top: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-profile-console--compact .profile-rating-chip {
  min-height: 3.5rem;
  padding: 0.55rem 0.7rem;
}

.user-profile-console--compact .profile-rating-chip strong {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  line-height: 1;
  white-space: nowrap;
}

.user-profile-console--compact .profile-rating-chip strong .stars,
.user-profile-console--compact .profile-rating-chip strong .star-rating,
.user-profile-console--compact .profile-rating-chip strong .rating-stars {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.05rem;
  width: max-content;
  min-width: max-content;
  white-space: nowrap;
}

.user-profile-console--compact .rating-stars__cell {
  flex: 0 0 1em;
}

.user-profile-console--compact .profile-rating-chip em {
  color: var(--frost-text, #0f172a);
  font-style: normal;
  font-weight: 800;
  margin-left: 0.35rem;
}

.user-profile-console--compact .profile-manage-card {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--snow-border, #dfe7f1);
  border-radius: 0.75rem;
  background: #fbfdff;
}

.user-profile-console--compact .profile-manage-card .profile-card-head {
  margin-bottom: 0.6rem;
}

.user-profile-console--compact .profile-manage-card h3,
.user-profile-console--compact .profile-section-label {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 900;
}

.user-profile-console--compact .profile-switch-grid {
  grid-template-columns: 1fr;
  gap: 0.35rem;
}

.user-profile-console--compact .profile-switch-row {
  border: 0;
  background: transparent;
  padding: 0.26rem 0;
  font-size: 0.86rem;
}

.profile-secondary-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.profile-card-head--sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.user-profile-console--compact .profile-metric-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.user-profile-console--compact .profile-metric-card {
  border-radius: 0.7rem;
  min-height: 5.2rem;
  padding: 0.8rem 0.95rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.user-profile-console--compact .profile-metric-card strong {
  color: #0f172a;
  font-size: 1.35rem;
  margin-top: 0.35rem;
}

.user-profile-console--compact .profile-console-grid {
  grid-template-columns: minmax(0, 2.25fr) minmax(23rem, 1fr);
  gap: 1rem;
}

.user-profile-console--compact .profile-console-card {
  border-radius: 0.75rem;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.profile-account-card,
.profile-jobs-card,
.profile-notes-card {
  grid-column: 1;
}

.profile-location-card,
.profile-properties-card,
.profile-messages-card {
  grid-column: 2;
}

.user-profile-console--compact .profile-card-head {
  margin-bottom: 0.8rem;
}

.user-profile-console--compact .profile-card-head h3 {
  font-size: 1.05rem;
}

.user-profile-console--compact .profile-card-head h3 span {
  color: #8a9ab0;
  font-weight: 600;
}

.user-profile-console--compact .profile-section-label {
  margin: 0.8rem 0 0.4rem;
}

.user-profile-console--compact .profile-info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-profile-console--compact .profile-info-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.user-profile-console--compact .profile-info-item {
  border: 0;
  background: transparent;
  padding: 0;
}

.user-profile-console--compact .profile-info-item strong {
  font-size: 0.88rem;
}

.profile-security-grid {
  align-items: end;
}

.user-profile-console--compact .profile-location-map {
  min-height: 7.1rem;
  border-radius: 0.65rem;
  background:
    linear-gradient(45deg, rgba(226, 232, 240, 0.75) 25%, transparent 25% 50%, rgba(226, 232, 240, 0.75) 50% 75%, transparent 75%),
    #f4f7fb;
  background-size: 1.4rem 1.4rem;
  color: #718096;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
}

.profile-location-value {
  margin: 0 0 0.75rem;
  font-weight: 800;
}

.profile-mini-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--snow-border, #dfe7f1);
  border-radius: 0.7rem;
}

.profile-mini-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 42rem;
  font-size: 0.86rem;
}

.profile-mini-table th {
  background: #f7f9fc;
  color: #8a9ab0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  text-align: left;
  padding: 0.8rem 0.9rem;
}

.profile-mini-table td {
  border-top: 1px solid var(--snow-border, #dfe7f1);
  padding: 0.8rem 0.9rem;
  vertical-align: middle;
}

.profile-rating-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.45rem;
  border-radius: 0.4rem;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  color: #087b4d;
  font-weight: 800;
}

.profile-rating-star {
  color: #f59e0b;
  font-weight: 900;
}

.profile-property-list {
  display: grid;
  gap: 0.75rem;
}

.profile-property-card {
  border: 1px solid var(--snow-border, #dfe7f1);
  border-radius: 0.75rem;
  padding: 0.9rem;
  background: #fff;
}

.profile-property-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.profile-property-card p {
  margin: 0.55rem 0 0.75rem;
  color: var(--frost-muted, #6b7d93);
  font-size: 0.86rem;
}

.user-profile-console--compact .comment-timeline-add,
.user-profile-console--compact .dm-composer {
  margin-top: 0.9rem;
}

@media (max-width: 1180px) {
  .user-profile-console--compact .profile-hero-card,
  .user-profile-console--compact .profile-console-grid {
    grid-template-columns: 1fr;
  }

  .profile-account-card,
  .profile-jobs-card,
  .profile-notes-card,
  .profile-location-card,
  .profile-properties-card,
  .profile-messages-card {
    grid-column: auto;
  }

  .user-profile-console--compact .profile-metric-grid,
  .user-profile-console--compact .profile-info-grid--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .user-profile-console--compact .profile-metric-grid,
  .user-profile-console--compact .profile-info-grid,
  .user-profile-console--compact .profile-info-grid--four {
    grid-template-columns: 1fr;
  }
}

/* Softer sidebar menu */
#sidebar {
  --menu-panel: #f3f7ff;
  --menu-panel-border: #dbe7ff;
  --menu-active-row: #e4edff;
  --menu-muted: #8fa0b7;
}

.sidebar-logo {
  padding: 1rem 1rem 0.95rem;
  border-bottom: 0;
  margin-bottom: 0.65rem;
  gap: 0.65rem;
}

.sidebar-logo img {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  background: #0f172a;
  box-shadow: none;
}

.sidebar-logo-text {
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 800;
  color: #0f172a;
}

.sidebar-logo-sub {
  margin-top: 0.25rem;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: #94a3b8;
}

#sidebar nav {
  padding: 0 0.75rem;
}

#sidebar nav .nav-top-link {
  min-height: 2.35rem;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.55rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #334155;
}

#sidebar nav .nav-top-link.active {
  background: transparent;
  color: #2563eb;
}

#sidebar nav .nav-top-link .nav-icon {
  color: #ef6c37;
  opacity: 1;
}

#sidebar .nav-group {
  margin: 0.1rem 0 0.55rem;
  border-radius: 0.75rem;
}

#sidebar .nav-label-toggle {
  min-height: 2.35rem;
  padding: 0.55rem 0.65rem;
  margin: 0;
  border-radius: 0.55rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: #475569;
}

#sidebar .nav-label-toggle .nav-icon {
  width: 1rem;
  height: 1rem;
  opacity: 0.65;
}

#sidebar .nav-label-toggle .nav-chevron {
  width: 0.8rem !important;
  height: 0.8rem !important;
  color: #9caec3;
  opacity: 0.7;
}

#sidebar .nav-group.is-active {
  background: var(--menu-panel);
  border: 1px solid var(--menu-panel-border);
  padding: 0.45rem;
}

#sidebar .nav-group.is-active .nav-label-toggle {
  color: #2563eb;
  background: transparent;
  box-shadow: none;
  font-weight: 800;
}

#sidebar .nav-group.is-active .nav-label-toggle .nav-icon,
#sidebar .nav-group.is-active .nav-label-toggle .nav-chevron {
  opacity: 1;
}

#sidebar .nav-group:not(.is-active) .nav-label-toggle:hover {
  background: #f8fbff;
}

#sidebar .nav-group-links {
  padding: 0.15rem 0;
}

#sidebar .nav-link {
  min-height: 2rem;
  padding: 0.42rem 0.55rem 0.42rem 2.25rem;
  margin: 0.05rem 0;
  border-radius: 0.45rem;
  font-size: 0.9rem;
  color: #526783;
  box-shadow: none;
}

#sidebar .nav-link .nav-icon-sm {
  display: none;
}

#sidebar .nav-link:hover {
  background: rgba(228, 237, 255, 0.65);
  color: #0f172a;
}

#sidebar .nav-link.active {
  background: var(--menu-active-row);
  color: #0f172a;
  box-shadow: none;
  font-weight: 700;
}

#sidebar .nav-group:not(.is-active) .nav-link.active {
  color: #2563eb;
}

#sidebar .nav-group:first-of-type::before {
  content: "OPERATIONS";
  display: block;
  padding: 0 0.55rem 0.45rem;
  color: var(--menu-muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

[data-theme="dark"] #sidebar {
  --menu-panel: rgba(37, 99, 235, 0.14);
  --menu-panel-border: rgba(96, 165, 250, 0.24);
  --menu-active-row: rgba(96, 165, 250, 0.18);
}

[data-theme="dark"] .sidebar-logo-text,
[data-theme="dark"] #sidebar .nav-link.active {
  color: #f8fafc;
}

/* =========================================================
   📁 Catalog CRUD — table + slide-in panel
   ========================================================= */

.catalog-page {
  position: relative;
}

.ct-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.85rem;
}

.ct-table-wrap {
  max-width: 100%;
}

.ct-table td:first-child {
  width: 9rem;
  vertical-align: middle;
}

.ct-row-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.ct-row-actions .btn {
  font-size: 0.72rem;
  padding: 0.28rem 0.5rem;
  white-space: nowrap;
}

/* Backdrop */
.ct-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 61, 92, 0.35);
  z-index: 490;
  -webkit-tap-highlight-color: transparent;
}

.ct-backdrop.is-visible {
  display: block;
}

/* Slide-in panel */
.ct-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 96vw);
  height: 100dvh;
  background: var(--snow-surface);
  border-left: 1px solid var(--snow-border);
  box-shadow: -8px 0 40px var(--shadow);
  z-index: 500;
  transform: translateX(110%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ct-panel.is-open {
  transform: translateX(0);
}

.ct-panel-inner {
  padding: 1.25rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.ct-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 0.75rem;
}

.ct-panel-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ice-deep);
}

.ct-panel-close {
  border: none;
  background: transparent;
  font-size: 1.15rem;
  cursor: pointer;
  color: var(--frost-muted);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  line-height: 1;
}

.ct-panel-close:hover {
  background: rgba(126, 184, 224, 0.2);
  color: var(--frost-text);
}

/* Form inside panel */
.ct-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cf-row {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-bottom: 0.85rem;
}

.cf-wide {
  width: 100%;
}

.cf-row label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--frost-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cf-row input,
.cf-row textarea,
.cf-select {
  width: 100%;
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--snow-border);
  border-radius: 8px;
  background: var(--flake);
  color: var(--frost-text);
}

.cf-row input:focus,
.cf-row textarea:focus,
.cf-select:focus {
  outline: 2px solid var(--ice);
  outline-offset: 1px;
}

.cf-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: normal;
  text-transform: none;
  letter-spacing: 0;
  color: var(--frost-text);
}

.req {
  color: var(--danger);
}

.ct-form-footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--snow-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

@media (max-width: 560px) {
  .ct-panel {
    width: 100vw;
    border-left: none;
    border-top: 1px solid var(--snow-border);
    top: auto;
    bottom: 0;
    right: 0;
    height: 90dvh;
    border-radius: 1rem 1rem 0 0;
    transform: translateY(110%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .ct-panel.is-open {
    transform: translateY(0);
  }
}

/* =========================================================
   Reports module
   ========================================================= */

/* Catalog */
.reports-catalog {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.reports-group-title {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--frost-muted);
  border-bottom: 1px solid var(--snow-border);
  padding-bottom: 0.35rem;
}

.reports-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.85rem;
}

.report-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.18s ease, transform 0.15s ease, border-color 0.15s ease, background 0.2s;
  outline: none;
}

.report-card:hover,
.report-card:focus {
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.15);
  border-color: var(--brand);
  transform: translateY(-2px);
}

.report-card:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3), 0 4px 16px var(--shadow);
}

.report-card-tag-export { color: var(--success) !important; }
.reports-group-title { color: var(--text-muted); border-color: var(--border); }

.report-card-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  width: 2.5rem;
  text-align: center;
}

.report-card-body {
  flex: 1;
  min-width: 0;
}

.report-card-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--frost-text);
  margin-bottom: 0.3rem;
}

.report-card-desc {
  font-size: 0.78rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.report-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.report-card-tag {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
  background: rgba(126, 184, 224, 0.18);
  color: var(--frost-muted);
  border: 1px solid var(--snow-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}

.report-card-tag--export {
  background: rgba(39, 103, 73, 0.12);
  color: var(--success);
  border-color: rgba(39, 103, 73, 0.3);
}

/* Detail view */
.report-detail-card {
  width: 100%;
  max-width: none;
}

.report-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.report-detail-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  color: var(--ice-deep);
}

.report-detail-icon {
  font-size: 2.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.report-detail-listlink {
  font-size: 0.78rem;
  color: var(--ice-deep);
  text-decoration: underline;
}

/* Filters */
.report-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  margin-bottom: 1rem;
}

.report-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 9rem;
}

.report-filter-field label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--frost-muted);
}

.report-filter-field input,
.report-filter-field select {
  font-size: 0.82rem;
  padding: 0.35rem 0.55rem;
}

.report-run-bar {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1rem;
}

/* Stats cards */
.report-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.report-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem 0.75rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--brand);
  transition: background 0.2s, border-color 0.2s;
}

.report-stat-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.report-stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.report-stat-sub {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-subtle);
  display: block;
  margin-top: 0.2rem;
}

/* Result area */
.report-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.report-result-pager {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 768px) {
  .reports-cards {
    grid-template-columns: 1fr;
  }

  .report-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .report-filter-form {
    flex-direction: column;
    gap: 0.65rem;
  }

  .report-filter-field {
    min-width: 0;
    width: 100%;
  }

  .report-detail-header {
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .report-stats-row {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   ⚙️  Configuration page
   ========================================================= */

.config-page {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.config-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.config-group-title {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.45rem;
}

.config-field {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) minmax(0, 2fr);
  gap: 0.65rem 1.25rem;
  align-items: start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.config-field:last-of-type {
  border-bottom: none;
}

.config-field-label {
  font-weight: 600;
  font-size: 0.82rem;
  display: block;
  margin-bottom: 0.25rem;
}

.config-field-desc {
  font-size: 0.72rem;
  line-height: 1.4;
  margin: 0;
}

.config-field-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.config-field-input-wrap input,
.config-field-input-wrap textarea {
  flex: 1;
  font-size: 0.82rem;
}

.config-reveal-btn {
  flex-shrink: 0;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
}

.config-secret-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(197, 48, 48, 0.12);
  color: var(--danger);
  border: 1px solid rgba(197, 48, 48, 0.3);
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
  vertical-align: middle;
}

.config-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.config-save-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.85rem 1rem;
  margin: 0 -1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

@media (max-width: 768px) {
  .config-field {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   📣  Marketing / Broadcast
   ========================================================= */

.mk-card {
  width: 100%;
  max-width: none;
}

.mk-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--snow-border);
  border-radius: 0.65rem;
  margin-bottom: 1rem;
}

.mk-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mk-filter-field label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--frost-muted);
}

.mk-audience-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.mk-stat {
  flex: 1 1 7rem;
  background: var(--surface-2);
  border: 1px solid var(--snow-border);
  border-radius: 0.65rem;
  padding: 0.6rem 0.85rem;
  display: flex;
  flex-direction: column;
}

.mk-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--frost-muted);
}

.mk-stat-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ice-deep);
}

.mk-sample {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: 0.78rem;
}

.mk-sample li {
  padding: 0.25rem 0;
  border-bottom: 1px dashed var(--snow-border);
}

.mk-sample li:last-child {
  border-bottom: none;
}

/* ── Marketing layout with sidebar ── */
.mk-layout {
  display: grid;
  grid-template-columns: 16rem 1fr;
  gap: 1.25rem;
  align-items: start;
}

.mk-sidebar {
  background: linear-gradient(165deg, var(--snow-surface) 0%, rgba(255,255,255,0.95) 100%);
  border: 1px solid var(--snow-border);
  border-radius: 0.85rem;
  padding: 0.85rem 0.9rem;
  box-shadow: 0 4px 14px var(--shadow);
  position: sticky;
  top: 1rem;
}

.mk-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

/* Saved audience items */
.sa-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px dashed var(--snow-border);
}

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

.sa-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sa-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sa-item-desc {
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sa-item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.sa-item-actions .btn {
  font-size: 0.7rem;
  padding: 0.22rem 0.45rem;
}

.geo-prox-tag {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(74,144,194,0.18);
  color: var(--ice-deep);
  border: 1px solid rgba(74,144,194,0.4);
  border-radius: 0.3rem;
  padding: 0.08rem 0.3rem;
  margin-left: 0.3rem;
  vertical-align: middle;
}

/* ── Section labels ── */
.mk-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--frost-muted);
  margin: 1rem 0 0.5rem;
}

.mk-prox-label {
  color: var(--ice-deep);
}

/* ── Proximity box ── */
.mk-prox-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
}

.mk-prox-opts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}

.mk-prox-opts-row .mk-filter-field {
  min-width: 10rem;
  flex: 1 1 10rem;
}

.mk-prox-clear-btn {
  margin-top: 0.65rem;
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  background: transparent;
  border-color: var(--snow-border);
  color: var(--frost-muted);
}

/* ── Geocode search ── */
.mk-geo-search-wrap {
  margin-bottom: 0.65rem;
}

.mk-geo-search-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--frost-muted);
  display: block;
  margin-bottom: 0.3rem;
}

.mk-geo-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.mk-geo-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.mk-geo-input {
  width: 100%;
  font-size: 0.85rem;
}

.geo-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--flake);
  border: 1px solid var(--snow-border);
  border-radius: 0.55rem;
  box-shadow: 0 8px 28px var(--shadow);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 600;
  max-height: 18rem;
  overflow-y: auto;
}

.geo-candidate {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(184,212,235,0.4);
  font-size: 0.83rem;
}

.geo-candidate:last-child { border-bottom: none; }

.geo-candidate:hover {
  background: rgba(126, 184, 224, 0.18);
}

.geo-candidate-label {
  flex: 1;
  font-weight: 500;
}

.geo-candidate-pop {
  font-size: 0.68rem;
  white-space: nowrap;
}

.geo-no-results {
  padding: 0.65rem 0.75rem;
  font-size: 0.82rem;
}

.mk-geo-resolved {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ice-deep);
  background: rgba(74,144,194,0.12);
  border: 1px solid rgba(74,144,194,0.35);
  border-radius: 0.4rem;
  padding: 0.25rem 0.6rem;
}

/* ── Result badges ── */
.mk-prox-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(74, 144, 194, 0.18);
  color: var(--ice-deep);
  border: 1px solid rgba(74, 144, 194, 0.4);
  border-radius: 0.5rem;
  padding: 0.3rem 0.7rem;
  margin-bottom: 0.65rem;
}

.mk-dist-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(39, 103, 73, 0.14);
  color: var(--success);
  border: 1px solid rgba(39, 103, 73, 0.3);
  border-radius: 0.3rem;
  padding: 0.1rem 0.35rem;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.mk-compose {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .mk-layout {
    grid-template-columns: 1fr;
  }

  .mk-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .mk-prox-opts-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .mk-geo-input-row {
    flex-direction: column;
  }

  .mk-geo-input-row button {
    width: 100%;
  }
}

.dm-composer-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

/* =========================================================
   🖼️  Gallery
   ========================================================= */

.gallery-header {
  margin-bottom: 1rem;
}

.gallery-header h2 {
  margin: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}

.gallery-card {
  background: var(--snow-surface);
  border: 1px solid var(--snow-border);
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 4px 14px var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.18s ease;
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(74,144,194,0.22);
}

.gallery-card-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: rgba(126, 184, 224, 0.15);
}

.gallery-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-card-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.gallery-card-meta {
  padding: 0.65rem 0.85rem 0.75rem;
}

.gallery-card-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.gallery-card-addr {
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card-stars {
  font-size: 0.9rem;
  color: var(--warning);
  margin-bottom: 0.2rem;
}

.gallery-card-count,
.gallery-card-date {
  font-size: 0.72rem;
}

.gallery-detail-card {
  width: 100%;
  max-width: none;
}

.gallery-detail-meta {
  font-size: 0.88rem;
  color: var(--frost-muted);
  margin: 0.35rem 0 0.5rem;
}

.gallery-detail-stars {
  color: var(--warning);
  font-size: 1rem;
}

.gallery-detail-parties {
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

.gallery-detail-pics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.gallery-detail-pic {
  display: flex;
  flex-direction: column;
  border-radius: 0.65rem;
  overflow: hidden;
  border: 1px solid var(--snow-border);
  background: rgba(126,184,224,0.1);
}

.gallery-detail-pic img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.gallery-detail-pic-label {
  font-size: 0.7rem;
  padding: 0.3rem 0.5rem;
  text-align: center;
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  }

  .mk-filters {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .mk-filters {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Dark-mode global catch-all for views that use inline styles
   ============================================================ */

/* Force <code> and inline code chips to use theme surface */
[data-theme="dark"] code:not([class]) {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.1em 0.35em;
}

/* Pre / code blocks (dark terminal style — keep dark in both modes) */
pre {
  background: #0d1117 !important;
  color: #e6edf3 !important;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  overflow: auto;
  font-size: 0.8125rem;
  line-height: 1.5;
}
[data-theme="dark"] pre { background: #010409 !important; }

/* API Docs: sidebar */
.api-docs-layout {
  display: grid;
  grid-template-columns: 13.75rem 1fr;
  gap: 0;
  min-height: 70vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.api-docs-sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 0.75rem 0;
  overflow-y: auto;
}

.api-docs-sidebar-label {
  padding: 0.5rem 0.875rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-subtle);
}

.api-docs-sidebar a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4375rem 0.75rem;
  text-decoration: none;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-radius: 0.375rem;
  margin: 0.0625rem 0.375rem;
  transition: background 0.12s, color 0.12s;
}
.api-docs-sidebar a:hover { background: var(--border); color: var(--text); }
.api-docs-sidebar a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.api-docs-content { padding: 1.25rem 1.5rem; overflow-y: auto; }

.api-docs-base {
  padding: 0.5rem 0.875rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
  border-top: 1px solid var(--border);
  margin-top: 0.75rem;
}

/* Endpoint cards */
.ep-card {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  margin-bottom: 0.875rem;
  overflow: hidden;
  background: var(--surface);
}

.ep-card-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.12s;
}
.ep-card-header:hover { background: var(--surface-2); }

.ep-card-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 0.875rem;
  background: var(--surface);
}

.ep-param-badge {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.ep-try-bar {
  background: var(--surface-2);
  padding: 0.375rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-family: monospace;
  color: var(--text);
  word-break: break-all;
  border: 1px solid var(--border);
}

/* ============================================================
   Dark-mode safe utilities — used by inline JS-rendered HTML
   ============================================================ */

/* Inset surface box (replaces hardcoded #f9fafb backgrounds) */
.inset-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--text);
}

/* Progress bar track (replaces #e5e7eb) */
.progress-track {
  height: 0.5rem;
  background: var(--border);
  border-radius: 9999px;
  overflow: hidden;
  flex: 1;
}
.progress-fill { height: 100%; border-radius: 9999px; }

/* Warning callout box (replaces #fef9c3 / #854d0e) */
.alert-warn {
  padding: 0.4rem 0.6rem;
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent);
}

/* Muted label text  (replaces inline color:#6b7280) */
.txt-muted { color: var(--text-muted); }
.txt-subtle { color: var(--text-subtle); }
.txt-danger { color: var(--danger); }
.txt-success { color: var(--success); }

/* Fix hardcoded badge "none" (auth badge light bg) */
.badge-auth-none {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Report / card tag fix */
.report-card-tag--export {
  background: var(--success-bg);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

/* Insight chat / snow widget text */
.snow-widget-meta a,
.snow-widget-row--alert td {
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
}

/* Fix hardcoded insight bubble colors */
.insight-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.insight-bubble-meta { color: var(--text-muted); }
.insight-bubble-hint { color: var(--text-subtle); }

/* User/job stat values in dark mode */
[data-theme="dark"] .stat-val-danger { color: #f87171; }
[data-theme="dark"] .stat-val-warn   { color: #fbbf24; }
[data-theme="dark"] .stat-val-ok     { color: #4ade80; }

/* Fix report/report-detail colors */
.report-detail-header h2 { color: var(--brand); }
.reports-group-title      { color: var(--text-muted); border-color: var(--border); }

/* ── Fix specific hardcoded icon/text colours ── */
.report-card-tag--export { color: var(--success) !important; }
[data-theme="dark"] .report-card-body { color: var(--text); }
[data-theme="dark"] .report-card-desc { color: var(--text-muted); }
[data-theme="dark"] .report-card-tag  { color: var(--text-muted); background: var(--surface-2); border-color: var(--border); }

/* Insight star / score colors */
.star-gold { color: var(--warning); }
[data-theme="dark"] .star-gold { color: #fbbf24; }

/* Fix table zebra stripes in dark mode — already handled but reinforce */
[data-theme="dark"] table.data tbody tr:nth-child(even) td,
[data-theme="dark"] table.data-table tbody tr:nth-child(even) td {
  background: transparent;
}

/* Health service warning card */
[data-theme="dark"] .health-warn {
  background: var(--warning-bg);
  color: var(--warning);
}

/* ── Border colors — fix hardcoded rgba(184,212,235,...) patterns ── */
[data-theme="dark"] .config-field        { border-color: var(--border); }
[data-theme="dark"] .config-group        { border-color: var(--border); }
[data-theme="dark"] .config-group-title  { border-color: var(--border); color: var(--text-muted); }
[data-theme="dark"] .config-save-bar     { background: var(--surface); border-color: var(--border); }

/* ── User profile / chat cards ── */
[data-theme="dark"] .user-comment-card,
[data-theme="dark"] .user-dm-card {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

/* ── Misc inline-style overrides for dark mode ── */
[data-theme="dark"] [style*="background:#f9fafb"],
[data-theme="dark"] [style*="background: #f9fafb"],
[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background:#fafafa"],
[data-theme="dark"] [style*="background:#f1f5f9"] {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}

[data-theme="dark"] [style*="background:#fef9c3"],
[data-theme="dark"] [style*="background: #fef9c3"] {
  background: var(--warning-bg) !important;
  color: var(--warning) !important;
}

[data-theme="dark"] [style*="background:#fffbeb"],
[data-theme="dark"] [style*="background: #fffbeb"] {
  background: var(--warning-bg) !important;
}

[data-theme="dark"] [style*="background:#f0fdf4"],
[data-theme="dark"] [style*="background: #f0fdf4"] {
  background: var(--success-bg) !important;
}

[data-theme="dark"] [style*="background:#fef2f2"],
[data-theme="dark"] [style*="background: #fef2f2"] {
  background: var(--danger-bg) !important;
}

[data-theme="dark"] [style*="color:#374151"],
[data-theme="dark"] [style*="color: #374151"],
[data-theme="dark"] [style*="color:#0f172a"],
[data-theme="dark"] [style*="color: #0f172a"],
[data-theme="dark"] [style*="color:#1e293b"],
[data-theme="dark"] [style*="color:#111827"] {
  color: var(--text) !important;
}

[data-theme="dark"] [style*="color:#6b7280"],
[data-theme="dark"] [style*="color: #6b7280"],
[data-theme="dark"] [style*="color:#64748b"],
[data-theme="dark"] [style*="color:#5a7a94"] {
  color: var(--text-muted) !important;
}

[data-theme="dark"] [style*="color:#9ca3af"],
[data-theme="dark"] [style*="color: #9ca3af"],
[data-theme="dark"] [style*="color:#94a3b8"] {
  color: var(--text-subtle) !important;
}

[data-theme="dark"] [style*="border:1px solid #e5e7eb"],
[data-theme="dark"] [style*="border: 1px solid #e5e7eb"],
[data-theme="dark"] [style*="border-bottom:1px solid #e5e7eb"],
[data-theme="dark"] [style*="border-top:1px solid #e5e7eb"] {
  border-color: var(--border) !important;
}

/* Progress bar track in dark mode */
[data-theme="dark"] [style*="background:#e5e7eb"] {
  background: var(--border) !important;
}
[data-theme="dark"] [style*="background: #e5e7eb"] {
  background: var(--border) !important;
}

/* Clickable job list rows */
table.data tbody tr[onclick] {
  cursor: pointer;
  transition: background 0.1s;
}
table.data tbody tr[onclick]:hover td {
  background: color-mix(in srgb, var(--brand) 7%, var(--surface)) !important;
}

.snow-widget-card {
  border: 3px solid #facc15;
}

.ops-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.ops-hero h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
}

.ops-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.ops-filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.ops-filter-strip span {
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.24rem 0.6rem;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.78rem;
}

.ops-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ops-card-grid--headline {
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.ops-subsection {
  margin-bottom: 1rem;
}

.ops-subsection h3 {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ops-card {
  display: flex;
  min-height: 7.25rem;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 0.25rem solid var(--ops-accent, var(--border));
  border-radius: var(--radius-sm);
  padding: 0.95rem 1.05rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.ops-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--ops-accent, var(--brand)) 8%, transparent), transparent 62%);
  opacity: 0;
  transition: opacity 0.16s ease;
  pointer-events: none;
}

.ops-card-label,
.ops-card-note,
.ops-card strong {
  position: relative;
  z-index: 1;
}

.ops-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--ops-accent, var(--brand)) 45%, var(--border));
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.10);
}

.ops-card:hover::after { opacity: 1; }

.ops-card-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ops-card-note {
  color: var(--text-subtle);
  font-size: 0.75rem;
  line-height: 1.3;
}

.ops-card strong {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ops-value, var(--text));
}

.ops-card--danger  { --ops-accent: var(--danger);  --ops-value: var(--danger); }
.ops-card--warning { --ops-accent: var(--warning); --ops-value: var(--warning); }
.ops-card--good    { --ops-accent: var(--success); --ops-value: var(--success); }
.ops-card--blue    { --ops-accent: var(--brand); }
.ops-card--neutral { --ops-accent: var(--border); }

.ops-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.ops-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ops-panel-head h2 {
  margin: 0;
}

.ops-planned-card {
  max-width: 58rem;
}

.ops-planned-list {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: var(--text);
}

.ops-planned-list li {
  margin-bottom: 0.45rem;
}

.ops-table a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.ops-status,
.ops-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  border-radius: 9999px;
  padding: 0.16rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.ops-status--healthy,
.ops-status--good,
.ops-status--excellent,
.ops-status--elite,
.ops-status--reliable,
.ops-status--ready,
.ops-priority--low {
  background: var(--success-bg);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

.ops-status--tight,
.ops-status--watch,
.ops-status--storm-watch,
.ops-status--standard,
.ops-status--limited,
.ops-priority--medium,
.ops-priority--high {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
}

.ops-status--critical,
.ops-status--no-coverage,
.ops-status--risky,
.ops-status--review,
.ops-status--bench-review,
.ops-status--missing,
.ops-priority--critical {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.ops-status--oversupplied,
.ops-status--no-active-storm {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
}

.ops-status--no-active-demand {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

.reliability-score {
  display: grid;
  grid-template-columns: 2.5rem minmax(5.5rem, 1fr);
  align-items: center;
  gap: 0.45rem;
  min-width: 8rem;
}

.reliability-score strong {
  font-size: 1rem;
  color: var(--text);
}

.reliability-score span {
  display: block;
  height: 0.45rem;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.reliability-score i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--danger), var(--warning), var(--success));
}

.reliability-components,
.reliability-model-grid,
.reliability-pending-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.reliability-model-grid {
  gap: 0.5rem;
}

.reliability-component,
.reliability-pending {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.14rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}

.reliability-component.good {
  background: var(--success-bg);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

.reliability-component.warn {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
}

.reliability-component.bad {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.reliability-component.pending,
.reliability-pending {
  background: var(--surface);
  color: var(--text-muted);
  border-style: dashed;
}

.ops-section {
  margin-bottom: 1.25rem;
}

.ops-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.ops-section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.ops-section-head h2::before {
  content: "";
  width: 0.2rem;
  height: 1.05em;
  border-radius: 9999px;
  background: linear-gradient(180deg, var(--brand-light), var(--brand));
}

.ops-section-head p {
  margin: 0.3rem 0 0;
}

.ops-filter-bar {
  display: grid;
  grid-template-columns: minmax(15rem, auto) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ops-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ops-filter-chip,
.ops-tab {
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.36rem 0.72rem;
  background: var(--surface-2);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.ops-filter-chip.is-active,
.ops-tab.is-active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
}

.ops-filter-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.55rem;
}

.ops-filter-fields label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ops-filter-fields label span {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.ops-filter-fields input,
.ops-filter-fields select {
  margin-top: 0.22rem;
  font-size: 0.82rem;
  padding: 0.34rem 0.5rem;
}

.ops-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.ops-tab-panel {
  display: none;
}

.ops-tab-panel.is-active {
  display: block;
}

.ops-cluster-layer {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--brand) 8%);
  padding: 0.9rem;
}

.ops-panel-head--compact {
  margin-bottom: 0.7rem;
}

.ops-panel-head--compact h3 {
  margin: 0;
  font-size: 1rem;
}

.ops-cluster-table tr.is-active {
  background: var(--sidebar-active-bg);
}

.ops-cluster-clear {
  margin-top: 0.7rem;
}

.ops-cluster-clear.is-hidden {
  display: none;
}

.linklike {
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.linklike:hover {
  text-decoration: underline;
}

.ops-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.88rem;
}

.ops-total-group {
  margin-bottom: 1rem;
}

.ops-total-group h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ops-card-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.ops-card--platform {
  min-height: 5.8rem;
  border-left-color: var(--text-subtle);
  box-shadow: none;
}

.ops-card--platform strong {
  font-size: 1.45rem;
}

.ops-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 1rem;
}

.ops-breakdown-panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.ops-breakdown-panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.10);
}

.ops-breakdown-total {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 6.6rem;
  padding: 1rem 1.1rem;
  color: var(--text);
  text-decoration: none;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border-left: 0.35rem solid var(--brand);
}

.ops-breakdown-total:hover,
.ops-breakdown-row:hover {
  background: var(--surface-2);
}

.ops-breakdown-total span {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.ops-breakdown-total strong {
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--brand-dark);
}

.ops-breakdown-total em,
.ops-breakdown-row em {
  font-style: normal;
  color: var(--text-muted);
}

.ops-breakdown-total em {
  font-size: 0.8rem;
}

.ops-breakdown-body {
  padding: 0.85rem 1rem 1rem;
}

.ops-breakdown-body h3 {
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ops-breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0;
  color: var(--text);
  text-decoration: none;
  border-top: 1px solid var(--border);
}

.ops-breakdown-row span {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.ops-breakdown-row strong {
  font-size: 0.92rem;
}

.ops-breakdown-row em {
  font-size: 0.76rem;
}

.ops-breakdown-row b {
  font-size: 1.1rem;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.property-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.property-saved-views {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.property-filter-bar {
  grid-template-columns: 1fr auto;
}

.property-filter-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
}

.property-summary-grid .ops-card strong {
  font-size: 1.35rem;
}

.property-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.property-sort-btn.is-active {
  color: var(--brand);
}

.property-coverage-note {
  margin-top: 0.75rem;
}

.property-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.property-detail-row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.property-detail-row span {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.property-detail-row strong {
  min-width: 0;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.property-map {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 12rem;
  color: var(--text);
  text-decoration: none;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--brand) 7%, transparent) 1px, transparent 1px),
    linear-gradient(0deg, color-mix(in srgb, var(--brand) 7%, transparent) 1px, transparent 1px),
    var(--surface-2);
  background-size: 28px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.property-map svg {
  width: 2rem;
  height: 2rem;
  color: var(--brand);
}

.property-map em {
  color: var(--text-muted);
  font-style: normal;
  font-size: 0.82rem;
}

.property-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--warning-bg);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
  border-left: 0.35rem solid var(--warning);
  border-radius: var(--radius-sm);
}

.property-warning div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.property-warning span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.dma-toolbar,
.dma-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.dma-bulk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.65rem;
  align-items: end;
}

.dma-bulk-grid label,
.dma-price-filters label {
  margin: 0;
}

.dma-ai-panel textarea,
.dma-structured-preview {
  width: 100%;
}

.dma-structured-preview {
  min-height: 4rem;
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  overflow: auto;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.dma-price-table-wrap {
  max-height: 34rem;
  overflow: auto;
}

.dma-price-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
}

.dma-price-table td,
.dma-price-table th {
  white-space: nowrap;
}

.dma-price-input {
  width: 5.8rem;
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.dma-preview-panel {
  margin-bottom: 1rem;
  border-left: 0.3rem solid var(--warning);
}

.dma-warning-list {
  margin-bottom: 0.75rem;
}

.dma-warning-list ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.dma-import-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.dma-import-stats span {
  padding: 0.65rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.dma-import-stats strong {
  color: var(--text);
  font-size: 1.15rem;
}

.ops-status--needs-customer-clarification,
.ops-status--unreviewed,
.ops-status--flagged-difficult-property {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
}

.ops-status--admin-approved,
.ops-status--ai-reviewed {
  background: var(--success-bg);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

.ops-status--admin-rejected-invalid {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

@media (max-width: 900px) {
  .ops-filter-bar {
    grid-template-columns: 1fr;
  }

  .ops-breakdown-grid {
    grid-template-columns: 1fr;
  }

  .property-filter-bar {
    grid-template-columns: 1fr;
  }

  .property-detail-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .property-warning {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Final sidebar polish override */
#sidebar {
  --menu-panel: #f3f7ff;
  --menu-panel-border: #dbe7ff;
  --menu-active-row: #e4edff;
  --menu-muted: #8fa0b7;
}

#sidebar .sidebar-logo {
  padding: 1rem 1rem 0.95rem;
  border-bottom: 0;
  margin-bottom: 0.65rem;
  gap: 0.65rem;
}

#sidebar .sidebar-logo img {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  background: #0f172a;
  box-shadow: none;
}

#sidebar .sidebar-logo-text {
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 800;
  color: #0f172a;
}

#sidebar .sidebar-logo-sub {
  margin-top: 0.25rem;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: #94a3b8;
}

#sidebar nav {
  padding: 0 0.75rem;
}

#sidebar nav .nav-top-link,
#sidebar .nav-label-toggle {
  min-height: 2.35rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.55rem;
  font-size: 0.92rem;
}

#sidebar nav .nav-top-link {
  margin: 0 0 0.75rem;
  font-weight: 600;
  color: #334155;
}

#sidebar nav .nav-top-link.active {
  background: transparent;
  color: #2563eb;
}

#sidebar nav .nav-top-link .nav-icon {
  color: #ef6c37;
  opacity: 1;
}

#sidebar .nav-group {
  margin: 0.1rem 0 0.55rem;
  border-radius: 0.75rem;
}

#sidebar .nav-label-toggle {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  color: #475569;
}

#sidebar .nav-label-toggle .nav-icon {
  width: 1rem;
  height: 1rem;
  opacity: 0.65;
}

#sidebar .nav-label-toggle .nav-chevron {
  width: 0.8rem !important;
  height: 0.8rem !important;
  color: #9caec3;
  opacity: 0.7;
}

#sidebar .nav-group.is-active {
  background: var(--menu-panel);
  border: 1px solid var(--menu-panel-border);
  padding: 0.45rem;
}

#sidebar .nav-group.is-active .nav-label-toggle {
  color: #2563eb;
  background: transparent;
  box-shadow: none;
  font-weight: 800;
}

#sidebar .nav-group.is-active .nav-label-toggle .nav-icon,
#sidebar .nav-group.is-active .nav-label-toggle .nav-chevron {
  opacity: 1;
}

#sidebar .nav-group:not(.is-active) .nav-label-toggle:hover {
  background: #f8fbff;
}

#sidebar .nav-group-links {
  padding: 0.15rem 0;
}

#sidebar .nav-link {
  min-height: 2rem;
  padding: 0.42rem 0.55rem 0.42rem 2.25rem;
  margin: 0.05rem 0;
  border-radius: 0.45rem;
  font-size: 0.9rem;
  color: #526783;
  box-shadow: none;
}

#sidebar .nav-link .nav-icon-sm {
  display: none;
}

#sidebar .nav-link:hover {
  background: rgba(228, 237, 255, 0.65);
  color: #0f172a;
}

#sidebar .nav-link.active {
  background: var(--menu-active-row);
  color: #0f172a;
  box-shadow: none;
  font-weight: 700;
}

#sidebar .nav-group:not(.is-active) .nav-link.active {
  color: #2563eb;
}

#sidebar .nav-group:first-of-type::before {
  content: "OPERATIONS";
  display: block;
  padding: 0 0.55rem 0.45rem;
  color: var(--menu-muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

[data-theme="dark"] #sidebar {
  --menu-panel: rgba(37, 99, 235, 0.14);
  --menu-panel-border: rgba(96, 165, 250, 0.24);
  --menu-active-row: rgba(96, 165, 250, 0.18);
}

[data-theme="dark"] #sidebar .sidebar-logo-text,
[data-theme="dark"] #sidebar .nav-link.active {
  color: #f8fafc;
}

.job-premium-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #eef4ff;
  border: 1px solid #cfe0ff;
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 800;
}

.job-open-duration {
  margin-top: 0.15rem;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
}

.job-schedule-timing {
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 800;
  white-space: nowrap;
}

.job-open-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  min-width: 13rem;
}

.job-open-actions .btn-sm {
  white-space: nowrap;
}
