/* ═══════════════════════════════════════════════════════════════════════════
   Samagra Company Portal — Ultra-Premium Executive Design System v4
   Built for high-aesthetic enterprise SaaS (Stripe / Linear / Raycast standard)
   High contrast · Crystal-clear readability · Flawless light & dark themes
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');

/* ── LIGHT THEME (Default) ── */
:root,
:root[data-theme="light"] {
  /* Brand accents */
  --navy: #1e293b;
  --cyan: #0ea5e9;
  --accent: #4f46e5;
  /* Indigo-600 */
  --accent-fg: #ffffff;
  --accent2: #06b6d4;
  /* Cyan-500 */
  --focus: #6366f1;

  /* Surfaces & backgrounds */
  --bg: #f8fafc;
  /* Crisp slate-50 */
  --surface: #ffffff;
  /* Pure white cards */
  --surface2: #f1f5f9;
  /* Slate-100 for hovers, table heads */
  --surface3: #e2e8f0;
  /* Slate-200 */
  --line: #e2e8f0;
  /* Razor-sharp clean border */
  --line2: #cbd5e1;
  /* Accent border */

  /* Text hierarchy (100% WCAG AAA compliant contrast) */
  --fg: #0f172a;
  /* Slate-900 (ultra crisp, high contrast) */
  --fg2: #1e293b;
  /* Slate-800 */
  --muted: #64748b;
  /* Slate-500 (readable secondary text) */
  --dim: #94a3b8;
  /* Slate-400 */

  /* Status */
  --good: #059669;
  /* Emerald-600 */
  --good-bg: #ecfdf5;
  --warn: #d97706;
  /* Amber-600 */
  --warn-bg: #fffbeb;
  --bad: #dc2626;
  /* Rose-600 */
  --bad-bg: #fef2f2;
  --bar-bg: #e2e8f0;

  /* Elevation Shadows */
  --sh0: 0 1px 2px rgba(15, 23, 42, 0.04);
  --sh1: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 14px -1px rgba(15, 23, 42, 0.06);
  --sh2: 0 10px 25px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --sh3: 0 20px 40px -6px rgba(15, 23, 42, 0.16);
  --sh-glow: 0 0 0 3px rgba(99, 102, 241, 0.22);

  /* Typography */
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-head: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;

  color-scheme: light;
}

/* ── DARK THEME (Obsidian & Electric Indigo) ── */
:root[data-theme="dark"] {
  --navy: #0f172a;
  --cyan: #38bdf8;
  --accent: #6366f1;
  /* Indigo-500 */
  --accent-fg: #ffffff;
  --accent2: #22d3ee;
  /* Cyan-400 */
  --focus: #818cf8;

  --bg: #090d16;
  /* Deep obsidian */
  --surface: #111827;
  /* Slate-900 */
  --surface2: #1e293b;
  /* Slate-800 */
  --surface3: #334155;
  --line: rgba(255, 255, 255, 0.08);
  --line2: rgba(255, 255, 255, 0.15);

  --fg: #f8fafc;
  /* Bright crisp white */
  --fg2: #e2e8f0;
  /* Slate-200 */
  --muted: #94a3b8;
  /* Slate-400 (crystal-clear contrast) */
  --dim: #64748b;
  /* Slate-500 */

  --good: #10b981;
  --good-bg: rgba(16, 185, 129, 0.14);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.14);
  --bad: #ef4444;
  --bad-bg: rgba(239, 68, 68, 0.14);
  --bar-bg: #1e293b;

  --sh0: 0 1px 2px rgba(0, 0, 0, 0.5);
  --sh1: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  --sh2: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --sh3: 0 25px 60px rgba(0, 0, 0, 0.8);
  --sh-glow: 0 0 0 3px rgba(99, 102, 241, 0.35);

  color-scheme: dark;
}

/* Fallback for OS dark preference ONLY if data-theme is not explicitly set to light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --navy: #0f172a;
    --cyan: #38bdf8;
    --accent: #6366f1;
    --accent-fg: #ffffff;
    --accent2: #22d3ee;
    --focus: #818cf8;

    --bg: #090d16;
    --surface: #111827;
    --surface2: #1e293b;
    --surface3: #334155;
    --line: rgba(255, 255, 255, 0.08);
    --line2: rgba(255, 255, 255, 0.15);

    --fg: #f8fafc;
    --fg2: #e2e8f0;
    --muted: #94a3b8;
    --dim: #64748b;

    --good: #10b981;
    --good-bg: rgba(16, 185, 129, 0.14);
    --warn: #f59e0b;
    --warn-bg: rgba(245, 158, 11, 0.14);
    --bad: #ef4444;
    --bad-bg: rgba(239, 68, 68, 0.14);
    --bar-bg: #1e293b;

    --sh0: 0 1px 2px rgba(0, 0, 0, 0.5);
    --sh1: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --sh2: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --sh3: 0 25px 60px rgba(0, 0, 0, 0.8);
    --sh-glow: 0 0 0 3px rgba(99, 102, 241, 0.35);

    color-scheme: dark;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL RESET & TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image: radial-gradient(1000px 500px at 50% -120px, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 60;
  background: var(--bg);
}

body.nav-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  text-wrap: balance;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}

a:hover {
  text-decoration: underline;
  color: var(--accent2);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 2px;
}

::selection {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: inherit;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line2) transparent;
}

img {
  max-width: 100%;
}

[hidden]:not([hidden=until-found i]) {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL LAYOUT
   ═══════════════════════════════════════════════════ */
.wrap {
  width: 100%;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

/* ── SIDEBAR (Executive Dark Obsidian) ── */
.side {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  height: calc(100vh - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 14px 16px;
  background: linear-gradient(180deg, #090d16 0%, #0d121f 55%, #070a12 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
  color: #e2e8f0;
}

.side::-webkit-scrollbar {
  width: 4px;
}

.side::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Main Content Container */
.content {
  min-width: 0;
  padding: 30px clamp(18px, 3.5vw, 56px) 90px;
}

main {
  display: flex;
  flex-direction: column;
  gap: 26px;
  max-width: 1320px;
  margin: 0 auto;
}

main>div {
  animation: slideUp .3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Top Bar */
.mbar {
  display: none;
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(9, 13, 22, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}

.mbar button {
  width: 42px;
  padding: 0;
  font-size: 19px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
}

.mbar b {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ─────────────────────────────────────────────────────────────
   TOPBAR & LOGGED-IN USER BADGE (Desktop + Mobile)
   ───────────────────────────────────────────────────────────── */
.topbar-desktop {
  max-width: 1320px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--sh1);
  position: relative;
  z-index: 25;
}

:root[data-theme="dark"] .topbar-desktop {
  background: rgba(17, 24, 39, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.01em;
}

.crumb-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
  flex-shrink: 0;
}

.crumb-text {
  color: var(--fg);
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.user-pill:hover {
  border-color: var(--focus);
  box-shadow: var(--sh0);
  transform: translateY(-1px);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.btn-top-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  min-height: 34px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] .btn-top-logout {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
}

.btn-top-logout:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #ffffff;
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.25);
  transform: translateY(-1px);
}

.btn-top-logout .logout-icon {
  font-size: 14px;
  line-height: 1;
}

/* User Profile Dropdown */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--sh3);
  z-index: 100;
  animation: udFadeIn 0.15s ease-out;
}

@keyframes udFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ud-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ud-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  flex-shrink: 0;
}

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

.ud-info b {
  font-size: 13.5px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ud-info span {
  font-size: 11.5px;
  color: var(--muted);
}

.ud-divider {
  height: 1px;
  background: var(--line);
  margin: 10px 0;
}

.ud-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.ud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
}

.ud-row strong {
  color: var(--fg);
}

.ud-details .badge-active {
  color: #10b981;
  font-weight: 600;
  font-size: 11px;
}

.ud-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ud-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  background: var(--surface2);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s;
}

.ud-link:hover {
  background: var(--surface3);
  color: var(--accent);
}

.ud-btn-logout {
  width: 100%;
  padding: 8px 12px;
  min-height: 32px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  cursor: pointer;
  transition: all 0.15s;
}

:root[data-theme="dark"] .ud-btn-logout {
  color: #fca5a5;
}

.ud-btn-logout:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

/* Mobile topbar adjustments */
.mbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 800;
}

.mbar-logout {
  width: 34px !important;
  height: 34px !important;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px !important;
  background: rgba(239, 68, 68, 0.15) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  color: #fca5a5 !important;
  font-size: 16px !important;
  cursor: pointer;
}

.mbar-logout:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  color: #fff !important;
}

/* On mobile / phone view, hide desktop topbar */
@media (max-width: 900px) {
  .topbar-desktop {
    display: none !important;
  }
}

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR COMPONENTS
   ═══════════════════════════════════════════════════ */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
}

.brand h1 {
  font-size: 15.5px;
  line-height: 1.25;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 3px 0 0;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 500;
}

.logo {
  display: flex;
  flex: none;
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.logo img {
  height: 52px;
  width: auto;
  display: block;
  border-radius: 10px;
}

/* Department buttons */
.dsw {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dsw button {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  padding: 9px 12px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  color: #94a3b8;
  min-height: 44px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.dsw button>span.dept-icon,
.dsw button>span:first-child {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 15px;
  transition: all 0.18s;
}

.dsw button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

.dsw button:hover>span.dept-icon,
.dsw button:hover>span:first-child {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.dsw button[aria-current=true] {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.28) 0%, rgba(14, 165, 233, 0.14) 100%);
  color: #ffffff;
  border: 1px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dsw button[aria-current=true]>span.dept-icon,
.dsw button[aria-current=true]>span:first-child {
  background: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.dsw button .dept-name {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.dsw button .dept-arrow {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-left: auto;
  color: #64748b;
  border-radius: 0;
  background: transparent;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), color 0.18s ease;
}

.dsw button:hover .dept-arrow {
  color: #f1f5f9;
}

.dsw button[aria-current=true] .dept-arrow {
  color: #c7d2fe;
}

.dsw button[aria-expanded=true] .dept-arrow {
  transform: rotate(90deg);
  color: #a5b4fc;
}

.dsw button .dept-arrow svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dsw button[hidden] {
  display: none;
}

/* Sub-nav Links */
.side nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 3px 0 10px 24px;
  padding: 3px 0 3px 14px;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.side nav a {
  display: block;
  padding: 7px 12px;
  border-radius: 9px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.side nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  text-decoration: none;
}

.side nav a[aria-current=page] {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  font-weight: 700;
  border-left: 2px solid #818cf8;
  margin-left: -16px;
  padding-left: 26px;
}

.side nav a[hidden],
.side nav a.dh {
  display: none !important;
}

/* Sidebar Footer Controls */
.ctl {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ctl>.row {
  gap: 8px;
}

.ctl .row button {
  width: 100%;
}

/* Status Pill */
.sync {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.sync i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  flex: none;
}

.sync.live i {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25), 0 0 10px rgba(16, 185, 129, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.9);
  }
}

.sync.off i {
  background: var(--bad);
}

#role {
  font-size: 11.5px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
}

#signout {
  width: 100%;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.25);
  background: rgba(248, 113, 113, 0.08);
  border-radius: 11px;
}

#signout:hover {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}

/* Segmented Buttons (View mode & Theme mode) */
.vm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
}

.vm button {
  border: 0;
  border-radius: 0;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s;
}

.vm button[aria-pressed=true] {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-weight: 700;
}

.vm button:hover:not([aria-pressed=true]) {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HERO BANNERS
   ═══════════════════════════════════════════════════ */
.dhero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 34px 40px;
  border-radius: 24px;
  color: #ffffff;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 38%, #1e3a8a 75%, #0284c7 100%);
  box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.35), 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Glowing Decorative Light Orbs */
.dhero::before {
  content: "";
  position: absolute;
  right: -60px;
  top: -120px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28), transparent 65%);
  pointer-events: none;
}

.dhero::after {
  content: "";
  position: absolute;
  left: -40px;
  bottom: -90px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.25), transparent 65%);
  pointer-events: none;
}

.dhero>* {
  position: relative;
  z-index: 1;
}

.dtitle h2 {
  font-size: 30px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.dtitle p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 500;
}

.hbrand {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.hbrand .logo {
  padding: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.hbrand .logo img {
  height: 72px;
}

.dfilters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.dhero label {
  color: rgba(255, 255, 255, 0.85);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dhero input,
.dhero select {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  color-scheme: dark;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  padding: 8px 14px;
}

.dhero select option {
  color: #0f172a;
  background: #ffffff;
}

.dhero input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* Executive Hero Actions & Live Status Badge */
.dhero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.hero-live-badge .badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

.hero-btn-primary {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 0 !important;
  font-weight: 800;
  font-size: 13.5px;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hero-btn-secondary {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.28) !important;
  backdrop-filter: blur(12px);
  font-weight: 700;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.24) !important;
  transform: translateY(-2px);
}

.dhero button {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  backdrop-filter: blur(12px);
  border-radius: 12px;
  font-weight: 700;
  padding: 8px 16px;
}

.dhero button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.dhero button.primary {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #ffffff !important;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.dhero .seg {
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.15);
}

.dhero .seg button {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  padding: 7px 14px;
}

.dhero .seg button[aria-pressed=true] {
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PANELS & DEPARTMENT CARDS
   ═══════════════════════════════════════════════════ */
.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  min-width: 0;
  box-shadow: var(--sh1);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel:hover {
  box-shadow: var(--sh2);
  transform: translateY(-3px);
  border-color: var(--line2);
}

.panel>header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--line);
}

.panel>header h2,
.panel>header h3 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel>header span {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EXECUTIVE DEPARTMENT OVERVIEW CARDS (Home Dashboard)
   ═══════════════════════════════════════════════════════════════════════════ */
.card-dept {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 26px;
  min-width: 0;
  box-shadow: var(--sh1);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-dept:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh2);
  border-color: var(--line2);
}

:root[data-theme="dark"] .card-dept,
html[data-theme="dark"] .card-dept {
  background: linear-gradient(180deg, rgba(20, 28, 45, 0.88) 0%, rgba(14, 20, 34, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .card-dept:hover,
html[data-theme="dark"] .card-dept:hover {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 24px -2px rgba(99, 102, 241, 0.25);
}

:root[data-theme="light"] .card-dept,
html[data-theme="light"] .card-dept {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 10px 24px -4px rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .card-dept:hover,
html[data-theme="light"] .card-dept:hover {
  border-color: var(--accent);
  box-shadow: 0 14px 32px -4px rgba(79, 70, 229, 0.12), 0 2px 6px rgba(15, 23, 42, 0.04);
}

/* Subtle accent edge glow */
.card-dept::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 2px;
  opacity: 0.8;
  border-radius: 99px;
  pointer-events: none;
}

.card-dept.c-sales::before {
  background: linear-gradient(90deg, transparent, #6366f1, transparent);
}

.card-dept.c-marketing::before {
  background: linear-gradient(90deg, transparent, #f97316, transparent);
}

.card-dept.c-ops::before {
  background: linear-gradient(90deg, transparent, #06b6d4, transparent);
}

.card-dept.c-hr::before {
  background: linear-gradient(90deg, transparent, #a855f7, transparent);
}

.card-dept.c-strat::before {
  background: linear-gradient(90deg, transparent, #10b981, transparent);
}

.card-dept.c-fin::before {
  background: linear-gradient(90deg, transparent, #eab308, transparent);
}

/* Card Header */
.cd-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.cd-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cd-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.c-sales .cd-icon-box {
  background: rgba(99, 102, 241, 0.14);
  border: 1.5px solid rgba(99, 102, 241, 0.3);
}

.c-marketing .cd-icon-box {
  background: rgba(249, 115, 22, 0.14);
  border: 1.5px solid rgba(249, 115, 22, 0.3);
}

.c-ops .cd-icon-box {
  background: rgba(6, 182, 212, 0.14);
  border: 1.5px solid rgba(6, 182, 212, 0.3);
}

.c-hr .cd-icon-box {
  background: rgba(168, 85, 247, 0.14);
  border: 1.5px solid rgba(168, 85, 247, 0.3);
}

.c-strat .cd-icon-box {
  background: rgba(16, 185, 129, 0.14);
  border: 1.5px solid rgba(16, 185, 129, 0.3);
}

.c-fin .cd-icon-box {
  background: rgba(234, 179, 8, 0.14);
  border: 1.5px solid rgba(234, 179, 8, 0.3);
}

.cd-title-wrap h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.2;
}

.cd-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

/* Open Pill Button */
.cd-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--surface2);
  border: 1.5px solid var(--line);
  color: var(--fg2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.cd-open-btn:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.cd-open-btn svg {
  transition: transform 0.2s ease;
}

.cd-open-btn:hover svg {
  transform: translateX(2px);
}

/* Card Hero Stat (Primary Metric) */
.cd-hero-stat {
  padding: 10px 0 4px;
}

.cd-hero-val {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--fg);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.cd-hero-lbl {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 5px;
}

.cd-divider {
  height: 1px;
  background: var(--line);
  margin: 2px 0;
}

/* Metric Rows (Secondary Stats) */
.cd-metrics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  gap: 10px;
}

.cd-lbl {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.cd-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Alert list and celebration list */
.alert-list,
.celebration-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-item,
.celebration-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--fg);
}

.alert-item a,
.celebration-item a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 11.5px;
  transition: all 0.15s ease;
}

.alert-item a:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Legacy panel styling compatibility */
#dBody .panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#dBody .panel>div[style*="justify-content:space-between"] {
  padding: 6px 0;
  border-bottom: 1px solid var(--surface2);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

#dBody .panel>div[style*="justify-content:space-between"]:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

#dBody .panel>div[style*="justify-content:space-between"] span {
  color: var(--muted) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

#dBody .panel>div[style*="justify-content:space-between"] b {
  color: var(--fg) !important;
  font-size: 14.5px !important;
  font-weight: 800 !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Sleek Open pill button in panel header */
.panel header button.small,
.panel button.small[data-go] {
  background: var(--surface2);
  border: 1.5px solid var(--line);
  color: var(--fg2);
  font-weight: 700;
  font-size: 11.5px;
  border-radius: 99px;
  padding: 4px 14px;
  min-height: 28px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel header button.small:hover,
.panel button.small[data-go]:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   KPI TILES
   ═══════════════════════════════════════════════════ */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.tile {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 22px 22px 26px;
  box-shadow: var(--sh1);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh2);
  border-color: var(--line2);
}

/* Left Accent Indicator */
.tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--kc, var(--accent)), color-mix(in srgb, var(--kc, var(--accent)) 60%, transparent));
  border-radius: 20px 0 0 20px;
}

/* Soft Ambient Color Tint */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, color-mix(in srgb, var(--kc, var(--accent)) 9%, transparent) 0%, transparent 60%);
  border-radius: inherit;
  pointer-events: none;
}

.tile i {
  font-style: normal;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 20px;
  margin-bottom: 12px;
  background: color-mix(in srgb, var(--kc, var(--accent)) 16%, transparent);
  position: relative;
  z-index: 1;
}

.tile small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.tile strong {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-head);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--fg);
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
}

.tile em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* Distinct KPI Accents */
.tiles.kpis {
  grid-template-columns: repeat(6, 1fr);
}

.tiles.kpis .tile.k1 {
  --kc: #4f46e5;
}

/* Indigo  */
.tiles.kpis .tile.k2 {
  --kc: #06b6d4;
}

/* Cyan    */
.tiles.kpis .tile.k3 {
  --kc: #8b5cf6;
}

/* Violet  */
.tiles.kpis .tile.k4 {
  --kc: #f59e0b;
}

/* Amber   */
.tiles.kpis .tile.k5 {
  --kc: #10b981;
}

/* Emerald */
.tiles.kpis .tile.k6 {
  --kc: #ec4899;
}

/* Pink    */

.tiles.kpis .tile strong {
  font-size: 25px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 13.5px;
}

.banner b {
  color: var(--fg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS & INPUTS
   ═══════════════════════════════════════════════════ */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  min-width: 0;
}

input,
select,
textarea {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 42px;
  min-width: 0;
  max-width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line2);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--sh-glow);
  outline: 0;
}

input[type=checkbox],
input[type=radio] {
  min-height: auto;
  accent-color: var(--accent);
}

input[type=date] {
  color-scheme: inherit;
}

textarea {
  resize: vertical;
}

/* Buttons */
button {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13.5px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  padding: 9px 18px;
  min-height: 40px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: -0.01em;
}

button:hover {
  background: var(--surface2);
  border-color: var(--line2);
}

button:active {
  transform: scale(0.98);
}

button.primary {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}

button.primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 22px rgba(79, 70, 229, 0.45);
  transform: translateY(-1px);
}

button.small {
  padding: 4px 12px;
  min-height: 30px;
  font-size: 12px;
  border-radius: 8px;
}

button.danger {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 30%, var(--line));
}

button.danger:hover {
  background: var(--bad-bg);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

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

.form .full,
.fgrid .full {
  grid-column: 1 / -1;
}

.lookup {
  background: var(--surface2);
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  min-height: 64px;
}

.lookup dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 18px;
  margin: 0;
}

.lookup dt {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.lookup dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
  color: var(--fg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLES & DATA GRIDS
   ═══════════════════════════════════════════════════ */
.tw {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--sh0);
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 12px 16px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface2);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  border-bottom: 2px solid var(--line);
}

th:first-child,
td:first-child {
  text-align: left;
}

td.l,
th.l {
  text-align: left;
}

td.wrapc {
  white-space: normal;
  min-width: 160px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 0.12s;
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

tr.clk {
  cursor: pointer;
}

tr.total td {
  font-weight: 800;
  background: var(--surface2);
  border-top: 2px solid var(--line);
  color: var(--fg);
}

tr.zero td {
  color: var(--dim);
}

td.hit {
  color: var(--good);
  font-weight: 800;
}

td {
  font-weight: 500;
  color: var(--fg2);
  font-size: 14px;
}

td:first-child {
  font-weight: 600;
  color: var(--fg);
}

/* Table Progress Bars */
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
}

.bar span {
  flex: 1;
  height: 8px;
  background: var(--bar-bg);
  border-radius: 6px;
  overflow: hidden;
  display: block;
}

.bar span b {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.bar em {
  font-style: normal;
  min-width: 44px;
  text-align: right;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}

/* Status Chips / Badges */
.chip {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--surface2);
  color: var(--muted);
}

.chip.good {
  background: var(--good-bg);
  color: var(--good);
  border: 1px solid color-mix(in srgb, var(--good) 35%, transparent);
}

.chip.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
}

.chip.bad {
  background: var(--bad-bg);
  color: var(--bad);
  border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent);
}

.empty {
  color: var(--muted);
  padding: 38px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}

.pager {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}

.seg {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.seg button {
  border: 0;
  border-radius: 0;
  background: var(--surface);
  font-size: 13px;
  padding: 7px 15px;
  min-height: 36px;
  color: var(--muted);
}

.seg button[aria-pressed=true] {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 800;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
}

svg text {
  fill: var(--muted);
  font-family: var(--font-body);
  font-size: 10px;
}

dl.defs {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 24px;
  margin: 0;
}

dl.defs dt {
  font-weight: 700;
  color: var(--fg);
}

dl.defs dd {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CALENDAR
   ═══════════════════════════════════════════════════ */
.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal>b {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cal button {
  min-height: 64px;
  padding: 6px 8px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  border-radius: 12px;
  font-size: 12px;
  border-width: 1.5px;
}

.cal button.sel {
  outline: 2.5px solid var(--accent);
  outline-offset: 1px;
}

.cal button.td {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.cal button.off {
  visibility: hidden;
}

.cal .n {
  font-weight: 800;
  font-size: 13px;
  font-family: var(--font-head);
}

.tw td input[type=time],
.tw td select {
  min-height: 34px;
  padding: 4px 8px;
}

.tile i,
#dBody .grid2 {
  gap: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOG A CALL VIEW
   ═══════════════════════════════════════════════════ */
.logpage {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}

.logform {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--sh1);
}

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

.loghead p {
  margin: 2px 0 0;
  color: var(--muted);
  font-weight: 500;
}

.loghead h2 {
  font-size: 23px;
}

.lhico {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 24px;
  flex: none;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
  color: #fff;
}

.step {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  background: var(--surface2);
}

.step h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.step h3 em {
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
  font-size: 13px;
}

.step h3 .n {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 13px;
  font-weight: 800;
}

.logbar {
  display: flex;
  gap: 12px;
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding: 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--sh2);
}

.leadside {
  position: sticky;
  top: 20px;
}

.hh {
  margin: 20px 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
}

.tg,
.pt {
  text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS & OVERLAYS
   ═══════════════════════════════════════════════════ */
.mdl {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) 16px 24px;
  overflow: auto;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  animation: slideUp 0.22s ease both;
}

.mdl>div {
  width: min(100%, 680px);
  margin: auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--sh3);
}

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

/* ── Executive Login Page ── */
#loginBox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 900px 500px at 50% 10%, rgba(79, 70, 229, 0.2), transparent 70%),
    radial-gradient(ellipse 700px 450px at 15% 90%, rgba(6, 182, 212, 0.15), transparent 65%),
    #070a12 !important;
  backdrop-filter: blur(24px);
  padding: 24px;
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.75), 0 0 50px rgba(79, 70, 229, 0.15);
  border-radius: 24px;
  padding: 38px 34px;
  position: relative;
  animation: loginAppear 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes loginAppear {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-wrap {
  display: inline-flex;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.login-logo-wrap img {
  height: 54px;
  width: auto;
  display: block;
}

.login-header h2 {
  font-family: var(--font-display, 'Outfit', sans-serif);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0 0 6px;
}

.login-header p {
  font-size: 13px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.45;
}

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

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.login-field label {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-icon {
  position: absolute;
  left: 14px;
  font-size: 15px;
  color: #64748b;
  pointer-events: none;
}

.login-input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 42px 0 42px;
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #ffffff;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.login-input-wrap input:focus {
  outline: none;
  border-color: #6366f1;
  background: rgba(10, 15, 30, 0.95);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.login-pw-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.login-pw-toggle:hover {
  color: #ffffff;
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -2px;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #94a3b8;
  user-select: none;
}

.login-remember input {
  accent-color: #6366f1;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.login-security-badge {
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 3px 9px;
  border-radius: 20px;
}

.login-error {
  min-height: 0;
  font-size: 13px;
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 10px 14px;
  border-radius: 10px;
  display: none;
  text-align: left;
}

.login-error:not(:empty) {
  display: block;
  animation: shake 0.3s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

.login-btn-submit {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
  transition: all 0.2s ease;
  margin-top: 4px;
}

.login-btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.45);
  filter: brightness(1.08);
}

.login-btn-submit:active {
  transform: translateY(0);
}

.login-footer-info {
  margin-top: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-footer-info span {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-footer-info small {
  font-size: 11px;
  color: #475569;
}

#toastbox {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  position: static;
  transform: none;
  background: linear-gradient(135deg, #4f46e5, #0891b2);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 14px;
  max-width: 92vw;
  box-shadow: var(--sh3);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.toast.err {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROFILE CARD
   ═══════════════════════════════════════════════════ */
.mdl>div.pf {
  width: min(100%, 1040px);
  padding: 0;
  overflow: hidden;
}

.pf-head {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 24px;
  align-items: center;
  padding: 30px 36px;
  color: #ffffff;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 45%, #1e3a8a 80%, #0369a1 100%);
}

.pf-x {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.pf-x:hover {
  background: rgba(255, 255, 255, 0.28);
}

.pf-av {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.18);
  border: 3.5px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: var(--font-head);
}

.pf-id h2 {
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
  padding-right: 80px;
}

.pf-id p {
  margin: 3px 0 12px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.pf-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pf-chips .chip {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
}

.pf-chips .chip.good {
  background: #10b981;
}

.pf-chips .chip.warn {
  background: #f59e0b;
}

.pf-chips .chip.bad {
  background: #ef4444;
}

.pf-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pfb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  min-height: 44px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  transition: all 0.18s;
}

.pfb:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: translateY(-1px);
}

.pfb.call {
  background: #2563eb;
  border-color: #2563eb;
}

.pfb.wa {
  background: #16a34a;
  border-color: #16a34a;
}

.pfb.call:hover {
  background: #1d4fd7;
}

.pfb.wa:hover {
  background: #15803d;
}

.pfb.off {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.pf-body {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr);
  gap: 22px;
  padding: 26px 36px 36px;
  background: var(--bg);
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.pf-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.pfc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: var(--sh0);
}

.pfc h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
}

.pfc dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px 18px;
  margin: 0;
}

.pfc dt {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.pfc dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-weight: 600;
  color: var(--fg);
}

.pf-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* Timeline */
.tl {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: 340px;
  overflow: auto;
}

.tl li {
  display: flex;
  gap: 14px;
  padding: 0 0 18px;
  position: relative;
}

.tl li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.tli {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface2);
  font-size: 15px;
  border: 1px solid var(--line);
}

.tl b {
  display: block;
  font-weight: 700;
  color: var(--fg);
}

.tl small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.tl p {
  margin: 4px 0 0;
  color: var(--fg2);
  font-size: 13px;
  font-weight: 500;
  background: var(--surface2);
  padding: 8px 12px;
  border-radius: 10px;
  line-height: 1.5;
}

/* Suggestion cards */
.sg {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.sg:last-of-type {
  border-bottom: 0;
}

.sgr {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #ffffff;
}

.sgm {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sgt {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.sgw {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════ */

/* Tablet + mobile: collapsible sidebar, mobile top-bar */
@media (max-width: 900px) {
  html .shell {
    display: block;
  }

  html .mbar {
    display: flex;
  }

  html .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 45;
    width: min(300px, 86vw);
    height: 100%;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    transform: translateX(-102%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--sh3);
  }

  html body.nav-open .side {
    transform: none;
  }

  html body.nav-open .scrim {
    display: block;
  }

  html .content {
    padding: 18px 16px 60px;
  }

  html .logpage {
    grid-template-columns: 1fr;
  }

  html .leadside {
    position: static;
  }

  html .dhero {
    padding: 22px 24px;
  }

  html .dtitle h2 {
    font-size: 24px;
  }

  html .grid2 {
    grid-template-columns: 1fr;
  }

  html .tiles.kpis {
    grid-template-columns: repeat(3, 1fr);
  }

  .pf-body {
    grid-template-columns: 1fr;
    padding: 18px;
    max-height: none;
  }

  .pf-head {
    grid-template-columns: 1fr;
    padding: 24px 20px;
  }

  .pf-av {
    width: 66px;
    height: 66px;
    font-size: 24px;
  }

  .pf-id h2 {
    font-size: 22px;
  }

  html .mdl>div.pf {
    margin: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — ≤700px
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  html body {
    background: var(--bg);
  }

  html .shell {
    display: block;
  }

  html .mbar {
    display: flex;
  }

  html .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 45;
    width: min(300px, 86vw);
    height: 100%;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    transform: translateX(-102%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--sh3);
  }

  html body.nav-open .side {
    transform: none;
  }

  html body.nav-open .scrim {
    display: block;
  }

  html .content {
    padding: 16px 14px 56px;
  }

  html .logpage {
    grid-template-columns: 1fr;
  }

  html .leadside {
    position: static;
  }

  html .dhero {
    padding: 20px;
  }

  html .dtitle h2 {
    font-size: 21px;
  }

  html .form,
  html .fgrid {
    grid-template-columns: 1fr !important;
  }

  html .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html .grid2 {
    grid-template-columns: 1fr;
  }

  html .panel {
    padding: 16px;
  }

  html .row>label {
    flex: 1 1 140px;
  }

  html input,
  html select,
  html textarea {
    font-size: 16px;
  }

  html .cal button {
    min-height: 48px;
    padding: 3px;
  }

  html .pf-body {
    grid-template-columns: 1fr;
    padding: 16px;
    max-height: none;
  }

  html .pf-head {
    grid-template-columns: 1fr;
    padding: 22px 18px;
  }

  html .mdl>div.pf {
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   STANDALONE LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 900px 450px at 80% -10%, color-mix(in srgb, var(--accent) 15%, transparent), transparent),
    radial-gradient(ellipse 700px 400px at 0% 110%, color-mix(in srgb, var(--accent2) 12%, transparent), transparent);
}

.login-box {
  width: min(100%, 420px);
  padding: 44px 38px 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--sh3);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.login-box .logo img {
  height: 64px;
  border-radius: 14px;
}

.login-box h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--fg);
}

.login-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}

.login-btn-g {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  cursor: pointer;
  transition: all 0.18s;
  color: var(--fg);
}

.login-btn-g:hover {
  background: var(--surface2);
  box-shadow: var(--sh1);
}

.login-btn-g svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.login-divider {
  position: relative;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--line);
}

.login-divider::before {
  left: 0;
}

.login-divider::after {
  right: 0;
}

.login-box .err {
  color: var(--bad);
  font-size: 12.5px;
  text-align: center;
  min-height: 18px;
  font-weight: 600;
}

.login-box input {
  width: 100%;
}

.login-box button.primary {
  width: 100%;
  min-height: 46px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}


/* ═══════════════════════════════════════════════════════════════════════════
   REPORTS VIEW — Responsive Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* Sub-tab pill row */
#rptTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

#rptTabs .rptTab {
  flex: 1 1 auto;
  min-width: 100px;
  text-align: center;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
}

/* Filter bar */
#rptFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 14px;
}

#rptFilters label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
  min-width: 110px;
}

#rptFilters input,
#rptFilters select {
  min-width: 110px;
  font-size: 13px;
}

#rptFilters button {
  align-self: flex-end;
}

/* Reports body */
#rptBody .tw {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#rptBody table {
  min-width: 480px;
}

/* Bar rows in exec/status/product charts */
.rpt-bar-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: 8px;
}

.rpt-bar-row span {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Day mini-chart */
.rpt-day-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 4px 36px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.rpt-day-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: none;
}

.rpt-day-bar-fill {
  width: 18px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  opacity: 0.85;
  transition: height 0.3s;
}

.rpt-day-bar-label {
  font-size: 9px;
  color: var(--muted);
  transform: rotate(-45deg);
  transform-origin: top left;
  white-space: nowrap;
  margin-top: 4px;
}

/* KPI tiles in reports — always 2-col min on small screens */
#rptBody .tiles {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 600px) {
  #rptBody .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rpt-bar-row {
    grid-template-columns: 150px 1fr;
  }
}

/* Mobile ≤ 700px */
@media (max-width: 700px) {
  #rptTabs .rptTab {
    font-size: 12px;
    padding: 7px 10px;
    min-width: 80px;
  }

  #rptFilters label {
    min-width: 90px;
    flex: 1 1 90px;
  }

  #rptFilters input,
  #rptFilters select {
    min-width: 90px;
    width: 100%;
  }

  #rptBody table {
    min-width: 420px;
    font-size: 12px;
  }

  #rptBody td,
  #rptBody th {
    padding: 6px 8px;
  }

  .rpt-bar-row {
    grid-template-columns: 100px 1fr;
  }

  /* Aging matrix table horizontal scroll */
  #agRBody .tw,
  #agBody .tw {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #agRBody table,
  #agBody table {
    min-width: 320px;
  }

  /* Report filter: stack on very small */
  #rptFilters {
    flex-direction: column;
    align-items: stretch;
  }

  #rptFilters label {
    width: 100%;
    flex: none;
  }

  #rptFilters input,
  #rptFilters select {
    width: 100%;
  }

  #rptFilters button {
    width: 100%;
  }
}

/* rpt-kpi-tiles: 4-col on desktop, responsive via auto-fit on mobile */
.rpt-kpi-tiles {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 700px) {
  .rpt-kpi-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}



/* ═══════════════════════════════════════════════════════════════════════════
   REPORTS VIEW — Responsive Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* Sub-tab pill row */
#rptTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

#rptTabs .rptTab {
  flex: 1 1 auto;
  min-width: 100px;
  text-align: center;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
}

/* Filter bar */
#rptFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 14px;
}

#rptFilters label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
  min-width: 110px;
}

#rptFilters input,
#rptFilters select {
  min-width: 110px;
  font-size: 13px;
}

#rptFilters button {
  align-self: flex-end;
}

/* Reports body */
#rptBody .tw {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#rptBody table {
  min-width: 480px;
}

/* Bar rows in exec/status/product charts */
.rpt-bar-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: 8px;
}

.rpt-bar-row span {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Day mini-chart */
.rpt-day-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 4px 36px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.rpt-day-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: none;
}

.rpt-day-bar-fill {
  width: 18px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  opacity: 0.85;
  transition: height 0.3s;
}

.rpt-day-bar-label {
  font-size: 9px;
  color: var(--muted);
  transform: rotate(-45deg);
  transform-origin: top left;
  white-space: nowrap;
  margin-top: 4px;
}

/* KPI tiles in reports — always 2-col min on small screens */
#rptBody .tiles {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 600px) {
  #rptBody .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rpt-bar-row {
    grid-template-columns: 150px 1fr;
  }
}

/* Mobile ≤ 700px */
@media (max-width: 700px) {
  #rptTabs .rptTab {
    font-size: 12px;
    padding: 7px 10px;
    min-width: 80px;
  }

  #rptFilters label {
    min-width: 90px;
    flex: 1 1 90px;
  }

  #rptFilters input,
  #rptFilters select {
    min-width: 90px;
    width: 100%;
  }

  #rptBody table {
    min-width: 420px;
    font-size: 12px;
  }

  #rptBody td,
  #rptBody th {
    padding: 6px 8px;
  }

  .rpt-bar-row {
    grid-template-columns: 100px 1fr;
  }

  /* Aging matrix table horizontal scroll */
  #agRBody .tw,
  #agBody .tw {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #agRBody table,
  #agBody table {
    min-width: 320px;
  }

  /* Report filter: stack on very small */
  #rptFilters {
    flex-direction: column;
    align-items: stretch;
  }

  #rptFilters label {
    width: 100%;
    flex: none;
  }

  #rptFilters input,
  #rptFilters select {
    width: 100%;
  }

  #rptFilters button {
    width: 100%;
  }
}