:root {
  --bg: #f4f7f2;
  --surface: #fff;
  --soft: #e8eee8;
  --ink: #14231e;
  --muted: #65736d;
  --brand: #153d32;
  --accent: #d9f99d;
  --line: #dce4de;
  --danger: #a83d42;
  --ok: #2e7d5b;
  --warn: #b6534f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1714;
    --surface: #14231e;
    --soft: #1b3028;
    --ink: #f2f7f3;
    --muted: #a9b8b1;
    --brand: #d9f99d;
    --accent: #254c3e;
    --line: #294039;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, Manrope, system-ui, sans-serif; }
a { color: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin: auto; }
.top { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; gap: 12px; align-items: center; font-weight: 900; font-size: 22px; }
.mark { width: 40px; height: 40px; border-radius: 12px; background: #153d32; color: #d9f99d; display: grid; place-items: center; font-weight: 900; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 22px; }
.nav a { text-decoration: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 10px 14px; font-weight: 800; font-size: 14px; }
.nav a.active { background: var(--brand); color: var(--bg); border-color: var(--brand); }
.button, button { border: 0; border-radius: 12px; padding: 12px 16px; background: var(--brand); color: var(--bg); font-weight: 800; cursor: pointer; }
.ghost { background: var(--soft); color: var(--ink); }
.danger { background: transparent; color: var(--danger); padding: 4px 0; }
.inline-danger { margin: -8px 0 16px 54px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 34%),
  radial-gradient(circle at 90% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 28%),
  var(--bg);
}
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px; box-shadow: 0 20px 60px rgba(25,57,47,.1); margin-bottom: 18px; }
.auth-shell { width: min(980px, 100%); display: grid; grid-template-columns: .9fr minmax(360px, 470px); gap: 18px; align-items: stretch; animation: authIn .45s ease both; }
.auth-hero { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; padding: 34px; background: linear-gradient(145deg, var(--brand), color-mix(in srgb, var(--brand) 72%, #000)); color: #f6ffe6; min-height: 520px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 24px 70px rgba(25,57,47,.18); }
.auth-hero::before { content: ""; position: absolute; width: 220px; height: 220px; right: -62px; top: -56px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 55%, transparent); filter: blur(2px); animation: floatGlow 5s ease-in-out infinite; }
.auth-hero::after { content: "G"; position: absolute; right: 28px; bottom: -22px; font-size: 210px; line-height: .8; font-weight: 1000; color: rgba(217,249,157,.12); letter-spacing: -.12em; }
.auth-hero .brand { position: relative; z-index: 1; }
.auth-hero .mark { background: #d9f99d; color: #153d32; }
.auth-hero h1 { position: relative; z-index: 1; max-width: 360px; margin: 54px 0 12px; font-size: clamp(36px, 5vw, 58px); line-height: .92; }
.auth-hero p { position: relative; z-index: 1; max-width: 380px; color: rgba(246,255,230,.76); font-size: 15px; }
.auth-points { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }
.auth-points span { border: 1px solid rgba(246,255,230,.22); background: rgba(255,255,255,.08); border-radius: 999px; padding: 9px 12px; font-size: 12px; font-weight: 900; backdrop-filter: blur(10px); }
.auth-card { width: 100%; border-radius: 28px; margin: 0; padding: 22px; display: flex; flex-direction: column; justify-content: center; }
.auth-tab-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px; border-radius: 18px; background: var(--soft); margin-bottom: 18px; }
.auth-tab-buttons .auth-tab-button { min-height: 42px; display: grid; place-items: center; border-radius: 14px; cursor: pointer; background: transparent; color: var(--muted); font-size: 13px; font-weight: 1000; padding: 10px 8px; transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease; }
.auth-tab-buttons .auth-tab-button:hover { transform: translateY(-1px); color: var(--ink); }
.auth-tab-buttons .auth-tab-button.active { background: var(--surface); color: var(--ink); box-shadow: 0 8px 22px rgba(25,57,47,.08); }
.auth-panels { position: relative; }
.auth-panel { display: none; animation: panelIn .24s ease both; }
.auth-panel.active { display: grid; }
.auth-panel h2 { margin: 0; }
.auth-panel p { margin: -4px 0 2px; }
.build-tag { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: 11px; }
@keyframes authIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes floatGlow { 0%, 100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(-12px,18px,0) scale(1.05); } }
h1, h2, h3 { letter-spacing: -.04em; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 800; color: var(--muted); }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); padding: 10px 12px; font: 600 14px system-ui; }
input[type=color] { padding: 6px; }
.check { display: flex; grid-template-columns: none; align-items: center; gap: 10px; color: var(--ink); font-size: 14px; }
.check input { width: auto; min-height: auto; }
.form { display: grid; gap: 14px; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; padding: 14px; border-radius: 18px; background: var(--soft); margin-bottom: 12px; }
.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; padding-top: 18px; border-top: 1px solid var(--line); margin-top: 18px; }
.grid { display: grid; gap: 16px; }
.two { grid-template-columns: 1fr 1fr; }
.summary { grid-template-columns: 1.2fr 1fr 1fr; margin: 24px 0; }
.summary.compact { grid-template-columns: repeat(3, 1fr); margin: 10px 0 24px; }
.summary .card { min-height: 130px; }
.summary strong { font-size: clamp(24px, 3vw, 36px); }
.positive { color: var(--ok); }
.negative { color: var(--warn); }
.layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, .8fr); gap: 18px; }
.row { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); }
.manage-row { grid-template-columns: 42px 1fr auto; }
.icon { width: 38px; height: 38px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; font-weight: 900; }
.muted { color: var(--muted); font-size: 12px; }
.amount { text-align: right; }
.amount b { display: block; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions.vertical { align-items: flex-end; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--soft); border-radius: 14px; padding: 4px; gap: 4px; }
.tabs button { background: transparent; color: var(--muted); }
.tabs button.active { background: var(--surface); color: var(--ink); }
.notice, .error, .success { padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; margin: 12px 0; }
.notice span { width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; font-weight: 1000; }
.notice.danger, .error { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.notice.danger span { background: color-mix(in srgb, var(--danger) 16%, transparent); }
.notice.good, .success { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); }
.notice.good span { background: color-mix(in srgb, var(--good) 18%, transparent); }
.assistant .note, .note { display: grid; grid-template-columns: 28px 1fr; gap: 10px; margin-top: 14px; }
.assistant .note span, .note span { width: 26px; height: 26px; border-radius: 8px; background: var(--soft); display: grid; place-items: center; color: var(--brand); font-weight: 900; }
.mini { background: var(--soft); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.mini strong { font-size: 20px; }
.empty-state { border: 1px dashed var(--line); background: var(--soft); border-radius: 18px; padding: 18px; display: grid; gap: 8px; margin: 14px 0; }
.empty-state strong { font-size: 16px; }
.empty-state p { margin: 0; }
.news-item { border-top: 1px solid var(--line); padding: 18px 0; }
.news-item:first-of-type { border-top: 0; }
.chat-demo { display: grid; gap: 12px; }
.chat-demo div { background: var(--soft); border-radius: 16px; padding: 14px; }
.assistant-avatar { width: 96px; height: 96px; border-radius: 28px; background: radial-gradient(circle at 30% 20%, #d9f99d, #153d32 70%); display: grid; place-items: center; margin: 18px 0; box-shadow: 0 18px 50px rgba(21,61,50,.24); }
.assistant-avatar span { width: 52px; height: 52px; border-radius: 18px; background: rgba(255,255,255,.92); color: #153d32; display: grid; place-items: center; font-weight: 1000; font-size: 32px; }
.category-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 24px; }
.category-chip { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); background: var(--soft); border-radius: 999px; padding: 8px 10px; font-weight: 800; margin:0; }
.category-chip span { width: 14px; height: 14px; border-radius: 999px; }
.category-chip small { color: var(--muted); font-weight: 700; }
.category-chip button { padding: 0 4px; min-width: 20px; }
.category-editor { width: 100%; border: 1px solid var(--line); border-radius: 18px; padding: 12px; background: var(--soft); }
.category-editor summary { cursor: pointer; display: flex; gap: 8px; align-items: center; font-weight: 900; }
.category-editor summary span { width: 14px; height: 14px; border-radius: 999px; }
.category-editor summary small { color: var(--muted); }
.category-editor form { margin-top: 12px; }
.bar-row { display: grid; gap: 8px; margin: 14px 0; }
.bar-row > div:first-child { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.bar-row span { color: var(--muted); }
.bar { height: 10px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; }
.month-chart { height: 240px; display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px; align-items: end; padding: 18px 4px; border: 1px solid var(--line); border-radius: 20px; background: var(--soft); }
.month-col { display: grid; gap: 8px; align-items: end; height: 100%; text-align: center; }
.bars { height: 180px; display: flex; gap: 3px; align-items: end; justify-content: center; }
.bars span { width: 10px; min-height: 3px; border-radius: 999px 999px 0 0; }
.bars .income, .legend .income { background: var(--ok); }
.bars .expense, .legend .expense { background: var(--warn); }
.legend { display: flex; gap: 8px; align-items: center; margin: 12px 0 24px; color: var(--muted); font-size: 13px; }
.legend span { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.goal-card { border-top: 1px solid var(--line); padding: 18px 0; display: grid; gap: 12px; }
.goal-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.progress { height: 12px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 999px; }
.budget-progress.over { outline: 2px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.goal-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.edit-transaction { grid-column: 2 / 4; background: var(--soft); border-radius: 16px; padding: 12px; }
.edit-transaction summary { cursor: pointer; font-weight: 800; color: var(--muted); margin-bottom: 12px; }
.receipt-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: end; background: var(--soft); border-radius: 16px; padding: 12px; }
.admin-edit { border-top: 1px solid var(--line); padding: 14px 0; }
.admin-edit summary { cursor: pointer; font-weight: 900; display: grid; gap: 4px; }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 18px; }
.section-head h2 { margin: 0; }
.history-text { white-space: pre-wrap; overflow: auto; max-height: 220px; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px; font: inherit; font-size: 13px; }
.checklist { background: var(--soft); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 8px; margin-bottom: 18px; }
.checklist p { margin: 0; }
.check-row { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: start; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.check-row small { display: block; margin-top: 3px; }
.status-pill { display: inline-grid; place-items: center; min-height: 26px; border-radius: 999px; padding: 0 9px; font-size: 11px; font-weight: 1000; }
.status-pill.ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.status-pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: #a16207; }
.status-pill.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.recovery-once { border-color: var(--ok); }
.recovery-once code { display: block; overflow: auto; background: var(--soft); border-radius: 14px; padding: 14px; font-weight: 900; letter-spacing: .08em; }

@media (max-width: 850px) {
  .summary, .summary.compact, .layout, .two { grid-template-columns: 1fr; }
  .login { padding: 14px; align-items: start; }
  .auth-shell { grid-template-columns: 1fr; gap: 12px; }
  .auth-hero { min-height: auto; padding: 22px; border-radius: 24px; }
  .auth-hero h1 { margin: 30px 0 10px; font-size: 36px; }
  .auth-hero::after { font-size: 120px; right: 18px; bottom: -10px; }
  .auth-points { margin-top: 18px; }
  .auth-card { border-radius: 24px; padding: 18px; }
  .filters { grid-template-columns: 1fr; }
  .top { height: auto; padding: 20px 0; align-items: flex-start; }
  .actions { justify-content: flex-end; }
  .card { padding: 20px; }
  .nav { overflow: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .nav a { white-space: nowrap; }
  .manage-row, .row { grid-template-columns: 36px 1fr; }
  .row .amount, .manage-row .actions { grid-column: 2; text-align: left; align-items: flex-start; }
  .inline-danger { margin-left: 48px; }
  .goal-head, .bar-row > div:first-child { display: grid; }
  .section-head { align-items: stretch; flex-direction: column; }
  .goal-actions { grid-template-columns: 1fr; }
  .edit-transaction { grid-column: 1 / -1; }
  .receipt-actions { grid-template-columns: 1fr; }
  .month-chart { gap: 5px; overflow-x: auto; }
  .bars span { width: 7px; }
}
