:root {
  --bg: #f3f4fb;
  --card: #ffffff;
  --ink: #1c1e2b;
  --muted: #8b90a6;
  --line: #eceef6;
  --purple: #5b4ef5;
  --purple-deep: #473dd4;
  --gold: #f0c14a;
  --green: #1fba6a;
  --green-deep: #149456;
  --pink: #ef5d86;
  --shadow: 0 10px 28px rgba(48, 42, 110, 0.06);
  --radius: 22px;
  --sans: Inter, "Segoe UI", "Noto Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--purple); text-decoration: none; }
h1, h2, p { margin: 0; }

#app { min-height: 100vh; }
.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0 10px;
  background: rgba(243, 244, 251, 0.9);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; letter-spacing: -0.02em; }
.logo {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--purple); color: white; font-weight: 700;
}
.navlinks { display: flex; gap: 4px; }
.navlinks a {
  color: #5d6278;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
}
.navlinks a.active { background: white; color: var(--ink); box-shadow: var(--shadow); }
.roles { margin-left: auto; display: flex; padding: 4px; background: white; border-radius: 999px; box-shadow: var(--shadow); }
.roles button {
  border: 0; background: transparent; border-radius: 999px;
  padding: 8px 14px; font-weight: 700; color: var(--muted);
}
.roles button.on { background: var(--purple); color: white; }

.banner-error {
  background: #ffe8ee; color: #b4234a; border-radius: 14px;
  padding: 10px 14px; margin-bottom: 12px; font-weight: 600;
}

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 8px 0 18px; }
.eyebrow { color: var(--muted); font-size: 14px; margin-bottom: 4px; }
h1 { font-size: 32px; letter-spacing: -0.04em; line-height: 1.15; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.week-switch { display: flex; align-items: center; gap: 8px; background: white; border-radius: 999px; padding: 6px; box-shadow: var(--shadow); }
.icon-btn, .btn, .btn-primary, .btn-green, .btn-white, .btn-ghost {
  border: 0; border-radius: 999px; font-weight: 700;
}
.icon-btn {
  width: 34px; height: 34px; background: #f4f5fb; color: #3c415c;
}
.icon-btn:hover { background: #eceefe; }
.week-pill { padding: 0 8px; font-weight: 700; color: #3a3f86; }
.week-pill span { color: var(--purple); font-weight: 600; }
.btn-primary, .btn-green, .btn-white, .btn, .btn-ghost { padding: 12px 18px; }
.btn-primary { background: var(--purple); color: white; }
.btn-primary:hover { background: var(--purple-deep); }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: var(--green-deep); }
.btn-white { background: white; color: var(--purple); }
.btn-ghost { background: transparent; color: var(--purple); padding-inline: 0; }
.btn-block { width: 100%; border-radius: 16px; }

.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.day-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border-radius: 18px; padding: 14px 12px 12px;
  box-shadow: var(--shadow); color: var(--ink); min-height: 112px;
  border: 2px solid transparent;
}
.day-card.is-today { border-color: var(--purple); }
.dow { color: var(--muted); font-size: 13px; font-weight: 600; }
.day-sum { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  width: fit-content; border-radius: 999px; padding: 3px 8px;
  font-size: 12px; font-weight: 700;
}
.pill.filled { background: #e5f8ee; color: #149456; }
.pill.missed { background: #ffe8ee; color: #e2557d; }
.pill.today { background: #eeebff; color: var(--purple); }
.pill.future { background: #f1f2f7; color: #9aa0b5; }

.hero { display: grid; grid-template-columns: 1.45fr 0.9fr; gap: 16px; margin-bottom: 16px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.hero-main {
  background: linear-gradient(180deg, #6a5bff 0%, #5b4ef5 100%);
  color: white; border-radius: var(--radius); padding: 26px 28px 22px;
  box-shadow: 0 16px 32px rgba(91, 78, 245, 0.22);
  min-height: 210px;
}
.kicker { font-weight: 600; opacity: 0.92; }
.hero-top, .card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.amount-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 14px 0 16px; }
.big { font-size: 56px; line-height: 0.95; letter-spacing: -0.045em; font-weight: 700; }
.of { font-size: 20px; font-weight: 600; opacity: 0.9; padding-bottom: 6px; }
.gold-pill, .soft-pill {
  border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 700;
}
.gold-pill { background: rgba(255,255,255,0.16); color: #ffe7a3; }
.track { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.22); overflow: hidden; }
.card .track { background: #eef0f6; }
.fill { height: 100%; border-radius: inherit; background: var(--gold); }
.fine { margin-top: 12px; font-size: 14px; opacity: 0.92; }
.card .fine { color: var(--muted); opacity: 1; }
.side-amount { font-size: 42px; }

.dirs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.dir-top { display: flex; align-items: center; gap: 8px; }
.dir-ico {
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.dir-name { font-weight: 700; letter-spacing: -0.02em; }
.pct-pill { margin-left: auto; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 800; }
.dir-sum { margin: 14px 0 8px; font-size: 28px; font-weight: 700; letter-spacing: -0.04em; }
.dir-sum span { font-size: 15px; color: var(--muted); font-weight: 600; }
.metric-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.metric-list li { color: #4d536c; font-size: 14px; }
.metric-list li::before { content: "•"; color: #c5c8d6; margin-right: 6px; }

.split { display: grid; grid-template-columns: 1.35fr 0.85fr; gap: 16px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }
.panel-head h2 { font-size: 20px; letter-spacing: -0.03em; }
.panel-head span, .muted { color: var(--muted); font-size: 13px; }
.bars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: end; min-height: 240px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 240px; }
.bar-val { font-size: 13px; font-weight: 700; color: #4d536c; min-height: 18px; }
.bar-track { flex: 1; width: 100%; max-width: 74px; background: transparent; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; border-radius: 14px 14px 8px 8px; background: #ddd9ff; min-height: 8px; }
.bar-col.current .bar-fill { background: var(--purple); }
.bar-col.future .bar-val { color: #b0b4c6; font-weight: 600; }
.bar-label { font-size: 12px; color: var(--muted); text-align: center; }

.bonus-list { display: grid; gap: 10px; }
.bonus-row, .task-mini {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  background: #f6f7fb; border-radius: 16px; padding: 12px;
}
.bonus-ico {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: white; font-weight: 800;
}
.bonus-row b { display: block; }
.bonus-row p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.badge { border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; background: #eceef5; color: #6b7188; }
.badge.ok { background: #e5f8ee; color: #149456; }
.badge.wait { background: #fff4e0; color: #c68414; }
.choice-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.choice-pills button, .seg button {
  border: 0; background: white; border-radius: 999px; padding: 7px 10px; font-weight: 700; font-size: 13px; color: #4d536c;
}
.choice-pills button.on, .seg button.on { background: var(--purple); color: white; }

.review {
  display: flex; align-items: center; gap: 12px;
  background: #e7f8ee; border-radius: 20px; padding: 16px 18px; margin-bottom: 18px;
}
.review-ico {
  width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: white;
  display: grid; place-items: center; font-weight: 800;
}
.review b { display: block; }
.review span { color: #3d8f62; font-size: 14px; }

.back { font-weight: 700; }
.day-layout, .tasks-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.day-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dir-card .card-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.earn-pill { margin-left: auto; background: #f4f5fb; border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 800; color: #4d536c; }
.control { margin-top: 10px; }
.control-label { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 14px; }
.hint { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 3px; }
.stepper, .seg, .grades { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.stepper { background: #f5f6fb; border-radius: 14px; padding: 4px; width: fit-content; }
.stepper button, .grades button {
  width: 36px; height: 36px; border: 0; border-radius: 11px; background: white; font-weight: 800; color: #3c415c;
}
.stepper b { min-width: 72px; text-align: center; }
.grades button.on { background: #f5a524; color: white; }
.check-row {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 0; background: #f6f7fb; border-radius: 14px; padding: 10px 12px; text-align: left; margin-top: 8px;
  color: var(--ink);
}
.check-row .box {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid #d5d8e6;
  display: grid; place-items: center; color: transparent; background: white; flex: none;
}
.check-row.on .box { background: var(--mark, var(--purple)); border-color: transparent; color: white; }
.check-row .grow { flex: 1; font-weight: 700; }
.check-row .plus { font-weight: 800; font-size: 13px; color: var(--mark, var(--purple)); }
.status-row {
  margin-top: 8px; background: #f6f7fb; border-radius: 14px; padding: 10px 12px; font-weight: 700;
}
.side-card { color: white; background: linear-gradient(180deg, #6a5bff, #5b4ef5); }
.side-card .track { margin: 12px 0; }
.side-line { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.note-card textarea {
  width: 100%; min-height: 88px; border: 0; resize: vertical; background: #f6f7fb; border-radius: 14px; padding: 12px; margin-top: 8px;
}
.stack { display: grid; gap: 16px; }
.quiet { color: rgba(255,255,255,0.8); font-size: 13px; margin-top: 8px; }
.toggles { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  border: 0; background: #f4f5fb; border-radius: 999px; padding: 8px 12px; font-weight: 700; color: #4c516b;
}
.chip.on { background: #eeebff; color: var(--purple); }

.task-form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 16px; }
.task-form .field { flex: 1 1 150px; }
.task-form .field:first-child { flex: 2 1 240px; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 700; }
input[type="text"], input[type="number"], select, .field input {
  width: 100%; background: #f5f6fb; border: 0; border-radius: 12px; padding: 11px 12px; font-weight: 600;
}
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button { border: 0; background: #f3f4f8; border-radius: 999px; padding: 8px 10px; font-weight: 800; font-size: 13px; color: #5c6278; }
.pills button.on { color: white; }
.task-table { width: 100%; border-collapse: collapse; }
.task-table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 700; padding: 0 8px 10px; }
.task-table td { padding: 12px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.task-table tr.done td { background: #f1fbf5; }
.task-title { font-weight: 700; }
.kind {
  display: inline-block; margin-top: 4px; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 800;
  background: #eef0f6; color: #6d738c;
}
.kind.bonus { background: #fff4e0; color: #c68414; }
.dir-tag { border-radius: 999px; padding: 4px 8px; font-weight: 800; font-size: 13px; }
.money { font-weight: 800; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: #5c6278; }
.overdue { color: var(--pink); font-weight: 700; }
.linkish { border: 0; background: transparent; color: #c0c4d2; font-weight: 800; padding: 4px; }
.summary-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.summary-card .big { font-size: 48px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-bottom { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 16px; margin-top: 16px; }
.dir-fields { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.dir-fields label { font-size: 12px; }
.metric-table { display: grid; gap: 8px; }
.metric-head, .metric-row {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.7fr) minmax(72px, 0.7fr) minmax(110px, 0.9fr) auto auto; gap: 8px; align-items: center;
}
.metric-head { color: var(--muted); font-size: 12px; font-weight: 700; padding: 0 4px; }
.add { margin-top: 10px; }
.switch { position: relative; width: 42px; height: 26px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: #e1e4ef; border-radius: 99px; transition: 0.15s;
}
.switch span::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: white; top: 3px; left: 3px; transition: 0.15s;
}
.switch input:checked + span { background: var(--switch, var(--purple)); }
.switch input:checked + span::after { transform: translateX(16px); }
.summary-card { color: white; background: linear-gradient(180deg, #6a5bff, #5b4ef5); }
.summary-card .summary-line { border-bottom: 1px solid rgba(255,255,255,0.12); }
.warn { background: rgba(255,255,255,0.16); border-radius: 12px; padding: 8px 10px; margin: 8px 0; }
.footnote { color: #a0a5b8; font-size: 13px; margin: 8px 0 28px; }
.loading, .empty { padding: 28px 8px; color: var(--muted); }
.row-actions { display: flex; align-items: center; gap: 8px; }

@media (max-width: 1020px) {
  .dirs, .hero, .split, .day-layout, .tasks-layout, .settings-grid, .settings-bottom, .task-form {
    grid-template-columns: 1fr;
  }
  .day-cards { grid-template-columns: 1fr 1fr; }
  .days { display: flex; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
  .day-card { min-width: 132px; scroll-snap-align: start; }
  h1 { font-size: 26px; }
  .big { font-size: 42px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .head-actions { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .wrap { width: min(1180px, calc(100% - 20px)); }
  .topnav { flex-wrap: wrap; }
  .navlinks { order: 3; width: 100%; overflow-x: auto; }
  .day-cards { grid-template-columns: 1fr; }
  .metric-head { display: none; }
  .metric-row { grid-template-columns: 1fr 1fr; background: #f6f7fb; border-radius: 14px; padding: 8px; }
  .task-table, .task-table tbody, .task-table tr, .task-table td { display: block; }
  .task-table thead { display: none; }
  .task-table tr { border-top: 1px solid var(--line); padding: 8px 0 12px; }
  .task-table td { border: 0; padding: 4px 0; }
  .bars { min-height: 180px; }
  .bar-col { height: 180px; }
}
