/* ==========================================================================
   L'Académie — Design System
   Palette: crème · encre · or
   ========================================================================== */

:root {
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'EB Garamond', Georgia, 'Times New Roman', serif;

  --cream: #f7f2e9;
  --ivory: #fbf7ef;
  --paper: #fffcf6;
  --ink: #171d27;
  --ink-2: #232b39;
  --navy: #161e2e;
  --navy-2: #101724;
  --muted: #7c7568;
  --muted-2: #9b9486;
  --line: #e8e0d2;
  --line-soft: #f0eadd;

  --gold: #b3863f;
  --gold-2: #8f6a2c;
  --gold-3: #c9a25e;
  --gold-soft: #f2e5cb;
  --gold-wash: #f8f0df;

  --sage: #5c7a60;
  --sage-soft: #e9efe6;
  --terra: #b05b45;
  --terra-soft: #f7e5de;
  --blue: #3d5a80;
  --blue-soft: #e6edf4;
  --plum: #7a5a83;
  --plum-soft: #efe7f1;

  --shadow-xs: 0 1px 2px rgba(23, 29, 39, .05);
  --shadow-sm: 0 1px 3px rgba(23, 29, 39, .05), 0 8px 20px -16px rgba(23, 29, 39, .35);
  --shadow: 0 1px 3px rgba(23, 29, 39, .04), 0 22px 44px -30px rgba(23, 29, 39, .4);
  --shadow-lg: 0 30px 70px -24px rgba(16, 23, 36, .45);

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --r-xl: 22px;

  --sidebar-w: 268px;
  --topbar-h: 86px;
  --slot: 58px;
  --ease: cubic-bezier(.22, .75, .25, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 90% -10%, rgba(201, 162, 94, .16), transparent 62%),
    radial-gradient(760px 460px at -8% 106%, rgba(61, 90, 128, .10), transparent 60%),
    var(--cream);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }
img { max-width: 100%; display: block; }

::selection { background: #e8d3aa; color: #221a0d; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d9cfbd;
  border-radius: 20px;
  border: 3px solid var(--cream);
}
::-webkit-scrollbar-thumb:hover { background: #c7b99f; }

[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Typography helpers
   -------------------------------------------------------------------------- */

.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.faint { color: var(--muted-2); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }

.overline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--gold-2);
  line-height: 1.4;
}
.overline::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--gold-3);
  display: inline-block;
}
.overline.no-rule::before { display: none; }

.page-title-sm {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.fleuron {
  color: var(--gold-3);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .4em;
  user-select: none;
}

/* --------------------------------------------------------------------------
   Splash
   -------------------------------------------------------------------------- */

.splash {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--cream);
  transition: opacity .45s ease, visibility .45s;
}
.splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-seal {
  width: 68px;
  height: 68px;
  display: grid;
  place-content: center;
  border: 1px solid rgba(179, 134, 63, .55);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--cream), inset 0 0 0 5px rgba(179, 134, 63, .24);
  font-family: var(--serif);
  font-size: 22px;
  color: var(--gold-2);
  animation: breathe 1.8s ease-in-out infinite;
}
.splash-name {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: .04em;
  color: var(--ink-2);
}
.splash-line {
  width: 1px;
  height: 34px;
  background: linear-gradient(var(--gold-3), transparent);
  animation: drop 1.4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: .9; }
  50% { transform: scale(1.04); opacity: 1; }
}
@keyframes drop {
  0% { transform: scaleY(.2); transform-origin: top; opacity: .1; }
  50% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(.2); transform-origin: bottom; opacity: .1; }
}

/* --------------------------------------------------------------------------
   Shell / sidebar
   -------------------------------------------------------------------------- */

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 26px 18px 18px;
  color: #e9e2d3;
  background:
    radial-gradient(440px 240px at 18% -4%, rgba(201, 162, 94, .15), transparent 72%),
    linear-gradient(180deg, #1b2434 0%, #151d2c 52%, #101724 100%);
  border-right: 1px solid rgba(255, 255, 255, .045);
  overflow: hidden;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 26px;
}
.brand-seal {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  border: 1px solid rgba(201, 162, 94, .55);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #192132, inset 0 0 0 4px rgba(201, 162, 94, .22);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: .02em;
  color: #e3c893;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: .01em;
  color: #f5eddd;
}
.brand-sub {
  margin-top: 2px;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(233, 226, 211, .44);
}

.nav {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  padding-bottom: 12px;
}
.nav-group {
  padding: 14px 12px 7px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: rgba(233, 226, 211, .32);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 500;
  color: #a8afbe;
  text-align: left;
  transition: background .18s, color .18s;
}
.nav-item:hover { background: rgba(255, 255, 255, .045); color: #efe7d8; }
.nav-item.active {
  background: rgba(255, 255, 255, .065);
  color: #fbf4e6;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #e2c48c, #b3863f);
  transform: translateY(-50%);
}
.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: currentColor;
  opacity: .85;
}
.nav-item.active .nav-icon { color: #d9b87b; opacity: 1; }
.nav-label { flex: 1; min-width: 0; }
.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-content: center;
  border-radius: 20px;
  background: rgba(201, 162, 94, .16);
  border: 1px solid rgba(201, 162, 94, .25);
  color: #e2c48c;
  font-size: 10px;
  font-weight: 600;
}
.nav-hint {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(233, 226, 211, .3);
}

.sidebar-foot {
  position: relative;
  z-index: 1;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 18px;
}
.sidebar-quote {
  position: relative;
  padding: 2px 10px 0 22px;
  color: rgba(233, 226, 211, .38);
}
.sidebar-quote .quote-mark {
  position: absolute;
  left: 6px;
  top: -4px;
  font-family: var(--serif);
  font-size: 24px;
  color: rgba(201, 162, 94, .5);
  line-height: 1;
}
.sidebar-quote p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  line-height: 1.5;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .06);
  text-align: left;
  transition: background .18s;
}
.user-card:hover { background: rgba(255, 255, 255, .08); }
.user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-name {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #f2ebdd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  display: block;
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(233, 226, 211, .42);
  margin-top: 1px;
}
.user-card .nav-icon { color: rgba(233, 226, 211, .4); margin-left: 2px; }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(16, 23, 36, .5);
  backdrop-filter: blur(2px);
  animation: fade .2s ease;
}

/* --------------------------------------------------------------------------
   Main / topbar
   -------------------------------------------------------------------------- */

.main-wrap { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 34px;
  background: rgba(247, 242, 233, .84);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  border-bottom: 1px solid rgba(232, 224, 210, .85);
}

.topbar .menu-btn { display: none; }

.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-title h1 {
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.012em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 244px;
  height: 38px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 252, 246, .72);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.searchbox:focus-within {
  border-color: #cfae74;
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(201, 162, 94, .13);
}
.searchbox-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--muted-2);
  background-repeat: no-repeat;
  background-size: contain;
}
.searchbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink);
}
.searchbox input::placeholder { color: var(--muted-2); }
.searchbox kbd {
  flex: 0 0 auto;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--ivory);
  font-family: var(--sans);
  font-size: 9.5px;
  color: var(--muted-2);
}

.date-chip {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 0 4px;
  white-space: nowrap;
}

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-content: center;
  border-radius: 11px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: background .18s, color .18s, border-color .18s;
}
.icon-btn:hover { background: rgba(255, 252, 246, .9); color: var(--ink); border-color: var(--line); }
.icon-btn svg { width: 18px; height: 18px; }

.bell .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--terra);
  border: 1.5px solid var(--cream);
  box-shadow: 0 0 0 1px rgba(176, 91, 69, .25);
}

.avatar-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-content: center;
  box-shadow: 0 0 0 1px var(--line), 0 0 0 3px rgba(255, 252, 246, .9);
  transition: transform .18s, box-shadow .18s;
}
.avatar-btn:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--gold-3), 0 0 0 3px rgba(255, 252, 246, .9); }
.avatar-btn .avatar { width: 36px; height: 36px; font-size: 11.5px; }

.page {
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
  padding: 30px 34px 90px;
  outline: none;
  animation: pageIn .45s var(--ease);
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .005em;
  white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s, transform .18s, box-shadow .18s;
}
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--ink);
  color: #fbf5e9;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08), 0 8px 18px -12px rgba(23, 29, 39, .7);
}
.btn-primary:hover {
  background: #263145;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -14px rgba(23, 29, 39, .75);
}

.btn-gold {
  background: linear-gradient(180deg, #caa45f, #b3863f);
  color: #211806;
  box-shadow: 0 1px 1px rgba(80, 55, 15, .2), 0 10px 22px -14px rgba(143, 106, 44, .9);
}
.btn-gold:hover {
  background: linear-gradient(180deg, #d3af6c, #bb8e46);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--paper); border-color: #d8ccb7; box-shadow: var(--shadow-xs); }

.btn-soft {
  background: var(--gold-soft);
  color: var(--gold-2);
}
.btn-soft:hover { background: #eeddba; }

.btn-danger { background: var(--terra-soft); color: var(--terra); border-color: #eccabf; }
.btn-danger:hover { background: #f2d7cd; }
.btn-danger-solid {
  background: #a9543f;
  color: #fff8f4;
  border-color: #a9543f;
  box-shadow: 0 8px 18px -12px rgba(169, 84, 63, .8);
}
.btn-danger-solid:hover { background: #96462f; border-color: #96462f; }

.btn-sm { height: 32px; padding: 0 11px; font-size: 11.5px; border-radius: 9px; gap: 6px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 13.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-2);
  transition: gap .18s, color .18s;
}
.link-btn:hover { gap: 8px; color: var(--gold); text-decoration: none; }
.link-btn svg { width: 14px; height: 14px; }

.icon-btn-sm {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-content: center;
  border-radius: 8px;
  color: var(--muted);
  transition: background .16s, color .16s;
}
.icon-btn-sm:hover { background: var(--ivory); color: var(--ink); }
.icon-btn-sm svg { width: 16px; height: 16px; }
.icon-btn-sm.danger:hover { background: var(--terra-soft); color: var(--terra); }

/* --------------------------------------------------------------------------
   Cards & layout grids
   -------------------------------------------------------------------------- */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px 24px; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.card-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--ink);
}
.card-sub { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.card-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.grid { display: grid; gap: 18px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); }
.split-wide { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.mt-18 { margin-top: 18px; }
.mt-24 { margin-top: 24px; }

/* --------------------------------------------------------------------------
   Page head / greeting
   -------------------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head-main { min-width: 0; }
.page-head h2 {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.1;
}
.page-head p { margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.page-head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.greeting {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.greeting h2 {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: clamp(32px, 3.2vw, 42px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -.02em;
}
.greeting h2 em { font-style: italic; color: var(--gold-2); }
.greeting p { margin-top: 9px; font-size: 13px; color: var(--muted); max-width: 480px; }
.greeting-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   KPI
   -------------------------------------------------------------------------- */

.kpi {
  position: relative;
  overflow: hidden;
  padding: 19px 20px 17px;
  min-height: 152px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s;
}
.kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 1px 3px rgba(23, 29, 39, .05), 0 26px 46px -30px rgba(23, 29, 39, .55);
  border-color: #ded3c0;
}
.kpi::after {
  content: "";
  position: absolute;
  top: -70px;
  right: -55px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 94, .14), transparent 68%);
  pointer-events: none;
}
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.5;
  max-width: 140px;
}
.ico-box {
  width: 34px;
  height: 34px;
  display: grid;
  place-content: center;
  border-radius: 10px;
  background: var(--gold-soft);
  color: var(--gold-2);
  flex: 0 0 auto;
}
.ico-box svg { width: 17px; height: 17px; }
.ico-box.blue { background: var(--blue-soft); color: var(--blue); }
.ico-box.sage { background: var(--sage-soft); color: var(--sage); }
.ico-box.terra { background: var(--terra-soft); color: var(--terra); }
.ico-box.plum { background: var(--plum-soft); color: var(--plum); }

.kpi-value {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 500;
  line-height: .95;
  letter-spacing: -.025em;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink);
}
.kpi-value .unit {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 5px;
}
.kpi-foot {
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.kpi-note { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }

.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px 2px 5px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.6;
  background: var(--sage-soft);
  color: var(--sage);
}
.delta svg { width: 11px; height: 11px; }
.delta.down { background: var(--terra-soft); color: var(--terra); }
.delta.flat { background: var(--ivory); color: var(--muted); border: 1px solid var(--line); }

.spark { width: 84px; height: 30px; flex: 0 0 auto; opacity: .95; }

/* --------------------------------------------------------------------------
   Charts
   -------------------------------------------------------------------------- */

.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--line-soft); stroke-width: 1; shape-rendering: crispEdges; }
.chart-axis { font-family: var(--sans); font-size: 9.5px; fill: var(--muted-2); }
.chart-point { transition: r .15s; }
.chart-tip {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--ink);
  color: #f7f1e4;
  font-size: 11px;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity .12s;
  white-space: nowrap;
}
.chart-tip.show { opacity: 1; }
.chart-tip b { font-family: var(--serif); font-size: 14px; font-weight: 600; color: #e9cfa0; }
.chart-legend { display: flex; align-items: center; gap: 14px; font-size: 10.5px; color: var(--muted); }
.chart-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-3);
  display: inline-block;
  margin-right: 5px;
}
.chart-total { display: flex; align-items: baseline; gap: 8px; }
.chart-total b {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -.02em;
  font-variant-numeric: lining-nums;
}
.chart-total span { font-size: 11px; color: var(--muted); }

.radar-svg { width: 100%; height: auto; max-width: 250px; margin: 0 auto; }
.radar-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-axis { stroke: var(--line); stroke-width: 1; }
.radar-shape { fill: rgba(179, 134, 63, .18); stroke: var(--gold); stroke-width: 1.6; }
.radar-dot { fill: var(--gold-2); }
.radar-label { font-family: var(--sans); font-size: 9px; font-weight: 600; fill: var(--muted); letter-spacing: .05em; }

/* --------------------------------------------------------------------------
   Avatars / chips / status
   -------------------------------------------------------------------------- */

.avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: inline-grid;
  place-content: center;
  border-radius: 50%;
  background: var(--av-bg, var(--gold-soft));
  color: var(--av-fg, var(--gold-2));
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid rgba(23, 29, 39, .04);
  user-select: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 9.5px; }
.avatar-lg { width: 48px; height: 48px; font-size: 14px; }
.avatar-xl { width: 62px; height: 62px; font-size: 18px; box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--line); }

.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person-main { min-width: 0; }
.person-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-sub {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}
.person-sub svg { width: 10px; height: 10px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.65;
  white-space: nowrap;
  background: var(--ivory);
  border: 1px solid var(--line);
  color: var(--muted);
}
.chip svg { width: 11px; height: 11px; }
.level { border: 0; letter-spacing: .04em; }
.level-A1 { background: var(--sage-soft); color: #4a6750; }
.level-A2 { background: var(--blue-soft); color: #35516f; }
.level-B1 { background: #f4ead3; color: #85642a; }
.level-B2 { background: var(--terra-soft); color: #96432f; }
.level-C1 { background: var(--plum-soft); color: #65446f; }
.level-BUSINESS { background: #e9e6df; color: #4c463a; }

.method-card { background: var(--blue-soft); color: var(--blue); border: 0; }
.method-cash { background: var(--sage-soft); color: var(--sage); border: 0; }
.method-transfer { background: var(--plum-soft); color: var(--plum); border: 0; }

.status { border: 0; }
.status-done { background: var(--sage-soft); color: var(--sage); }
.status-scheduled { background: var(--blue-soft); color: var(--blue); }
.status-absent { background: var(--terra-soft); color: var(--terra); }
.status-cancelled { background: var(--ivory); color: var(--muted); border: 1px solid var(--line); }

.badge-count {
  display: inline-grid;
  place-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--terra-soft);
  color: var(--terra);
  font-size: 10.5px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th:first-child { padding-left: 24px; }
.table th:last-child { padding-right: 24px; }
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  font-size: 12.5px;
}
.table td:first-child { padding-left: 24px; }
.table td:last-child { padding-right: 24px; }
.table tbody tr { transition: background .16s; }
.table tbody tr:hover { background: #fbf6ec; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table .col-actions { text-align: right; white-space: nowrap; }
.row-actions { display: inline-flex; align-items: center; gap: 2px; }

.table-empty { padding: 38px 24px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* --------------------------------------------------------------------------
   Balance
   -------------------------------------------------------------------------- */

.balance { display: flex; flex-direction: column; gap: 6px; min-width: 104px; }
.balance-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.balance-num {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink);
}
.balance-num .u { font-family: var(--sans); font-size: 10px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.balance-cap { font-size: 10px; color: var(--muted-2); }
.balance-track {
  height: 5px;
  width: 100%;
  border-radius: 99px;
  background: #f0e8da;
  overflow: hidden;
}
.balance-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #d3b276, #b3863f);
  transition: width .6s var(--ease);
}
.balance.low .balance-num { color: var(--terra); }
.balance.low .balance-fill { background: linear-gradient(90deg, #cf8a73, #b05b45); }
.balance-empty .balance-fill { background: #ddd3c1; }

/* --------------------------------------------------------------------------
   Lists / timeline
   -------------------------------------------------------------------------- */

.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(var(--line), var(--line-soft));
}
.tl-item { position: relative; padding: 0 108px 17px 0; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--gold-3);
  box-shadow: 0 0 0 3px var(--paper);
}
.tl-item.done::before { background: var(--gold-3); }
.tl-time {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted-2);
  text-transform: uppercase;
}
.tl-title { margin-top: 2px; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tl-sub { margin-top: 1px; font-size: 10.5px; color: var(--muted); }
.tl-side { position: absolute; right: 0; top: 0; }

.renew-list { display: flex; flex-direction: column; }
.renew-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.renew-item:last-child { border-bottom: 0; padding-bottom: 0; }
.renew-item:first-child { padding-top: 0; }
.renew-info { flex: 1; min-width: 0; }
.renew-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.renew-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.renew-hours {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--terra);
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}
.renew-hours.ok { color: var(--sage); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label,
.label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field .req { color: var(--terra); }

.input, .select, .textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  font-size: 13px;
  color: var(--ink);
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: #dbd0bd; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: #c9a25e;
  background: #fffefa;
  box-shadow: 0 0 0 3px rgba(201, 162, 94, .14);
}
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237c7568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.textarea { height: auto; min-height: 82px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: 0; }
.form-grid > * { min-width: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
.hint { font-size: 10.5px; color: var(--muted-2); line-height: 1.5; }
.error-text { font-size: 11px; color: var(--terra); }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ivory);
}
.segmented button {
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  transition: background .16s, color .16s, box-shadow .16s;
}
.segmented button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.switch { position: relative; display: inline-flex; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  width: 100%;
  height: 100%;
  border-radius: 99px;
  background: #ded4c3;
  transition: background .2s;
  pointer-events: none;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .2s;
}
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::after { transform: translateX(16px); }

/* --------------------------------------------------------------------------
   Filters / toolbar
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar .grow { flex: 1; }

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  width: min(280px, 100%);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
.search-field svg { width: 15px; height: 15px; color: var(--muted-2); flex: 0 0 auto; }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 12.5px; }
.search-field input::placeholder { color: var(--muted-2); }
.search-field:focus-within { border-color: #cfae74; box-shadow: 0 0 0 3px rgba(201, 162, 94, .12); }

.filter-chip {
  height: 32px;
  padding: 0 11px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  transition: all .16s;
}
.filter-chip:hover { border-color: #d8ccb7; color: var(--ink); }
.filter-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f1e4;
}

.toolbar-select {
  height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%237c7568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  font-size: 11.5px;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Schedule
   -------------------------------------------------------------------------- */

.week-card { overflow: hidden; }
.week-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf8, var(--paper));
}
.week-nav { display: flex; align-items: center; gap: 4px; }
.week-range {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  min-width: 170px;
  text-align: center;
  letter-spacing: -.01em;
}
.week-scroll { overflow-x: auto; }

.week {
  display: grid;
  grid-template-columns: 62px repeat(6, minmax(112px, 1fr));
  min-width: 760px;
}
.week-head-cell {
  padding: 11px 6px 10px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid transparent;
}
.week-head-cell .dow {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.week-head-cell .dom {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink-2);
}
.week-head-cell.today { background: rgba(201, 162, 94, .09); }
.week-head-cell.today .dow { color: var(--gold-2); }
.week-head-cell.today .dom { color: var(--gold-2); }
.week-head-cell.today .dom::after {
  content: "";
  display: block;
  width: 14px;
  height: 2px;
  margin: 3px auto 0;
  border-radius: 2px;
  background: var(--gold-3);
}

.week-time-col { position: relative; }
.week-time {
  position: absolute;
  right: 10px;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--muted-2);
  transform: translateY(-5px);
  font-variant-numeric: tabular-nums;
}

.week-col {
  position: relative;
  border-left: 1px solid var(--line-soft);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--slot) - 1px),
    var(--line-soft) calc(var(--slot) - 1px),
    var(--line-soft) var(--slot)
  );
}
.week-col.today { background-color: rgba(201, 162, 94, .035); }
.week-col.closed { background-color: rgba(23, 29, 39, .02); }

.lesson {
  position: absolute;
  left: 4px;
  right: 4px;
  overflow: hidden;
  padding: 5px 7px 6px;
  border-radius: 8px;
  border-left: 3px solid var(--lv, var(--gold));
  background: var(--lv-bg, var(--gold-wash));
  box-shadow: 0 1px 1px rgba(23, 29, 39, .05);
  cursor: pointer;
  transition: transform .16s, box-shadow .16s, filter .16s;
  min-height: 34px;
  text-align: left;
}
.lesson:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px -10px rgba(23, 29, 39, .45);
  filter: saturate(1.06);
  z-index: 3;
}
.lesson:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.lesson .l-time { display: block; font-size: 9px; font-weight: 600; color: var(--lv, var(--gold-2)); letter-spacing: .02em; }
.lesson .l-name {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lesson .l-meta {
  display: block;
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lesson.status-done { opacity: .9; }
.lesson.status-cancelled { opacity: .55; text-decoration: line-through; text-decoration-color: rgba(23, 29, 39, .25); }
.lesson.status-absent { border-left-style: dashed; }
.lesson.compact { padding: 4px 5px; }
.lesson.compact .l-time { font-size: 8px; }
.lesson.compact .l-name { font-size: 9.5px; }
.lesson.compact .l-meta { display: none; }

.lv-A1 { --lv: #5c7a60; --lv-bg: #edf2ea; }
.lv-A2 { --lv: #3d5a80; --lv-bg: #eaf0f6; }
.lv-B1 { --lv: #a87c31; --lv-bg: #f8efdc; }
.lv-B2 { --lv: #b05b45; --lv-bg: #f9e9e2; }
.lv-C1 { --lv: #7a5a83; --lv-bg: #f2ebf4; }
.lv-BUSINESS { --lv: #4c463a; --lv-bg: #efede7; }

.now-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--terra); z-index: 4; opacity: .55; }
.now-line::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--terra);
}

.schedule-mobile { display: none; }
.day-pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.day-pill {
  flex: 0 0 auto;
  min-width: 56px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  text-align: center;
}
.day-pill .dp-dow { display: block; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.day-pill .dp-dom { display: block; font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 1.2; }
.day-pill.active { background: var(--ink); border-color: var(--ink); color: #f7f1e4; }
.day-pill.active .dp-dow { color: rgba(247, 241, 228, .55); }
.day-pill.today:not(.active) { border-color: var(--gold-3); }

.m-lesson {
  display: flex;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.m-lesson:last-child { border-bottom: 0; }
.m-time { width: 46px; flex: 0 0 auto; padding-top: 1px; }
.m-time b { display: block; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.m-time span { font-size: 9.5px; color: var(--muted-2); }
.m-body { flex: 1; min-width: 0; }
.m-name { font-size: 13px; font-weight: 600; }
.m-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.m-side { flex: 0 0 auto; align-self: center; }

/* --------------------------------------------------------------------------
   Teachers / materials
   -------------------------------------------------------------------------- */

.teacher-card {
  padding: 19px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.teacher-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #ded3c0; }
.teacher-top { display: flex; align-items: center; gap: 12px; }
.teacher-name { font-family: var(--serif); font-size: 18.5px; font-weight: 600; line-height: 1.2; }
.teacher-spec { font-size: 11px; color: var(--muted); margin-top: 1px; }
.teacher-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
}
.teacher-stat b {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: lining-nums;
}
.teacher-stat span {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 16px;
}
.material {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.material:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #ded3c0; }
.material-ico {
  width: 42px;
  height: 42px;
  display: grid;
  place-content: center;
  border-radius: 12px;
  background: var(--ivory);
  border: 1px solid var(--line-soft);
  color: var(--gold-2);
}
.material-ico svg { width: 19px; height: 19px; }
.material-ico.pdf { background: var(--terra-soft); color: var(--terra); border-color: transparent; }
.material-ico.audio { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.material-ico.image { background: var(--sage-soft); color: var(--sage); border-color: transparent; }
.material-title { font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.material-meta { font-size: 10px; color: var(--muted-2); margin-top: 3px; }
.material-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }

.dropzone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1.5px dashed #d8ccb7;
  border-radius: 13px;
  background: #fbf6ec;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold-3); background: #f8efdd; }
.dropzone-ico {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  border-radius: 11px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--gold-2);
}
.dropzone-ico svg { width: 18px; height: 18px; }
.dropzone b { font-size: 12.5px; font-weight: 600; display: block; }
.dropzone span { font-size: 10.5px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Drawer / modal
   -------------------------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 23, 36, .52);
  animation: fade .2s ease;
}
.overlay.drawer-mode { padding: 0; justify-content: flex-end; align-items: stretch; }
.overlay-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: pop .28s var(--ease);
  overscroll-behavior: contain;
}
.overlay.drawer-mode .overlay-panel {
  width: min(580px, 100%);
  height: 100vh;
  max-height: none;
  border-radius: 0;
  border-right: 0;
  animation: slideIn .32s var(--ease);
}
.overlay.closing { animation: fadeOut .18s ease forwards; }
.overlay.closing .overlay-panel { animation: popOut .18s ease forwards; }

.modal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px 14px;
  background: linear-gradient(var(--paper) 70%, rgba(255, 252, 246, .92));
}
.modal-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.015em;
}
.modal-sub { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.modal-body { padding: 8px 26px 8px; }
.modal-foot {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 16px 26px 22px;
  background: linear-gradient(rgba(255, 252, 246, .97), var(--paper) 45%);
  border-top: 1px solid var(--line-soft);
}
.modal-close { flex: 0 0 auto; color: var(--muted-2); }
.modal-close:hover { color: var(--ink); }

.drawer-head {
  position: relative;
  padding: 26px 26px 20px;
  background:
    radial-gradient(420px 180px at 88% -20%, rgba(201, 162, 94, .18), transparent 70%),
    linear-gradient(180deg, #faf4e9, var(--paper));
  border-bottom: 1px solid var(--line-soft);
}
.drawer-id { display: flex; align-items: center; gap: 14px; padding-right: 40px; }
.drawer-name { font-family: var(--serif); font-size: 27px; font-weight: 600; line-height: 1.1; letter-spacing: -.015em; }
.drawer-sub { display: flex; align-items: center; gap: 7px; margin-top: 5px; flex-wrap: wrap; }
.drawer-close { position: absolute; top: 18px; right: 18px; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 2px;
  padding: 0 26px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
}
.tab {
  padding: 12px 10px 11px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: color .16s, border-color .16s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-color: var(--gold); }
.drawer-body { padding: 22px 26px 46px; }

.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dl-item .label { display: block; margin-bottom: 3px; }
.dl-value { font-size: 13px; color: var(--ink); }
.dl-value.muted { color: var(--muted); }

.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 104px; height: 104px; flex: 0 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: #efe6d6; stroke-width: 7; }
.ring-fill { fill: none; stroke: var(--gold); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring-fill.low { stroke: var(--terra); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center b { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1; font-variant-numeric: lining-nums; }
.ring-center span { font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); margin-top: 2px; }

.tab-pane { animation: fade .22s ease; }
.subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 10px;
}
.subhead:first-child { margin-top: 0; }
.subhead h4 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.history-item:last-child { border-bottom: 0; }
.history-dot {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold-3);
}
.history-dot.pay { background: var(--sage); }
.history-main { flex: 1; min-width: 0; }
.history-title { font-size: 12.5px; font-weight: 500; }
.history-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.history-amt { font-size: 12px; font-weight: 600; white-space: nowrap; }
.history-amt.plus { color: var(--sage); }

.progress-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.progress-label { display: flex; justify-content: space-between; font-size: 11px; }
.progress-label b { font-weight: 600; }
.progress-label span { color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-bar { height: 6px; border-radius: 99px; background: #f0e8da; overflow: hidden; }
.progress-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #d3b276, #b3863f);
  transition: width .7s var(--ease);
}

/* --------------------------------------------------------------------------
   Menus / popovers
   -------------------------------------------------------------------------- */

.menu {
  position: fixed;
  z-index: 150;
  width: 270px;
  padding: 7px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-lg);
  animation: pop .18s var(--ease);
}
.menu.wide { width: 340px; }
.menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
}
.menu-head .user-name { color: var(--ink); }
.menu-head .user-role { color: var(--muted); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-align: left;
  transition: background .14s;
}
.menu-item svg { width: 15px; height: 15px; color: var(--muted); }
.menu-item:hover { background: var(--ivory); }
.menu-item.danger { color: var(--terra); }
.menu-item.danger svg { color: var(--terra); }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--line-soft); }
.menu-section { padding: 9px 10px 3px; font-size: 9px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.menu-empty { padding: 16px 10px; text-align: center; font-size: 11.5px; color: var(--muted); }
.menu-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .14s;
}
.menu-notice:hover { background: var(--ivory); }
.menu-notice .person { gap: 9px; }
.menu-notice-hours { font-size: 11px; font-weight: 600; color: var(--terra); }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(390px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 13px;
  background: #1a2334;
  color: #f6f0e3;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, .08);
  font-size: 12px;
  line-height: 1.5;
  animation: toastIn .32s var(--ease);
}
.toast.out { animation: toastOut .24s ease forwards; }
.toast-ico {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  border-radius: 50%;
  background: rgba(201, 162, 94, .18);
  color: #e2c48c;
  margin-top: 1px;
}
.toast-ico svg { width: 13px; height: 13px; }
.toast.error .toast-ico { background: rgba(176, 91, 69, .22); color: #efb8a8; }
.toast.warn .toast-ico { background: rgba(201, 162, 94, .22); color: #efd2a0; }
.toast-text { flex: 1; min-width: 0; }
.toast-close { color: rgba(246, 240, 227, .4); padding: 2px; }
.toast-close:hover { color: #f6f0e3; }
.toast-close svg { width: 13px; height: 13px; }

/* --------------------------------------------------------------------------
   Empty states / notices
   -------------------------------------------------------------------------- */

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-ico { margin: 0 auto 12px; color: #cbbfa9; width: 46px; height: 46px; }
.empty-ico svg { width: 100%; height: 100%; }
.empty h4 { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--ink-2); }
.empty p { font-size: 11.5px; margin-top: 3px; max-width: 320px; margin-left: auto; margin-right: auto; }
.empty .btn { margin-top: 14px; }

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #ead9b7;
  border-radius: 11px;
  background: #fdf6e6;
  font-size: 11.5px;
  color: #7b5c26;
  margin-bottom: 18px;
}
.notice svg { width: 15px; height: 15px; flex: 0 0 auto; }
.notice .link-btn { color: #7b5c26; text-decoration: underline; }
.notice-close { margin-left: auto; color: #a98c53; }
.notice-close svg { width: 14px; height: 14px; }

/* --------------------------------------------------------------------------
   Settings
   -------------------------------------------------------------------------- */

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row-main { min-width: 0; }
.setting-row-title { font-size: 12.5px; font-weight: 600; }
.setting-row-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}
.conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.conn.on { color: var(--sage); }
.conn.on i { background: var(--sage); box-shadow: 0 0 0 3px rgba(92, 122, 96, .14); }
.conn.local { color: var(--gold-2); }
.conn.local i { background: var(--gold-3); }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  background: #f4eee2;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

/* --------------------------------------------------------------------------
   Auth
   -------------------------------------------------------------------------- */

.auth {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1.04fr .96fr;
  background: var(--cream);
  overflow-y: auto;
}
.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 50px 54px 40px;
  overflow: hidden;
  color: #f0e7d6;
  background:
    radial-gradient(700px 420px at 85% 10%, rgba(201, 162, 94, .14), transparent 65%),
    linear-gradient(155deg, #1e2839 0%, #161e2e 48%, #101724 100%);
}
.auth-visual::before {
  content: "";
  position: absolute;
  right: -280px;
  top: -270px;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 94, .17);
  box-shadow: 0 0 0 70px rgba(201, 162, 94, .03), 0 0 0 140px rgba(201, 162, 94, .025);
}
.auth-visual::after {
  content: "";
  position: absolute;
  left: -160px;
  bottom: -220px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 94, .1);
}
.auth-brand, .auth-hero, .auth-quote { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-brand .brand-seal { width: 44px; height: 44px; font-size: 15px; }
.auth-brand-name { font-family: var(--serif); font-size: 22px; color: #f5eddd; letter-spacing: .015em; }
.auth-brand-sub {
  display: block;
  margin-top: 1px;
  font-size: 8.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(240, 231, 214, .42);
}
.auth-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(52px, 5.6vw, 76px);
  line-height: .94;
  letter-spacing: -.025em;
}
.auth-hero h1 em { font-style: italic; color: #d9b87b; }
.auth-hero p {
  margin-top: 22px;
  max-width: 370px;
  font-size: 13.5px;
  line-height: 1.75;
  color: rgba(240, 231, 214, .56);
}
.auth-hero .fleuron { margin-top: 26px; color: rgba(201, 162, 94, .55); }
.auth-quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.6;
  color: rgba(240, 231, 214, .48);
  max-width: 420px;
}
.auth-quote span { display: block; margin-top: 8px; font-family: var(--sans); font-style: normal; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: rgba(240, 231, 214, .3); }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 44px 40px;
}
.auth-card { width: min(410px, 100%); }
.auth-title {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -.02em;
}
.auth-desc { margin-top: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.auth-form { margin-top: 24px; display: flex; flex-direction: column; gap: 13px; }
.auth-form .btn { margin-top: 3px; }
.auth-error {
  display: none;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--terra-soft);
  border: 1px solid #eccabf;
  color: #8d3f2d;
  font-size: 11.5px;
  line-height: 1.5;
}
.auth-error.show { display: block; }

.role-list { display: flex; flex-direction: column; gap: 9px; margin-top: 22px; }
.role-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 13px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.role-card:hover {
  border-color: #d9c39a;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -18px rgba(23, 29, 39, .5);
}
.role-ico {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  border-radius: 50%;
  background: var(--gold-wash);
  color: var(--gold-2);
}
.role-ico svg { width: 17px; height: 17px; }
.role-main { flex: 1; min-width: 0; }
.role-name { display: block; font-size: 12.5px; font-weight: 600; }
.role-sub { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.role-arrow { color: var(--muted-2); transition: transform .18s, color .18s; }
.role-arrow svg { width: 15px; height: 15px; }
.role-card:hover .role-arrow { transform: translateX(2px); color: var(--gold-2); }

.auth-foot { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.auth-note { font-size: 10.5px; color: var(--muted-2); line-height: 1.6; }
.auth-link {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.auth-link:hover { color: var(--gold-2); border-color: var(--gold-3); text-decoration: none; }
.auth-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 4px;
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* --------------------------------------------------------------------------
   Mobile nav
   -------------------------------------------------------------------------- */

.mobile-nav { display: none; }
.mnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted-2);
  transition: color .16s;
}
.mnav-ico {
  width: 34px;
  height: 25px;
  display: grid;
  place-content: center;
  border-radius: 8px;
  transition: background .16s, color .16s;
}
.mnav-ico svg { width: 17px; height: 17px; }
.mnav-item.active { color: var(--ink); }
.mnav-item.active .mnav-ico { background: var(--gold-soft); color: var(--gold-2); }

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes popOut { to { opacity: 0; transform: translateY(6px) scale(.99); } }
@keyframes slideIn { from { transform: translateX(26px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; }
.scroll-x { overflow-x: auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .searchbox { width: 200px; }
  .searchbox kbd { display: none; }
  .date-chip { display: none; }
}

@media (max-width: 1120px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split-wide, .settings-grid { grid-template-columns: 1fr; }
  .topbar, .page { padding-left: 26px; padding-right: 26px; }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 284px;
    transform: translateX(-102%);
    transition: transform .3s var(--ease);
    box-shadow: 30px 0 60px -40px rgba(0, 0, 0, .6);
  }
  .sidebar.open { transform: none; }
  .topbar { height: 76px; padding: 0 18px; gap: 12px; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar-title h1 { font-size: 21px; }
  .topbar-title .overline { font-size: 8.5px; letter-spacing: .14em; }
  .page { padding: 22px 18px 100px; }
  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    justify-content: space-around;
    align-items: center;
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    background: rgba(255, 252, 246, .93);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--line);
  }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toasts { bottom: 86px; }
  .auth { grid-template-columns: 1fr; }
  .auth-visual { min-height: 240px; padding: 30px 28px 26px; justify-content: flex-start; }
  .auth-hero h1 { font-size: 44px; margin-top: 26px; }
  .auth-hero p, .auth-hero .fleuron, .auth-quote { display: none; }
  .auth-panel { min-height: auto; padding: 34px 26px 60px; }
  .auth-visual::before { right: -340px; top: -380px; }
}

@media (max-width: 760px) {
  .searchbox { display: none; }
  .bell { margin-left: auto; }
  .topbar-actions { gap: 2px; }
  .greeting { align-items: flex-start; }
  .greeting h2 { font-size: 32px; }
  .greeting-actions { width: 100%; }
  .greeting-actions .btn { flex: 1; }
  .cols-3 { grid-template-columns: 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
  .grid { gap: 14px; }
  .card-pad { padding: 18px; }
  .page-head { align-items: flex-start; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1; }
  .week-scroll { display: none; }
  .schedule-mobile { display: block; }
  .day-pills { gap: 4px; overflow: visible; }
  .day-pill { flex: 1; min-width: 0; padding: 6px 3px; }
  .week-toolbar { padding: 14px; }
  .week-range { font-size: 15px; min-width: 130px; }
  .dl { grid-template-columns: 1fr; }
  .overlay { padding: 0; align-items: flex-end; }
  .overlay-panel {
    width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    animation: sheetUp .3s var(--ease);
  }
  .overlay.drawer-mode .overlay-panel { width: 100%; height: 100vh; border-radius: 0; }
  .modal-head { padding: 20px 20px 12px; }
  .modal-body { padding: 6px 20px; overflow-x: hidden; }
  .modal-foot { padding: 14px 20px calc(18px + env(safe-area-inset-bottom)); }
  .drawer-head { padding: 22px 20px 18px; }
  .tabs { padding: 0 16px; }
  .drawer-body { padding: 20px 20px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr {
    margin: 0 12px 12px;
    padding: 6px 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    box-shadow: var(--shadow-xs);
  }
  .table tbody tr:hover { background: var(--paper); }
  .table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--line-soft);
    text-align: right;
  }
  .table td::before {
    content: attr(data-label);
    flex: 0 0 82px;
    width: 82px;
    padding-top: 2px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted-2);
    text-align: left;
  }
  .table td > span,
  .table td > b,
  .table td > a {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
  }
  .table td > span:not(.chip):not(.status) { flex: 1; white-space: normal; }
  .toolbar .btn-primary { flex: 1 0 100%; }
  .table td:first-child, .table td:last-child { padding: 8px 14px; }
  .table td:last-child { border-bottom: 0; }
  .table td[data-label=""]::before, .table td.cell-person::before { display: none; }
  .table td.cell-person { justify-content: flex-start; padding: 12px 14px 10px; }
  .table td.cell-person .person { gap: 10px; }
  .table td.col-actions { justify-content: flex-end; padding-top: 4px; }
  .table td.col-actions::before { display: none; }
  .balance { min-width: 0; align-items: flex-end; }
  .balance-head { justify-content: flex-end; }
  .balance-track { width: 110px; }
  .material-grid, .materials-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .materials-grid { gap: 12px; }
  .material { padding: 15px; }
  .teacher-stats { grid-template-columns: repeat(3, 1fr); }
  .toasts { right: 12px; left: 12px; bottom: 84px; max-width: none; }
}

@media (max-width: 520px) {
  .page { padding: 18px 14px 96px; }
  .topbar { padding: 0 14px; }
  .topbar-title h1 { font-size: 19px; }
  .greeting h2 { font-size: 29px; }
  .kpi { min-height: 132px; padding: 15px 16px 14px; }
  .kpi-value { font-size: 33px; }
  .kpi-label { font-size: 9px; letter-spacing: .09em; max-width: 110px; }
  .kpi .spark { display: none; }
  .kpi-foot { margin-top: 8px; }
  .cols-4 { gap: 10px; }
  .card-head { flex-direction: column; gap: 8px; }
  .card-actions { width: 100%; }
  .week-range { min-width: 118px; font-size: 14px; }
  .auth-visual { min-height: 210px; padding: 26px 22px; }
  .auth-hero h1 { font-size: 38px; margin-top: 20px; }
  .auth-panel { padding: 28px 20px 50px; }
  .auth-title { font-size: 31px; }
  .modal-title { font-size: 21px; }
  .drawer-name { font-size: 23px; }
  .ring { width: 88px; height: 88px; }
}

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

@keyframes sheetUp { from { transform: translateY(28px); opacity: .7; } to { transform: none; opacity: 1; } }
