:root {
  --ink: #171827;
  --muted: #6d6e80;
  --paper: #f7f7fc;
  --card: #ffffff;
  --purple: #5146dc;
  --purple-dark: #3930ad;
  --yellow: #ffc94a;
  --mint: #c4f0df;
  --red: #f7685b;
  --line: #e8e8f0;
  --shadow: 0 12px 36px rgba(34, 28, 96, .12);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px; background: #1d1c3b; color: #fff; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 28px; font-weight: 800; letter-spacing: -.04em; font-size: 21px; }
.logo { width: 34px; height: 34px; display: grid; place-items: center; background: var(--yellow); color: #332c00; border-radius: 12px; transform: rotate(-7deg); }
.nav { display: grid; gap: 5px; }
.nav-btn { width: 100%; padding: 12px 13px; border-radius: 10px; color: #d7d5ef; text-align: left; background: transparent; font-weight: 650; }
.nav-btn:hover, .nav-btn.active { color: #fff; background: rgba(255,255,255,.12); }
.sidebar-bottom { margin-top: auto; padding: 14px 8px; color: #c2c0df; font-size: 12px; }
.main { max-width: 1280px; width: 100%; margin: 0 auto; padding: 34px 42px 48px; }
.topbar, .section-title, .task-top, .task-bottom, .reward-top, .member-line, .history-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(28px, 4vw, 42px); line-height: 1.05; letter-spacing: -.05em; }
h2 { margin-bottom: 4px; font-size: 24px; letter-spacing: -.035em; }
h3 { margin-bottom: 4px; font-size: 17px; letter-spacing: -.02em; }
.subtle, .muted { color: var(--muted); }
.primary, .secondary, .tiny-btn, .icon-btn { border-radius: 10px; font-weight: 750; }
.primary { padding: 11px 16px; color: #fff; background: var(--purple); box-shadow: 0 6px 14px rgba(81,70,220,.25); }
.primary:hover { background: var(--purple-dark); }
.secondary { padding: 10px 14px; color: var(--purple-dark); background: #ecebff; }
.tiny-btn { padding: 8px 11px; color: var(--purple-dark); background: #eeedff; font-size: 13px; }
.tiny-btn.done { color: #277559; background: #dff7ea; }
.tiny-btn.ghost { color: var(--muted); background: #f1f1f5; }
.task-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.danger-btn { padding: 10px 12px; border-radius: 10px; color: #a32820; background: #ffe9e6; font-weight: 750; }
.badge.risk-green { color: #257253; background: #dff7ea; }
.badge.risk-yellow { color: #815c06; background: #fff1c9; }
.badge.risk-adult { color: #9d3330; background: #ffe0dc; }
.warning-text { margin: 9px 0 0; color: #a32820; font-size: 13px; font-weight: 700; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; background: #efeff6; color: var(--ink); }
.hero { margin: 28px 0; display: grid; grid-template-columns: 1.4fr .9fr; gap: 20px; }
.hero-card { min-height: 204px; padding: 26px; border-radius: 22px; background: linear-gradient(135deg, #5146dc, #7f5fdf); color: #fff; overflow: hidden; position: relative; }
.hero-card:after { content: "✦"; position: absolute; right: 18px; bottom: -43px; color: rgba(255,255,255,.16); font-size: 172px; }
.hero-card p { max-width: 480px; margin-bottom: 22px; color: #e5e2ff; }
.hero-stats { display: flex; gap: 34px; }
.hero-stats strong { display: block; font-size: 28px; }
.hero-stats span { color: #dfdcff; font-size: 13px; }
.family-card { padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); }
.streak { display: flex; justify-content: space-between; padding: 13px; border-radius: 13px; background: #fff5d6; }
.streak b { color: #705008; }
.avatar-list { display: flex; margin: 22px 0; }
.avatar { width: 42px; height: 42px; margin-right: -9px; display: grid; place-items: center; border: 3px solid #fff; border-radius: 50%; font-weight: 800; color: #fff; }
.alert { margin: 0 0 20px; padding: 12px 15px; border-radius: 12px; background: #fff4cf; color: #6e520e; font-weight: 600; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 34px; }
.summary { min-height: 115px; padding: 19px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.summary .number { display: block; margin-top: 10px; font-size: 30px; font-weight: 850; letter-spacing: -.05em; }
.summary.yellow { background: #fff9e8; }
.summary.mint { background: #effcf7; }
.section { margin-top: 32px; }
.task-list, .reward-grid, .member-grid, .history-list { display: grid; gap: 12px; }
.task { padding: 16px 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); transition: transform .15s ease, box-shadow .15s ease; }
.task:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(35,31,81,.07); }
.task.complete { opacity: .72; background: #f5fff9; }
.task-title { display: flex; align-items: center; gap: 10px; font-weight: 770; }
.task-title .check { width: 22px; height: 22px; border-radius: 7px; border: 2px solid #cac9d8; }
.complete .task-title .check { display: grid; place-items: center; border-color: #45ae83; color: #fff; background: #45ae83; }
.badges, .task-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.badge { padding: 4px 7px; border-radius: 99px; background: #f1f0f8; color: #56566a; font-size: 12px; font-weight: 680; }
.badge.floor { background: #e8f7ff; color: #26718f; }
.badge.points { background: #fff4d5; color: #8a6505; }
.badge.proof { background: #faeafa; color: #944180; }
.task-bottom { margin-top: 13px; }
.assignee { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.assignee .avatar { width: 25px; height: 25px; margin: 0; border: 0; font-size: 10px; }
.view-header { margin-bottom: 26px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 22px; }
.filter { padding: 8px 11px; border-radius: 99px; background: #ececf3; color: #59596b; font-size: 13px; font-weight: 700; }
.filter.active { color: #fff; background: var(--purple); }
.reward-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reward { padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); }
.reward-emoji { font-size: 30px; }
.reward p { min-height: 42px; color: var(--muted); font-size: 14px; }
.cost { font-weight: 850; color: #9d7000; }
.member-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.member { padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); }
.member .avatar { width: 48px; height: 48px; margin: 0 0 10px; border: 0; }
.member strong { font-size: 23px; letter-spacing: -.04em; }
.history-item { padding: 13px 0; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: 0; }
.proof-thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.empty { padding: 32px; border: 2px dashed #dedde9; border-radius: 16px; color: var(--muted); text-align: center; }
.modal-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(18,17,40,.5); }
.modal { width: min(540px, 100%); max-height: 92vh; overflow: auto; padding: 24px; border-radius: 21px; background: #fff; box-shadow: var(--shadow); }
.modal form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 12px; border: 1px solid #d8d7e4; border-radius: 10px; background: #fff; font: inherit; }
.field textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.weekday-row { display: flex; flex-wrap: wrap; gap: 8px; }
.weekday-row label { display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 9px; background: #f1f0f8; font-size: 13px; }
.weekday-row input { width: auto; padding: 0; }
.member-edit { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.member-edit legend { padding: 0 5px; color: var(--muted); font-size: 13px; font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.proof-preview { display: block; max-width: 100%; max-height: 220px; margin: 6px 0; border-radius: 12px; }
.notice { position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: 360px; padding: 13px 16px; border-radius: 13px; color: #fff; background: #28254b; box-shadow: var(--shadow); }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 80% 10%, #ddd8ff, transparent 35%), var(--paper); }
.auth-card { width: min(510px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
.auth-brand { margin-bottom: 30px; padding: 0; color: var(--ink); }
.auth-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin: 24px 0 18px; }
.auth-form { display: grid; gap: 14px; }
.auth-form .primary { margin-top: 7px; }
.invite-code { margin: 22px 0 14px; padding: 16px; border-radius: 13px; color: var(--purple-dark); background: #eeedff; font-size: 28px; font-weight: 850; letter-spacing: .12em; text-align: center; }
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; z-index: 5; height: auto; padding: 11px 13px; flex-direction: row; align-items: center; }
  .brand { padding: 0; font-size: 16px; white-space: nowrap; }
  .logo { width: 27px; height: 27px; border-radius: 9px; }
  .nav { margin-left: auto; display: flex; overflow-x: auto; }
  .nav-btn { width: auto; padding: 8px 9px; font-size: 12px; white-space: nowrap; }
  .sidebar-bottom { display: none; }
  .main { padding: 24px 17px 38px; }
  .topbar { align-items: flex-start; }
  .hero, .summary-grid, .reward-grid, .member-grid { grid-template-columns: 1fr; }
  .hero { margin: 20px 0; }
  .hero-card { min-height: 180px; }
  .form-grid { grid-template-columns: 1fr; }
}
