/* YahSync — dark dashboard
   Layout: icon rail + labeled panel on the left, sticky top bar, fluid card grid. */
:root {
  --bg: #0b1220;
  --bg-2: #0f1828;
  --surface: #141f33;
  --surface-2: #1a273f;
  --surface-3: #22314d;
  --line: #24324c;
  --line-soft: #1c2840;
  --text: #e8eef9;
  --text-2: #b4c0d6;
  --muted: #7d8ba6;

  --blue: #1e9bff;
  --blue-2: #0b7fe6;
  --rose: #e2566b;
  --violet: #8b6cf6;
  --green: #2fbf71;
  --amber: #f5a524;

  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;

  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --rail: 76px;
  --panel: 248px;
  --gap: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 14.5px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { flex: none; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--green); }
.neg { color: var(--rose); }
.late { color: var(--rose) !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 8px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) var(--panel) minmax(0, 1fr); min-height: 100%; }
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 20px 0; background: var(--bg-2); border-right: 1px solid var(--line-soft);
}
.logo { display: grid; place-items: center; }
.rail-nav { display: flex; flex-direction: column; gap: 8px; flex: 1; padding-top: 10px; }
.rail-nav a { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); transition: background .2s, color .2s; }
.rail-nav a:hover { color: var(--text); background: var(--surface); }
.rail-nav a.on { color: var(--blue); background: rgba(30, 155, 255, .14); }
.rail-avatar, .avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #4cc3ff, var(--violet)); color: #fff; font: 700 15px var(--font-display);
}

.panel {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
  padding: 26px 18px 18px; background: var(--bg-2); border-right: 1px solid var(--line-soft);
}
.panel-brand { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px 0; font: 700 19px var(--font-display); }
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-label { padding: 0 14px 6px; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: 999px; color: var(--text-2); font-weight: 600; transition: background .2s, color .2s; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.on { background: linear-gradient(90deg, rgba(30,155,255,.22), rgba(30,155,255,.08)); color: var(--blue); }
.panel-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border-radius: var(--r-md); background: var(--surface); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who b { display: block; font-size: 14px; }
.who small { color: var(--muted); }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 14px; padding: 16px 32px;
  background: rgba(11, 18, 32, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
#navToggle { display: none; }
.search { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; max-width: 460px; padding: 0 14px; height: 44px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-soft); color: var(--muted); }
.search:focus-within { border-color: var(--blue); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); }
.search kbd { font: 600 11px var(--font-body); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.search.sm { height: 40px; max-width: 300px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.today { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-weight: 600; padding: 0 6px; }

.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; border: 0; background: transparent; color: var(--text-2); cursor: pointer; position: relative;
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.danger:hover { color: var(--rose); background: rgba(226, 86, 107, .12); }
.bell .dot { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rose); color: #fff; font: 700 10.5px/18px var(--font-body); font-style: normal; }

.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 300px; z-index: 30;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, .55); padding: 8px; display: none;
}
.dropdown.open .menu { display: block; }
.menu-head { padding: 8px 10px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.menu-item { display: flex; gap: 10px; padding: 10px; border-radius: var(--r-sm); }
.menu-item:hover { background: var(--surface-3); }
.menu-item small { display: block; color: var(--muted); }
.mi-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); margin-top: 7px; flex: none; }
.mi-dot.late { background: var(--rose); }
.menu-empty { padding: 6px 10px 10px; color: var(--muted); margin: 0; }
.menu-foot { display: block; text-align: center; padding: 10px; color: var(--blue); font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; }

.content { padding: 28px 32px 12px; display: flex; flex-direction: column; gap: var(--gap); max-width: 1480px; width: 100%; }
.foot { padding: 18px 32px 26px; color: var(--muted); font-size: 12.5px; }

/* ---------- Generic blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 24px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head h2 { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head p { margin: 3px 0 0; font-size: 13px; }
.link { color: var(--blue); font-weight: 700; font-size: 13.5px; }
.link:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: 999px; border: 1px solid transparent; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform .15s, background .2s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 10px 24px -10px rgba(30, 155, 255, .8); }
.btn.primary:hover { background: var(--blue-2); }
.btn.ghost { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
.btn.ghost:hover { color: var(--text); }
.btn.danger { background: var(--rose); color: #fff; }
.btn.block { width: 100%; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line-soft); }
.seg a, .seg button { border: 0; background: none; padding: 7px 15px; border-radius: 999px; color: var(--text-2); font-weight: 700; font-size: 13px; cursor: pointer; }
.seg a:hover, .seg button:hover { color: var(--text); }
.seg .on { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.25); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.b-blue { background: rgba(30,155,255,.15); color: #5bb8ff; }
.b-rose { background: rgba(226,86,107,.15); color: #f07c8e; }
.b-violet { background: rgba(139,108,246,.17); color: #a891ff; }
.b-green { background: rgba(47,191,113,.15); color: #4fd68c; }
.b-amber { background: rgba(245,165,36,.15); color: #f7b84a; }
.b-muted { background: rgba(125,139,166,.15); color: var(--text-2); }

.prog { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.prog .bar { flex: 1; height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.prog .bar i { display: block; height: 100%; border-radius: 99px; }
.prog span { font-size: 12.5px; font-weight: 700; color: var(--text-2); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.p-blue { background: linear-gradient(90deg, #0b7fe6, #4cc3ff); }
.p-violet { background: linear-gradient(90deg, #6d4fe0, #a891ff); }
.p-green { background: linear-gradient(90deg, #22a35e, #4fd68c); }
.p-amber { background: linear-gradient(90deg, #e08c0b, #f7b84a); }

.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-md); font-weight: 600; }
.toast.ok { background: rgba(47,191,113,.12); color: #4fd68c; border: 1px solid rgba(47,191,113,.25); }
.toast.err { background: rgba(226,86,107,.12); color: #f07c8e; border: 1px solid rgba(226,86,107,.25); }
.toast.warn { background: rgba(245,165,36,.12); color: #f7b84a; border: 1px solid rgba(245,165,36,.25); }
.content > .toast { animation: toastIn .3s ease; }
@keyframes toastIn { from { transform: translateY(-6px); opacity: .4; } }

/* ---------- Dashboard ---------- */
.hero-row { display: grid; grid-template-columns: minmax(0, 2.1fr) repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.welcome {
  position: relative; overflow: hidden; display: flex; align-items: stretch; min-height: 230px;
  border-radius: var(--r-lg); padding: 28px 30px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #4cc3ff 0%, transparent 55%), linear-gradient(135deg, #1e9bff 0%, #0b6fe0 60%, #1450c8 100%);
  box-shadow: 0 24px 50px -24px rgba(30, 155, 255, .7);
}
.welcome-text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; max-width: 62%; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.welcome h1 { font-size: clamp(22px, 2.2vw, 28px); font-weight: 700; }
.welcome p { margin: 0; opacity: .9; }
.welcome-stats { display: flex; gap: 10px; margin-top: auto; padding-top: 18px; flex-wrap: wrap; }
.welcome-stats a { display: flex; flex-direction: column; padding: 10px 16px; border-radius: 16px; background: rgba(255,255,255,.16); backdrop-filter: blur(4px); transition: background .2s; }
.welcome-stats a:hover { background: rgba(255,255,255,.26); }
.welcome-stats b { font: 700 22px var(--font-display); line-height: 1.2; }
.welcome-stats span { font-size: 12.5px; opacity: .9; }
.welcome-art { position: absolute; right: -6px; bottom: -4px; width: 46%; max-width: 300px; height: auto; }
.float { animation: floaty 6s ease-in-out infinite; }
.float.b { animation-delay: -2s; }
.float.c { animation-delay: -4s; }
@keyframes floaty { 50% { transform: translateY(-6px); } }

.kpi {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 24px 22px;
  border-radius: var(--r-lg); border: 1px solid transparent; transition: transform .2s, border-color .2s;
}
.kpi:hover { transform: translateY(-2px); }
.kpi-ic { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #fff; margin-bottom: auto; }
.kpi b { font: 700 28px var(--font-display); margin-top: 22px; letter-spacing: -.02em; }
.kpi-sub { font-size: 12.5px; color: var(--text-2); opacity: .8; }
.kpi > span:last-child { font-weight: 700; color: var(--text-2); margin-top: 6px; }
.k-rose { background: linear-gradient(180deg, #3a2532, #2c2030); border-color: rgba(226,86,107,.18); }
.k-rose .kpi-ic { background: var(--rose); box-shadow: 0 10px 22px -8px var(--rose); }
.k-violet { background: linear-gradient(180deg, #2b2a4d, #232540); border-color: rgba(139,108,246,.2); }
.k-violet .kpi-ic { background: var(--violet); box-shadow: 0 10px 22px -8px var(--violet); }
.k-green { background: linear-gradient(180deg, #1d3a36, #1a2f30); border-color: rgba(47,191,113,.18); }
.k-green .kpi-ic { background: var(--green); box-shadow: 0 10px 22px -8px var(--green); }

.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.chart-box { position: relative; height: 220px; }
.chart-box.tall { height: 300px; }
.flow-foot { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.flow-foot .btn { margin-left: auto; }
.mini { display: flex; align-items: center; gap: 12px; }
.mini b { display: block; font-size: 15.5px; }
.mini small { color: var(--muted); }
.mini-ic, .list-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.list-ic { width: 36px; height: 36px; border-radius: 11px; }
.t-green { background: rgba(47,191,113,.14); color: var(--green); }
.t-rose { background: rgba(226,86,107,.14); color: var(--rose); }
.t-blue { background: rgba(30,155,255,.14); color: var(--blue); }
.t-violet { background: rgba(139,108,246,.16); color: var(--violet); }
.t-amber { background: rgba(245,165,36,.14); color: var(--amber); }
.t-muted { background: rgba(125,139,166,.14); color: var(--text-2); }

.gauge { position: relative; height: 170px; margin-top: 4px; }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; }
.gauge-center b { display: block; font: 700 30px var(--font-display); }
.gauge-center small { color: var(--muted); font-weight: 700; }
.pill-center { display: flex; justify-content: center; margin: 14px 0 18px; }
.pill-center .badge { padding: 7px 14px; font-size: 13px; }
.legend { list-style: none; margin: 0; padding: 18px 0 0; border-top: 1px solid var(--line-soft); display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.legend li { display: flex; gap: 10px; align-items: flex-start; }
.legend i { width: 12px; height: 12px; border-radius: 4px; margin-top: 5px; flex: none; }
.legend b { display: block; font-size: 16px; }
.legend small { color: var(--muted); }
.lg-blue { background: var(--blue); } .lg-green { background: var(--green); } .lg-rose { background: var(--rose); } .lg-muted { background: #5a6a88; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.list li:last-child { border-bottom: 0; }
.list li > div { flex: 1; min-width: 0; }
.list li b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li a { display: block; flex: 1; min-width: 0; }
.list.roomy li { padding: 14px 0; }
.list li.col { flex-direction: column; align-items: stretch; gap: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row-between b { min-width: 0; }
.when { font-size: 12.5px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.dot-ic { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.d-rose { background: var(--rose); box-shadow: 0 0 0 4px rgba(226,86,107,.15); }
.d-amber { background: var(--amber); box-shadow: 0 0 0 4px rgba(245,165,36,.15); }
.d-muted { background: #5a6a88; box-shadow: 0 0 0 4px rgba(125,139,166,.15); }
.empty-line { color: var(--muted); margin: 0; padding: 8px 0; }

.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.quick-links a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-soft); transition: border-color .2s, transform .2s; min-width: 0; }
.quick-links a:hover { border-color: var(--blue); transform: translateY(-1px); }
.quick-links a > span:last-child { min-width: 0; }
.quick-links b, .quick-links small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-links small { color: var(--muted); font-size: 12px; }
.fav { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, rgba(30,155,255,.25), rgba(139,108,246,.25)); color: #cfe3ff; font: 700 15px var(--font-display); }

/* ---------- Section pages ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.tile { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); min-width: 0; }
.tile > div { min-width: 0; }
.tile b { display: block; font: 700 21px var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { color: var(--muted); font-weight: 600; }
.tile-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.tile.t-blue, .tile.t-rose, .tile.t-green, .tile.t-violet, .tile.t-amber { background: var(--surface); color: inherit; }
.t-blue .tile-ic { background: rgba(30,155,255,.15); color: var(--blue); }
.t-rose .tile-ic { background: rgba(226,86,107,.15); color: var(--rose); }
.t-green .tile-ic { background: rgba(47,191,113,.15); color: var(--green); }
.t-violet .tile-ic { background: rgba(139,108,246,.17); color: var(--violet); }
.t-amber .tile-ic { background: rgba(245,165,36,.15); color: var(--amber); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 600; }

.table-wrap { position: relative; overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table .r { text-align: right; }
.cell-title b { display: block; font-weight: 600; }
.cell-title b a:hover { color: var(--blue); }
.cell-title small { display: block; color: var(--muted); font-size: 12.5px; }
.actions { white-space: nowrap; }
.actions > * { vertical-align: middle; }
form.inline { display: inline; }
.chip-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; margin-right: 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.chip-btn:hover { color: var(--green); border-color: rgba(47,191,113,.4); }

.empty { text-align: center; padding: 48px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-2); color: var(--blue); margin-bottom: 6px; }
.empty h3 { font-size: 18px; }
.empty p { margin: 0 0 10px; color: var(--muted); }

.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.link-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-soft); min-width: 0; }
.link-card:hover { border-color: var(--line); }
.link-main { display: flex; align-items: center; gap: 12px; color: var(--text); }
.link-main:hover b { color: var(--blue); }
.link-main > .ic { color: var(--muted); }
.link-text { flex: 1; min-width: 0; }
.link-text b, .link-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-text small { color: var(--muted); font-size: 12.5px; }
.link-card p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.link-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.row-actions { margin-left: auto; display: flex; }

.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); }

/* ---------- Forms & modal ---------- */
.modal { border: 0; padding: 0; background: transparent; color: var(--text); width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.modal.small { width: min(420px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(4, 8, 16, .7); backdrop-filter: blur(4px); }
.modal[open] { animation: pop .2s ease; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-body { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h2 { font-size: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.confirm-text { color: var(--text-2); margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field.check { justify-content: flex-end; padding-bottom: 8px; }
.field label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.field label em { color: var(--rose); font-style: normal; }
.field input:not([type=checkbox]):not([type=range]), .field select, .field textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { height: auto; padding: 10px 14px; resize: vertical; min-height: 84px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,155,255,.18); }
.field input::-webkit-calendar-picker-indicator { filter: invert(.75); cursor: pointer; }
.range { display: flex; align-items: center; gap: 12px; height: 44px; }
.range input { flex: 1; accent-color: var(--blue); }
.range output { width: 44px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 42px; height: 24px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .2s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Auth ---------- */
body.auth { display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(60% 50% at 80% 0%, rgba(30,155,255,.18), transparent), radial-gradient(50% 40% at 0% 100%, rgba(139,108,246,.14), transparent), var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 26px; padding: 32px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.auth-brand b { display: block; font: 700 19px var(--font-display); }
.auth-brand small { color: var(--muted); }
.auth-card h1 { font-size: 24px; }
.auth-card > p { margin: -8px 0 4px; }

/* ---------- Responsive ---------- */
.only-mobile { display: none; }
@media (max-width: 1280px) {
  .hero-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .welcome { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .shell { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .panel { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .25s ease; width: var(--panel); box-shadow: 20px 0 50px rgba(0,0,0,.5); }
  .shell.nav-open .panel { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(4,8,16,.6); }
  #navToggle, .only-mobile { display: inline-grid; }
  .grid-2-1, .grid-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid-2-1 > :first-child { grid-column: 1 / -1; }
  .grid-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { padding: 12px 16px; gap: 8px; }
  .search kbd, .today { display: none; }
  .content { padding: 18px 16px 8px; }
  .foot { padding: 14px 16px 22px; }
  .hero-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
  .kpi:last-child { grid-column: 1 / -1; }
  .welcome { padding: 22px; min-height: 0; }
  .welcome-text { max-width: 100%; }
  .welcome-art { opacity: .35; width: 60%; }
  .grid-2-1, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 > :last-child:nth-child(odd) { grid-column: auto; }
  .card { padding: 18px; border-radius: 18px; }
  .table-wrap { margin: 0 -18px; padding: 0 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 24px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tile { padding: 14px; gap: 10px; }
  .tile-ic { width: 38px; height: 38px; }
  .tile b { font-size: 17px; }
  .flow-foot .btn { margin-left: 0; width: 100%; }
  .search.sm { max-width: none; flex: 1 1 100%; }
  .toolbar .count { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
