/* Layout: app bar → project heading → one scroll surface (sticky week header + sticky phase column), editor drawer on the right. Neutral greys carry the page; Manyone Blue only for actions, Red only for "we are here". */
:root {
  --bg: #FFFFFF;
  --surface: #F5F4F6;      /* Grey 3 */
  --line: #EDECEF;         /* Grey 2 */
  --line-strong: #DCD9E0;  /* Grey 1 */
  --fg: #0A001B;           /* Manyone Deep Blue */
  --fg-2: #4B4559;
  --fg-3: #827C8F;
  --accent: #200BD1;       /* Manyone Blue */
  --accent-fg: #FFFFFF;
  --accent-soft: #E5E5FF;  /* Blue 3 */
  --task-bg: #E5E5FF;      /* Blue 3 */
  --task-hover: #DADAFB;
  --task-fg: #0A001B;
  --block-bg: transparent;
  --block-fg: #4B4559;
  --deliv-bg: #6F70E9;     /* Blue 1 */
  --deliv-fg: #FFFFFF;
  --deliv-prog: #B4B5FF;
  --mile: #FFCCF4;         /* Pink */
  --mile-edge: #E08FCD;
  --done: #17914F;
  --today: #FF4639;        /* Red */
  --arrow: #C4BFCB;
  --arrow-hl: #0A001B;
  --danger: #D2281B;
  --shadow: 0 12px 40px rgba(10,0,27,.14), 0 2px 6px rgba(10,0,27,.06);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --r: 6px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0D0620; --surface: #150D2A; --line: #221A38; --line-strong: #342A4D;
  --fg: #F5F4F6; --fg-2: #BDB7CA; --fg-3: #847D96;
  --accent: #6F70E9; --accent-fg: #FFFFFF; --accent-soft: #221F55;
  --task-bg: #201D4A; --task-hover: #282458; --task-fg: #F5F4F6;
  --block-bg: transparent; --block-fg: #BDB7CA;
  --deliv-bg: #6F70E9; --deliv-fg: #FFFFFF; --deliv-prog: #E5E5FF;
  --mile: #FFCCF4; --mile-edge: #FFCCF4; --today: #FF4639; --done: #3CCB7F;
  --arrow: #4A4063; --arrow-hl: #F5F4F6; --danger: #FF6A5F;
  --shadow: 0 12px 40px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0D0620; --surface: #150D2A; --line: #221A38; --line-strong: #342A4D;
  --fg: #F5F4F6; --fg-2: #BDB7CA; --fg-3: #847D96;
  --accent: #6F70E9; --accent-fg: #FFFFFF; --accent-soft: #221F55;
  --task-bg: #201D4A; --task-hover: #282458; --task-fg: #F5F4F6;
  --block-bg: transparent; --block-fg: #BDB7CA;
  --deliv-bg: #6F70E9; --deliv-fg: #FFFFFF; --deliv-prog: #E5E5FF;
  --mile: #FFCCF4; --mile-edge: #FFCCF4; --today: #FF4639; --done: #3CCB7F;
  --arrow: #4A4063; --arrow-hl: #F5F4F6; --danger: #FF6A5F;
  --shadow: 0 12px 40px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 13px; line-height: 1.4; font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { height: 100%; display: flex; flex-direction: column; min-height: 0; }

/* App bar */
.top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -0.01em; font-size: 14px; margin-right: 6px; white-space: nowrap; }
.brand .mark { width: 18px; height: 18px; border-radius: 50%; background: var(--fg); position: relative; }
.brand .mark::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg); }
.brand span.sub { color: var(--fg-3); font-weight: 500; }
.spacer { flex: 1; }
.btn { height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--bg); display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--fg-2); }
.btn.quiet:hover { background: var(--surface); color: var(--fg); }
.btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.danger { color: var(--danger); border-color: var(--line-strong); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn svg { width: 14px; height: 14px; flex: none; }
.selwrap { position: relative; }
.selwrap select { appearance: none; height: 32px; padding: 0 30px 0 12px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--bg); font-weight: 500; max-width: 260px; }
.selwrap::after { content: ""; position: absolute; right: 12px; top: 13px; width: 6px; height: 6px; border-right: 1.5px solid var(--fg-2); border-bottom: 1.5px solid var(--fg-2); transform: rotate(45deg); pointer-events: none; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 2px; gap: 2px; background: var(--bg); }
.seg button { height: 26px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent; color: var(--fg-2); font-weight: 500; }
.seg button:hover:not(:disabled) { color: var(--fg); }
.seg button:disabled { opacity: .35; cursor: default; }
.seg button svg { display: block; }
.seg .pct { min-width: 50px; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-strong); }
.pill { height: 24px; padding: 0 10px; border-radius: 999px; background: var(--surface); color: var(--fg-2); font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-3); }

/* Main */
#main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 24px; padding-block: 18px 14px; }
.head .t { min-width: 0; }
.eyebrow { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3); }
h1 { margin: 2px 0 0; font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; text-wrap: balance; }
h1 button { all: unset; cursor: pointer; border-radius: 4px; }
h1 button:hover { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
h1 button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.meta { color: var(--fg-2); font-variant-numeric: tabular-nums; margin-top: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-left: auto; color: var(--fg-2); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.task { background: var(--task-bg); }
.sw.block { background: none; border: 1px dashed var(--line-strong); }
.sw.deliv { background: var(--deliv-bg); }
.sw.mile { width: 10px; height: 10px; margin: 0 3px; background: var(--mile); transform: rotate(45deg); box-shadow: inset 0 0 0 1px var(--mile-edge); border-radius: 1px; }
.sw.today { width: 2px; height: 12px; background: var(--today); border-radius: 0; }

/* Timeline surface */
#scroller { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); overscroll-behavior: contain; position: relative; }
#canvas { position: relative; }
.export-title { display: none; }
.exporting .export-title { display: block; padding: 20px 20px 16px; }
.exporting .export-title h1 { font-size: 22px; }
.exporting .no-export { display: none !important; }

.hdr { position: sticky; top: 0; z-index: 8; display: flex; background: var(--bg); border-bottom: 1px solid var(--line); }
.hdr .corner { position: sticky; left: 0; z-index: 2; background: var(--bg); border-right: 1px solid var(--line); flex: none; display: flex; align-items: flex-end; padding: 0 12px 8px; color: var(--fg-3); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.hdr .cols { position: relative; flex: none; }
.hrow { position: relative; display: flex; }
.hrow .c { flex: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.hrow.r1 { height: 22px; }
.hrow.r1 .c { padding: 5px 8px 0; font-size: 11px; color: var(--fg-3); font-weight: 500; border-left: 1px solid var(--line); }
.hrow.r2 { height: 30px; }
.hrow.r2 .c { padding: 7px 8px 0; font-size: 11.5px; color: var(--fg-2); font-weight: 500; border-left: 1px solid var(--line); }
.hrow .c.now { color: var(--fg); font-weight: 600; }
.hrow .c.wknd-gap { border-left-color: var(--line-strong); }
.here { position: absolute; top: calc(100% + 10px); transform: translateX(-50%); background: var(--today); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .01em; height: 24px; line-height: 24px; padding: 0 9px; border-radius: 4px; white-space: nowrap; z-index: 3; }

.rows { position: relative; }
.lane { display: flex; border-bottom: 1px solid var(--line); }
.lane:last-child { border-bottom: 0; }
.ll { position: sticky; left: 0; z-index: 6; flex: none; background: var(--bg); border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ll .num { font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.ll .nm { all: unset; font-weight: 600; font-size: 13.5px; line-height: 1.3; letter-spacing: -0.005em; color: var(--fg); overflow-wrap: anywhere; border-radius: 3px; }
.ll .nm.edit { cursor: pointer; }
.ll .nm.edit:hover { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.ll .nm:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ll .cnt { color: var(--fg-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.ll .add { all: unset; cursor: pointer; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--accent); align-self: flex-start; border-radius: 3px; padding: 2px 0; }
.ll .add:hover { text-decoration: underline; text-underline-offset: 3px; }
.ll .add:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lb { position: relative; flex: none; }
.today-line { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px solid var(--today); z-index: 4; pointer-events: none; }
.today-line::after { content: ""; position: absolute; bottom: -4px; left: -4.75px; width: 8px; height: 8px; border-radius: 50%; background: var(--today); }
svg.arrows { position: absolute; top: 0; z-index: 1; pointer-events: none; overflow: visible; }
svg.arrows path { fill: none; stroke-width: 1.25; transition: stroke .12s; }

/* Items */
.it { position: absolute; z-index: 2; height: 100px; border-radius: 5px; user-select: none; -webkit-user-select: none; touch-action: none; }
.it.k-task { background: var(--task-bg); color: var(--task-fg); }
.it.k-task:hover { background: var(--task-hover); }
.it.k-block { background: var(--block-bg); color: var(--block-fg); border: 1px dashed var(--line-strong); }
.it.k-deliverable { background: var(--deliv-bg); color: var(--deliv-fg); }
.it .mt { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 14px; opacity: .78; }
.tag { position: absolute; top: 12px; right: 12px; z-index: 1; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--bg); color: var(--fg-2); font-size: 11px; font-weight: 500; line-height: 1; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.tag i { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.tag.done i { background: var(--done); }
.tag.in_progress i { background: var(--accent); }
.ebrow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ebrow .tag { position: static; box-shadow: inset 0 0 0 1px var(--line-strong); height: 18px; }
.has-tag .in > .eb { padding-right: 96px; }
.it .in { position: sticky; left: var(--lw, 0px); display: flex; flex-direction: column; width: max-content; max-width: min(100%, 440px); height: 100%; padding: 14px; justify-content: center; gap: 4px; overflow: hidden; }
.eb { font-size: 10.5px; font-weight: 500; letter-spacing: .02em; opacity: .72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 14px; }
.ti { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 18px; display: flex; align-items: center; gap: 5px; }
.ti > span { overflow: hidden; text-overflow: ellipsis; }
.it.k-block .in { align-items: flex-start; }
.it.k-block .ti { font-weight: 600; }
.ck { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--done); display: inline-grid; place-items: center; }
.ck svg { width: 9px; height: 9px; }
.st-done.k-task .ti, .it-out.st-done .ti { color: var(--fg-2); }
.prog { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); border-radius: 0 0 0 4px; }
.k-deliverable .prog { background: var(--deliv-prog); }
.it .h { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 2; }
.it .h.l { left: -2px; } .it .h.r { right: -2px; }
.it .h::after { content: ""; position: absolute; top: 26px; bottom: 26px; left: 3px; width: 2px; border-radius: 2px; background: currentColor; opacity: 0; transition: opacity .12s; }
.it:hover .h::after { opacity: .35; }
.editing .it { cursor: grab; }
.editing .it.dragging { cursor: grabbing; box-shadow: 0 6px 18px rgba(10,0,27,.18); z-index: 5; }
.it.sel { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); z-index: 3; }
.it.k-milestone { background: var(--bg); border: 2px dotted var(--mile-edge); color: var(--fg); }
.it.k-milestone:hover { background: color-mix(in srgb, var(--mile) 18%, var(--bg)); }
.dia-i { flex: none; width: 10px; height: 10px; margin: 0 3px 0 1px; background: var(--mile); box-shadow: inset 0 0 0 1px var(--mile-edge); transform: rotate(45deg); border-radius: 1.5px; }

.it-out { position: absolute; z-index: 2; height: 100px; overflow: hidden; padding-block: 14px; justify-content: center; gap: 4px; color: var(--fg); cursor: pointer; display: flex; flex-direction: column; min-width: 0; }
.it-out .eb { color: var(--fg-3); opacity: 1; }
.it-out .ti { color: var(--fg); }
.it-out .mt { font-size: 11px; color: var(--fg-2); font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 14px; }
.it-out:hover .ti span { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.it-out.k-milestone { justify-content: flex-start; }
.ds { font-size: 11.5px; line-height: 15px; font-weight: 400; opacity: .78; margin-top: 2px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.it-out .ds { color: var(--fg-2); opacity: 1; }
.it-out.k-milestone .ds, .k-deliverable .ds, .it.k-milestone .ds { -webkit-line-clamp: 1; }
.it-out.k-block .ti { color: var(--block-fg); }

.addphase { position: sticky; left: 0; display: inline-flex; margin: 12px; }
.empty-lanes { padding: 40px 24px; color: var(--fg-2); }

/* Portfolio */
.pf .lb .pbar { position: absolute; height: 18px; border-radius: 3px; background: var(--task-bg); color: var(--fg); font-size: 11.5px; font-weight: 500; line-height: 18px; padding: 0 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf .lb .plab { position: absolute; height: 18px; line-height: 18px; font-size: 11.5px; font-weight: 500; color: var(--fg-2); white-space: nowrap; }
.pf .lb .pfill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--line-strong); opacity: .55; }
.pf .lb .pbar span { position: relative; }
.pf .lb .pm { position: absolute; width: 10px; height: 10px; background: var(--mile); box-shadow: inset 0 0 0 1px var(--mile-edge); transform: rotate(45deg); border-radius: 1px; }
.pf .lb .pd { position: absolute; width: 8px; height: 18px; border-radius: 2px; background: var(--deliv-bg); box-shadow: inset 0 0 0 1.5px var(--accent); }
.pf .ll .open { all: unset; cursor: pointer; font-weight: 600; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; border-radius: 3px; }
.pf .ll .open:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.pf .ll .open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* State screens */
.state { margin: auto; max-width: 420px; text-align: center; padding: 48px 16px; color: var(--fg-2); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.state h2 { margin: 0; font-size: 18px; color: var(--fg); letter-spacing: -0.01em; font-weight: 600; }
.state p { margin: 0; }
.skel { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 520px; }
.skel i { display: block; height: 14px; border-radius: 4px; background: var(--surface); }

/* Drawer */
#panel { position: fixed; z-index: 30; top: calc(env(safe-area-inset-top, 0px) + 64px); right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); width: min(380px, calc(100vw - 32px)); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.pn-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.pn-head .eyebrow { flex: 1; }
.x { all: unset; cursor: pointer; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; color: var(--fg-2); }
.x:hover { background: var(--surface); color: var(--fg); }
.x:focus-visible { outline: 2px solid var(--accent); }
.pn-body { flex: 1; overflow: auto; padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 14px; }
.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f > label, .f > .fl { font-size: 11.5px; font-weight: 500; color: var(--fg-2); }
.f input[type="text"], .f input[type="date"], .f input[type="time"], .f select, .f textarea { width: 100%; box-sizing: border-box; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); }
.f textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.f input.big { height: 38px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg.full { display: grid; grid-template-columns: repeat(4, 1fr); }
.seg.full button { padding: 0 4px; font-size: 12px; }
.rng { display: flex; align-items: center; gap: 10px; }
.rng input { flex: 1; accent-color: var(--accent); }
.rng output { width: 38px; text-align: right; font-variant-numeric: tabular-nums; color: var(--fg-2); }
.deps { border: 1px solid var(--line); border-radius: var(--r); max-height: 220px; overflow: auto; padding: 4px 0; }
.deps .g { font-size: 11px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-3); padding: 8px 10px 4px; }
.deps label { display: flex; align-items: center; gap: 8px; padding: 5px 10px; cursor: pointer; }
.deps label:hover { background: var(--surface); }
.deps input { accent-color: var(--accent); margin: 0; flex: none; }
.deps label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { font-size: 12px; color: var(--fg-3); }
.sep { height: 1px; background: var(--line); margin: 4px 0; }
.confirm { background: var(--surface); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.confirm .acts { display: flex; gap: 8px; }
.ro dt { font-size: 11.5px; font-weight: 500; color: var(--fg-3); margin: 0 0 3px; }
.ro dd { margin: 0 0 14px; color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere; }
.ro h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: -0.01em; font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface); color: var(--fg-2); }
.badge .d { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-3); }
.badge.in_progress .d { background: var(--accent); }
.badge.done .d { background: var(--fg); }

#modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
#modal .mb { position: absolute; inset: 0; background: color-mix(in srgb, var(--fg) 32%, transparent); }
.md { position: relative; width: min(520px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--bg); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.md-h { display: flex; align-items: center; gap: 8px; padding: 18px 16px 6px 24px; }
.md-h h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.md-b { padding: 12px 24px 8px; display: flex; flex-direction: column; gap: 16px; overflow: auto; }
.md-f { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid var(--line); margin-top: 8px; }
.err { font-size: 12px; color: var(--danger); }
.f input[aria-invalid="true"] { border-color: var(--danger); }
.ph-h { display: flex; align-items: center; justify-content: space-between; }
.ph-h .fl { font-size: 11.5px; font-weight: 500; color: var(--fg-2); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r); }
.stepper button { width: 30px; height: 28px; border: 0; background: none; font-size: 15px; color: var(--fg-2); border-radius: 5px; }
.stepper button:hover:not(:disabled) { background: var(--surface); color: var(--fg); }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper output { min-width: 26px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.ph-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ph-list li { display: flex; align-items: center; gap: 6px; }
.ph-list .n { width: 22px; flex: none; font-size: 11px; font-weight: 500; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.ph-list input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); }
.ph-list input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ic { flex: none; width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--fg-3); font-size: 14px; }
.ic:hover:not(:disabled) { background: var(--surface); color: var(--fg); }
.ic:disabled { opacity: .3; cursor: default; }
.brand { all: unset; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -0.01em; font-size: 14px; margin-right: 6px; white-space: nowrap; border-radius: 4px; }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.tabs { display: flex; gap: 2px; }
.tabs a { height: 32px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: var(--r); color: var(--fg-2); text-decoration: none; font-weight: 500; }
.tabs a:hover { background: var(--surface); color: var(--fg); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--fg); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumbs a.btn { color: var(--fg); text-decoration: none; }
.crumbs a.btn[aria-current="page"] { background: var(--surface); }
.crumb-sep { color: var(--line-strong); font-size: 18px; }
.chip { display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 4px 0 12px; border-radius: var(--r); background: var(--surface); font-weight: 600; min-width: 0; max-width: 340px; }
.chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 5px; background: none; color: var(--fg-2); }
.chip-x:hover { background: var(--line); color: var(--fg); }
.home { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: auto; padding-bottom: 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cnt-b { display: inline-grid; place-items: center; min-width: 18px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--line); font-size: 11px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.plist-wrap { border: 1px solid var(--line); border-radius: 10px; }
.plist-h, .prow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) 80px 212px 90px 44px; gap: 16px; align-items: center; padding: 0 12px 0 18px; }
.plist-h { height: 36px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.plist { list-style: none; margin: 0; padding: 0; }
.prow { min-height: 72px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.prow:last-child { border-bottom: 0; }
.prow:hover { background: var(--surface); }
.pc-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pname { font-weight: 600; font-size: 14px; color: var(--fg); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 3px; }
.pname:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.pc-dates, .pc-done { display: flex; flex-direction: column; gap: 2px; font-variant-numeric: tabular-nums; color: var(--fg); min-width: 0; }
.pc-dates .sub, .pc-done .sub { color: var(--fg-3); font-size: 12px; }
.pc-edit { color: var(--fg-3); font-size: 12px; white-space: nowrap; }
.strip { display: block; max-width: 100%; height: auto; overflow: visible; }
.strip .sb { fill: var(--accent); opacity: .3; }
.strip .st { fill: var(--today); }
.pc-menu { position: relative; display: flex; justify-content: flex-end; }
.ic.more { width: 32px; height: 32px; display: grid; place-items: center; color: var(--fg-2); }
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 190px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; cursor: default; }
.menu button { all: unset; cursor: pointer; padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.menu button:hover, .menu button:focus-visible { background: var(--surface); }
.menu .dz { color: var(--danger); }
.msep { height: 1px; background: var(--line); margin: 4px 0; }
.md-s { width: min(460px, 100%); }
.md-p { margin: 0; line-height: 1.5; }
.exp-wrap { position: relative; display: inline-flex; }
.exp-wrap .menu { top: calc(100% + 6px); min-width: 210px; }
.pill.arch { height: 20px; margin-right: 2px; }
.linkbtn { all: unset; cursor: pointer; color: var(--accent); font-weight: 500; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 760px) {
  .plist-h { display: none; }
  .prow { grid-template-columns: minmax(0, 1fr) 44px; grid-template-areas: "name menu" "dates menu"; padding: 12px 8px 12px 14px; gap: 4px 8px; }
  .pc-name { grid-area: name; } .pc-menu { grid-area: menu; align-self: start; }
  .pc-dates { grid-area: dates; flex-direction: row; gap: 8px; color: var(--fg-2); font-size: 12.5px; }
  .pc-done, .pc-strip, .pc-edit { display: none; }
  .tabs a { padding: 0 8px; }
}
#tip { position: fixed; z-index: 40; pointer-events: none; background: var(--fg); color: var(--bg); font-size: 11.5px; font-weight: 500; padding: 4px 8px; border-radius: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#toast { position: fixed; z-index: 50; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 14px; border-radius: 8px; font-weight: 500; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

@media (max-width: 640px) {
  .brand span.sub { display: none; }
  .head { padding-block: 14px 10px; }
  h1 { font-size: 20px; }
  .legend { margin-left: 0; }
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 78%; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .hide-sm { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Share links (Cloudflare build) */
.share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.share-list li { display: flex; flex-direction: column; gap: 6px; }
.share-row { display: flex; gap: 8px; }
.share-row input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--fg-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.share-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.share-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.linkbtn.dz { color: var(--danger); }
