:root {
  --bg: #f7f3f1;
  --bg-2: #fffdfc;
  --ink: #2b2326;
  --muted: #8d7b81;
  --line: rgba(120, 70, 85, 0.12);
  --rose: #b85c72;
  --rose-deep: #8d3d54;
  --rose-soft: #f8e7ec;
  --gold: #b08968;
  --card: rgba(255, 252, 251, 0.86);
  --shadow: 0 10px 30px rgba(90, 40, 55, 0.08);
  --ok: #2f7d57;
  --warn: #b8860b;
  --hot: #d06a1f;
  --bad: #c23b4e;
  --radius: 22px;
  --nav: 74px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1d1a1c;
  --bg-2: #262226;
  --ink: #f6eef1;
  --muted: #b7a4ab;
  --line: rgba(255, 210, 220, 0.12);
  --rose: #e28aa0;
  --rose-deep: #f0b3c2;
  --rose-soft: #3a2a30;
  --gold: #d4b08a;
  --card: rgba(38, 33, 36, 0.9);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  --ok: #7dcea0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(184, 92, 114, 0.16), transparent 60%),
    radial-gradient(900px 400px at -10% 0%, rgba(176, 137, 104, 0.12), transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.shell { display: block; }
.sidebar { display: none; }
.main { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 10px; align-items: center;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.search { flex: 1; }
.search input, label input, label select, label textarea, .field {
  width: 100%; border: 1px solid var(--line); background: var(--bg-2);
  border-radius: 14px; padding: 13px 14px; outline: none;
}
.search input:focus, label input:focus, label select:focus, label textarea:focus { border-color: var(--rose); }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; position: relative; cursor: pointer;
}
.bell i {
  position: absolute; top: -4px; right: -4px; background: var(--rose); color: white;
  border-radius: 99px; font-style: normal; font-size: 11px; min-width: 18px; text-align: center; padding: 1px 4px;
}
.content { padding: 16px 16px calc(var(--nav) + 78px); max-width: 1180px; margin: 0 auto; }

.hero { margin-bottom: 16px; }
.kicker { letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-size: 12px; margin: 0 0 4px; }
.hero h1 { font-size: 28px; line-height: 1.05; margin: 0; font-weight: 650; }
.hero h1 span { display: block; font-weight: 450; color: var(--muted); font-size: 16px; margin-top: 4px; }
.hello { margin: 10px 0 0; color: var(--muted); }

.scroller { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.scroller::-webkit-scrollbar { display: none; }
.stat {
  scroll-snap-align: start; min-width: 168px; flex: 1;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  animation: rise .45s ease both;
}
.card { animation: rise .4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stat small, .card small { color: var(--muted); display: block; }
.stat strong, .money { font-size: 24px; letter-spacing: -0.03em; display: block; margin-top: 6px; }
.up { color: var(--ok); } .down { color: var(--bad); }
.stat.net { background: linear-gradient(160deg, var(--rose-deep), var(--rose)); color: white; }
.stat.net small { color: rgba(255,255,255,.8); }

.grid-2, .grid-3, .form-grid { display: grid; gap: 12px; }
.form-grid { grid-template-columns: 1fr 1fr; }
.form-grid .wide { grid-column: 1 / -1; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-top: 12px;
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 16px; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.muted { color: var(--muted); }
.pill { border-radius: 999px; padding: 4px 10px; font-size: 12px; background: var(--rose-soft); color: var(--rose-deep); }
.pill.ok { background: rgba(47,125,87,.12); color: var(--ok); }
.pill.wait { background: rgba(184,134,11,.14); color: var(--warn); }
.pill.soon { background: rgba(208,106,31,.14); color: var(--hot); }
.pill.late, .pill.bad { background: rgba(194,59,78,.12); color: var(--bad); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.late { background: var(--bad); } .dot.today { background: var(--warn); } .dot.soon { background: var(--hot); }

.btn, button.btn {
  border: 0; border-radius: 14px; padding: 13px 16px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; background: var(--rose-soft); color: var(--rose-deep);
  min-height: 46px; transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(160deg, var(--rose), var(--rose-deep)); color: white; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-bad { background: rgba(194,59,78,.12); color: var(--bad); }
.btn-block { width: 100%; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(18px); border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.tabbar a { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--rose); }
.fab {
  position: fixed; right: 16px; bottom: calc(var(--nav) + 12px); z-index: 31;
  width: 58px; height: 58px; border-radius: 20px; border: 0; cursor: pointer;
  background: linear-gradient(160deg, var(--rose), var(--rose-deep)); color: white;
  font-size: 34px; line-height: 1; box-shadow: 0 12px 24px rgba(141, 61, 84, .35);
  transition: transform .18s ease;
}
.fab:hover { transform: translateY(-2px) scale(1.03); }
.fab:active { transform: scale(.96); }
.sheet { position: fixed; inset: 0; background: rgba(30, 18, 22, .45); z-index: 40; display: grid; align-items: end; }
.sheet-card { background: var(--bg-2); border-radius: 28px 28px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.sheet-grid a { background: var(--rose-soft); color: var(--rose-deep); border-radius: 16px; padding: 16px 12px; text-align: center; }

.toast { border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; background: var(--rose-soft); }
.toast-bad { background: rgba(194,59,78,.12); color: var(--bad); }
.toast-ok { background: rgba(47,125,87,.12); color: var(--ok); }
.alert { border-radius: 14px; padding: 12px; }
.alert-bad { background: rgba(194,59,78,.12); color: var(--bad); }

.bars { display: grid; gap: 8px; }
.bar-line { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.track { height: 8px; background: var(--rose-soft); border-radius: 99px; overflow: hidden; }
.track span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--rose)); border-radius: 99px; }
.chart { width: 100%; height: 180px; }
.chart polyline { fill: none; stroke: var(--rose); stroke-width: 2.4; }
.chart .exp { stroke: var(--gold); }
.donut { width: 132px; height: 132px; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal b, .cal a, .cal span { text-align: center; border-radius: 12px; padding: 8px 0; font-size: 13px; }
.cal b { color: var(--muted); font-weight: 500; }
.cal a.has { background: var(--rose-soft); color: var(--rose-deep); }
.cal a.today { outline: 2px solid var(--rose); }
.timeline { border-left: 2px solid var(--line); margin-left: 8px; display: grid; gap: 12px; }
.timeline article { padding-left: 14px; position: relative; }
.timeline article::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--rose); position: absolute; left: -6px; top: 4px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chips a { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; white-space: nowrap; font-size: 13px; }
.chips a.on { background: var(--rose); color: white; border-color: transparent; }

.auth-body { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 28px 22px; box-shadow: var(--shadow); }
.brand-kicker { letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-size: 12px; }
.lead { color: var(--muted); }
.more-list { display: grid; gap: 8px; }
.more-list a { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; justify-content: space-between; }

.empty { color: var(--muted); padding: 12px 0; }
.linkish { color: var(--rose-deep); }

@media (min-width: 980px) {
  .shell { display: grid; grid-template-columns: 250px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
    padding: 22px 16px; border-right: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg-2) 75%, transparent);
  }
  .logo { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; }
  .logo-mark { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: white; background: linear-gradient(160deg, var(--rose), var(--rose-deep)); }
  .logo small { display: block; color: var(--muted); }
  .side-nav { display: grid; gap: 4px; overflow: auto; }
  .side-nav a { padding: 10px 12px; border-radius: 12px; color: var(--muted); }
  .side-nav a.active, .side-nav a:hover { background: var(--rose-soft); color: var(--rose-deep); }
  .side-user { margin-top: auto; display: grid; gap: 2px; font-size: 14px; }
  .side-user small, .side-user a { color: var(--muted); }
  .tabbar, .fab { display: none; }
  .content { padding: 24px 28px 48px; }
  .grid-2 { grid-template-columns: 1.4fr .8fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr 1fr; }
  .hero h1 { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
