/* Teamwork Kanban. Clean SaaS look: crisp corners, compact cards, line icons,
   Molten Orange accent, light / dark / auto. Easy for everyone: 16px+ text,
   strong contrast, 44px tap targets. (The illustrated island style is kept
   for the future Live view map only.) */
:root {
  --accent: #D14022; --accent-hover: #B23218; --accent-ink: #FFFFFF; --accent-text: #B8361B; --accent-soft: #FCEDE8; --accent-line: #F2B8A8;
  --bg: #F5F6F8; --panel: #FFFFFF; --panel2: #F0F2F5; --ink: #111827; --muted: #5B6270; --faint: #8A919E; --line: #E3E6EB; --line2: #CDD2DA;
  --red: #C0362C; --red-bg: #FDECEA; --amber: #94590A; --amber-bg: #FFF3DC; --blue: #1F5FC4; --blue-bg: #E8EFFC;
  --violet: #6B46C1; --violet-bg: #F1ECFC; --green: #1D7D45; --green-bg: #E4F4EA; --gray-bg: #EEF0F3;
  --shadow: 0 1px 2px rgba(17,24,39,.05); --shadow-lg: 0 16px 48px rgba(17,24,39,.2);
  --r: 8px; --r-lg: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #D14022; --accent-hover: #E4542F; --accent-ink: #FFFFFF; --accent-text: #FF8259; --accent-soft: #3A1C13; --accent-line: #6E2E1C;
    --bg: #0B0E14; --panel: #141821; --panel2: #1B202B; --ink: #EEF0F4; --muted: #A1A8B5; --faint: #808896; --line: #262C38; --line2: #353C4A;
    --red: #FF8C80; --red-bg: #3B1815; --amber: #F2B552; --amber-bg: #372912; --blue: #86ADFF; --blue-bg: #172648;
    --violet: #B9A0FF; --violet-bg: #2A2048; --green: #5FD394; --green-bg: #13301F; --gray-bg: #232937;
    --shadow: 0 1px 2px rgba(0,0,0,.5); --shadow-lg: 0 16px 48px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #D14022; --accent-hover: #E4542F; --accent-ink: #FFFFFF; --accent-text: #FF8259; --accent-soft: #3A1C13; --accent-line: #6E2E1C;
  --bg: #0B0E14; --panel: #141821; --panel2: #1B202B; --ink: #EEF0F4; --muted: #A1A8B5; --faint: #808896; --line: #262C38; --line2: #353C4A;
  --red: #FF8C80; --red-bg: #3B1815; --amber: #F2B552; --amber-bg: #372912; --blue: #86ADFF; --blue-bg: #172648;
  --violet: #B9A0FF; --violet-bg: #2A2048; --green: #5FD394; --green-bg: #13301F; --gray-bg: #232937;
  --shadow: 0 1px 2px rgba(0,0,0,.5); --shadow-lg: 0 16px 48px rgba(0,0,0,.6);
  color-scheme: dark;
}

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 "Inter", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font-family: inherit; }
.tg, .count, .chip .c, .badge, .dotn, .seg .n { font-variant-numeric: tabular-nums; }
a { color: var(--accent-text); }
h1 { font-size: 28px; margin: 0; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: 18px; margin: 24px 0 10px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* buttons & fields */
button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); border-radius: var(--r);
  padding: 8px 14px; min-height: 44px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--faint); }
button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; }
.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px rgba(209,64,34,.22); }
.primary:hover, .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ok { background: var(--green); border-color: var(--green); color: #fff; }
button.danger { color: var(--red); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--panel2); }
button.iconbtn { min-width: 44px; padding: 8px; border-color: transparent; background: transparent; color: var(--muted); position: relative; }
button.iconbtn:hover { color: var(--ink); background: var(--panel2); }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent-text); text-decoration: underline; font-weight: 600; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 9px 12px; min-height: 44px; max-width: 100%; }
textarea { width: 100%; min-height: 88px; resize: vertical; line-height: 1.5; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
label .muted { font-weight: 400; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); margin: 0; flex: none; }

/* sign-in / info pages */
body.center { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.signin { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px 24px; max-width: 420px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.signin h1 { font-size: 26px; margin-bottom: 8px; }
.signin .logo { width: 64px; height: 64px; border-radius: 14px; margin-bottom: 10px; }
.signin .co { font-size: 13px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 5px; padding: 1px 7px; vertical-align: middle; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.btn.line { background: #06C755; border-color: #06C755; color: #fff; }
.btn span { font-weight: 400; opacity: .9; }
.signin .btn:not(.line):not(.ghost) { background: var(--accent); border-color: var(--accent); color: #fff; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 0 16px 0 20px; height: 64px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; white-space: nowrap; min-width: 0; }
.brand img { width: 36px; height: 36px; border-radius: 8px; }
.brand .name { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.brand .co { font-size: 12px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 5px; padding: 1px 7px; letter-spacing: .02em; }
.mainnav { display: flex; gap: 2px; margin-left: 14px; }
.mainnav a { color: var(--muted); text-decoration: none; padding: 9px 12px; border-radius: var(--r); font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.mainnav a:hover { color: var(--ink); background: var(--panel2); }
.mainnav a[aria-current="page"] { color: var(--ink); background: var(--panel2); }
.topright { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.dotn { position: absolute; top: 3px; right: 1px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #E5484D; color: #fff; font-size: 12px; font-weight: 800; line-height: 20px; text-align: center; }

/* avatars */
.av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; background: var(--gray-bg); display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 800; color: var(--muted); border: 1px solid var(--line); }
.av.lg { width: 36px; height: 36px; font-size: 13px; }
.av.xl { width: 42px; height: 42px; font-size: 14px; border-radius: 10px; }

main { max-width: 1680px; margin: 0 auto; padding: 22px 24px 48px; }

/* page header */
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head .sub { color: var(--muted); font-size: 16px; font-weight: 500; }
.grow { flex: 1; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; min-height: 40px; padding: 6px 14px; color: var(--muted); border-radius: var(--r); }
.seg button:hover { color: var(--ink); background: var(--panel2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg button .n { display: inline-block; min-width: 24px; padding: 0 7px; border-radius: 12px; background: var(--amber-bg); color: var(--amber); font-size: 13px; line-height: 22px; font-weight: 800; }
.seg button[aria-pressed="true"] .n { background: rgba(255,255,255,.25); color: #fff; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }
.sync { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; margin-left: auto; white-space: nowrap; }
.sync i { width: 9px; height: 9px; border-radius: 50%; background: var(--green); display: inline-block; }
.sync.busy i { background: var(--amber); } .sync.err i { background: var(--red); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.tool { min-height: 42px; border-color: var(--line); background: var(--panel); color: var(--ink); }
.tool .k { color: var(--muted); font-weight: 500; }
.tool.on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }
.toggle { display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; margin: 0; cursor: pointer; }
.toggle input { width: 48px; height: 28px; appearance: none; -webkit-appearance: none; background: var(--line2); border-radius: 14px; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(20px); }
.searchbox { position: relative; flex: 0 1 300px; }
.searchbox input { width: 100%; padding-left: 40px; min-height: 42px; }
.searchbox .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.count { color: var(--muted); font-size: 15px; white-space: nowrap; }

/* status chips (with icons) and bottleneck pills */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: var(--r);
  padding: 5px 10px 5px 6px; min-height: 42px; font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip .ic { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; }
.chip .ic .i { width: 17px; height: 17px; }
.chip .c { min-width: 26px; padding: 0 7px; border-radius: 13px; background: var(--gray-bg); color: var(--ink); font-size: 14px; line-height: 24px; text-align: center; font-weight: 800; }
.chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
.pills .lbl { color: var(--muted); font-size: 15px; display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: transparent; color: var(--ink); border-radius: 20px;
  padding: 4px 14px; min-height: 38px; font-size: 15px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.pill b { font-weight: 800; }
.pill.hot { border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.pill.hot b { color: var(--red); }
.pill.warm { border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill[aria-pressed="true"] b { color: #fff; }
.strip { margin-bottom: 4px; }
.remind { display: flex; align-items: center; gap: 10px; background: var(--red-bg); color: var(--red); border-radius: var(--r); padding: 10px 14px; font-weight: 600; margin-bottom: 14px; }

/* status colours */
.s-inbox { color: var(--muted); background: var(--gray-bg); } .s-working { color: var(--blue); background: var(--blue-bg); }
.s-attention { color: var(--red); background: var(--red-bg); } .s-review { color: var(--violet); background: var(--violet-bg); }
.s-held { color: var(--amber); background: var(--amber-bg); } .s-done { color: var(--green); background: var(--green-bg); }
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; padding: 1px 10px 1px 7px; border-radius: 13px; white-space: nowrap; line-height: 22px; }
.st .i { width: 14px; height: 14px; stroke-width: 2.2; }

/* small pills on cards */
.tg { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; padding: 1px 10px; border-radius: 13px; white-space: nowrap; line-height: 22px;
  border: 1px solid var(--line2); color: var(--muted); background: transparent; }
.tg .i { width: 13px; height: 13px; stroke-width: 2.2; }
.tg.late, .tg.stuck { border-color: transparent; background: var(--red-bg); color: var(--red); font-weight: 700; }
.tg.today, .tg.waitingLong { border-color: transparent; background: var(--amber-bg); color: var(--amber); font-weight: 700; }
.tg.startsLater, .tg.ext { border-color: transparent; background: var(--blue-bg); color: var(--blue); }
.tg.tag { font-weight: 700; }
.tg.tag.orange { border-color: #E9A58F; color: #A8341A; background: #FDF1EC; } .tg.tag.red { border-color: #EBA39C; color: #A92B22; background: #FDEDEB; }
.tg.tag.amber { border-color: #E7C27F; color: #8A5200; background: #FFF6E5; } .tg.tag.green { border-color: #9ED3B2; color: #1B6E3E; background: #EAF6EE; }
.tg.tag.aqua { border-color: #96D3D3; color: #146B6B; background: #E7F6F6; } .tg.tag.blue { border-color: #A7C1EE; color: #1E54AD; background: #ECF2FC; }
.tg.tag.violet { border-color: #C3B2EE; color: #5B3BB0; background: #F3EFFC; } .tg.tag.pink { border-color: #E9A9C9; color: #A2296A; background: #FCEEF5; }
:root[data-theme="dark"] .tg.tag:not(.gray) { background: transparent; filter: brightness(1.35); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tg.tag:not(.gray) { background: transparent; filter: brightness(1.35); } }

/* list: grouped rows (the reference's phone list) */
.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 16px; overflow: hidden; }
.group > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ghead { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: 15px; padding: 3px 12px 3px 9px; border-radius: 16px; border: 1px solid currentColor; background: transparent; }
.ghead .i { width: 16px; height: 16px; }
.ghead.plain { color: var(--ink); border-color: var(--line2); }
.rowcard { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; cursor: pointer; }
.group > header + .rowcard { border-top: 0; }
.rowcard:hover { background: var(--panel2); }
.rowcard .crumb { font-size: 13px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.rowcard .ttl { font-weight: 700; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.rowcard .tgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rowcard .side { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; }
.rowcard .side .who { font-size: 12px; color: var(--muted); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.rowcard .side .who.none { color: var(--amber); font-weight: 700; }
.more { min-height: 34px; min-width: 44px; padding: 0 6px; border-color: transparent; background: transparent; color: var(--muted); }
.more:hover { border-color: var(--line2); color: var(--ink); }
.addrow { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--accent-text); font-weight: 600; border: 0; border-top: 1px solid var(--line); background: none; border-radius: 0; width: 100%; justify-content: flex-start; min-height: 54px; }
.addrow:hover { background: var(--panel2); }

/* board + grid cards (the reference's board card) */
.card { position: relative; display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none; cursor: pointer; touch-action: manipulation; }
.card:hover { border-color: var(--line2); }
.card .tgs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.card .crumb { font-size: 13px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .ttl { font-weight: 700; font-size: 17px; margin: 2px 0 12px; overflow-wrap: anywhere; line-height: 1.35; }
.card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card .foot .bdgs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.card .more { position: absolute; top: 6px; right: 6px; }
.holder { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); font-size: 15px; min-width: 0; }
.holder .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.holder.none { color: var(--amber); }
.card.dragging { opacity: .35; }
.ghostcard { position: fixed; z-index: 100; pointer-events: none; width: 290px; transform: rotate(2deg); box-shadow: var(--shadow-lg); opacity: .96; }
.board { display: grid; grid-template-columns: repeat(6, minmax(260px, 1fr)); gap: 14px; align-items: stretch; overflow-x: auto; padding-bottom: 10px; min-height: calc(100vh - 340px); }
.col { background: var(--panel2); border-radius: var(--r-lg); padding: 10px; border: 2px solid transparent; }
.col.drop { border-color: var(--accent); border-style: dashed; }
.col > header { display: flex; align-items: center; gap: 8px; margin: 2px 4px 12px; font-weight: 800; font-size: 15px; }
.col > header .ic { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; }
.col > header .ic .i { width: 16px; height: 16px; }
.col > header .n { color: var(--muted); margin-left: auto; font-weight: 700; }
.cards { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin-bottom: 8px; }
.tiles .card { min-height: 160px; display: flex; flex-direction: column; }
.tiles .card .foot { margin-top: auto; }
.gtitle { display: flex; align-items: center; gap: 10px; margin: 20px 0 10px; }
.gtitle:first-child { margin-top: 0; }

/* side panel (one task) */
.scrim { position: fixed; inset: 0; background: rgba(8,10,14,.45); z-index: 40; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(660px, 100vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  border-left: 1px solid var(--line); animation: slidein .16s ease-out; }
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }
.panel > .ph { display: flex; align-items: flex-start; gap: 4px; padding: 12px 10px 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.panel > .ph h2 { margin: 2px 0 0; font-size: 21px; overflow-wrap: anywhere; }
.panel > .pb { flex: 1; overflow-y: auto; padding: 16px 20px 24px; -webkit-overflow-scrolling: touch; }
.panel > .pf { border-top: 1px solid var(--line); background: var(--panel); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.sec { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 12px; }
.sec > h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.field { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; align-items: center; margin: 8px 0; }
.field > .k { color: var(--muted); font-weight: 600; font-size: 15px; }
.field select, .field input { width: 100%; }
.stbtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stbtns button { min-height: 46px; padding: 6px 8px; font-size: 14px; white-space: normal; line-height: 1.2; justify-content: flex-start; text-align: left; background: var(--panel); color: var(--ink); }
.stbtns button .i { width: 18px; height: 18px; }
.stbtns button[aria-pressed="true"] { border-width: 2px; border-color: currentColor; }
.tagpick { display: flex; flex-wrap: wrap; gap: 6px; }
.tagpick button { min-height: 36px; padding: 4px 12px; font-size: 14px; border-radius: 18px; }
.tagpick button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.note { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--r); padding: 10px 12px; margin: 10px 0; font-size: 15px; }
.note > .i { margin-top: 2px; }
.note.warn { background: var(--amber-bg); } .note.info { background: var(--blue-bg); } .note.ok { background: var(--green-bg); } .note.bad { background: var(--red-bg); } .note.review { background: var(--violet-bg); }
.note.block { display: block; }

/* checklist */
.ck { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-radius: var(--r); }
.ck:hover { background: var(--panel2); }
.ck .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 1px; }
.ck.done .tx .t { color: var(--muted); text-decoration: line-through; }
.ck .by { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.ck .child { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--accent-text); text-decoration: none;
  border: 1px solid var(--accent-line); border-radius: 13px; padding: 1px 10px 1px 6px; }
.ck .child .i { width: 14px; height: 14px; }
.progress { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin: 4px 0 10px; }
.progress span { display: block; height: 100%; background: var(--green); }
.menu { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; min-width: 250px; max-height: calc(100vh - 16px); overflow-y: auto; }
.menu button { display: flex; width: 100%; justify-content: flex-start; border: 0; background: none; min-height: 48px; font-weight: 600; gap: 12px; }
.menu button .mi { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--panel2); color: var(--muted); }
.menu button .mi .i { width: 17px; height: 17px; }
.menu button:hover, .menu button:focus-visible { background: var(--panel2); }
.menu button.on { color: var(--accent-text); }
.menu button.danger { color: var(--red); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .mt { padding: 6px 12px 2px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* thread */
.ev { display: flex; gap: 10px; padding: 6px 0; font-size: 14px; color: var(--muted); align-items: flex-start; }
.ev .evi { width: 28px; height: 28px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; flex: none; }
.ev .evi .i { width: 14px; height: 14px; }
.cm { display: flex; gap: 10px; padding: 10px 0; }
.cm .bub { background: var(--panel2); border-radius: var(--r-lg); padding: 8px 12px; flex: 1; min-width: 0; }
.cm .bub .w { font-weight: 700; font-size: 14px; }
.cm .bub .b { white-space: pre-wrap; overflow-wrap: anywhere; }
.compose { display: flex; gap: 8px; align-items: flex-end; }
.compose textarea { min-height: 48px; height: 48px; flex: 1 1 auto; width: auto; min-width: 0; }
.links ul { margin: 0; padding: 0; list-style: none; }
.pfield { width: 100%; justify-content: flex-start; gap: 10px; min-height: 48px; font-weight: 600; }
.pfield > .i { margin-left: auto; color: var(--muted); }
.plist { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-height: 52vh; overflow-y: auto; }
.prow { justify-content: flex-start; gap: 12px; min-height: 56px; border-color: transparent; background: transparent; font-size: 17px; text-align: left; }
.prow:hover { background: var(--panel2); }
.prow.on { border-color: var(--accent); background: var(--accent-soft); }
.prow > .i { margin-left: auto; color: var(--accent-text); }
.links li { margin: 6px 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; }

/* dialogs and bottom sheets */
dialog { border: 1px solid var(--line2); border-radius: var(--r-lg); padding: 0; background: var(--panel); color: var(--ink); width: min(560px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); max-height: calc(100vh - 24px); }
dialog::backdrop { background: rgba(8,10,14,.5); }
dialog form { padding: 20px 22px; }
dialog h2 { margin: 0 0 4px; font-size: 21px; }
dialog input:not([type="checkbox"]):not([type="radio"]), dialog select { width: 100%; }
dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.checks label { font-weight: 500; display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.opt { display: flex; gap: 8px; flex-wrap: wrap; }
.opt label { margin: 0; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line2); border-radius: var(--r); padding: 8px 12px; min-height: 44px; cursor: pointer; font-weight: 600; }
.opt input { width: 18px; height: 18px; }
.opt label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.sheetbg { position: fixed; inset: 0; background: rgba(8,10,14,.45); z-index: 60; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--panel); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg);
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .16s ease-out; max-height: 88vh; overflow-y: auto; }
@media (min-width: 721px) { .sheet { left: 50%; right: auto; width: 480px; transform: translateX(-50%); bottom: 24px; border-radius: var(--r-lg); animation: none; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line2); margin: 4px auto 12px; }
.sheet h2 { margin: 4px 4px 12px; font-size: 20px; }
.sheet .big { display: flex; width: 100%; justify-content: flex-start; gap: 14px; min-height: 72px; font-size: 19px; border: 1px solid var(--line); margin-bottom: 10px; text-align: left; white-space: normal; border-radius: var(--r-lg); }
.sheet .big .mi { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.sheet .big .mi .i { width: 24px; height: 24px; }
.sheet .big small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); }
.sheet select { width: 100%; }
.sheet label { margin: 14px 2px 6px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet .actions button { flex: 1; }

/* projects / settings */
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 14px; }
.lhead { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.lhead h2 { margin: 0; }
.mach { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.mach > .row { margin-bottom: 4px; }
.mrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 8px; border-radius: var(--r); color: var(--ink); text-decoration: none; cursor: pointer; }
.mrow:hover { background: var(--panel2); }
.avs { display: inline-flex; }
.avs .av { margin-left: -6px; border: 2px solid var(--panel); }
.avs .av:first-child { margin-left: 0; }
.tabs2 { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs2 button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--muted); min-height: 46px; }
.tabs2 button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.step { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; margin: 10px 0; background: var(--panel2); }
.step .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.step textarea { min-height: 96px; }
pre.digest { white-space: pre-wrap; background: var(--panel2); border-radius: var(--r); padding: 12px; font: 14px/1.5 ui-monospace, Menlo, Consolas, monospace; max-height: 420px; overflow: auto; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.soonbox { padding: 56px 20px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line2); border-radius: var(--r-lg); }
.soonbox .i { width: 40px; height: 40px; stroke-width: 1.4; color: var(--faint); display: block; margin: 0 auto 12px; }

/* calendar */
.cal { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.cal-side { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.cal-side h3 { display: flex; align-items: center; gap: 8px; }
.cal-tasks { display: flex; flex-direction: column; gap: 8px; }
.cal-task { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--panel); cursor: grab; display: flex; flex-direction: column; gap: 6px; touch-action: none; user-select: none; }
.cal-task:hover { border-color: var(--line2); }
.cal-task.hot { border-left: 4px solid var(--amber); }
.cal-task.planned { opacity: .7; }
.cal-main { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px 14px; min-width: 0; }
.cal-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-label { font-size: 17px; margin: 0 6px; }
.cal-nav .tool { margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr)); column-gap: 6px; }
.cal-dh { text-align: center; font-weight: 700; font-size: 14px; padding: 6px 2px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); }
.cal-dh.today { color: var(--accent-text); }
.cal-times { grid-column: 1; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-times > div { transform: translateY(-7px); text-align: right; padding-right: 6px; }
.cal-col { position: relative; border-radius: var(--r); background: repeating-linear-gradient(to bottom, var(--panel2) 0, var(--panel2) 1px, transparent 1px, transparent 34px); cursor: copy; }
.cal-col.today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.cal-b { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 4px 8px; overflow: hidden; cursor: pointer; font-size: 13px; line-height: 1.25;
  display: flex; flex-direction: column; gap: 1px; touch-action: none; user-select: none; box-shadow: var(--shadow); }
.cal-b.task { background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--ink); border-left: 4px solid var(--accent); }
.cal-b.plain { background: var(--blue-bg); border: 1px solid transparent; border-left: 4px solid var(--blue); color: var(--ink); }
.cal-b.done { opacity: .55; }
.cal-b.due { border-left-color: var(--amber); }
.cal-b.live { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-b .tm { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-b b { font-size: 14px; overflow-wrap: anywhere; }
.cal-b .cr { font-size: 12px; color: var(--muted); }
.cal-b .rs { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; cursor: ns-resize; }
.cal-b .rs::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 22px; height: 3px; border-radius: 2px; background: var(--line2); transform: translateX(-50%); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 2; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.cal-drop { position: absolute; left: 3px; right: 3px; border: 2px dashed var(--accent); border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 13px; padding: 4px 8px; pointer-events: none; z-index: 3; }
.cal-ghost { position: fixed; z-index: 100; pointer-events: none; width: 240px; box-shadow: var(--shadow-lg); opacity: .95; }
@media (max-width: 1000px) { .cal { grid-template-columns: 1fr; } .cal-side { position: static; max-height: none; } .cal-tasks { flex-direction: row; overflow-x: auto; } .cal-task { min-width: 220px; } }
@media (max-width: 720px) {
  .cal { gap: 10px; }
  .cal-side { padding: 8px 10px; }
  .cal-side h3 { margin: 0 0 6px; font-size: 13px; }
  .cal-side > p { display: none; }
  .cal-task { cursor: pointer; touch-action: manipulation; min-width: 190px; max-width: 230px; padding: 7px 10px; gap: 4px; }
  .cal-task b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-corner, .cal-dh { display: none; }
  .cal-nav { margin-bottom: 4px; }
  .cal-label { font-size: 16px; }
  .cal-main { padding: 8px 8px 12px; }
  .cal-grid { grid-template-columns: 46px minmax(0, 1fr); }
  .cal-b, .cal-col { touch-action: pan-y; }
}

/* phone bottom bar (Board, List, +, Filter, More) */
.bottombar, .phoneonly { display: none; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 10px 12px 10px 18px; border-radius: var(--r-lg);
  max-width: calc(100vw - 24px); display: flex; align-items: center; gap: 14px; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 80; font-weight: 600; box-shadow: var(--shadow-lg); }
#toast.on { opacity: 1; pointer-events: auto; }
#toast.err { background: var(--red); color: #fff; }
#toast button { min-height: 36px; background: transparent; color: inherit; border-color: currentColor; padding: 4px 12px; }
@media (prefers-reduced-motion: reduce) { #toast, .toggle input, .toggle input::after { transition: none; } }

@media (max-width: 1180px) { .mainnav .lbl { display: none; } }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(6, 280px); } }

/* phone: the reference's focused layout */
@media (max-width: 720px) {
  body { font-size: 17px; }
  .top { height: 60px; padding: 0 6px 0 14px; gap: 6px; }
  .brand .name { font-size: 17px; }
  .brand img { width: 32px; height: 32px; }
  .mainnav, .desk { display: none !important; }
  .phoneonly { display: inline-flex; }
  main { padding: 14px 14px calc(110px + env(safe-area-inset-bottom)); }
  h1 { font-size: 26px; }
  main { padding-top: 10px; }
  .head { margin-bottom: 8px; gap: 8px; }
  .head.tools { flex-wrap: nowrap; }
  .head.tools .count { display: none; }
  .head.tools .tool { padding: 6px 12px; font-size: 15px; min-width: 0; flex: 0 1 auto; }
  .head.tools .iconbtn { min-width: 40px; padding: 6px; }
  .brand { gap: 8px; }
  .brand .name { font-size: 16px; letter-spacing: -.015em; }
  .brand .co { font-size: 11px; padding: 0 6px; }
  .topright .iconbtn { min-width: 42px; padding: 6px; }
  .head.tools .searchbox:not(.desk) { flex: 1 1 auto; min-width: 0; }
  .head.tools .searchbox:not(.desk) ~ .tool, .head.tools .searchbox:not(.desk) ~ .count { display: none; }
  .head.mine { margin: -2px 0 6px; }
  .head.mine .toggle { padding: 2px; font-size: 15px; }
  .strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 -14px 10px; padding: 0 14px 2px; scrollbar-width: none; }
  .strip::-webkit-scrollbar { display: none; }
  .strip .chips, .strip .pills { display: contents; }
  .strip .pills .lbl { display: flex; align-items: center; color: var(--faint); padding: 0 2px 0 6px; border-left: 1px solid var(--line2); margin-left: 2px; }
  .strip .pills .lbl span, .strip .pills .lbl .t { display: none; }
  .chip { min-height: 38px; padding: 3px 10px 3px 4px; font-size: 15px; flex: none; }
  .chip .ic { width: 28px; height: 28px; }
  .pill { min-height: 38px; padding: 3px 12px; font-size: 15px; flex: none; }
  .tool { min-height: 40px; }
  .group > header { padding: 8px 14px; }
  .ghead { font-size: 14px; padding: 2px 10px 2px 8px; }
  .rowcard { padding: 11px 14px; gap: 10px; }
  .rowcard .ttl { font-size: 17px; }
  .rowcard .tgs { margin-top: 6px; }
  .rowcard .side { width: 58px; gap: 2px; }
  .rowcard .side .av.xl { width: 38px; height: 38px; }
  .more { min-height: 32px; }
  .head .sub { display: none; }
  .seg button { padding: 6px 6px; font-size: 16px; }
  /* Tabs: full width; each tab is as wide as its words plus an equal share of
     the spare room, so "Assigned to me" always fits on one line. */
  #tabs { display: flex; width: 100%; flex: 1 1 100%; }
  #tabs button { flex: 1 1 auto; justify-content: center; text-align: center; white-space: nowrap; padding: 6px 10px; font-size: 15px; min-width: 0; gap: 6px; }
  #tabs button .n { min-width: 22px; padding: 0 6px; line-height: 20px; font-size: 12px; }
  .tool { border-radius: 22px; padding: 6px 14px; gap: 6px; }
  .tool .i { display: none; }
  .count { margin-left: auto; }
  .toggle { width: 100%; padding: 8px 2px; font-size: 17px; }
  .chips, .pills { flex-wrap: nowrap; overflow-x: auto; margin-left: -14px; margin-right: -14px; padding: 0 14px 2px; scrollbar-width: none; }
  .chips::-webkit-scrollbar, .pills::-webkit-scrollbar { display: none; }
  .pills .lbl { flex-direction: column; align-items: flex-start; gap: 0; font-size: 14px; }
  .searchbox { flex: 1 1 100%; }
  .tiles { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(6, 84vw); scroll-snap-type: x mandatory; margin: 0 -14px; padding: 0 14px 10px; min-height: 0; }
  .col { scroll-snap-align: center; }
  .bottombar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--panel);
    border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottombar button { flex-direction: column; gap: 3px; border: 0; background: none; min-height: 62px; padding: 6px 2px; font-size: 14px; font-weight: 600; color: var(--muted); border-radius: var(--r-lg); position: relative; }
  .bottombar button .i { width: 26px; height: 26px; }
  .bottombar button[aria-pressed="true"] { color: var(--ink); background: var(--panel2); }
  .bottombar .fab { align-self: center; }
  .bottombar .fab > span { width: 58px; height: 58px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(209,64,34,.4); }
  .bottombar .fab .i { width: 28px; height: 28px; stroke-width: 2.2; }
  .bottombar .fn { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; font-size: 11px; background: var(--accent); color: #fff; border-radius: 9px; padding: 0 5px; line-height: 18px; }
  .panel { width: 100vw; border-left: 0; }
  .field { grid-template-columns: 1fr; gap: 4px; }
  .field > .k { font-size: 14px; }
  .step .two { grid-template-columns: 1fr; }
  #toast { bottom: calc(94px + env(safe-area-inset-bottom)); }
  .mrow { grid-template-columns: minmax(0, 1fr) auto; }
  .mrow .hide-sm { display: none; }
}

/* very narrow phones (360px Android): keep the header from touching the bell */
@media (max-width: 370px) {
  .top { padding-left: 10px; gap: 4px; }
  .brand { gap: 6px; }
  .brand img { width: 28px; height: 28px; }
  .brand .name { font-size: 15px; }
  .topright .iconbtn { min-width: 38px; }
}
