:root {
  color-scheme: light;
  --ink: #142820;
  --muted: #52675b;
  --green: #0c573f;
  --green-deep: #093e2e;
  --surface: #fff;
  --paper: #f5f7f4;
  --line: #dce5dd;
  --tint: #e3f2e9;
  --radius: 17px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 290px; font-size: 1rem; }
button, input, select, textarea { font: inherit; }
button { min-height: 42px; cursor: pointer; }
button[disabled] { opacity: .65; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #358a65; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }

.layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { background: #102d22; color: white; position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 27px 17px; gap: 38px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; font-weight: 750; letter-spacing: -.04em; white-space: nowrap; }
.brand img { display: block; border-radius: 11px; }
.sidebar .brand { padding-inline: 9px; }
.sidebar nav { display: grid; gap: 6px; }
.nav-action { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; font-size: .94rem; font-weight: 650; color: #dbece1; background: transparent; border: 0; border-radius: 9px; padding: 11px 12px; }
.nav-action:hover { background: #1e4434; }
.nav-action.active { background: #285440; color: #fff; }
.nav-icon { min-width: 22px; text-align: center; font-size: 1.18rem; line-height: 1; }
.side-bottom { margin-top: auto; border-top: 1px solid #39604e; padding-top: 12px; }
.mobile-bar { display: none; }
.content { max-width: 1360px; margin: 0 auto; display: grid; gap: 21px; padding: 35px clamp(20px, 4.2vw, 64px) 48px; }
.preview-banner { background: #eee9d8; color: #534420; padding: 10px clamp(20px, 4.2vw, 64px); font-size: .9rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin-bottom: 2px; }
h1 { font-size: clamp(2rem, 3.5vw, 3.05rem); line-height: 1.07; letter-spacing: -.06em; }
.page-head p, .login p, .welcome-panel p { color: var(--muted); margin-top: 8px; line-height: 1.5; }
.page-actions { flex-shrink: 0; }
.primary, .secondary, .icon-button, .plain, .danger, .checked-button { border: 1px solid transparent; border-radius: 9px; font-weight: 650; padding: 8px 13px; }
.primary { color: white; background: var(--green); }
.primary:hover { background: var(--green-deep); }
.secondary, .icon-button { background: white; color: var(--ink); border-color: var(--line); }
.secondary:hover, .icon-button:hover, .plain:hover { background: var(--tint); }
.compact { padding: 5px 10px; font-size: .875rem; }
.icon-button { min-width: 39px; padding: 3px 9px; font-size: 1.4rem; line-height: 1; }
.plain { background: transparent; color: var(--green); padding: 4px 7px; font-size: .875rem; }
.danger { background: #fff5f3; color: #922c20; border-color: #edd1ca; }
.checked-button { background: var(--tint); color: var(--green-deep); border-color: #c3dfce; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.segmented { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: #eaf0ea; }
.segmented button { min-height: 36px; border: 0; border-radius: 7px; background: transparent; padding: 4px 12px; color: var(--muted); font-size: .9rem; font-weight: 650; }
.segmented .selected { background: white; color: var(--ink); box-shadow: 0 1px 3px #102d2218; }
.date-controls { display: flex; align-items: center; gap: 5px; }
.date-picker { position: relative; display: grid; align-items: center; background: white; border: 1px solid var(--line); border-radius: 9px; min-height: 42px; padding: 5px 9px; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.date-picker:focus-within { outline: 3px solid #358a65; outline-offset: 2px; }
.date-picker input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.date-picker input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; cursor: pointer; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { display: flex; flex-direction: column; min-height: 115px; gap: 5px; background: white; border: 1px solid var(--line); border-radius: 13px; padding: 15px; }
.metric:first-child { background: #e8f2ea; border-color: #d4e5d8; }
.metric p { min-height: 1.25em; color: #354e40; font-size: .91rem; font-weight: 650; }
.metric strong { font-size: clamp(1.25rem, 2.5vw, 1.9rem); letter-spacing: -.045em; line-height: 1.13; overflow-wrap: anywhere; }
.metric span { color: var(--muted); font-size: .82rem; line-height: 1.35; }

.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.panel, .goal-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 63px; padding: 11px 17px; border-bottom: 1px solid var(--line); }
h2 { font-size: 1.13rem; line-height: 1.3; letter-spacing: -.022em; }
.empty { padding: 19px 17px; color: var(--muted); font-size: .94rem; line-height: 1.55; }
.time-row, .task-row, .ledger-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.time-row:last-child, .task-row:last-child, .ledger-row:last-child { border-bottom: 0; }
.time-range { display: grid; gap: 3px; min-width: 67px; font-size: .8rem; }
.time-range span, .row-meta, .muted { color: var(--muted); }
.row-content { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-content > strong { display: block; font-size: .97rem; }
.row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 9px; font-size: .82rem; margin-top: 4px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; border-radius: 6px; background: #edf0ed; color: #3c4e44; padding: 3px 7px; font-size: .8rem; font-weight: 640; }
.tag-study { background: #e3eef9; color: #254f72; }
.tag-business, .tag-rapido, .tag-money { background: #e4f1e7; color: #22533a; }
.tag-personal, .tag-vaagai { background: #f0eaf7; color: #5d4477; }
.tag-distraction { background: #ffece6; color: #8b3b2a; }
.check-wrap { display: grid; place-items: center; min-width: 38px; min-height: 42px; }
input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--green); cursor: pointer; }
.done { text-decoration: line-through; color: var(--muted); }
.review { padding: 3px 17px 16px; margin: 0; }
.review dt { font-weight: 700; margin-top: 13px; }
.review dd { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .91rem; }
th, td { padding: 10px 17px; border-bottom: 1px solid var(--line); }
thead th { color: var(--muted); font-weight: 650; }
tbody th { font-weight: 600; }
tbody tr:last-child > * { border-bottom: 0; }

.calendar-labels, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-labels { background: var(--paper); color: var(--muted); font-size: .84rem; font-weight: 650; }
.calendar-labels span { padding: 9px; text-align: center; }
.calendar-day, .calendar-gap { min-height: 73px; border: 0; border-top: 1px solid var(--line); border-right: 1px solid var(--line); padding: 8px; background: white; color: var(--ink); }
.calendar-day { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; }
.calendar-day:hover, .calendar-today { background: var(--tint); }
.calendar-day span { color: var(--muted); font-size: .8rem; }
.calendar-day i { display: none; }
.calendar-grid > :nth-child(7n) { border-right: 0; }
.calendar-gap { background: var(--paper); }

.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.goal-card, .welcome-panel { padding: 17px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.goal-card h3 { margin: 6px 0 9px; font-size: 1.15rem; overflow-wrap: anywhere; }
.progress-label strong { font-size: 1.45rem; letter-spacing: -.045em; }
.progress-label span, .goal-meta { color: var(--muted); font-size: .9rem; }
progress { display: block; width: 100%; height: 9px; margin: 10px 0 12px; accent-color: var(--green); }
.goal-meta { display: grid; gap: 4px; }
.welcome-panel .row-actions { margin-top: 14px; gap: 9px; }
.streak-values { display: flex; gap: 25px; margin: 14px 0; }
.streak-values div { display: grid; }
.streak-values strong { color: var(--green); font-size: 1.65rem; line-height: 1.1; }
.streak-values span { color: var(--muted); font-size: .86rem; margin-top: 4px; }
.budget-list { padding: 8px 16px; }
.budget-list div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.budget-list div:last-child { border-bottom: 0; }
.budget-list strong, .ledger-amount { white-space: nowrap; }
.budget-total { color: var(--green-deep); font-weight: 700; }
.ledger-footer { padding: 12px 15px; color: var(--muted); border-top: 1px solid var(--line); font-size: .86rem; }

.launch { min-height: 100dvh; display: grid; place-items: center; padding: 18px; }
.login { width: min(100%, 420px); padding: 25px; }
.login h1 { margin-top: 22px; font-size: 2.15rem; }
.login form { display: grid; gap: 12px; margin-top: 18px; }
.login > button { margin-top: 18px; }
dialog { width: min(calc(100% - 24px), 510px); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: 0 20px 80px #102d2240; }
dialog::backdrop { background: #102d226a; }
.dialog-head, .dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px 17px; }
.dialog-head { border-bottom: 1px solid var(--line); }
.dialog-footer { border-top: 1px solid var(--line); flex-wrap: wrap; }
.dialog-footer > div { display: flex; flex-wrap: wrap; gap: 7px; }
.form-body { display: grid; gap: 13px; padding: 17px; }
.form-body > p { color: var(--muted); line-height: 1.5; }
.field { display: grid; gap: 5px; min-width: 0; font-weight: 650; font-size: .92rem; }
.field input, .field textarea, .field select { width: 100%; min-width: 0; min-height: 44px; padding: 7px 9px; background: white; border: 1px solid #bbcfc1; border-radius: 8px; font-size: 1rem; font-weight: 450; color: var(--ink); }
.field textarea { resize: vertical; }
.field :disabled { background: #edf1ed; }
.field-pair, .form-group { display: grid; gap: 12px; }
.field-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.help { font-size: .84rem; color: var(--muted); }
fieldset { min-width: 0; padding: 8px 10px; margin: 0; border: 1px solid var(--line); border-radius: 8px; }
.weekday-grid { display: flex; flex-wrap: wrap; gap: 1px 10px; }
.weekday { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; }
.form-error { color: #952e25 !important; font-size: .92rem; }
.notice { position: fixed; z-index: 5; bottom: 20px; right: 20px; max-width: min(92vw, 450px); background: #102d22; color: white; padding: 11px 15px; border-radius: 9px; box-shadow: 0 8px 26px #102d2240; }

@media (max-width: 1050px) {
  .layout { grid-template-columns: 170px minmax(0, 1fr); }
  .content { padding-inline: 20px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .time-row { flex-wrap: wrap; }
  .time-row .row-actions { margin-left: auto; }
}
@media (max-width: 750px) {
  .layout { display: block; }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 4; gap: 0; padding: 5px 5px calc(5px + env(safe-area-inset-bottom)); }
  .sidebar .brand, .side-bottom { display: none; }
  .sidebar nav { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .nav-action { flex-direction: column; justify-content: center; gap: 4px; font-size: .77rem; padding: 5px 1px; min-height: 50px; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #102d22; color: white; padding: calc(9px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 9px max(14px, env(safe-area-inset-left)); }
  .content { gap: 14px; padding: 19px 13px calc(83px + env(safe-area-inset-bottom)); }
  .notice { bottom: calc(72px + env(safe-area-inset-bottom)); right: 10px; }
  .calendar-day { min-height: 51px; padding: 5px; align-items: center; }
  .calendar-day span { display: none; }
  .calendar-day i { display: block; width: 6px; height: 6px; background: var(--green); border-radius: 50%; }
}
@media (max-width: 525px) {
  .split, .card-grid { grid-template-columns: 1fr; gap: 13px; }
  .page-head { align-items: flex-start; flex-wrap: wrap; }
  .page-head p { margin-top: 5px; }
  .metric { min-height: 102px; padding: 11px; }
  .metrics { gap: 8px; }
  .toolbar { gap: 7px; }
  .panel-head { min-height: 57px; padding: 8px 12px; }
  .empty { padding: 15px 12px; }
  .calendar-labels span { padding: 8px 3px; }
}
