/* ================================================================
   MEDIX — Dashboard Design System 2026
   Brand: Forest #1E3F37 · Gold #C6A86A · Ivory #F4F1EA
   ================================================================ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand:       #1E3F37;
  --brand-dim:   #274E44;
  --brand-dark:  #122C26;
  --gold:        #C6A86A;
  --gold-light:  #F0E0B8;

  /* Sidebar */
  --sb-bg:       #0C1917;
  --sb-border:   rgba(255 255 255 / .06);
  --sb-text:     rgba(255 255 255 / .55);
  --sb-hover:    rgba(255 255 255 / .06);
  --sb-active:   rgba(198 168 106 / .14);
  --sb-active-t: #C6A86A;
  --sb-group:    rgba(255 255 255 / .28);

  /* Surface */
  --bg:          #F2F4F6;
  --surface:     #FFFFFF;
  --surface-2:   #F8FAFB;
  --border:      #E4E9ED;
  --border-2:    #EEF1F4;

  /* Text */
  --ink:         #0E1C1A;
  --ink-2:       #374845;
  --muted:       #6B7C7A;

  /* Status */
  --s-confirmed: #1D7A5C;  --s-confirmed-bg: #E6F5EF;
  --s-pending:   #B45309;  --s-pending-bg:   #FEF3C7;
  --s-arrived:   #1E40AF;  --s-arrived-bg:   #DBEAFE;
  --s-progress:  #6D28D9;  --s-progress-bg:  #EDE9FE;
  --s-completed: #374845;  --s-completed-bg: #EEF1F0;
  --s-cancelled: #9F1239;  --s-cancelled-bg: #FFE4E6;
  --s-noshow:    #7C7C7C;  --s-noshow-bg:    #F0F0F0;
  --s-rescheduled: #0369A1; --s-rescheduled-bg: #E0F2FE;

  /* Semantic */
  --ok:          #059669; --ok-bg:   #D1FAE5;
  --err:         #DC2626; --err-bg:  #FEE2E2;
  --warn:        #D97706; --warn-bg: #FEF3C7;
  --info:        #2563EB; --info-bg: #DBEAFE;

  /* Shape */
  --r:    10px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* Shadow */
  --sh-xs: 0 1px 2px rgba(0 0 0 / .05);
  --sh:    0 1px 4px rgba(0 0 0 / .07), 0 4px 12px rgba(0 0 0 / .05);
  --sh-lg: 0 4px 20px rgba(0 0 0 / .10);

  /* Layout */
  --sb-w:   260px;
  --bar-h:  60px;

  /* Font */
  --font: "Cairo", "SF Arabic", "Segoe UI", Tahoma, sans-serif;

  /* Transition */
  --tr: 160ms cubic-bezier(.2, 0, 0, 1);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.65; font-size: 14.5px; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.3; font-weight: 700; }
p { margin: 0 0 .75rem; }
img { max-width: 100%; }
button { cursor: pointer; }

/* ── App Shell ──────────────────────────────────────────────── */
.app-body {
  display: grid;
  grid-template-columns: var(--sb-w) minmax(0, 1fr);
  min-height: 100dvh;
  width: 100%;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  background: var(--sb-bg);
  border-inline-start: 1px solid var(--sb-border);
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sb-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.25rem 1.1rem;
  border-bottom: 1px solid var(--sb-border);
  color: #fff;
  font-weight: 800;
  letter-spacing: .05em;
  font-size: 1rem;
}
.sb-logo {
  width: 34px; height: 34px;
  background: conic-gradient(from 210deg, var(--brand), #3AA39A, var(--gold));
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: .8rem; font-weight: 800; color: #fff;
  flex: none;
  box-shadow: 0 2px 8px rgba(0 0 0/.4);
}

.sb-user {
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: .7rem;
}
.sb-avatar {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand-dim);
  color: var(--gold); font-weight: 800; font-size: .85rem;
  display: grid; place-items: center; flex: none;
}
.sb-user-name { color: #fff; font-weight: 600; font-size: .88rem; margin: 0; line-height: 1.2; }
.sb-user-role { color: var(--sb-text); font-size: .78rem; margin: 0; }

.sb-nav { flex: 1; padding: .75rem 0; overflow: auto; }
#clinics, #billing, #growth, #plans, #specialties, #reviews { scroll-margin-top: calc(var(--bar-h) + 16px); }

.sb-group-label {
  color: var(--sb-group);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .8rem 1.1rem .35rem;
  display: block;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .5rem 1rem;
  margin: 1px .55rem;
  border-radius: 8px;
  color: var(--sb-text);
  font-size: .88rem;
  font-weight: 600;
  transition: background var(--tr), color var(--tr);
  white-space: nowrap;
}
.sb-link i { width: 18px; text-align: center; font-size: .9rem; opacity: .7; flex: none; transition: opacity var(--tr); }
.sb-link:hover { background: var(--sb-hover); color: rgba(255 255 255/.85); }
.sb-link:hover i { opacity: 1; }
.sb-link.active { background: var(--sb-active); color: var(--sb-active-t); }
.sb-link.active i { opacity: 1; color: var(--sb-active-t); }

.sb-footer {
  padding: .85rem 1rem;
  border-top: 1px solid var(--sb-border);
}
.sb-logout {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  background: none;
  border: none;
  color: var(--sb-text);
  font: inherit;
  font-size: .85rem;
  padding: .45rem .6rem;
  border-radius: 7px;
  transition: background var(--tr), color var(--tr);
}
.sb-logout:hover { background: rgba(220 38 38/.15); color: #F87171; }

/* ── Main Area ───────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-width: 0;
  width: 100%;
}

/* ── Top Bar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--bar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 20;
  gap: 1rem;
}
.topbar-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.topbar-title i { color: var(--muted); font-size: .85rem; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.topbar-bell {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid; place-items: center;
  color: var(--muted);
  transition: background var(--tr), color var(--tr);
  font-size: .9rem;
}
.topbar-bell:hover { background: var(--surface-2); color: var(--ink); }
.topbar-user-chip {
  display: flex; align-items: center; gap: .5rem;
  padding: .3rem .7rem .3rem .4rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: .82rem;
  font-weight: 600;
}
.topbar-user-chip span {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--brand);
  color: #fff; font-size: .72rem; font-weight: 800;
  display: grid; place-items: center;
}

/* ── Page Content ────────────────────────────────────────────── */
.app-main {
  flex: 1;
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: clamp(1rem, 1.5vw, 1.75rem) clamp(1rem, 2vw, 2rem) 1.5rem;
}
.app-foot {
  margin-top: auto;
  padding: 0 clamp(1rem, 2vw, 2rem) 1.1rem;
}
.app-foot .m2-signature,
.m2-signature--light {
  --m2-sig-text: #0E1C1A;
  --m2-sig-accent: #C6A86A;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; margin: 0; }
.page-header .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  background: var(--brand); color: #fff;
  border: 1px solid transparent; border-radius: 9px;
  padding: .55rem 1.1rem;
  font: 600 .88rem var(--font);
  transition: background var(--tr), box-shadow var(--tr), transform var(--tr);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { background: var(--brand-dim); box-shadow: 0 2px 8px rgba(30 63 55/.3); }
.btn:active { transform: scale(.98); }
.btn-sm { padding: .35rem .8rem; font-size: .82rem; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-ghost {
  background: var(--surface); color: var(--ink);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); box-shadow: var(--sh-xs); }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #B91C1C; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #B8944D; }
.btn-icon {
  width: 34px; height: 34px; padding: 0; border-radius: 8px;
}
button, .btn { cursor: pointer; }
.inline { display: inline; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .85rem 1rem;
  border-radius: var(--r);
  margin-bottom: 1.1rem;
  font-size: .9rem;
  font-weight: 500;
}
.alert::before { font-family: "Font Awesome 6 Free"; font-weight: 900; margin-top: .05em; flex: none; }
.alert-ok  { background: var(--ok-bg);  color: var(--ok);  border: 1px solid #A7F3D0; }
.alert-ok::before  { content: "\f00c"; }
.alert-error { background: var(--err-bg); color: var(--err); border: 1px solid #FECACA; }
.alert-error::before { content: "\f071"; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #FDE68A; }
.alert-warn::before { content: "\f0a1"; }

/* ── Forms ───────────────────────────────────────────────────── */
label {
  display: grid;
  gap: .3rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-2);
}
input, select, textarea {
  font: 500 .92rem var(--font);
  padding: .6rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--tr), box-shadow var(--tr);
  width: 100%;
  line-height: 1.5;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30 63 55 / .12);
}
input::placeholder, textarea::placeholder { color: #A0AEC0; }
textarea { resize: vertical; min-height: 90px; }
.stack { display: grid; gap: .9rem; }
.stack.sm { gap: .6rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }

/* ── Cards / Panels ──────────────────────────────────────────── */
.panel, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.1rem;
}
.panel:last-child, .card:last-child { margin-bottom: 0; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.panel h2 { font-size: 1rem; margin: 0; }
.panel h3 { font-size: .9rem; margin: 0 0 .5rem; }

/* ── Stats ───────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: .9rem;
  margin-bottom: 1.25rem;
}
.stats article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.stats strong {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--brand);
  display: block;
}
.stats span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.stats .icon-wrap {
  width: 36px; height: 36px; border-radius: 9px;
  background: rgba(30 63 55 / .1);
  display: grid; place-items: center;
  color: var(--brand); font-size: .9rem;
  margin-bottom: .25rem;
}
.stat-green .icon-wrap { background: var(--ok-bg); color: var(--ok); }
.stat-gold .icon-wrap  { background: var(--gold-light); color: #8B6914; }
.stat-blue .icon-wrap  { background: var(--info-bg); color: var(--info); }
.stat-purple .icon-wrap { background: #EDE9FE; color: #7C3AED; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  border: 1px solid var(--border);
}
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: .88rem;
}
.table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-2);
  vertical-align: middle;
  text-align: right;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(30 63 55 / .025); }
.table small { display: block; color: var(--muted); font-size: .8rem; margin-top: .1rem; }

/* ── Badges / Status ─────────────────────────────────────────── */
.badge, .tag, .chips li {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.4;
}
.badge-green, .chips li { background: var(--s-completed-bg); color: var(--s-completed); }
.badge-ok    { background: var(--ok-bg);   color: var(--ok); }
.badge-err   { background: var(--err-bg);  color: var(--err); }
.badge-warn  { background: var(--warn-bg); color: var(--warn); }
.badge-info  { background: var(--info-bg); color: var(--info); }
.badge-gold  { background: var(--gold-light); color: #7C5408; }

/* Appointment status badges */
.tag { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.status-CONFIRMED   { background: var(--s-confirmed-bg);   color: var(--s-confirmed); }
.status-PENDING     { background: var(--s-pending-bg);     color: var(--s-pending); }
.status-ARRIVED     { background: var(--s-arrived-bg);     color: var(--s-arrived); }
.status-IN_PROGRESS { background: var(--s-progress-bg);    color: #6D28D9; }
.status-COMPLETED   { background: var(--s-completed-bg);   color: var(--s-completed); }
.status-CANCELLED   { background: var(--s-cancelled-bg);   color: var(--s-cancelled); }
.status-NO_SHOW     { background: var(--s-noshow-bg);      color: var(--s-noshow); }
.status-RESCHEDULED { background: var(--s-rescheduled-bg); color: var(--s-rescheduled); }

/* ── Chips / Tag cloud ───────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; list-style: none; margin: 0; }

/* ── List items ──────────────────────────────────────────────── */
.queue, .list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.queue li, .list a {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .7rem 1rem;
  color: inherit;
  font-size: .9rem;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.queue li:hover, .list a:hover { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30 63 55/.08); }

/* ── Avatar ──────────────────────────────────────────────────── */
.avatar {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(30 63 55/.1); color: var(--brand);
  display: grid; place-items: center;
  font-weight: 800; font-size: 1rem; flex: none;
  overflow: hidden;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.5rem; border-radius: 14px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Divider ─────────────────────────────────────────────────── */
.sep { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Utilities ───────────────────────────────────────────────── */
.muted  { color: var(--muted); }
.mt     { margin-top: 1.25rem; }
.mb     { margin-bottom: 1rem; }
.text-sm { font-size: .85rem; }
.font-bold { font-weight: 700; }
.flex   { display: flex; align-items: center; gap: .6rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ── Inline filter bar ───────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-bar input, .filter-bar select { width: auto; min-width: 140px; }
.inline-filter { margin-bottom: 1rem; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty i { font-size: 2.5rem; opacity: .25; display: block; margin-bottom: .75rem; }
.empty p { margin: 0; }

/* ── Section muted note ──────────────────────────────────────── */
.note {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--r);
  padding: .7rem 1rem;
  color: var(--muted);
  font-size: .85rem;
}

/* ── Summary card ────────────────────────────────────────────── */
.summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .8rem 1rem;
  margin-bottom: 1rem;
  font-size: .9rem;
}

/* ── Progress bar ────────────────────────────────────────────── */
.prog { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.prog-bar { height: 100%; border-radius: 999px; background: var(--brand); }

/* ── M2 signature ────────────────────────────────────────────── */
.m2-signature {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  letter-spacing: 0.2px;
  text-align: center;
}
.m2-signature__logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.m2-signature__logo:hover { opacity: 0.85; transform: translateY(-2px); }
.m2-signature__logo img { height: 18px; width: auto; max-width: 52px; object-fit: contain; }
.m2-signature__mark {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: var(--m2-sig-accent);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--m2-sig-accent) 55%, transparent));
  animation: m2-sig-pulse 3.4s ease-in-out infinite;
}
.m2-signature__mark svg { width: 100%; height: 100%; display: block; }
@keyframes m2-sig-pulse {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.9; }
  50% { transform: scale(1.12) rotate(45deg); opacity: 1; }
}
.m2-signature__tag,
.m2-signature__tag strong { color: var(--m2-sig-text); font-size: 13px; font-weight: 700; }
.m2-signature__year { color: color-mix(in srgb, var(--m2-sig-text) 78%, transparent); font-size: 13px; }
@media (max-width: 575px) {
  .m2-signature { gap: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .m2-signature__mark { animation: none; }
}

/* ── Site footer (print) ─────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; color: var(--muted); }

/* ── Auth pages ──────────────────────────────────────────────── */
body.auth-body {
  background: var(--bg);
  min-height: 100dvh;
}
.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  justify-items: stretch;
}
.auth-aside { display: none; }
.auth-main {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 2rem 1.25rem;
  background: var(--bg);
}
.auth-main-inner { width: 100%; max-width: 460px; }
.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  padding: 2rem 1.75rem 1.75rem;
}
.auth-brand {
  display: flex; align-items: center; gap: .7rem;
  margin-bottom: 1.35rem;
  color: var(--ink);
  font-weight: 800; font-size: 1.15rem; letter-spacing: .05em;
}
.auth-brand .sb-logo { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.auth-title { font-size: 1.35rem; margin-bottom: .3rem; }
.auth-sub   { color: var(--muted); font-size: .9rem; margin-bottom: 1.35rem; }

.auth-aside-brand {
  display: flex; align-items: center; gap: .8rem;
  margin-bottom: 2rem; color: #fff;
  font-weight: 800; font-size: 1.25rem; letter-spacing: .05em;
}
.auth-aside-brand .sb-logo { width: 42px; height: 42px; border-radius: 12px; font-size: 1.05rem; }
.auth-aside h2 {
  color: #fff; font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  line-height: 1.35; margin: 0 0 1rem;
}
.auth-aside p {
  color: rgba(255 255 255 / .62);
  font-size: .95rem; line-height: 1.75; margin: 0;
}
.auth-aside-list {
  list-style: none; padding: 0; margin: 2rem 0 0;
  display: grid; gap: .9rem;
}
.auth-aside-list li {
  display: flex; align-items: center; gap: .75rem;
  color: rgba(255 255 255 / .78); font-size: .9rem;
}
.auth-aside-list i { color: var(--gold); width: 18px; text-align: center; flex: none; }

@media (min-width: 960px) {
  .auth-shell {
    grid-template-columns: 1fr 1fr;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }
  .auth-aside {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 0;
    padding: 3.5rem 4rem;
    background:
      radial-gradient(ellipse 70% 55% at 70% 28%, rgba(198 168 106 / .14), transparent 60%),
      linear-gradient(165deg, #122C26 0%, #0C1917 55%, #1E3F37 100%);
    border-inline-end: 1px solid rgba(255 255 255 / .06);
    position: relative;
    overflow: hidden;
  }
  .auth-aside-inner { position: relative; z-index: 1; width: 100%; max-width: 420px; }
  .auth-main {
    height: 100%;
    min-height: 0;
    overflow: auto;
    padding: 2rem;
  }
  .auth-card { padding: 2.15rem 2rem 1.85rem; }
  .auth-card .auth-brand { display: none; }
  .auth-card .row-2 { gap: 1.15rem; }
}

.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  transition: background-color 9999s ease-out;
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-header .actions, form { display: none !important; }
  .app-body { grid-template-columns: 1fr; }
  .panel { box-shadow: none; border: 1px solid #ddd; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .topbar-user-chip { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 900px) {
  :root { --sb-w: 0px; }
  .app-body { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: 0; inset-inline-start: 0;
    width: min(280px, 86vw);
    transform: translateX(110%);
    z-index: 100;
    transition: transform var(--tr);
  }
  .sidebar.open { transform: translateX(0); }
  .app-shell { width: 100%; }
  .app-main { padding: 1rem .9rem 2rem; }
  .topbar { padding: 0 .75rem; height: auto; min-height: var(--bar-h); }
  .topbar-user-chip { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats strong { font-size: 1.45rem; }
  .row-2 { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-header .actions { width: 100%; }
  .page-header .actions .btn { flex: 1; }
  .sb-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--muted); font-size: .9rem;
    flex: none;
  }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.15rem; }
}
@media (min-width: 901px) {
  .sb-toggle { display: none; }
}

/* ── Wrap / legacy ───────────────────────────────────────────── */
.wrap { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.section { padding: 2rem 0 2.5rem; }
.narrow { max-width: 520px; }

/* ── Checkbox rows ───────────────────────────────────────────── */
.check {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  font-weight: 500;
}
.check input { width: auto; flex: none; }

/* ── Invoice line editor ─────────────────────────────────────── */
.inv-line {
  display: grid;
  grid-template-columns: 130px minmax(160px, 1.2fr) minmax(160px, 1.4fr) 90px 120px;
  gap: .7rem;
  padding: .9rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: .7rem;
}
@media (max-width: 1100px) {
  .inv-line { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .inv-line { grid-template-columns: 1fr; }
}

/* ── Code / secrets ──────────────────────────────────────────── */
code, .secret-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .15rem .4rem;
  word-break: break-all;
}
.secret-box {
  display: block;
  padding: .7rem .9rem;
  border-style: dashed;
}

/* ── Notifications ───────────────────────────────────────────── */
.notif-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.notif-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .9rem 1.05rem;
  display: grid;
  gap: .2rem;
}
.notif-list strong { font-size: .92rem; }
.notif-list span { color: var(--ink-2); font-size: .88rem; }
.notif-list small { color: var(--muted); font-size: .78rem; }
