/* GSD — Bosstek palette: tinted off-black, teal → blue → cobalt gradient */
:root {
  --bg: #070B12;
  --bg-2: #0E141C;
  --panel: #111820;
  --panel-2: #161E27;
  --border: rgba(255,255,255,0.08);
  --border-3: rgba(255,255,255,0.16);
  --text: #F5F6F8;
  --text-2: #B6BCC6;
  --text-3: #6E7682;
  --teal: #12B0C4;
  --accent: #3B8EE0;
  --accent-2: #2647CF;
  --sky: #6FB9EE;
  --grad: linear-gradient(120deg, var(--teal), var(--accent) 52%, var(--accent-2));
  --red: #FF5C6C;
  --orange: #FF9F43;
  --yellow: #F7C948;
  --green: #2ED39A;
  --radius: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); }
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; font-size: 16px; color: var(--text); }
[hidden] { display: none !important; }

.glow {
  position: fixed; inset: -20vh -30vw auto; height: 60vh; pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, rgba(18,176,196,0.18), transparent 70%),
              radial-gradient(closest-side at 70% 40%, rgba(38,71,207,0.22), transparent 70%);
  filter: blur(20px);
}

.wordmark {
  font-family: 'Cabinet Grotesk', 'DM Sans', sans-serif;
  font-weight: 800; letter-spacing: -0.02em; font-size: 40px; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wordmark.big { font-size: 72px; }

/* ---------- Welcome ---------- */
.welcome { position: relative; z-index: 1; min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 24px calc(24px + var(--safe-b)); }
.welcome-inner { width: 100%; max-width: 380px; text-align: center; display: flex; flex-direction: column; gap: 18px; }
.welcome-logo { width: 88px; height: 88px; border-radius: 24px; margin: 0 auto; box-shadow: 0 20px 50px rgba(38,71,207,0.45); }
.tagline { color: var(--text); font-size: 20px; font-weight: 600; margin-top: -8px; }
.tagline span { color: var(--text-3); font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.field input, .field textarea, .code-row input {
  width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; outline: none; transition: border-color .2s;
}
.field input:focus, .field textarea:focus, .code-row input:focus { border-color: var(--accent); }
.field textarea { resize: none; min-height: 72px; }
.join-box p { color: var(--text); margin-bottom: 10px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 13px; margin: 14px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.code-row { display: flex; gap: 10px; }
.code-row input { text-transform: uppercase; letter-spacing: 0.1em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 15px 20px; border-radius: 14px; font-weight: 700; font-size: 16px; transition: transform .12s, opacity .2s; }
.btn:active { transform: scale(0.97); }
.btn.primary { width: 100%; background: var(--grad); color: #fff; box-shadow: 0 10px 30px rgba(59,142,224,0.35); }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--border-3); color: var(--text); }
.btn.danger { background: rgba(255,92,108,0.12); color: var(--red); border: 1px solid rgba(255,92,108,0.25); }
.row2 .btn { white-space: nowrap; }
.btn.small { padding: 9px 14px; font-size: 14px; border-radius: 11px; }
.btn:disabled { opacity: .5; }

/* ---------- App shell ---------- */
.app { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: calc(18px + var(--safe-t)) 18px calc(120px + var(--safe-b)); }
.top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.hello { font-size: 14px; color: var(--text-3); font-weight: 500; margin-bottom: 4px; }
.summary { margin-top: 8px; font-size: 14px; color: var(--text-2); display: flex; gap: 12px; flex-wrap: wrap; }
.summary b { color: var(--text); }
.summary .s-over b { color: var(--red); }
.summary .s-today b { color: var(--orange); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 42px; height: 42px; border-radius: 13px; background: var(--panel); border: 1px solid var(--border); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--text-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); transition: background .3s; }
.sync-dot.off { background: var(--orange); box-shadow: 0 0 10px var(--orange); }
.sync-dot.busy { background: var(--sky); box-shadow: 0 0 10px var(--sky); }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 14px; padding: 2px 18px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); font-weight: 600; font-size: 14px; color: var(--text-2); white-space: nowrap; transition: all .2s; }
.chip .n { font-size: 12px; background: rgba(255,255,255,0.08); padding: 1px 7px; border-radius: 999px; color: var(--text-2); }
.chip.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 20px rgba(59,142,224,0.3); }
.chip.on .n { background: rgba(255,255,255,0.22); color: #fff; }
.chip.add { color: var(--sky); border-style: dashed; border-color: rgba(111,185,238,0.4); }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.seg { flex: 1; display: flex; padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 13px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--text-3); transition: all .2s; white-space: nowrap; }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--border-3); }

.list-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 6px; }
.list-head h2 { font-family: 'Cabinet Grotesk', sans-serif; color: var(--text); font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.list-head .members { font-size: 13px; color: var(--text-3); }
.list-head button { color: var(--sky); font-weight: 600; font-size: 14px; padding: 6px 2px; }

/* ---------- Tasks ---------- */
.group { margin-top: 18px; }
.group-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin: 0 4px 8px; }
.group-h .dot { width: 7px; height: 7px; border-radius: 50%; }
.group-h .count { color: var(--text-3); font-weight: 600; opacity: .7; }
.group-h .spacer { flex: 1; }
.group-h button { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--sky); font-weight: 600; }

.task { position: relative; margin-bottom: 8px; border-radius: var(--radius); overflow: hidden; touch-action: pan-y; }
.task-del { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--red)); display: flex; align-items: center; justify-content: flex-end; padding-right: 22px; color: #fff; font-weight: 700; font-size: 14px; }
.task-inner { position: relative; display: flex; align-items: flex-start; gap: 13px; padding: 14px 14px 14px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); transition: transform .25s cubic-bezier(.2,.8,.2,1), opacity .3s, background .2s; }
.task-inner:active { background: var(--panel-2); }
.task.p2 .task-inner { border-left: 3px solid var(--red); padding-left: 10px; }
.task.overdue .task-inner { background: linear-gradient(90deg, rgba(255,92,108,0.08), var(--panel) 60%); }

.check { flex: none; width: 26px; height: 26px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--border-3); display: grid; place-items: center; transition: all .25s; }
.check svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.5); transition: all .25s; }
.task.p2 .check { border-color: rgba(255,92,108,0.7); }
.task.p0 .check { border-color: rgba(255,255,255,0.1); }
.task.done .check, .check.pop { background: var(--grad); border-color: transparent; }
.task.done .check svg, .check.pop svg { opacity: 1; transform: scale(1); }
.check.pop { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.25); } }

.t-body { flex: 1; min-width: 0; }
.t-title { color: var(--text); font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.task.done .t-title { color: var(--text-3); text-decoration: line-through; font-weight: 500; }
.t-notes { font-size: 13.5px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 7px; background: rgba(255,255,255,0.05); color: var(--text-2); }
.tag.over { background: rgba(255,92,108,0.14); color: var(--red); }
.tag.today { background: rgba(255,159,67,0.14); color: var(--orange); }
.tag.soon { background: rgba(247,201,72,0.12); color: var(--yellow); }
.tag.hi { background: rgba(255,92,108,0.14); color: var(--red); }
.tag.who { background: rgba(59,142,224,0.14); color: var(--sky); }
.task.done .tag { opacity: .6; }
.leaving .task-inner { opacity: 0; transform: translateX(30px); }

.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .big { font-size: 46px; margin-bottom: 10px; }
.empty h3 { color: var(--text); font-family: 'Cabinet Grotesk', sans-serif; font-size: 22px; margin-bottom: 6px; }

.fab { position: fixed; right: max(20px, calc(50vw - 300px)); bottom: calc(24px + var(--safe-b)); z-index: 5; width: 62px; height: 62px; border-radius: 20px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 14px 40px rgba(38,71,207,0.55), 0 0 0 1px rgba(255,255,255,0.12) inset; transition: transform .15s; }
.fab:active { transform: scale(0.92); }
.fab svg { width: 28px; height: 28px; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }

/* ---------- Sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 10; background: rgba(3,6,10,0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-width: 640px; margin: 0 auto; max-height: 92dvh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--border-3); border-bottom: 0; border-radius: 26px 26px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); animation: up .28s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.sheet-x { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); color: var(--text-2); font-size: 15px; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--border-3); margin: 0 auto 16px; }
.sheet h3 { font-family: 'Cabinet Grotesk', sans-serif; color: var(--text); font-size: 22px; font-weight: 800; margin-bottom: 16px; }
.sheet .stack { display: flex; flex-direction: column; gap: 18px; }
.title-input { width: 100%; background: transparent; border: 0; outline: none; font-size: 22px !important; font-weight: 600; color: var(--text); padding: 4px 0; }
.title-input::placeholder { color: var(--text-3); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { padding: 9px 13px; border-radius: 11px; background: var(--panel); border: 1px solid var(--border); font-size: 14px; font-weight: 600; color: var(--text-2); transition: all .15s; }
.pill.on { background: rgba(59,142,224,0.18); border-color: var(--accent); color: var(--text); }
.pill.hi.on { background: rgba(255,92,108,0.16); border-color: var(--red); }
.pill.lo.on { background: rgba(255,255,255,0.08); border-color: var(--border-3); }
.row2 { display: flex; gap: 10px; }
.row2 input { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px; color-scheme: dark; }
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet-actions .btn.primary { flex: 1; }
.meta-note { font-size: 13px; color: var(--text-3); }

.share-code { text-align: center; padding: 18px; background: var(--panel); border: 1px dashed var(--border-3); border-radius: 16px; }
.share-code .code { font-family: 'Cabinet Grotesk', monospace; font-size: 30px; font-weight: 800; color: var(--text); letter-spacing: 0.08em; }
.share-code p { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.member-list { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; font-size: 14px; color: var(--text); }
.avatar i { width: 26px; height: 26px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 12px; color: #fff; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-grid button { width: 44px; height: 44px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); font-size: 22px; }
.emoji-grid button.on { border-color: var(--accent); background: rgba(59,142,224,0.18); }
.help { font-size: 14px; color: var(--text-2); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.help b { color: var(--text); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 14px; background: #1C2530; border: 1px solid var(--border-3); color: var(--text); font-size: 14.5px; font-weight: 500; box-shadow: 0 16px 40px rgba(0,0,0,0.5); animation: fade .2s; }
.toast button { color: var(--sky); font-weight: 700; }

/* ---------- Checklist items ---------- */
.tag.prog { background: rgba(18,176,196,0.14); color: var(--teal); font: inherit; font-size: 12px; font-weight: 700; padding: 3px 9px; }
.tag.prog.full { background: rgba(46,211,154,0.16); color: var(--green); }
.items { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.item { display: flex; align-items: center; gap: 11px; padding: 7px 4px; border-radius: 10px; cursor: pointer; }
.item:active { background: rgba(255,255,255,0.04); }
.ibox { flex: none; width: 21px; height: 21px; border-radius: 7px; border: 2px solid var(--border-3); display: grid; place-items: center; transition: all .2s; }
.ibox svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.5); transition: all .2s; }
.item.on .ibox, .sitem.on .ibox { background: var(--grad); border-color: transparent; }
.item.on .ibox svg, .sitem.on .ibox svg { opacity: 1; transform: scale(1); }
.itext { color: var(--text-2); font-size: 15px; overflow-wrap: anywhere; }
.item.on .itext { color: var(--text-3); text-decoration: line-through; }
.iadd { margin-top: 4px; width: 100%; background: transparent; border: 1px dashed var(--border-3); border-radius: 10px; padding: 9px 11px; outline: none; color: var(--text); }
.iadd:focus { border-style: solid; border-color: var(--accent); background: var(--bg-2); }
.iadd::placeholder, .add-items::placeholder { color: var(--sky); opacity: .8; }

.sitems { display: flex; flex-direction: column; gap: 6px; }
.sitems:empty { display: none; }
.sitem { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.sitext { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; padding: 8px 0; }
.sitem.on .sitext { color: var(--text-3); text-decoration: line-through; }
.ix { flex: none; width: 34px; height: 34px; border-radius: 9px; color: var(--text-3); font-size: 14px; }
.ix:active { background: rgba(255,92,108,0.15); color: var(--red); }
.add-items { width: 100%; background: var(--panel); border: 1px dashed rgba(111,185,238,0.45); border-radius: 12px; padding: 13px 14px; outline: none; }
.add-items:focus { border-style: solid; border-color: var(--accent); }
.field .sitext { background: transparent; border: 0; border-radius: 0; padding: 8px 0; }
.field .sitext:focus { border: 0; }
