:root {
  --ink: #17324d;
  --ink-soft: #52677a;
  --muted: #81909c;
  --paper: #f7f8f5;
  --surface: #ffffff;
  --surface-soft: #eef3f5;
  --line: #dce4e8;
  --gold: #f2b84b;
  --gold-soft: #fff3d8;
  --mint: #d9f0e2;
  --mint-strong: #2f8f68;
  --danger: #b34c4c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; max-width: 1480px; margin: 0 auto; padding: 0 30px 26px; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px; background: var(--ink); color: var(--gold); font-size: 23px; box-shadow: 0 8px 18px #17324d1f; }
.eyebrow { margin: 0; font-size: 11px; line-height: 1.2; letter-spacing: .14em; font-weight: 800; color: var(--muted); }
.accent { color: #b47b18; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 20px; letter-spacing: -.03em; }
h2 { margin: 5px 0 5px; font-size: clamp(28px, 4vw, 43px); letter-spacing: -.05em; line-height: 1; }
h3 { margin-bottom: 4px; font-size: 17px; letter-spacing: -.02em; }
.icon-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; width: 42px; height: 42px; font-size: 21px; display: grid; place-items: center; transition: .18s ease; }
.icon-button:hover { border-color: var(--ink); transform: translateY(-1px); }
.week-hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 26px 0 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.week-range { color: var(--ink-soft); margin: 0; font-size: 14px; }
.week-controls { display: flex; gap: 8px; align-items: center; }
.soft-button, .today-button, .primary-button, .outline-button, .text-button { border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 700; font-size: 13px; transition: .18s ease; }
.soft-button { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.soft-button:hover { border-color: var(--ink); background: #fbfcfc; }
.today-button { background: var(--gold); color: var(--ink); }
.today-button:hover, .primary-button:hover { filter: brightness(.97); transform: translateY(-1px); }
.primary-button { background: var(--ink); color: white; }
.outline-button { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.outline-button:hover { border-color: var(--ink); }
.text-button { background: none; padding: 0; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.summary-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 22px 0 8px; }
.summary-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; min-height: 78px; }
.summary-card .summary-name { font-size: 14px; font-weight: 800; }
.summary-card .summary-detail { color: var(--muted); font-size: 12px; margin-top: 4px; }
.summary-value { font-size: 28px; line-height: 1; font-weight: 850; letter-spacing: -.06em; }
.summary-unit { font-size: 12px; color: var(--muted); margin-left: 4px; }
.children-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding-top: 14px; }
.child-card { background: var(--surface); border: 1px solid var(--line); border-radius: 19px; overflow: hidden; box-shadow: 0 12px 28px #17324d0a; }
.child-header { padding: 19px 20px 17px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: linear-gradient(135deg, #edf4f7, #ffffff 70%); border-bottom: 1px solid var(--line); }
.child-name { display: flex; align-items: center; gap: 11px; min-width: 0; }
.avatar { width: 37px; height: 37px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; background: var(--ink); color: var(--gold); font-weight: 900; }
.child-name h3 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.child-total { text-align: right; flex: 0 0 auto; }
.child-total strong { display: block; font-size: 26px; line-height: 1; letter-spacing: -.06em; }
.child-total span { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.task-table { padding: 0 12px 14px; }
.day-head, .task-row { display: grid; grid-template-columns: minmax(150px, 1fr) repeat(7, 34px) 45px; gap: 5px; align-items: center; }
.day-head { padding: 13px 8px 9px; color: var(--muted); font-size: 11px; font-weight: 800; text-align: center; }
.day-head .task-label { text-align: left; }
.task-row { padding: 7px 8px; border-top: 1px solid #edf1f2; min-height: 45px; }
.task-label { min-width: 0; }
.task-label strong { display: block; font-size: 13px; line-height: 1.25; font-weight: 700; }
.task-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.task-button { height: 30px; width: 30px; border-radius: 9px; border: 1px solid var(--line); background: #fbfcfb; color: transparent; margin: auto; transition: .14s ease; }
.task-button:hover { border-color: var(--ink); }
.task-button.done { background: var(--mint); border-color: #9ad3b4; color: var(--mint-strong); font-weight: 900; }
.task-points { text-align: center; font-weight: 850; font-size: 12px; color: var(--ink-soft); }
.category-row { padding: 12px 8px 6px; color: #b47b18; font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.daily-total { margin: 12px 8px 0; padding: 12px 13px; display: flex; align-items: center; justify-content: space-between; border-radius: 11px; background: var(--surface-soft); color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.daily-total strong { color: var(--ink); font-size: 14px; }
.rewards { padding: 0 20px 20px; }
.rewards-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 2px 0 8px; }
.rewards-heading h4 { margin: 0; font-size: 13px; }
.rewards-heading span { font-size: 11px; color: var(--muted); }
.reward { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid #edf1f2; font-size: 12px; }
.reward small { display: block; color: var(--muted); margin-top: 2px; }
.reward-status { padding: 5px 8px; border-radius: 7px; background: var(--gold-soft); color: #956a16; font-size: 11px; font-weight: 800; white-space: nowrap; }
.reward-status.unlocked { background: var(--mint); color: var(--mint-strong); }
.app-footer { padding: 24px 2px 0; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }

.settings-dialog { border: 0; padding: 0; width: min(760px, calc(100% - 24px)); max-height: calc(100vh - 24px); background: transparent; }
.settings-dialog::backdrop { background: #102b3f88; backdrop-filter: blur(3px); }
.dialog-card { padding: 23px; border-radius: 20px; background: var(--paper); box-shadow: 0 30px 80px #102b3f55; max-height: calc(100vh - 24px); overflow-y: auto; }
.dialog-header, .section-heading, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-header { padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 29px; }
.settings-section { padding: 20px 0 5px; }
.settings-section > p, .section-heading p { color: var(--muted); font-size: 12px; margin: 0; }
.name-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.field, .editor-row { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 800; font-size: 12px; color: var(--ink-soft); }
input { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); outline: none; }
input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px #17324d13; }
.task-editor, .reward-editor { display: grid; gap: 8px; margin-top: 13px; }
.editor-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 80px 36px; align-items: center; gap: 7px; }
.editor-row.reward-edit { grid-template-columns: minmax(0, 1fr) 80px 36px; }
.editor-row select, .editor-row input { min-width: 0; }
select { appearance: none; padding: 10px 8px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
.remove-row { height: 36px; width: 36px; border: 1px solid #edd2d2; border-radius: 9px; color: var(--danger); background: #fff7f7; font-size: 18px; }
.dialog-actions { justify-content: flex-end; padding-top: 18px; margin-top: 15px; border-top: 1px solid var(--line); }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: var(--ink); color: white; padding: 10px 14px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: 0 8px 25px #17324d33; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1060px) {
  .app-shell { padding-left: 18px; padding-right: 18px; }
  .children-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .app-shell { padding: 0 12px 20px; }
  .topbar { height: 72px; }
  .week-hero { align-items: flex-start; flex-direction: column; padding: 22px 0 18px; }
  .week-controls { width: 100%; justify-content: space-between; }
  .week-controls button { padding: 9px 10px; }
  .week-controls span { display: none; }
  .summary-strip { gap: 8px; }
  .summary-card { padding: 13px; min-height: 68px; }
  .summary-card .summary-name { font-size: 12px; }
  .summary-card .summary-detail { font-size: 10px; }
  .summary-value { font-size: 23px; }
  .child-header { padding: 15px; }
  .task-table { padding: 0 7px 12px; overflow-x: auto; }
  .day-head, .task-row { grid-template-columns: minmax(138px, 1fr) repeat(7, 30px) 40px; gap: 3px; padding-left: 5px; padding-right: 5px; min-width: 414px; }
  .day-head { padding-top: 12px; }
  .task-button { width: 27px; height: 27px; border-radius: 8px; }
  .task-label strong { font-size: 12px; }
  .rewards { padding: 0 15px 15px; }
  .app-footer { align-items: flex-start; gap: 14px; flex-direction: column; }
  .name-fields { grid-template-columns: 1fr; }
  .dialog-card { padding: 17px; }
  .editor-row { grid-template-columns: 64px minmax(0, 1fr) 64px 34px; }
}
