/* Trackly — design tokens. Light is the default; dark follows the system unless the user picks a theme. */
:root {
  color-scheme: light;
  --bg: #f3f4f7; --surface: #ffffff; --surface-2: #e9ecf2; --hover: #dfe3ec;
  --text: #172033; --muted: #4f5a72; --border: #c3cad8;
  --primary: #2450c8; --on-primary: #ffffff; --primary-soft: #e3eaff;
  --danger: #b3261e; --ok: #1b6e45; --ok-bg: #d9f2e3; --warn-bg: #fde6b0; --warn-text: #5e3b00; --bad-bg: #fcdcd9; --bad-text: #8c1d17;
  --focus: #1447e6; --shadow: 0 1px 2px rgba(16, 24, 40, .18); --shadow-lg: 0 12px 32px rgba(16, 24, 40, .28);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11141b; --surface: #222836; --surface-2: #171b25; --hover: #2c3445;
    --text: #e8ebf3; --muted: #a9b2c6; --border: #3a4357;
    --primary: #9ab6ff; --on-primary: #0b1633; --primary-soft: #26355e;
    --danger: #ff9a92; --ok: #7fdcaa; --ok-bg: #173a29; --warn-bg: #4d3a0c; --warn-text: #ffdf9a; --bad-bg: #4f1f1c; --bad-text: #ffc4bf;
    --focus: #a9c3ff; --shadow: 0 1px 2px rgba(0, 0, 0, .5); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11141b; --surface: #222836; --surface-2: #171b25; --hover: #2c3445;
  --text: #e8ebf3; --muted: #a9b2c6; --border: #3a4357;
  --primary: #9ab6ff; --on-primary: #0b1633; --primary-soft: #26355e;
  --danger: #ff9a92; --ok: #7fdcaa; --ok-bg: #173a29; --warn-bg: #4d3a0c; --warn-text: #ffdf9a; --bad-bg: #4f1f1c; --bad-text: #ffc4bf;
  --focus: #a9c3ff; --shadow: 0 1px 2px rgba(0, 0, 0, .5); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
#app { height: 100dvh; display: flex; flex-direction: column; }
.main { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.main:focus { outline: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--primary); }
ul { margin: 0; padding: 0; list-style: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
kbd { font: 12px ui-monospace, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 4px; background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: 6px; z-index: 3000; }
.skip:focus { left: 8px; }
.boot { margin: auto; padding: 40px; color: var(--muted); text-align: center; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .grow { flex: 1; min-width: 0; } .pad { padding: 8px 12px; }
.error { color: var(--danger); font-weight: 600; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* controls */
.btn { font: inherit; font-weight: 600; font-size: .9rem; min-height: 34px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 28px; padding: 3px 9px; font-size: .82rem; }
.btn.block { width: 100%; min-height: 40px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.icon-btn { font: inherit; font-size: 1.1rem; line-height: 1; width: 32px; height: 32px; flex: none; border-radius: 8px; border: 0; background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--hover); }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; text-decoration: underline; text-align: left; }
.input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-height: 34px; width: 100%; max-width: 100%; }
.input::placeholder { color: var(--muted); opacity: 1; }
.input.narrow { width: auto; }
textarea.input { resize: vertical; display: block; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
.pill { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); white-space: nowrap; }
.pill.warn, .banner.warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.banner { padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.avatar { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--primary-soft); color: var(--text); font-size: .7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); }
.avatars { display: inline-flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg-btn { font: inherit; font-size: .85rem; font-weight: 600; padding: 5px 10px; min-height: 32px; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.seg-btn.on { background: var(--primary); color: var(--on-primary); }
.seg-btn:focus-visible { outline-offset: -2px; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 48px; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.brand.big { font-size: 1.6rem; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(90deg, #fff 0 0) 5px 5px / 5px 12px no-repeat, linear-gradient(90deg, rgba(255,255,255,.8) 0 0) 12px 5px / 5px 8px no-repeat, #2f5fdd; flex: none; display: inline-block; }
.search { position: relative; width: min(280px, 40vw); }
.search-results { position: absolute; right: 0; top: calc(100% + 4px); width: min(420px, 92vw); max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 900; padding: 4px; }
.search-results li { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; }
.search-results li.sel { background: var(--hover); }
.hit-title { font-weight: 600; overflow-wrap: anywhere; }
.account .avatar { background: var(--primary); color: var(--on-primary); border: 0; }

/* popover + menus */
.popover { position: fixed; z-index: 1500; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; font-weight: 400; font-size: .92rem; text-align: left; }
.popover.wide-menu { width: 300px; }
.menu-item { display: block; width: 100%; font: inherit; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; text-decoration: none; }
.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-item:disabled { color: var(--muted); cursor: not-allowed; }
.menu-item.danger { color: var(--danger); }
.menu-check { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-weight: 400; }
.menu-check:hover { background: var(--hover); }
.menu-check input { width: 16px; height: 16px; flex: none; }
.menu-field { display: flex; flex-direction: column; gap: 4px; padding: 6px 10px; font-size: .85rem; font-weight: 600; }
.menu-field label { display: flex; flex-direction: column; gap: 4px; }

/* modal */
dialog.modal { border: 1px solid var(--border); padding: 0; border-radius: 14px; background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.modal.wide { width: min(760px, calc(100vw - 20px)); margin-top: 5vh; max-height: calc(95dvh - 10px); }
dialog.modal::backdrop { background: rgba(8, 12, 22, .6); }
.modal-inner { padding: 16px 18px 18px; overflow: auto; max-height: calc(100dvh - 22px); position: relative; }
dialog.modal.wide .modal-inner { max-height: calc(95dvh - 12px); }
.modal-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; min-height: 8px; }
.modal-head h2 { flex: 1; overflow-wrap: anywhere; }
.modal-head .close { margin: -4px -6px 0 auto; }
.modal-head:has(.sr-only) { margin-bottom: 0; float: right; position: sticky; top: 0; z-index: 2; }

/* toasts */
.toasts { position: fixed; left: 12px; bottom: 12px; z-index: 4000; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 24px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 10px; background: #1d2433; color: #fff; box-shadow: var(--shadow-lg); font-size: .92rem; }
.toast span { overflow-wrap: anywhere; }
.toast.error { background: #8c1d17; }
.toast .btn { background: #fff; color: #172033; border-color: #fff; }
.toast .icon-btn { color: #fff; }
.toast .icon-btn:hover { background: rgba(255,255,255,.18); }
.toast :focus-visible { outline-color: #fff; }

/* pages */
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 20px 16px 32px; display: flex; flex-direction: column; gap: 18px; flex: 1 0 auto; }
.page.narrow { max-width: 720px; }
.page.center { align-items: center; justify-content: center; text-align: center; }
.page section { display: flex; flex-direction: column; gap: 10px; }
.page-head .input { width: min(220px, 100%); }
.footer { text-align: center; padding: 14px; color: var(--muted); font-size: .85rem; flex: none; }
.empty { text-align: center; padding: 40px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: 14px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.board-tile { position: relative; border-radius: 12px; min-height: 96px; overflow: hidden; box-shadow: var(--shadow); display: flex; }
.board-tile-link { flex: 1; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 12px 40px 12px 12px; color: #fff; text-decoration: none; font-weight: 700; background: rgba(0, 0, 0, .42); overflow-wrap: anywhere; }
.board-tile-link:hover { background: rgba(0, 0, 0, .3); }
.board-tile-link:focus-visible { outline-offset: -3px; outline-color: #fff; }
.board-tile .star { position: absolute; top: 6px; right: 6px; color: #fff; }
.board-tile .star:hover { background: rgba(255,255,255,.25); }
.board-tile .star:focus-visible { outline-color: #fff; }
.star.on { color: #ffd84d !important; }
.rows { display: flex; flex-direction: column; }
.rows li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; overflow-wrap: anywhere; }
.settings section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.prose ul { list-style: disc; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.auth-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }

/* board backgrounds (decorative only; text never sits directly on them) */
.bg-gradient-1 { background: linear-gradient(135deg, #2b59c3, #6a3fb5); } .bg-gradient-2 { background: linear-gradient(135deg, #0b7a75, #1f5fa8); }
.bg-gradient-3 { background: linear-gradient(135deg, #b4441f, #8a2f6b); } .bg-gradient-4 { background: linear-gradient(135deg, #2f7d3b, #0f6b7a); }
.bg-gradient-5 { background: linear-gradient(135deg, #7a3fb5, #c2416b); } .bg-gradient-6 { background: linear-gradient(135deg, #1f3f7a, #0e7c8c); }
.bg-gradient-7 { background: linear-gradient(135deg, #a1541b, #b03a3a); } .bg-gradient-8 { background: linear-gradient(135deg, #36465e, #5a6b86); }
.bg-gradient-9 { background: linear-gradient(135deg, #0f6e5a, #4f7d1f); } .bg-gradient-10 { background: linear-gradient(135deg, #a12a5e, #5b3fb5); }
.bg-gradient-11 { background: linear-gradient(135deg, #1b5fa8, #2f9fb5); } .bg-gradient-12 { background: linear-gradient(135deg, #5a3d2b, #8a6a2f); }
.bg-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatch { height: 36px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.bg-preview { height: 84px; border-radius: 10px; display: flex; align-items: flex-end; }
.bg-preview span { background: rgba(0,0,0,.5); color: #fff; font-weight: 700; padding: 4px 10px; border-radius: 0 8px 0 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* board */
.board-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.board-bar { --focus: #ffffff; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: rgba(0, 0, 0, .5); color: #fff; flex: none; }
.board-title { font-size: 1.15rem; min-width: 0; max-width: 100%; }
.board-title .editable-btn { color: #fff; }
.board-bar .icon-btn:hover, .btn.glass:hover { background: rgba(255, 255, 255, .22); }
.btn.glass { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .45); color: #fff; }
.btn.glass.on { background: #fff; color: #172033; }
.board-bar .seg { background: transparent; border-color: rgba(255, 255, 255, .45); }
.board-bar .seg-btn { color: #fff; }
.board-bar .seg-btn.on { background: #fff; color: #172033; }
.board-bar .pill { background: rgba(255,255,255,.9); color: #172033; border: 0; }
.board-bar .pill.warn { background: var(--warn-bg); color: var(--warn-text); }
.bar-avatars .avatar { background: #fff; color: #172033; border: 0; }
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; }
.filter-bar .input { width: auto; flex: 0 1 200px; }
.board-scroll { flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; padding: 12px; scroll-padding: 12px; }
.lists { display: flex; align-items: flex-start; gap: 12px; height: 100%; width: max-content; }
.list { width: 280px; max-width: calc(100vw - 48px); flex: none; max-height: 100%; display: flex; flex-direction: column; background: var(--surface-2); color: var(--text); border-radius: 12px; border: 1px solid var(--border); }
.list.drop { outline: 2px solid var(--focus); outline-offset: -1px; }
.list-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 4px; cursor: grab; touch-action: manipulation; }
.list-title { flex: 1; min-width: 0; font-size: .95rem; }
.count { font-size: .78rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); flex: none; }
.count.over { background: #f5b800; color: #2e2000; border-color: #8a6500; }
.cards { flex: 1; min-height: 6px; overflow-y: auto; padding: 2px 8px 8px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.card { background: var(--surface); color: var(--text); border-radius: 9px; border: 1px solid var(--border); box-shadow: var(--shadow); padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; flex: none; touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; overflow: hidden; }
.card:hover { border-color: var(--focus); }
.card.saving { opacity: .6; }
.card.completed .card-title { color: var(--muted); }
.card-cover { height: 28px; margin: -8px -10px 2px; }
.card-title-row { display: flex; gap: 8px; align-items: flex-start; }
.card-title { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.card-num { color: var(--muted); font-weight: 600; }
.card-edit { min-height: 54px; }
.check { width: 18px; height: 18px; margin-top: 2px; flex: none; border-radius: 50%; border: 2px solid var(--muted); background: var(--surface); color: #fff; font-size: 11px; line-height: 1; font-weight: 900; padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.check.on { background: #1b6e45; border-color: #1b6e45; }
.check.big { width: 26px; height: 26px; font-size: 15px; margin-top: 4px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: .8rem; }
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 6px; font-weight: 600; }
.badge.due.overdue { background: var(--bad-bg); color: var(--bad-text); }
.badge.due.soon { background: var(--warn-bg); color: var(--warn-text); }
.badge.due.done { background: var(--ok-bg); color: var(--ok); }
.badges .avatars { margin-left: auto; }
.badges .avatar { width: 22px; height: 22px; font-size: .62rem; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; min-height: 20px; min-width: 36px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.small { font-size: .7rem; padding: 1px 6px; min-height: 16px; }
.chip.dot { min-width: 20px; width: 20px; height: 20px; padding: 0; flex: none; }
.chip-color { font-weight: 600; opacity: .95; }
.label-green { background: #1f7a52; color: #fff; } .label-yellow { background: #f2c744; color: #2e2400; } .label-orange { background: #b34700; color: #fff; }
.label-red { background: #c2332a; color: #fff; } .label-purple { background: #6a55c2; color: #fff; } .label-blue { background: #0b5fd6; color: #fff; }
.label-sky { background: #9bd8ee; color: #08303d; } .label-lime { background: #b0dc6e; color: #22330a; } .label-pink { background: #e886c2; color: #3b0a2a; }
.label-black { background: #3f4d66; color: #fff; }
.placeholder { border: 2px dashed var(--focus); border-radius: 9px; background: var(--primary-soft); flex: none; min-height: 34px; }
.placeholder-list { height: 120px; border: 2px dashed #fff; background: rgba(255, 255, 255, .25); }
.drag-source { display: none !important; }
.drag-ghost { position: fixed; z-index: 5000; pointer-events: none; margin: 0; box-shadow: var(--shadow-lg); opacity: .96; overflow: hidden; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
.add-card { font: inherit; font-weight: 600; text-align: left; margin: 0 8px 8px; padding: 7px 10px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.add-card:hover { background: var(--hover); color: var(--text); }
.composer { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 6px; flex: none; }
.add-list { font: inherit; font-weight: 700; width: 280px; max-width: calc(100vw - 48px); flex: none; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px dashed rgba(255,255,255,.8); background: rgba(0, 0, 0, .45); color: #fff; cursor: pointer; }
.add-list:hover { background: rgba(0, 0, 0, .6); }
.add-list:focus-visible { outline-color: #fff; }
.add-list-form { padding: 8px; gap: 6px; }
.empty-board { background: var(--surface); padding: 12px 16px; border-radius: 10px; }
.list.collapsed { width: 44px; }
.list.collapsed .list-head { flex-direction: column; padding: 6px 4px 10px; }
.list.collapsed .list-title { writing-mode: vertical-rl; flex: none; max-height: 50vh; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editable-btn { font: inherit; color: inherit; background: none; border: 0; padding: 2px 4px; margin: 0; border-radius: 6px; cursor: text; text-align: left; width: 100%; overflow-wrap: anywhere; }
.editable-btn:hover { background: rgba(127, 127, 127, .2); }
.editable-input { font-weight: 700; }

/* calendar + table views */
.view-pane { flex: 1; min-height: 0; overflow: auto; margin: 12px; padding: 12px; background: var(--surface); color: var(--text); border-radius: 12px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.cal-nav { flex-wrap: wrap; }
.cal-nav h2 { min-width: 150px; text-align: center; }
.cal-scroll, .table-scroll { overflow-x: auto; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); min-width: 660px; }
.cal-dow { background: var(--surface-2); padding: 4px 6px; font-size: .78rem; font-weight: 700; }
.cal-day { background: var(--surface); min-height: 84px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .cal-date { color: var(--muted); }
.cal-day.today .cal-date { background: var(--primary); color: var(--on-primary); border-radius: 999px; padding: 0 7px; align-self: flex-start; }
.cal-date { font-size: .78rem; font-weight: 700; }
.cal-card { font: inherit; font-size: .78rem; text-align: left; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--primary-soft); color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-card.overdue { background: var(--bad-bg); color: var(--bad-text); } .cal-card.done { background: var(--ok-bg); color: var(--ok); } .cal-card.soon { background: var(--warn-bg); color: var(--warn-text); }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.table th { font-size: .82rem; background: var(--surface-2); white-space: nowrap; }
.th-btn { font: inherit; font-weight: 700; background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; }

/* card dialog */
.card-dialog { display: flex; flex-direction: column; gap: 16px; }
.card-dialog section { display: flex; flex-direction: column; gap: 8px; }
.cd-head { display: flex; gap: 10px; align-items: flex-start; padding-right: 36px; }
.cd-title { font-size: 1.25rem; display: block; }
.cd-meta { display: flex; flex-direction: column; gap: 8px; }
.cd-meta:empty { display: none; }
.cd-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.member-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; margin-right: 4px; }
.md { overflow-wrap: anywhere; }
.md > * { margin: 0 0 8px; } .md > *:last-child { margin-bottom: 0; }
.md ul, .md ol { padding-left: 22px; } .md ul { list-style: disc; } .md ol { list-style: decimal; }
.md code { font: 13px ui-monospace, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow: auto; } .md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--border); padding-left: 10px; color: var(--muted); margin-left: 0; }
.md table { border-collapse: collapse; } .md th, .md td { border: 1px solid var(--border); padding: 4px 8px; }
.md h1, .md h2, .md h3, .md h4 { font-size: 1.05rem; }
.checklist { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .small { min-width: 78px; }
.progress { flex: 1; height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); transition: width .15s; }
.progress-fill.full { background: #1b8a57; }
.items li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.items input[type="checkbox"] { width: 17px; height: 17px; flex: none; }
.items li.done .item-text { text-decoration: line-through; color: var(--muted); }
.item-text { font-weight: 400; }
.comments { display: flex; flex-direction: column; gap: 12px; }
.comments li { display: flex; flex-direction: column; gap: 4px; }
.comment-body { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.activity { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; overflow-wrap: anywhere; }
.label-list { display: flex; flex-direction: column; gap: 6px; }
.label-list li { display: flex; align-items: center; gap: 6px; }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; align-items: baseline; }
.shortcuts dd { margin: 0; }

@media (max-width: 640px) {
  .brand-name { display: none; }
  .topbar { padding: 6px 8px; gap: 4px; }
  .search { width: auto; flex: 1; }
  .board-bar { padding: 6px 8px; gap: 6px; }
  .bar-avatars { display: none; }
  .board-scroll { scroll-snap-type: x proximity; padding: 8px; }
  .list, .add-list { width: calc(100vw - 56px); scroll-snap-align: center; }
  .list.collapsed { width: 44px; }
  dialog.modal, dialog.modal.wide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: auto; border-radius: 14px 14px 0 0; margin-top: auto; margin-bottom: 0; }
  dialog.modal.wide .modal-inner { max-height: calc(100dvh - 2px); }
  .modal-inner { max-height: calc(100dvh - 2px); padding: 14px; }
  .bg-picker { grid-template-columns: repeat(6, 1fr); }
  .toasts { left: 8px; right: 8px; bottom: 8px; }
  .filter-bar .input { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .topbar, .board-bar .btn, .board-bar .seg, .filter-bar, .add-card, .add-list, .toasts, .footer { display: none !important; }
  #app, .main, .board-page, .board-scroll, .lists, .list, .cards { height: auto !important; max-height: none !important; overflow: visible !important; }
  .lists { flex-wrap: wrap; }
  .board-page { background: none !important; }
  .board-bar { background: none; color: #000; }
  .board-title .editable-btn { color: #000; }
}
