/* ===== Nascent Tasks — styles (brand: nascentpc.com — Poppins, navy #112240, green #2ecc71) ===== */
:root {
  --navy: #34435f;
  --navy-2: #43547a;
  --navy-3: #55688f;
  --green: #2ecc71;
  --green-deep: #27ae60;
  --green-ink: #0f5132;

  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --surface-3: #e4e8ef;
  --border: #e6eaf0;
  --text: #1f2c45;
  --text-2: #4d5a73;
  --text-3: #8a94a6;
  --accent: #34435f;
  --accent-soft: #e9edf4;
  --accent-text: #34435f;
  --link: #1f5fbf;
  --danger: #e0443e;
  --danger-soft: #fdeceb;
  --warn: #e0961c;
  --warn-soft: #fdf3e0;
  --ok: #27ae60;
  --ok-soft: #e6f8ec;
  --shadow: 0 1px 2px rgba(17, 34, 64, .05), 0 2px 8px rgba(17, 34, 64, .06);
  --shadow-md: 0 6px 20px rgba(17, 34, 64, .10);
  --shadow-lg: 0 18px 50px rgba(17, 34, 64, .22);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Poppins', 'Ubuntu', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #161c27;
  --surface: #1f2735;
  --surface-2: #273140;
  --surface-3: #344055;
  --border: #2e3a4d;
  --text: #eef2f7;
  --text-2: #b7c2d3;
  --text-3: #7d8ba0;
  --accent: #2ecc71;
  --accent-soft: rgba(46, 204, 113, .14);
  --accent-text: #5fe39a;
  --link: #7db8ff;
  --danger: #ff6b63;
  --danger-soft: rgba(224, 68, 62, .18);
  --warn: #f3b344;
  --warn-soft: rgba(224, 150, 28, .18);
  --ok: #2ecc71;
  --ok-soft: rgba(46, 204, 113, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; overscroll-behavior-y: none; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--link); text-decoration: none; }
[hidden] { display: none !important; }
.boot { display: grid; place-items: center; height: 100dvh; color: var(--text-3); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 13px; height: 13px; stroke-width: 2.3; }
.muted { color: var(--text-3); }
code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ===== Layout ===== */
.app { display: flex; min-height: 100dvh; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 0 14px calc(var(--nav-h) + var(--safe-b) + 84px); max-width: 720px; width: 100%; margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: calc(8px + var(--safe-t)) 14px 6px; }
.topbar-inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 8px; }
.topbar h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.topbar .sub { font-size: 12px; color: var(--text-3); font-weight: 500; margin-top: -1px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); transition: background .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent-text); }

.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--border); display: flex; justify-content: space-around; align-items: stretch; }
.bottomnav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; font-weight: 500; color: var(--text-3); position: relative; }
.bottomnav button.active { color: var(--accent); font-weight: 600; }
.bottomnav button .badge { position: absolute; top: 6px; left: calc(50% + 5px); }
.badge { background: var(--green); color: var(--navy); font-size: 10px; font-weight: 700; line-height: 1; padding: 3px 5px; border-radius: 999px; min-width: 17px; text-align: center; }
.badge.red { background: var(--danger); color: #fff; }
.badge.gray { background: var(--surface-3); color: var(--text-2); }

.fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 31; width: 54px; height: 54px; border-radius: 17px; background: var(--green); color: var(--navy); display: grid; place-items: center; box-shadow: 0 10px 26px rgba(46, 204, 113, .45); transition: transform .15s, box-shadow .15s; }
.fab:hover { box-shadow: 0 12px 30px rgba(46, 204, 113, .55); transform: translateY(-1px); }
.fab:active { transform: scale(.94); }
.fab svg.i { width: 24px; height: 24px; stroke-width: 2.6; }

@media (min-width: 900px) {
  :root { --nav-h: 0px; }
  .sidebar { display: flex; flex-direction: column; width: 232px; flex: none; position: sticky; top: 0; height: 100dvh; padding: 18px 12px 14px; background: linear-gradient(180deg, #3b4a68 0%, #2f3c57 100%); color: #dbe3ef; overflow-y: auto; }
  .bottomnav { display: none; }
  .content { padding: 0 28px 110px; max-width: 780px; }
  .content.wide { max-width: 1240px; }
  .topbar { padding: 18px 28px 8px; }
  .topbar-inner { max-width: 780px; }
  .topbar h1 { font-size: 22px; }
  .fab { bottom: 26px; right: 26px; }
  .app.has-sheet .main { margin-right: 420px; }
  .app.has-sheet .fab { right: 446px; }
}

/* ===== Sidebar (navy) ===== */
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; width: 100%; text-align: left; cursor: pointer; }
.brand:hover .logo { transform: scale(1.06); }
.brand .logo { transition: transform .15s; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--green); color: var(--navy); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(46, 204, 113, .35); }
.brand .logo svg.i { stroke-width: 3; }
.brand .b1 { font-weight: 700; font-size: 15px; color: #fff; line-height: 1.1; letter-spacing: -.01em; }
.brand .b2 { font-size: 9.5px; font-weight: 600; letter-spacing: .18em; color: var(--green); }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; font-weight: 500; font-size: 13.5px; color: #c3cddd; text-align: left; transition: background .12s, color .12s; position: relative; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: rgba(46, 204, 113, .14); color: #fff; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--green); }
.nav-item .count { margin-left: auto; font-size: 11px; color: #9aa7bd; font-weight: 600; }
.nav-item.active .count { color: var(--green); }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: #9aa7bd; font-weight: 600; padding: 16px 10px 5px; display: flex; align-items: center; }
.nav-section button { margin-left: auto; color: #7f8ea6; }
.nav-section button:hover { color: var(--green); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .08); }
.sidebar .spacer { flex: 1; }
.kbd-hint { font-size: 10.5px; color: #9aa7bd; padding: 10px 8px 0; }
kbd { font-family: var(--mono); font-size: 10px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); border-radius: 4px; padding: 1px 4px; color: #c3cddd; }

/* ===== Today hero (navy card) ===== */
.hero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin: 6px 0 4px; border-radius: 16px; background: linear-gradient(135deg, #3b4a68 0%, #455880 60%, #3f6d84 100%); color: #fff; box-shadow: var(--shadow-md); }
.hero::after { content: ''; position: absolute; right: -60px; top: -80px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(46, 204, 113, .35), transparent 65%); pointer-events: none; }
.hero .ring { position: relative; width: 62px; height: 62px; flex: none; }
.hero .ring svg { width: 62px; height: 62px; transform: rotate(-90deg); }
.hero .ring circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.hero .ring .bg { stroke: rgba(255, 255, 255, .14); }
.hero .ring .fg { stroke: var(--green); transition: stroke-dashoffset .5s ease; filter: drop-shadow(0 0 6px rgba(46, 204, 113, .5)); }
.hero .ring .lbl { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-weight: 700; font-size: 13px; }
.hero .ring .lbl small { font-size: 8.5px; font-weight: 600; color: rgba(255, 255, 255, .6); display: block; text-align: center; line-height: 1; letter-spacing: .06em; text-transform: uppercase; }
.hero .ring .lbl .big { display: block; text-align: center; line-height: 1.1; }
.hero .hero-text { flex: 1; min-width: 0; position: relative; }
.hero .greet { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.hero .stats { font-size: 12px; color: rgba(255, 255, 255, .72); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; }
.hero .stats b { color: #fff; font-weight: 600; }
.hero .stats .ov, .hero .stats .ov b { color: #ff9a94; }
.hero .stats svg.i { vertical-align: -2px; color: var(--green); }
.streak { display: inline-flex; align-items: center; gap: 4px; }

/* ===== Sections & lists ===== */
.section { margin-top: 12px; }
.section-h { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--text-3); padding: 6px 2px; letter-spacing: .08em; text-transform: uppercase; }
.section-h .n { color: var(--text-3); font-weight: 500; opacity: .8; }
.section-h.danger { color: var(--danger); }
.section-h .right { margin-left: auto; font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.section-h button.link { color: var(--link); font-size: 11.5px; font-weight: 600; margin-left: auto; text-transform: none; letter-spacing: 0; }
.section-h.collapsible { cursor: pointer; user-select: none; }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.list:empty { display: none; }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); position: relative; transition: background .12s; }
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--surface-2); }
.task.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--green); }
.task.done .title { text-decoration: line-through; color: var(--text-3); }
.task.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.completing { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.015); background: var(--ok-soft); } 100% { transform: scale(1); } }
.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #b8c1cf; flex: none; margin-top: 2px; display: grid; place-items: center; color: transparent; transition: all .15s; background: var(--surface); }
.check:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.check.p3 { border-color: var(--danger); background: var(--danger-soft); }
.check.p2 { border-color: var(--warn); background: var(--warn-soft); }
.check.p1 { border-color: #5b8def; background: #e8f0fe; }
.check svg.i { width: 11px; height: 11px; stroke-width: 3.2; }
.task-body { flex: 1; min-width: 0; cursor: pointer; }
.task .title { font-weight: 500; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.task .meta { display: flex; flex-wrap: wrap; gap: 2px 9px; margin-top: 2px; font-size: 11px; color: var(--text-3); align-items: center; }
.task .meta .m { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.task .meta .m.over { color: var(--danger); font-weight: 600; }
.task .meta .m.soon { color: var(--warn); font-weight: 600; }
.task .meta .m.cat { color: var(--text-2); font-weight: 500; }
.task .meta .m.run { color: var(--green-deep); font-weight: 600; font-variant-numeric: tabular-nums; }
[data-theme="dark"] .task .meta .m.run { color: var(--green); }
.task .meta .m.tag { background: var(--surface-2); padding: 0 6px; border-radius: 999px; font-size: 10.5px; }
.task .side { flex: none; display: flex; align-items: center; gap: 4px; }
.task .side .icon-btn { width: 30px; height: 30px; color: var(--text-3); }
.task.working { background: linear-gradient(90deg, var(--ok-soft), transparent); }
.empty { text-align: center; padding: 34px 20px; color: var(--text-3); font-size: 13px; }
.empty .big { font-size: 34px; margin-bottom: 6px; }
.empty b { color: var(--text-2); display: block; font-size: 15px; margin-bottom: 2px; }
.inline-add { display: flex; align-items: center; gap: 9px; padding: 8px 12px; color: var(--text-3); font-weight: 500; font-size: 13px; width: 100%; text-align: left; border-radius: var(--radius); }
.inline-add:hover { color: var(--accent-text); background: var(--surface); }
.inline-add .plus { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 1.5px dashed var(--text-3); }
.inline-add:hover .plus { border-color: var(--green-deep); color: var(--green-deep); }

.day-group { margin-top: 14px; }
.day-h { display: flex; align-items: baseline; gap: 7px; padding: 4px 2px; }
.day-h .d { font-weight: 600; font-size: 13.5px; }
.day-h .w { color: var(--text-3); font-size: 11.5px; }
.day-h .right { margin-left: auto; font-size: 11px; color: var(--text-3); }
.day-h.today .d { color: var(--green-deep); }
[data-theme="dark"] .day-h.today .d { color: var(--green); }

/* cards for browse */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; text-align: left; display: flex; flex-direction: column; gap: 5px; min-height: 76px; transition: transform .12s, box-shadow .12s; border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card:active { transform: scale(.98); }
.card .ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; color: #fff; }
.card .nm { font-weight: 600; font-size: 13.5px; }
.card .ct { font-size: 11.5px; color: var(--text-3); }
.row-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.row-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; font-weight: 500; font-size: 13.5px; }
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: var(--surface-2); }
.row-item .count { margin-left: auto; color: var(--text-3); font-size: 12px; font-weight: 500; }
.row-item .chev { color: var(--text-3); }

/* ===== Buttons / forms ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 13px; border-radius: 9px; font-weight: 600; font-size: 13px; background: var(--surface-2); color: var(--text); transition: background .12s, transform .1s, box-shadow .12s; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
[data-theme="dark"] .btn.primary { background: var(--green); color: var(--navy); }
.btn.go { background: var(--green); color: var(--navy); box-shadow: 0 4px 12px rgba(46, 204, 113, .3); }
.btn.go:hover { background: #3ad67c; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.input, select.input, textarea.input { width: 100%; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); outline: none; transition: border .12s, box-shadow .12s; font-size: 13.5px; }
.input:focus { border-color: var(--green-deep); box-shadow: 0 0 0 3px rgba(46, 204, 113, .18); }
textarea.input { resize: vertical; min-height: 70px; }
select, select.input { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a94a6' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 28px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 10.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; }
.field .help { font-size: 11.5px; color: var(--text-3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 13px; }
.switch input { width: 40px; height: 24px; appearance: none; -webkit-appearance: none; background: var(--surface-3); border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--green); }
.switch input:checked::after { transform: translateX(16px); }
.seg { display: flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { flex: 1; padding: 6px 4px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg button.active.p3 { color: var(--danger); }
.seg button.active.p2 { color: var(--warn); }
.seg button.active.p1 { color: #3b6fd6; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); border: 1px solid transparent; line-height: 1.3; white-space: nowrap; transition: background .12s, color .12s; }
.chip:hover { background: var(--surface-3); }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
[data-theme="dark"] .chip.on { background: var(--green); color: var(--navy); border-color: var(--green); }
.chip.on .dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
.chip svg.i { width: 12px; height: 12px; }
.chip.soft { background: var(--ok-soft); color: var(--green-ink); }
[data-theme="dark"] .chip.soft { color: var(--green); }
select.chip { display: inline-block; line-height: normal; padding: 3px 24px 3px 9px; min-width: 96px; background-position: right 7px center; background-size: 13px; cursor: pointer; text-overflow: ellipsis; }
select.chip.on { background-color: var(--ok-soft); color: var(--green-ink); border-color: var(--green-deep); font-weight: 600; background-repeat: no-repeat; background-position: right 7px center; background-size: 13px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2327ae60' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
[data-theme="dark"] select.chip.on { color: var(--green); }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.panel h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; }
.panel p { margin: 0 0 8px; color: var(--text-2); font-size: 13px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.settings-row:last-child { border-bottom: 0; }

/* ===== Sheet (task detail) ===== */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(17, 34, 64, .42); z-index: 40; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 20px 20px 0 0; max-height: 94dvh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: up .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.sheet .grip { width: 36px; height: 4px; border-radius: 4px; background: var(--surface-3); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 4px 8px 0; }
.sheet-head .spacer { flex: 1; }
.sheet-head .state { font-size: 12px; color: var(--text-3); }
.sheet-body { overflow-y: auto; padding: 0 12px calc(16px + var(--safe-b)); -webkit-overflow-scrolling: touch; }
@media (min-width: 900px) {
  .sheet-backdrop { background: transparent; pointer-events: none; }
  .sheet { left: auto; top: 0; width: 420px; max-height: 100dvh; border-radius: 0; border-left: 1px solid var(--border); box-shadow: -8px 0 30px rgba(17, 34, 64, .06); animation: slide .2s ease; }
  @keyframes slide { from { transform: translateX(30px); opacity: 0; } }
  .sheet .grip { display: none; }
  .sheet-head { padding: 10px 10px 0; }
}
.title-input { width: 100%; font-size: 16px; font-weight: 600; border: 0; background: transparent; outline: none; resize: none; padding: 4px 0 8px; line-height: 1.3; letter-spacing: -.01em; overflow: hidden; }
.title-input.done { text-decoration: line-through; color: var(--text-3); }
.prop { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--border); min-height: 42px; }
.prop .ic { color: var(--text-3); display: grid; place-items: center; }
.prop .ic svg.i { width: 16px; height: 16px; }
.prop .ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prop .ctl.two > select { flex: 0 1 auto; }
.prop .ctl .inl { color: var(--text-3); display: inline-flex; margin-left: 2px; }
.prop .ctl .inl-txt { font-size: 11.5px; color: var(--text-3); }
.prop .until { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.prop select[data-field="recurrence"] { flex: 1 1 120px; min-width: 120px; max-width: 200px; }
.prop input[data-field="recur_until"] { width: 138px; }
.prop .rb, .prop .rb-days { margin-top: 2px; }
.prop .seg.pri { flex: 1; min-width: 180px; padding: 3px; }
.prop .seg.pri button { padding: 4px 2px; font-size: 11.5px; }
.prop select, .prop input[type="date"], .prop input[type="text"], .prop input[type="number"] { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); outline: none; font-size: 13px; min-width: 0; max-width: 100%; }
.prop select:focus, .prop input:focus { border-color: var(--green-deep); }
.prop input[type="number"] { width: 58px; text-align: center; }
.prop .quick { display: flex; gap: 6px; flex-wrap: wrap; }
.prop .quick button { font-size: 10.5px; font-weight: 600; color: var(--accent-text); padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); }
.prop .quick button:hover { background: var(--surface-3); }

.due-live { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 12px; }
.due-live > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.due-live .ic { width: 26px; height: 26px; border-radius: 8px; background: var(--surface); display: grid; place-items: center; color: var(--accent-text); flex: none; }
.due-live b { display: inline; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.due-live .sub { color: var(--text-2); font-size: 11.5px; }
.due-live.over { background: var(--danger-soft); }
.due-live.over .ic, .due-live.over b { color: var(--danger); }
.due-live.soon { background: var(--warn-soft); }
.due-live.soon .ic, .due-live.soon b { color: var(--warn); }

.budget { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border-radius: 12px; padding: 12px 14px; margin: 10px 0 12px; position: relative; overflow: hidden; }
.budget::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(46, 204, 113, .3), transparent 65%); pointer-events: none; }
.budget > * { position: relative; }
.budget .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.budget .lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: rgba(255, 255, 255, .6); }
.budget .clock { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; margin: 4px 0 0; }
.budget .clock.over { color: #ff9a94; }
.budget .clock.running { color: var(--green); }
.budget .sub { font-size: 12px; color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }
.budget .bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .14); margin: 8px 0 9px; overflow: hidden; }
.budget .bar i { display: block; height: 100%; background: var(--green); border-radius: 5px; transition: width 1s linear; }
.budget .bar i.over { background: #ff6b63; }
.budget .actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.budget .actions .btn { background: rgba(255, 255, 255, .1); color: #fff; }
.budget .actions .btn:hover { background: rgba(255, 255, 255, .18); }
.budget .actions .btn.go { background: var(--green); color: var(--navy); }
.budget .actions .btn.ghost { background: transparent; color: rgba(255, 255, 255, .75); }
.budget .est { display: flex; align-items: center; gap: 4px; margin-left: auto; font-size: 12px; color: rgba(255, 255, 255, .75); }
.budget .est input { width: 46px; padding: 4px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .1); color: #fff; text-align: center; font-size: 13px; outline: none; }
.budget .est input:focus { border-color: var(--green); }
.subtasks { margin: 10px 0; }
.subtasks .st { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.subtasks .st .check { width: 18px; height: 18px; margin: 0; }
.subtasks .st .check svg.i { width: 10px; height: 10px; }
.subtasks .st input[type="text"] { flex: 1; border: 0; background: transparent; outline: none; padding: 3px 0; font-size: 13px; }
.subtasks .st.done input[type="text"] { text-decoration: line-through; color: var(--text-3); }
.subtasks .st .rm { color: var(--text-3); opacity: 0; }
.subtasks .st:hover .rm { opacity: 1; }
.subtasks .add { display: flex; align-items: center; gap: 8px; color: var(--text-3); padding: 4px 0; }
.subtasks .add input { flex: 1; border: 0; background: transparent; outline: none; padding: 3px 0; font-size: 13px; }
.notes-input { width: 100%; border: 0; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; outline: none; resize: vertical; min-height: 56px; line-height: 1.5; font-size: 13px; }
.sheet-foot { display: flex; align-items: center; gap: 8px; padding: 8px 0 0; font-size: 11.5px; color: var(--text-3); }
.sheet-foot .spacer { flex: 1; }
.tags-input { width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 6px 9px; outline: none; font-size: 13px; }

/* ===== Quick add modal ===== */
.qa-backdrop { position: fixed; inset: 0; background: rgba(17, 34, 64, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.qa { width: 100%; background: var(--surface); border-radius: 20px 20px 0 0; padding: 12px 14px calc(12px + var(--safe-b)); box-shadow: var(--shadow-lg); animation: up .2s cubic-bezier(.2, .8, .2, 1); }
.qa textarea { width: 100%; border: 0; background: transparent; outline: none; font-size: 16px; font-weight: 500; resize: none; padding: 4px 0; line-height: 1.4; }
.qa .preview { display: flex; flex-wrap: wrap; gap: 4px; min-height: 24px; margin: 2px 0 8px; }
.qa .preview .chip { font-size: 11px; padding: 2px 8px; }
.qa .preview .muted { font-size: 11.5px; padding-top: 3px; }
.qa .opts { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.qa .opts .chips { gap: 4px; }
.qa .actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.qa .actions .hint { flex: 1; font-size: 11px; color: var(--text-3); }
@media (min-width: 900px) {
  .qa-backdrop { align-items: flex-start; padding-top: 10vh; }
  .qa { width: 600px; border-radius: 16px; padding: 16px 18px; }
}

/* ===== Toast ===== */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 20px); transform: translateX(-50%); z-index: 60; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 11px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); animation: up .2s ease; }
.toast button { color: var(--green); font-weight: 700; }
[data-theme="dark"] .toast { background: #eef2f7; color: #1f2c45; }
[data-theme="dark"] .toast button { color: var(--green-deep); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; width: 100%; height: 100%; }

/* ===== Login ===== */
.login { flex: 1; width: 100%; min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #3b4a68 0%, #2f3c57 100%); }
.login form { width: 100%; max-width: 340px; background: var(--surface); border-radius: 18px; padding: 26px; box-shadow: var(--shadow-lg); text-align: center; }
.login .logo { width: 52px; height: 52px; border-radius: 15px; background: var(--green); color: var(--navy); display: grid; place-items: center; margin: 0 auto 12px; }
.login .logo svg.i { width: 24px; height: 24px; stroke-width: 3; }
.login h2 { margin: 0 0 2px; font-size: 18px; }
.login p { color: var(--text-3); margin: 0 0 16px; font-size: 13px; }
.login .err { color: var(--danger); font-size: 12.5px; margin-top: 10px; }

/* ===== Review / stats ===== */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 12px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.stat .l { font-size: 11px; color: var(--text-3); font-weight: 500; }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 110px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; justify-content: flex-end; }
.bars .b i { width: 100%; background: var(--navy-3); border-radius: 4px 4px 2px 2px; min-height: 3px; opacity: .9; transition: height .3s; }
[data-theme="dark"] .bars .b i { background: var(--navy-3); }
.bars .b.today i { background: var(--green); }
.bars .b span { font-size: 9.5px; color: var(--text-3); }
.bars .b .n { font-size: 10.5px; font-weight: 600; color: var(--text-2); }

/* ===== Import preview ===== */
.import-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.import-table th, .import-table td { text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.import-table th { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.scroll-x { overflow-x: auto; }

/* search */
.search-wrap { margin: 6px 0 12px; position: relative; }
.search-wrap svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-wrap input { padding-left: 34px; }

/* utilities */
.hstack { display: flex; align-items: center; gap: 8px; }
.mt { margin-top: 12px; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--green); border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* recurrence builder */
.rb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; padding: 6px 0 2px; font-size: 12.5px; color: var(--text-2); }
.rb input[type="number"] { width: 54px; }
.rb-days { display: flex; gap: 5px; width: 100%; }
.rb-days button { flex: 1; padding: 5px 0; border-radius: 7px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--text-3); }
.rb-days button.on { background: var(--green); color: #1f2c45; }
.rb-label { width: 100%; display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--green-ink); font-weight: 600; }
[data-theme="dark"] .rb-label { color: var(--green); }

/* ===== Calendar ===== */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 4px 0 10px; }
.cal-seg { width: 220px; }
.print-title { display: none; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-day { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); min-height: 180px; display: flex; flex-direction: column; overflow: hidden; }
.cal-day.today { border-color: var(--green); box-shadow: 0 0 0 1px var(--green), var(--shadow); }
.cal-day.past { opacity: .78; }
.cal-dh { display: flex; align-items: baseline; gap: 5px; padding: 7px 9px 5px; border-bottom: 1px solid var(--border); }
.cal-dh .dn { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.cal-dh .dd { font-size: 16px; font-weight: 700; }
.cal-day.today .cal-dh .dd { color: var(--green-deep); }
.cal-dh .pl { margin-left: auto; font-size: 10px; color: var(--text-3); }
.cal-items { padding: 5px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.cal-empty { color: var(--text-3); font-size: 11px; text-align: center; padding: 8px 0; }
.cal-item { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 6px; font-size: 11.5px; line-height: 1.3; cursor: pointer; background: var(--surface-2); border-left: 2px solid transparent; min-width: 0; }
.cal-item:hover { background: var(--surface-3); }
.cal-item .dot { width: 6px; height: 6px; box-shadow: none; }
.cal-item .tm { color: var(--text-3); font-size: 10.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-item .tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cal-item svg.i { width: 10px; height: 10px; color: var(--text-3); }
.cal-item.p3 { border-left-color: var(--danger); }
.cal-item.p2 { border-left-color: var(--warn); }
.cal-item.p1 { border-left-color: #5b8def; }
.cal-item.done .tt { text-decoration: line-through; color: var(--text-3); font-weight: 400; }
.cal-item.virtual { background: transparent; border: 1px dashed var(--border); border-left-width: 2px; }
.cal-add { display: flex; align-items: center; gap: 4px; padding: 6px 9px; font-size: 11px; color: var(--text-3); border-top: 1px solid var(--border); }
.cal-add:hover { color: var(--green-deep); background: var(--surface-2); }
.cal-month { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); overflow: hidden; }
.cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-wd span { padding: 6px 8px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 96px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px 5px; cursor: pointer; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.other { background: color-mix(in srgb, var(--surface-2) 55%, transparent); color: var(--text-3); }
.cal-cell .num { font-size: 11.5px; font-weight: 600; margin-bottom: 3px; display: inline-block; padding: 1px 5px; border-radius: 6px; }
.cal-cell.today .num { background: var(--green); color: #1f2c45; }
.cal-cell .cell-items { display: flex; flex-direction: column; gap: 2px; }
.cal-cell .cell-items .cal-item { padding: 1px 4px; font-size: 10.5px; }
.cal-cell .more { font-size: 10px; color: var(--text-3); padding-left: 4px; }
.cal-cell .cell-dots { display: none; }
.cal-year { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.cal-mini { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); padding: 10px 10px 8px; }
.cal-mini .mn { font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; cursor: pointer; margin-bottom: 6px; }
.cal-mini .mn .muted { font-size: 11px; font-weight: 500; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mini-grid span { position: relative; font-size: 10.5px; text-align: center; padding: 3px 0 5px; border-radius: 5px; cursor: pointer; }
.mini-grid span.h { color: var(--text-3); font-weight: 600; font-size: 9.5px; cursor: default; }
.mini-grid span.o { visibility: hidden; }
.mini-grid span.has { font-weight: 600; }
.mini-grid span.has i { position: absolute; left: 50%; bottom: 1px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--green-deep); }
.mini-grid span.busy { background: var(--ok-soft); }
.mini-grid span.today { background: var(--green); color: #1f2c45; }
.mini-grid span:hover { background: var(--surface-3); }
@media (max-width: 700px) {
  .cal-toolbar { justify-content: center; }
  .cal-seg { width: 100%; order: 3; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-day { min-height: 0; }
  .cal-day.past:not(.today) { opacity: .6; }
  .cal-cell { min-height: 54px; padding: 3px 3px; }
  .cal-cell .cell-items { display: none; }
  .cal-cell .cell-dots { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
  .cal-cell .cell-dots i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
  .cal-cell .cell-dots b { font-size: 9px; color: var(--text-3); }
  .cal-year { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cal-mini { padding: 8px 6px 6px; }
}
@media print {
  .sidebar, .bottomnav, .fab, .topbar, #sheet-root, #qa-root, #toast, .cal-toolbar, .cal-add, .cal-empty { display: none !important; }
  html, body { background: #fff !important; color: #111 !important; }
  .app { display: block; }
  .main { margin: 0 !important; }
  .content { max-width: none !important; padding: 0 !important; width: 100%; }
  .print-title { display: block; font-size: 14px; margin: 0 0 8px; }
  .cal-week { grid-template-columns: repeat(7, 1fr) !important; gap: 4px; }
  .cal-day, .cal-month, .cal-mini, .cal-item { box-shadow: none !important; break-inside: avoid; opacity: 1 !important; }
  .cal-day, .cal-month, .cal-mini { border: 1px solid #bbb !important; }
  .cal-day { min-height: 150mm; }
  .cal-item { background: #fff !important; border: 1px solid #ddd; border-left-width: 3px; font-size: 9.5pt; page-break-inside: avoid; }
  .cal-item .tt { white-space: normal; }
  .cal-item.virtual { border-style: dashed; }
  .cal-cell { min-height: 32mm !important; padding: 3px 4px; }
  .cal-cell .cell-items { display: flex !important; }
  .cal-cell .cell-dots { display: none !important; }
  .cal-cell.today .num, .mini-grid span.today { background: #2ecc71 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cal-item .dot, .mini-grid span.has i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cal-year { grid-template-columns: repeat(3, 1fr) !important; gap: 6mm; }
  .mini-grid span.busy { background: #e6f8ec !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Today / Tomorrow switch */
.day-seg { width: 240px; margin: 6px 0 8px; }
.day-seg button { padding: 7px 4px; font-size: 12.5px; }
.day-seg .n { font-size: 10.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 1px 6px; margin-left: 2px; }
.day-seg button.active .n { background: var(--green); color: #1f2c45; }
@media (max-width: 700px) { .day-seg { width: 100%; } }

/* save status in the task panel */
.save-state { font-size: 11px; font-weight: 600; margin-right: 4px; white-space: nowrap; }
.save-state.ok { color: var(--green-deep); }
.save-state.busy { color: var(--text-3); }
.save-state.dirty { color: var(--warn); }
[data-theme="dark"] .save-state.ok { color: var(--green); }

/* start / deadline */
.prop .ctl .inl-txt.lbl { min-width: 34px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; }
.task .meta .m.dl { color: var(--text-2); }
.section-h.warn { color: var(--warn); }
.cal-item.deadline { background: var(--danger-soft); border-left-color: var(--danger); color: var(--danger); }
.cal-item.deadline svg.i { color: var(--danger); }
.cal-item.deadline .tt { font-weight: 600; }
@media print { .cal-item.deadline { background: #fff !important; border-color: #e0443e !important; } }

/* login extras */
.login .mt-s { margin-top: 8px; }
.login .or { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; color: var(--text-3); font-size: 12px; }
.login .or::before, .login .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login .g-btn { background: var(--surface); border: 1px solid var(--border); }
.login .g-btn:hover { background: var(--surface-2); }
.login .link-btn { display: block; margin: 8px auto 0; font-size: 12px; color: var(--link); }

/* pull to refresh indicator */
.ptr { position: fixed; top: 0; left: 50%; transform: translate(-50%, -60px); z-index: 25; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-md); font-size: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .15s, transform .12s; }
.ptr.show { opacity: 1; }
.ptr .spin { visibility: hidden; }
.ptr.ready { color: var(--green-deep); }
.ptr.busy .spin { visibility: visible; }
@media (min-width: 900px) { .ptr { display: none; } }
