/* Design system ported from D:\MTA_Optical_ERP\MtaOpticalErp.Web\wwwrootpp.css at the user's
   explicit request (2026-10-01) — replaces the "MaterialPro" direction (solid teal topbar). Now:
   Cairo font, sky-blue primary (#0284C7), slate neutrals, white sidebar with per-link colored icon
   chips, translucent blurred topbar, hairline-bordered 18px cards, tinted table headers.
   Token NAMES (--color-*) are unchanged so every Razor page keeps working; only values changed.
   Accessible *-fg text colors remain separate from solid-background colors (WCAG AA). */
:root {
  --color-primary: #0284C7;
  --color-primary-dark: #0369A1;
  --color-secondary: #0EA5E9;
  --color-accent: #F59E0B;
  --color-ink: #0F172A;
  --color-muted: #64748B;
  --color-canvas: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-surface-2: #F1F5F9;
  --color-border: #E2E8F0;
  --color-primary-tint: #E0F2FE;
  --color-success: #16A34A;
  --color-danger: #EF4444;
  --radius-card: 18px;
  --radius-button: 10px;
  --radius-input: 10px;

  --tint-success-fg: #15803D;
  --tint-danger-fg: #B91C1C;
  --tint-warning-fg: #B45309;
  --tint-secondary-fg: #0369A1;
  --color-danger-text: #DC2626;

  --sidebar-bg: var(--color-surface);
  --sidebar-border: var(--color-border);
  --sidebar-text: #475569;
  --sidebar-text-active: var(--color-primary);
  --sidebar-hover-bg: var(--color-surface-2);
  --sidebar-active-bg: var(--color-primary-tint);
  --sidebar-active-fg: var(--color-primary-dark);

  --topbar-bg: color-mix(in srgb, var(--color-surface) 92%, transparent);
  --topbar-fg: var(--color-ink);

  --shadow-card: 0 4px 20px -2px rgba(148, 163, 184, 0.08), 0 2px 8px -1px rgba(148, 163, 184, 0.04);
  --shadow-card-hover: 0 12px 28px -6px rgba(148, 163, 184, 0.18);
  --shadow-primary: 0 2px 8px rgba(2, 132, 199, 0.24);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary: #38BDF8;
    --color-primary-dark: #0369A1;
    --color-ink: #E7EDF5;
    --color-muted: #94A3B8;
    --color-canvas: #0B1120;
    --color-surface: #111A2B;
    --color-surface-2: #172032;
    --color-border: #26324A;
    --color-primary-tint: rgba(56, 189, 248, 0.14);
    --tint-success-fg: #4ADE80;
    --tint-danger-fg: #F87171;
    --tint-warning-fg: #FBBF24;
    --tint-secondary-fg: #38BDF8;
    --color-danger-text: #F87171;
    --sidebar-text: #AAB6C6;
    --sidebar-active-fg: #7DD3FC;
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 12px 28px -8px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  --color-primary: #38BDF8;
  --color-primary-dark: #0369A1;
  --color-ink: #E7EDF5;
  --color-muted: #94A3B8;
  --color-canvas: #0B1120;
  --color-surface: #111A2B;
  --color-surface-2: #172032;
  --color-border: #26324A;
  --color-primary-tint: rgba(56, 189, 248, 0.14);
  --tint-success-fg: #4ADE80;
  --tint-danger-fg: #F87171;
  --tint-warning-fg: #FBBF24;
  --tint-secondary-fg: #38BDF8;
  --color-danger-text: #F87171;
  --sidebar-text: #AAB6C6;
  --sidebar-active-fg: #7DD3FC;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 12px 28px -8px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Cairo", "Segoe UI", Tahoma, sans-serif;
  letter-spacing: normal;
  background: var(--color-canvas);
  color: var(--color-ink);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* Iconography per asnani_flutter/design/brand_identity.json: "Material Symbols Rounded",
   default_size 24, rounded stroke. */
.material-symbols-rounded {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  color: currentColor;
}
h1, h2, h3 { font-weight: 800; line-height: 1.3; margin: 0 0 12px; }
p { margin: 0 0 8px; }
code { background: var(--color-border); padding: 2px 6px; border-radius: 6px; font-size: 0.9em; }

.content-plain {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--color-canvas);
}

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-inline-end: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 8px 20px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
}
.brand-name { font-weight: 800; font-size: 18px; color: var(--color-ink); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-button);
  color: var(--sidebar-text);
  font-weight: 600;
  transition: background-color 150ms, color 150ms;
}
.nav-link:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-active); }
.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-fg);
  font-weight: 700;
  box-shadow: var(--shadow-card);
}
.nav-link.active .material-symbols-rounded { color: var(--sidebar-active-fg); }
.logout-form { margin: 0; }
.logout-btn {
  width: 100%; text-align: start; background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: inherit; font-weight: 600; color: var(--sidebar-text); padding: 10px 12px;
  border-radius: var(--radius-button);
}
.logout-btn:hover { color: var(--tint-danger-fg); background: var(--sidebar-hover-bg); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: var(--topbar-bg);
  color: var(--topbar-fg);
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 0;
  z-index: 10;
}
.user-name { font-weight: 700; color: var(--topbar-fg); }
.theme-toggle {
  width: 40px; height: 40px; border-radius: var(--radius-button);
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: var(--topbar-fg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background-color 150ms;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.22); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.notif-bell-wrap { position: relative; }
.notif-badge {
  position: absolute; top: -4px; inset-inline-end: -4px;
  min-width: 16px; height: 16px; padding: 0 3px; border-radius: 999px;
  background: var(--color-danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 50;
  width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card-hover);
}
.notif-dropdown-header { padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--color-border); }
.notif-dropdown-footer {
  display: block; padding: 10px 16px; text-align: center; font-weight: 600;
  color: var(--color-primary); border-top: 1px solid var(--color-border);
}
.notif-empty { padding: 24px 16px; text-align: center; color: var(--color-muted); font-size: 14px; }
.notif-item { padding: 10px 16px; border-bottom: 1px solid var(--color-border); }
.notif-item:last-child { border-bottom: none; }
.notif-item-title { font-weight: 700; font-size: 14px; }
.notif-item-message { font-size: 13px; color: var(--color-muted); margin-top: 2px; }
.notif-item-time { font-size: 11px; color: var(--color-muted); margin-top: 4px; }
.content { padding: 24px; overflow-x: auto; }
.content > * { max-width: 1560px; margin-inline: auto; }

/* Flat card — plain surface + hairline border, no accent strip, minimal shadow (PostMan-style
   analytics look). See pending-decisions.md 2026-09-12 (redesign) for why the earlier colored
   "folder tab" accent strip was dropped. */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 20px;
  transition: box-shadow 200ms;
}
.card:hover { box-shadow: var(--shadow-card-hover); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-header h3 { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 20px;
  border-radius: var(--radius-button);
  border: none; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 15px;
  transition: background-color 150ms, box-shadow 150ms, transform 100ms;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: var(--color-secondary); color: #fff; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-ink); }
.btn-outline:hover { background: var(--color-canvas); }
.btn-block { width: 100%; }

/* Base input/select styling applies with or without a .field wrapper — a few inline update-status
   forms (e.g. Appointments/Index.cshtml) use a bare <select> next to a fully-styled .btn, and an
   unstyled native select next to a rounded pill button reads as a jarring shape mismatch.
   Checkboxes/radios are excluded — they're native controls used inline with a text label, not
   text-entry fields, and boxing one in a 44px bar would look broken, not consistent. */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-input);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 150ms, box-shadow 150ms;
}
input:focus:not([type="checkbox"]):not([type="radio"]), select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}
textarea { height: auto; padding: 10px 14px; min-height: 88px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; }
.field .error { color: var(--color-danger-text); font-size: 13px; margin-top: 4px; display: block; }

/* Ledger tables: tabular-nums keeps amounts/dates/counts aligned into scannable columns. */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--color-border); }
th { color: var(--color-muted); font-size: 13px; font-weight: 700; }
tbody tr:hover { background: var(--color-canvas); }
td { font-variant-numeric: tabular-nums; }

.pill {
  display: inline-flex; align-items: center;
  padding: 6px 10px; border-radius: 24px;
  font-weight: 700; font-size: 12px;
}
.pill-success { background: rgba(42,157,112,0.14); color: var(--tint-success-fg); }
.pill-warning { background: rgba(244,201,93,0.18); color: var(--tint-warning-fg); }
.pill-danger { background: rgba(217,93,93,0.14); color: var(--tint-danger-fg); }
.pill-muted { background: var(--color-border); color: var(--color-muted); }

/* Stat cards: PostMan pattern — small muted label, one big bold number, a small delta line
   below (colored up/down text + a muted "هذا الشهر"-style caption). No icon badge by default
   (matches the reference exactly); .stat-icon stays available for the few places that still want
   one, just visually lighter now. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  transition: box-shadow 200ms;
}
.stat-card:hover { box-shadow: var(--shadow-card-hover); }
.stat-card .label { color: var(--color-muted); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 800; color: var(--color-ink); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-card .delta {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--color-border);
  font-size: 13px; color: var(--color-muted);
}
.stat-card .delta strong { color: var(--tint-success-fg); font-weight: 800; }
.stat-card .delta.down strong { color: var(--tint-danger-fg); }
.stat-icon {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-button);
  font-size: 20px; margin-bottom: 12px;
}
.stat-card-link { display: block; transition: box-shadow 200ms; }
.stat-card-link:hover { box-shadow: var(--shadow-card-hover); }

/* Weekly appointments load (Pages/Index) — every bar is a real COUNT(*) per calendar day, never
   decorative placeholder data. Flat solid bars (PostMan-style), no gradient. */
.week-chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 220px; padding-bottom: 4px; border-bottom: 1px dashed var(--color-border); }
.week-chart-col { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 100%; }
.week-chart-count { font-size: 13px; font-weight: 800; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.week-chart-bar-track { flex: 1; width: 100%; max-width: 40px; display: flex; align-items: flex-end; }
.week-chart-bar {
  width: 100%; min-height: 4px; border-radius: 6px 6px 0 0;
  background: var(--color-secondary);
  transition: height 300ms;
  transform-origin: bottom;
  animation: barGrow 600ms ease-out both;
}
.week-chart-bar-today { background: var(--color-primary); }
.week-chart-day { font-size: 12px; font-weight: 700; color: var(--color-muted); }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .week-chart-bar { transition: none; animation: none; } }

/* Visual platform picker (Pages/Social) — a colored icon badge per platform instead of a plain
   <select>. Real radio inputs underneath for keyboard/no-JS support; visually hidden,
   not display:none, so they stay focusable. */
.platform-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.platform-option {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px;
  border-radius: var(--radius-button);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
}
.platform-option:hover { background: var(--color-canvas); }
.platform-option input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.platform-option:has(input:checked) { border-color: var(--color-primary); background: var(--color-canvas); }
.platform-option:focus-within { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.platform-badge {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.platform-badge .material-symbols-rounded { color: #fff; font-size: 20px; }
.platform-badge-sm { width: 28px; height: 28px; }
.platform-badge-sm .material-symbols-rounded { font-size: 16px; }
.platform-label { font-size: 11px; font-weight: 700; text-align: center; }

/* Login screen (2026-09-12, تكملة — إعادة تصميم): شاشة مقسومة نصفين — نموذج الدخول على أبيض/سطح
   عادي، ولوحة الجانب التاني الآن صورة واحدة جاهزة (wwwroot/images/login-visual.png، من المستخدم
   مباشرة — صورة عيادة حقيقية + الشعار والنص مدموجين فيها بالفعل) بدل التدرّج/الدوائر CSS
   والنص/الشعار المنفصلين اللي كانوا هنا الأول. الشعار المستخدم في نموذج تسجيل الدخول نفسه (مش
   الصورة) لسه asnani_app_icon.svg الرسمي بالظبط — الصورة دي غيّرت الجانب الزخرفي بس. */
.login-shell {
  position: fixed; inset: 0;
  display: flex;
  background: var(--color-surface);
}
.login-shell-badge {
  position: absolute; top: 24px; inset-inline-start: 24px; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 13px; color: var(--color-muted);
}
.login-shell-badge .material-symbols-rounded { color: var(--color-primary); font-size: 18px; }
.login-shell-form {
  flex: 1 1 50%; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-shell-card { width: 100%; max-width: 400px; }
.login-shell-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-shell-logo img { width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0; }
.login-shell-logo-text h1 { margin: 0; font-size: 24px; }
.login-shell-logo-text p { margin: 2px 0 0; font-size: 13px; color: var(--color-muted); }
.login-shell-visual {
  flex: 1 1 50%; min-width: 0;
  background-image: url('/images/login-visual.png');
  background-size: cover;
  background-position: center;
}
.login-shell-footer {
  position: absolute; bottom: 20px; inset-inline-start: 24px; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; color: var(--color-muted);
}
.login-shell-footer .material-symbols-rounded { font-size: 16px; color: var(--color-primary); }
@media (max-width: 860px) {
  .login-shell-visual { display: none; }
}

.field-icon-wrap { position: relative; }
.field-icon-wrap input { padding-inline-end: 42px; }
.field-icon {
  position: absolute; top: 50%; inset-inline-end: 12px; transform: translateY(-50%);
  color: var(--color-muted); font-size: 20px; pointer-events: none;
}
.field-icon-toggle {
  position: absolute; top: 50%; inset-inline-end: 8px; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  display: flex; color: var(--color-muted);
}

.alert { background: rgba(217,93,93,0.1); color: var(--color-danger-text); padding: 12px 16px; border-radius: var(--radius-input); margin-bottom: 16px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.alert .material-symbols-rounded { font-size: 20px; flex-shrink: 0; }

/* Action feedback (TempData-driven, see _Layout.cshtml) */
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-input);
  margin-bottom: 16px; font-weight: 700; font-size: 14px;
}
.toast-success { background: rgba(42,157,112,0.12); color: var(--tint-success-fg); }
.toast-error { background: rgba(217,93,93,0.12); color: var(--color-danger-text); }

/* Empty states for tables/lists with no data */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 20px; color: var(--color-muted); text-align: center;
}
.empty-state .material-symbols-rounded { font-size: 36px; opacity: 0.5; }
.empty-state p { margin: 0; font-size: 14px; }

/* Visible focus ring per brand_identity.json accessibility spec (2px primary outline). Sidebar is
   a light surface now (not solid teal), so the nav-link ring no longer needs a white override. */
a:focus-visible, button:focus-visible, .btn:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
.nav-link:focus-visible, .theme-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

/* Responsive: collapse the fixed sidebar into an icon rail below ~960px so tables/forms
   on laptop-sized screens don't get squeezed under a 240px-wide sidebar. */
@media (max-width: 960px) {
  .sidebar { width: 76px; padding: 20px 10px; }
  .brand-name, .nav-link span:last-child, .logout-btn span:last-child { display: none; }
  .brand { justify-content: center; padding-inline: 0; }
  .nav-link, .logout-btn { justify-content: center; padding-inline: 0; }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  /* Several pages lay out multi-column forms with an inline grid-template-columns style
     rather than a class; collapse those to one column on narrow screens too. */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Table row action-button groups (edit/toggle/delete) — several pages lay these out inline
   with `style="display:flex; gap:6px;"` rather than a class; bump to the 8px minimum spacing
   between adjacent touch targets without having to touch every page individually. */
[style*="display:flex; gap:6px"] { gap: 8px !important; }

/* ===================================================================================
   MTA_Optical_ERP design-system overrides (2026-10-01) — later rules win over the legacy
   MaterialPro rules above. Sources: MtaOpticalErp.Web/wwwroot/app.css (sidebar chips, topbar,
   cards, tinted table headers, status pills, form controls).
   =================================================================================== */
.sidebar { width: 264px; padding: 0; overflow-y: auto; position: sticky; top: 0; height: 100vh; }
.brand { flex-direction: column; justify-content: center; gap: 8px; padding: 22px 18px 18px; border-bottom: 1px solid var(--color-surface-2); }
.brand-mark { width: 44px; height: 44px; border-radius: 13px; background: var(--color-primary-tint); color: var(--color-primary-dark); font-size: 20px; }
.brand-name { font-size: 16px; text-align: center; }
.nav { padding: 12px 10px; gap: 2px; }
.nav-link { --ic: #0284c7; padding: 7px 10px; font-size: 0.95rem; font-weight: 500; color: var(--sidebar-text); }
.nav > .nav-link:nth-child(8n+1) { --ic: #0284c7; }
.nav > .nav-link:nth-child(8n+2) { --ic: #8b5cf6; }
.nav > .nav-link:nth-child(8n+3) { --ic: #16a34a; }
.nav > .nav-link:nth-child(8n+4) { --ic: #d97706; }
.nav > .nav-link:nth-child(8n+5) { --ic: #db2777; }
.nav > .nav-link:nth-child(8n+6) { --ic: #0891b2; }
.nav > .nav-link:nth-child(8n+7) { --ic: #6366f1; }
.nav > .nav-link:nth-child(8n+8) { --ic: #ea580c; }
.nav-link .material-symbols-rounded {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
  font-size: 19px; color: var(--ic);
  background: color-mix(in srgb, var(--ic) 15%, transparent);
  transition: background 150ms, transform 150ms;
}
.nav-link:hover { background: var(--color-surface-2); color: var(--color-ink); }
.nav-link:hover .material-symbols-rounded { background: color-mix(in srgb, var(--ic) 26%, transparent); transform: scale(1.06); }
.nav-link.active {
  background: color-mix(in srgb, var(--ic) 12%, var(--color-surface));
  color: var(--color-ink); font-weight: 700; box-shadow: none;
}
.nav-link.active .material-symbols-rounded { background: var(--ic); color: #fff; }
.logout-form { padding: 12px 10px; border-top: 1px solid var(--color-surface-2); }
.logout-btn { --ic: #ef4444; display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-weight: 500; }
.logout-btn:hover { color: var(--tint-danger-fg); }

.topbar {
  height: 60px; padding: 0 22px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border); box-shadow: none;
}
.user-name { font-weight: 600; font-size: 0.85rem; }
.theme-toggle {
  width: 36px; height: 36px; border-radius: var(--radius-button);
  background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-ink);
}
.theme-toggle:hover { background: var(--color-border); }
.notif-bell-wrap button, .notif-bell-wrap > a { color: var(--color-ink); }
.content { padding: 22px 28px 40px; }

.card, .stat-card {
  border: 1px solid var(--color-border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 18px;
}
.card:hover { box-shadow: var(--shadow-card); }
.stat-card { transition: transform 180ms, box-shadow 180ms; }
.stat-card:hover, .stat-card-link:hover .stat-card { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.stat-card .value { font-weight: 700; font-size: 2rem; }
.stat-card .delta { border-top: 1px solid var(--color-surface-2); }
.stat-icon { border-radius: var(--radius-button); }

.btn { font-weight: 600; font-size: 0.92rem; }
.btn-primary { box-shadow: var(--shadow-primary); }
.btn-outline { background: var(--color-surface); }
.btn-outline:hover { background: var(--color-surface-2); }
:root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .btn-secondary { background: var(--color-primary-dark); }
:root[data-theme="dark"] .btn-primary:hover { background: #075985; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary, :root:not([data-theme="light"]) .btn-secondary { background: var(--color-primary-dark); }
  :root:not([data-theme="light"]) .btn-primary:hover { background: #075985; }
}

input:not([type="checkbox"]):not([type="radio"]), select, textarea { background: var(--color-surface-2); font-size: 0.95rem; }
input:focus:not([type="checkbox"]):not([type="radio"]), select:focus, textarea:focus { background: var(--color-surface); box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14); }
.field label { font-weight: 500; color: var(--color-muted); font-size: 0.9rem; }

/* Tables: tinted header + primary rule, rounded hairline frame (ERP .data-table) */
table { border-collapse: separate; border-spacing: 0; }
th, td { border-bottom: 1px solid var(--color-surface-2); padding: 12px 15px; font-size: 0.92rem; }
th { background: var(--color-primary-tint); color: var(--tint-secondary-fg); font-size: 0.95rem; font-weight: 700; border-bottom: 2px solid var(--color-primary); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--color-surface-2); }

/* Status pills get the ERP leading dot */
.pill { gap: 6px; padding: 4px 12px; font-size: 0.82rem; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-success { background: rgba(22, 163, 74, 0.12); }
.pill-warning { background: rgba(217, 119, 6, 0.12); }
.pill-danger { background: rgba(239, 68, 68, 0.12); }
.pill-muted { background: var(--color-surface-2); }
.toast-success { background: rgba(22, 163, 74, 0.12); }
.toast-error, .alert { background: rgba(239, 68, 68, 0.1); }

.week-chart-bar { background: var(--color-primary-tint); }
.week-chart-bar-today { background: var(--color-primary); }
.notif-dropdown { border-radius: 14px; }

@media (max-width: 960px) {
  .sidebar { width: 76px; }
  .nav-link, .logout-btn { font-size: 0; justify-content: center; padding-inline: 0; }
  .nav-link .material-symbols-rounded { display: grid !important; font-size: 19px; }
  .brand-name { display: none; }
}
@media (max-width: 640px) { .content { padding: 16px; } }

/* Login centered (2026-10-01, user request): single centered card like MTA_Optical_ERP's login;
   the split-screen visual panel is hidden (its baked-in logo/text would clash behind a card). */
.login-shell {
  justify-content: center; align-items: center;
  background: radial-gradient(60% 60% at 50% 40%, var(--color-primary-tint), var(--color-canvas));
}
.login-shell-visual { display: none; }
.login-shell-form { flex: 0 1 auto; padding: 24px; width: 100%; max-width: 456px; }
.login-shell-card {
  max-width: 408px; padding: 34px 30px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 22px; box-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 30px 60px -15px rgba(15, 23, 42, .22);
}
.login-shell-logo { flex-direction: column; text-align: center; gap: 10px; }
.login-shell-logo img { width: 64px; height: 64px; }
