/* Layout: sidebar + content on wide screens, top bar + bottom tabs on phones. Run-sheet look: ink blue, white sheets, member colours as identity. */
:root {
  --ground: #f2f4f8; --surface: #ffffff; --raised: #f8f9fb; --ink: #18202e; --muted: #5b6577; --line: #dde2ea;
  --navy: #1f3a68; --accent: #2b54d6; --accent-soft: #e5ebfb;
  --harsh: #0f7f78; --manas: #7348c9; --jinshri: #c2502f;
  --todo: #8a93a3; --doing: #b7791f; --doing-soft: #fbf1de; --done: #2e8b57; --done-soft: #e2f3e9; --late: #c23a3a; --late-soft: #fbe6e6;
  --f-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 10px; --r-sm: 7px;
  --tabbar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #0f131a; --surface: #171d27; --raised: #1c2330; --ink: #e6eaf1; --muted: #9aa4b5; --line: #2a3242;
    --navy: #8fb0ff; --accent: #7d9bff; --accent-soft: #1f2a47;
    --harsh: #3cc2b8; --manas: #a98af0; --jinshri: #f08a68;
    --todo: #7b8597; --doing: #e0a84a; --doing-soft: #33281a; --done: #5bc48a; --done-soft: #17301f; --late: #f07272; --late-soft: #3a1c1f;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); z-index: 50; }
.skip:focus { left: 12px; }
[hidden] { display: none !important; }

/* shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
.side { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-family: var(--f-display); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--raised); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .new { margin-top: 12px; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--line); font-size: 14px; }
main { min-width: 0; padding: 28px clamp(16px, 4vw, 44px) 48px; max-width: 1080px; width: 100%; }
.topbar, .tabbar { display: none; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 10; align-items: center; justify-content: space-between; gap: 12px;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; font-size: 17px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 48px; justify-content: center; font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; border-radius: var(--r-sm); }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .plus { color: #fff; }
  .tabbar .plus span.ic { background: var(--accent); border-radius: 12px; width: 40px; height: 30px; display: grid; place-items: center; }
  main { padding: 18px max(16px, env(safe-area-inset-left, 0px)) calc(var(--tabbar) + 32px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
  h1 { font-size: 23px; }
}

/* common */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.eyebrow { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.sub { color: var(--muted); margin: 4px 0 0; max-width: 62ch; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm); border: 1px solid transparent; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .12s ease, filter .12s ease; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); filter: none; }
.btn.danger { background: var(--surface); color: var(--late); border-color: var(--line); }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: default; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 18px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.avatar.lg { width: 34px; height: 34px; font-size: 14px; }
.who { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--c); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); background: var(--surface); }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .d { background: var(--done); } .bar .p { background: var(--doing); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .grid3 { grid-template-columns: minmax(0, 1fr); } }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.stat { padding: 12px 14px; display: grid; gap: 2px; }
.stat b { font-family: var(--f-display); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.late b { color: var(--late); }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* task rows */
.group { display: grid; gap: 8px; margin-bottom: 22px; }
.ghead { display: flex; align-items: baseline; gap: 10px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.ghead.late h2 { color: var(--late); }
.ghead .n { font-size: 12px; color: var(--muted); }
.rows { display: grid; gap: 6px; }
.task { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 11px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); text-decoration: none; color: inherit; transition: border-color .12s ease, transform .12s ease; }
.task:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-1px); }
.task .title { margin: 0; font-weight: 500; }
.task[data-s="done"] .title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 12.5px; color: var(--muted); align-items: center; }
.code { font-size: 11px; font-weight: 600; background: var(--raised); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.due { font-size: 12.5px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; max-width: 150px; }
.due small { display: block; font-size: 11.5px; }
.due.late { color: var(--late); font-weight: 600; }
@media (max-width: 560px) { .task { grid-template-columns: auto minmax(0, 1fr); } .task .due { grid-column: 2; text-align: left; max-width: none; } .due small { display: inline; margin-left: 6px; } }
.st { border: 1px solid var(--line); background: var(--surface); color: var(--todo); border-radius: 999px; width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.st svg { width: 16px; height: 16px; }
.st[data-s="doing"] { color: var(--doing); background: var(--doing-soft); border-color: transparent; }
.st[data-s="done"] { color: #fff; background: var(--done); border-color: transparent; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--raised); color: var(--muted); }
.pill.doing { background: var(--doing-soft); color: var(--doing); }
.pill.done { background: var(--done-soft); color: var(--done); }
.pill.late { background: var(--late-soft); color: var(--late); }

/* competitions */
.comps { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.comp { padding: 16px; display: grid; gap: 10px; text-decoration: none; color: inherit; transition: transform .12s ease, border-color .12s ease; }
.comp:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.comp .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.comp .org { font-size: 13px; color: var(--muted); }
.comp .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); gap: 8px; }
.stack { display: flex; }
.stack .avatar { width: 22px; height: 22px; font-size: 10px; border: 2px solid var(--surface); margin-left: -6px; }
.stack .avatar:first-child { margin-left: 0; }

/* detail pages */
.two { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .two { grid-template-columns: minmax(0, 1fr); } }
.panel { padding: 16px; display: grid; gap: 12px; }
aside .panel + .panel, .two > div > .panel + .panel { margin-top: 14px; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.details { white-space: pre-wrap; margin: 0; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.check { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--done); cursor: pointer; }
.check.done span { color: var(--muted); text-decoration: line-through; }
.check .x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.check .x:hover { color: var(--late); background: var(--late-soft); }
.addrow { display: flex; gap: 8px; }
.addrow input { flex: 1; min-width: 0; }
.sub-item { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; display: grid; gap: 4px; }
.sub-item p { margin: 0; white-space: pre-wrap; }
.sub-item .meta { margin: 0; }
.feed { display: grid; gap: 0; }
.feed li { list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed ul { margin: 0; padding: 0; }
.feed time { display: block; font-size: 12px; color: var(--muted); }
.dates { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.dates li { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.dates li:last-child { border-bottom: 0; padding-bottom: 0; }
.dates b { font-weight: 600; }
.statusbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* forms */
form.f { display: grid; gap: 14px; max-width: 680px; }
.field { display: grid; gap: 6px; }
.field label, .lbl { font-weight: 600; font-size: 13.5px; }
.field .hint { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=url], input[type=password], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.err { color: var(--late); font-size: 13px; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* sign in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.signin .box { width: 100%; max-width: 400px; display: grid; gap: 18px; }
.signin .brand { padding: 0; font-size: 22px; }
.people { display: grid; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; text-align: left; font-weight: 600; font-size: 16px; min-height: 56px; }
.person:hover { border-color: var(--c); }
.person[aria-pressed="true"] { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.pin { font-size: 22px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.install { padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; background: var(--accent-soft); border-color: transparent; }
.install p { margin: 0; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 9px; font-size: 14px; z-index: 40; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgb(0 0 0 / .18); }
@media (max-width: 820px) { #toast { bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom, 0px)); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* day plan: a work slot (time column) and a deadline per task */
.task.timed { grid-template-columns: 74px auto minmax(0, 1fr) auto; }
.tm { display: grid; gap: 0; padding-top: 4px; font-variant-numeric: tabular-nums; }
.tm b { font-family: var(--f-display); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.tm b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 2px; }
.tm small { font-size: 11.5px; color: var(--muted); padding-left: 13px; }
.tm.moved b { color: var(--doing); font-size: 14px; }
.task[data-s="done"] .tm b { color: var(--muted); }
.due .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.now { display: flex; align-items: center; gap: 8px; color: var(--late); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.now::after { content: ""; flex: 1; height: 1.5px; background: var(--late); border-radius: 1px; }
.empty.small { padding: 16px 12px; font-size: 14px; }

.strip-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.strip-head .mono { font-weight: 600; font-size: 14px; min-width: 120px; text-align: center; }
.strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 22px; }
.dchip { display: grid; justify-items: center; gap: 2px; padding: 8px 4px 7px; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); color: var(--ink); text-decoration: none; min-height: 84px; transition: box-shadow .12s ease, transform .12s ease; }
.dchip:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 50%, var(--line)); transform: translateY(-1px); }
.dchip .dw { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.dchip b { font-family: var(--f-display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.dchip .dots { display: flex; gap: 3px; min-height: 6px; }
.dchip .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.dchip .cnt { font-size: 11px; color: var(--muted); display: grid; justify-items: center; line-height: 1.25; font-variant-numeric: tabular-nums; }
.dchip .cnt em { font-style: normal; color: var(--late); font-weight: 600; }
.dchip.past { opacity: .6; }
.dchip.today .dw { color: var(--accent); }
.dchip[aria-current="date"] { background: var(--ink); color: var(--surface); box-shadow: none; opacity: 1; }
.dchip[aria-current="date"] .dw, .dchip[aria-current="date"] .cnt { color: color-mix(in srgb, var(--surface) 75%, transparent); }
.dchip[aria-current="date"] .cnt em { color: #ffb4a8; }
.dchip[aria-current="date"] .dots i { box-shadow: 0 0 0 1.5px var(--ink); }
@media (max-width: 560px) { .strip { gap: 4px; } .dchip { min-height: 76px; padding: 7px 2px 6px; border-radius: 10px; } .dchip b { font-size: 17px; } .dchip .cnt em { font-size: 10px; } }

.dayhead { margin-bottom: 10px; }
.dayhead h2 { font-size: 20px; }
.dayhead .muted { font-weight: 500; }
.lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; align-items: start; }
.lanes.one { grid-template-columns: minmax(0, 1fr); }
.lane { display: grid; gap: 8px; }
.lane-head { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 6px; border-bottom: 2px solid var(--c); }
.lane-head .n { font-size: 12px; color: var(--muted); }
.lanes:not(.one) .task.timed { grid-template-columns: 58px auto minmax(0, 1fr); }
.lanes:not(.one) .task.timed .due { grid-column: 3; text-align: left; max-width: none; }
.lanes:not(.one) .due small { display: inline; margin-left: 6px; }
.lanes:not(.one) .tm b { font-size: 14.5px; }
@media (max-width: 980px) { .lanes { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .task.timed { grid-template-columns: 58px auto minmax(0, 1fr); }
  .task.timed .due { grid-column: 3; text-align: left; max-width: none; }
  .tm b { font-size: 14.5px; }
}
.group.dues .ghead h2 { font-size: 16px; }
.ghead h2 a { color: inherit; text-decoration: none; }
.ghead h2 a:hover { color: var(--accent); }

.whenbar { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; font-size: 14px; }
.whenbar > span { background: var(--surface); box-shadow: 0 0 0 1px var(--line); border-radius: 999px; padding: 5px 12px; }
.whenbar .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 4px; }
.whenbar .late { color: var(--late); font-weight: 600; }
fieldset.when { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; min-width: 0; }
fieldset.when legend { margin-bottom: 6px; padding: 0; }
.when-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; }
input[type=date], input[type=time] { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 0; box-shadow: 0 0 0 1px var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 500; cursor: pointer; min-height: 30px; font-variant-numeric: tabular-nums; }
.chip:hover { box-shadow: 0 0 0 1px var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.strip-head .legend { margin-left: auto; font-size: 12px; color: var(--muted); }
@media (max-width: 560px) {
  .home-head .sub { display: none; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
  .stat { padding: 8px 8px; }
  .stat b { font-size: 19px; }
  .stat span { font-size: 11px; line-height: 1.25; }
  .strip-head .legend { margin-left: 0; width: 100%; order: 9; }
}
.task.timed .due { max-width: 200px; }
