/* The board on top of the kit's base.css and kit.css (team/kit/static/css): the shell, the
   columns and cards, the card detail, My cards, Time, Clients & projects. Same paper, ink
   and kraft; corners, not radii (avatars stay round). Columns are a strip of the floor, cards
   are sheets of writing paper on it. */

:root {
  --col-bg: var(--floor);
  --card-bg: var(--sheet);
  --card-edge: 0 1px 0 rgba(54, 40, 26, 0.16), 0 1px 3px rgba(54, 40, 26, 0.10);
  --panel-edge: 0 1px 0 rgba(54, 40, 26, 0.12), 0 2px 10px -4px rgba(54, 40, 26, 0.18);
  --live: #C2553A;
  --col-w: 300px;
  --detail-w: 460px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --col-bg: #211D19;
    --card-bg: #2E2924;
    --card-edge: 0 1px 0 rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.35);
    --panel-edge: 0 1px 0 rgba(0, 0, 0, 0.45), 0 2px 10px -4px rgba(0, 0, 0, 0.5);
    --live: #F0A08A;
  }
}
:root[data-theme="dark"] {
  --col-bg: #211D19;
  --card-bg: #2E2924;
  --card-edge: 0 1px 0 rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.35);
  --panel-edge: 0 1px 0 rgba(0, 0, 0, 0.45), 0 2px 10px -4px rgba(0, 0, 0, 0.5);
  --live: #F0A08A;
}

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
select, input, textarea { font: inherit; color: inherit; }
.app, .content, .board-slot, .page-body, .ts-body, .sum-body { min-width: 0; }
.boot { height: 100%; }

/* ---- shell -------------------------------------------------------------------------- */
.shell {
  height: 100%; height: 100dvh; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr); position: relative; overflow: hidden;
}
.dialog-slot { display: contents; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view-page { overflow-y: auto; overscroll-behavior: contain; padding: 28px 32px 56px; }
.scrim { display: none; }

/* rail: on the wall, a pencil line down its edge */
.rail {
  position: relative; display: flex; flex-direction: column; padding: 20px 14px 12px;
  background: var(--wall); overflow-y: auto; min-height: 0; z-index: 2;
}
.rail::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 6px;
  background: var(--pencil-v) repeat-y 0 0 / 6px 480px; filter: var(--stroke-filter); opacity: 0.6; pointer-events: none;
}
.rail-brand { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 22px; }
.rail-close { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 10px;
  margin-bottom: 2px; border: 0; background: transparent; color: var(--ink); text-align: left;
}
.nav-item:hover { background: var(--hover); }
.nav-item.is-current { background: var(--kraft-light); font-weight: 600; }
.nav-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count {
  font-family: var(--font-form); font-size: 0.875rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.nav-new { color: var(--muted); }
.nav-new:hover { color: var(--ink); }
.rail-section { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 4px; padding-left: 10px; }
.rail-heading {
  font-family: var(--font-form); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.rail-gap { flex: 1; min-height: 18px; }
.rail-foot {
  position: relative; display: flex; align-items: center; gap: 4px; padding: 16px 0 0 10px; margin-top: 8px;
}
.rail-foot::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px;
  background: var(--pencil-light) repeat-x 0 0 / 480px 6px; filter: var(--stroke-filter);
}
.rail-foot .account-btn { margin-left: -6px; }
.rail-who {
  flex: 1; min-width: 0; margin: 0; font-family: var(--font-form); font-size: 0.875rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* the app switcher at the top of the rail: three equal tiles, icon over label (as in E-Mail) */
.apps-rail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 0 16px; border: 1.5px solid var(--ink); }
.apps-rail .apps-link {
  flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 4px 0; border: 0;
  font-family: var(--font-form); font-size: 0.75rem;
}
.apps-rail .apps-link + .apps-link { border-left: 1px solid var(--rule); }
.apps-rail .apps-link .icon { font-size: 1.2rem; }
.apps-rail .apps-link.is-current { background: var(--solid); color: var(--on-solid); }

/* top bar and bottom navigation: phones and tablets in portrait only */
.topbar, .bottomnav { display: none; }
.topbar {
  position: relative; align-items: center; gap: 4px; min-height: 56px; background: var(--wall);
  padding: calc(4px + env(safe-area-inset-top)) calc(6px + env(safe-area-inset-right)) 4px calc(4px + env(safe-area-inset-left));
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 6px; z-index: 1;
  background: var(--pencil) repeat-x 0 0 / 480px 6px; filter: var(--stroke-filter); opacity: 0.7; pointer-events: none;
}
.topbar-title {
  flex: 1; min-width: 0; margin: 0; padding-left: 4px; font-size: var(--step-1); font-weight: 700;
  letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bottomnav {
  grid-template-columns: repeat(3, 1fr); background: var(--sheet); border-top: 1.5px solid var(--ink);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px;
  border: 0; background: transparent; color: var(--ink); font-family: var(--font-form); font-size: 0.8125rem;
  font-weight: 700; letter-spacing: 0.02em;
}
.tab .icon { font-size: 1.35rem; }
.tab.is-current { background: var(--solid); color: var(--on-solid); }

/* the running timer: a slip of black paper over every screen */
.timerbar {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 10px 4px 16px;
  background: var(--solid); color: var(--on-solid); z-index: 1;
}
.timer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); flex: none; animation: pulse 1.6s var(--ease) infinite; }
.timer-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0; border: 0;
  background: transparent; color: inherit; text-align: left; font-weight: 600;
}
.timer-open .icon { opacity: 0.8; }
.timer-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-clock { font-family: var(--font-form); font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timerbar .timer-stop { color: inherit; border-color: currentColor; }
.timerbar .timer-stop:hover { background: rgba(127, 127, 127, 0.2); }

/* ---- page views --------------------------------------------------------------------- */
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 22px; min-width: 0; }
.page-title {
  margin: 0; font-size: var(--step-3); font-weight: 700; letter-spacing: -0.035em; line-height: 1.1;
  min-width: 0; overflow-wrap: anywhere;
}
.page-sub { margin: 0; padding-top: 6px; color: var(--muted); font-family: var(--font-form); }
.empty {
  display: grid; justify-items: center; text-align: center; gap: 6px; padding: 48px 24px;
  max-width: 480px; margin: 0 auto;
}
.empty-icon { width: 40px; height: 40px; color: var(--kraft); }
.empty-title { margin: 8px 0 0; font-size: var(--step-1); font-weight: 700; letter-spacing: -0.02em; }
.empty-text { margin: 0 0 12px; color: var(--muted); }
.empty-small { padding: 18px 12px 10px; }
.empty-small .empty-icon { width: 30px; height: 30px; }

.skeleton-card, .skeleton-line, .skeleton-block {
  background: linear-gradient(90deg, transparent, rgba(170, 130, 90, 0.18), transparent) 0 0 / 200% 100%, var(--card-bg);
  animation: sheen 1.4s linear infinite; opacity: 0.8;
}
.skeleton-card { height: 76px; margin-bottom: 8px; }
.skeleton-line { height: 22px; margin: 8px 0; max-width: 60%; }
.skeleton-block { height: 160px; }
@keyframes sheen { to { background-position: -200% 0, 0 0; } }

/* ---- card face ---------------------------------------------------------------------- */
.card {
  position: relative; display: grid; gap: 6px; width: 100%; min-width: 0; padding: 10px 12px 11px;
  border: 0; background: var(--card-bg); color: var(--ink); text-align: left; box-shadow: var(--card-edge);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: box-shadow 0.15s var(--ease);
}
.card:hover { box-shadow: 0 0 0 1.5px var(--kraft), var(--card-edge); }
.card.is-open { box-shadow: 0 0 0 2px var(--ink), var(--card-edge); }
.card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.card-project {
  display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-family: var(--font-form); font-size: 0.875rem; font-variant-caps: all-small-caps;
  letter-spacing: 0.08em; color: var(--muted); line-height: 1.1;
}
.card-project::before { content: ""; width: 7px; height: 7px; background: var(--project); flex: none; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.chip-label {
  display: inline-block; max-width: 100%; padding: 1px 6px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; background: var(--chip); color: #F6F1E8; font-family: var(--font-form);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; line-height: 1.35;
}
.card-title { display: flex; gap: 6px; min-width: 0; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.card-title > span:last-child { min-width: 0; }
.card-done-icon { color: var(--focus); margin-top: 2px; }
.card.is-done .card-title { color: var(--muted); }
.card-where {
  font-family: var(--font-form); font-size: var(--step--1); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-height: 24px; min-width: 0;
  color: var(--muted); font-family: var(--font-form); font-size: 0.8125rem; font-variant-numeric: tabular-nums;
}
.meta { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.meta-due.is-overdue { color: var(--error); font-weight: 700; }
.meta-due.is-done { text-decoration: line-through; }
.meta.is-complete { color: var(--focus); font-weight: 700; }
.meta-running { color: var(--live); animation: pulse 1.6s var(--ease) infinite; }
.card-people { display: flex; flex: none; }
.card-people .avatar { box-shadow: 0 0 0 2px var(--card-bg); }
.card-people .avatar + .avatar { margin-left: -6px; }

/* dragging: the card follows the pointer, a slot shows where it lands */
.card.is-drag-source { display: none; }
.card-slot { background: rgba(170, 130, 90, 0.16); outline: 1.5px dashed var(--kraft); outline-offset: -1.5px; }
.card-ghost {
  position: fixed; left: 0; top: 0; z-index: 100; margin: 0; pointer-events: none; will-change: transform;
  box-shadow: var(--lift); opacity: 0.97;
}
.is-dragging, .is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.is-dragging .board-cols { scroll-snap-type: none !important; }

/* ---- the board ---------------------------------------------------------------------- */
.view-board { overflow: hidden; }
.board-slot, .board, .board-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.board-head { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 22px 20px 12px 24px; }
.board-head .page-title { font-size: var(--step-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-project-slot { min-width: 0; flex: 0 1 auto; }
.board-project { width: auto; max-width: 280px; min-height: 36px; font-size: var(--step--1); }
.board-cols {
  flex: 1; min-height: 0; display: flex; align-items: flex-start; gap: 14px; padding: 4px 24px 20px;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-padding: 0 24px;
}
.cols-row { display: contents; }
.col {
  flex: 0 0 var(--col-w); width: var(--col-w); max-height: 100%; min-height: 0; display: flex; flex-direction: column;
  background: var(--col-bg);
}
.col-head { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 4px 4px 14px; }
.col-name {
  margin: 0; min-width: 0; font-size: var(--step-0); font-weight: 700; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.col-count {
  flex: 1; color: var(--muted); font-family: var(--font-form); font-weight: 700; font-variant-numeric: tabular-nums;
}
.col-menu {
  position: absolute; right: 4px; top: 42px; z-index: 6; display: grid; min-width: 190px; padding: 4px 0;
  background: var(--sheet); box-shadow: var(--lift);
}
.menu-item { justify-content: flex-start; width: 100%; min-height: 42px; border: 0; font-weight: 500; }
.col-body { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 4px; }
.col-cards { display: grid; gap: 8px; }
.col-empty { margin: 2px 6px 6px; color: var(--muted); font-size: var(--step--1); }
.col.is-target .col-empty { display: none; }
.col-add { padding: 4px 8px 8px; }
.add-open {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 0 8px; border: 0;
  background: transparent; color: var(--muted); font-weight: 600; text-align: left;
}
.add-open:hover { background: var(--hover); color: var(--ink); }
.add-form { display: grid; gap: 8px; }
.add-input { min-height: 64px; padding: 8px 10px; resize: none; background: var(--card-bg); border-width: 1.5px; }
.add-actions { display: flex; align-items: center; gap: 6px; }
.col-new { background: transparent; outline: 1.5px dashed var(--rule); outline-offset: -1.5px; padding: 8px; }
.col-new .add-open { min-height: 44px; }
.col-skeleton { padding: 44px 8px 8px; height: 260px; }
.list-tabs { display: none; }

/* ---- the card detail ---------------------------------------------------------------- */
.detail-layer { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.detail-scrim { position: absolute; inset: 0; background: rgba(26, 23, 20, 0.28); pointer-events: auto; }
.detail {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(var(--detail-w), 100vw); display: flex;
  flex-direction: column; background: var(--sheet); box-shadow: var(--lift); pointer-events: auto;
  animation: slide-in 0.22s var(--ease);
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.detail-head {
  position: relative; display: flex; align-items: center; gap: 4px; min-height: 56px; padding: 6px 8px 6px 18px;
}
.detail-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 6px;
  background: var(--pen) repeat-x 0 0 / 480px 6px; filter: var(--stroke-filter); opacity: 0.8;
}
.d-back { display: none; }
.d-crumb {
  flex: 1; min-width: 0; font-family: var(--font-form); font-size: 0.875rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.d-body-inner { display: grid; gap: 18px; min-width: 0; padding: 18px 22px 48px; }
.d-title {
  display: block; width: calc(100% + 12px); margin: 0 -6px; padding: 4px 6px; border: 0; resize: none; overflow: hidden;
  background: transparent; color: var(--ink); font-size: var(--step-2); font-weight: 700; letter-spacing: -0.03em;
  line-height: 1.2; overflow-wrap: anywhere;
}
.d-title:hover { background: var(--hover); }
.d-title:focus { outline: 2px solid var(--focus); outline-offset: 0; background: var(--wall); }
.d-title-static { margin: 0; }
.d-where { margin: -12px 0 0; color: var(--muted); font-family: var(--font-form); font-size: var(--step--1); }
.d-move { display: grid; gap: 6px; }
.d-label { font-family: var(--font-form); font-size: 0.875rem; font-weight: 700; letter-spacing: 0.02em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 34px; padding: 0 12px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-size: var(--step--1); font-weight: 500;
}
.chip > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { background: var(--hover); }
.chip.is-on { background: var(--solid); border-color: var(--solid); color: var(--on-solid); font-weight: 600; }
.chip-toggle:not(.is-on) { border-color: var(--rule); }
.chip-dot { width: 10px; height: 10px; flex: none; background: var(--chip); }
.d-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.d-actions .btn { min-height: 44px; }
.d-timer-stop { background: var(--solid); border-color: var(--solid); color: var(--on-solid); }
.d-timer-stop:hover { background: var(--solid); opacity: 0.9; }
.d-timer-clock { font-family: var(--font-form); font-weight: 700; font-variant-numeric: tabular-nums; }
.d-done.is-on { background: var(--green); border-color: var(--green); color: var(--on-dark); }
.d-logged { margin-left: auto; font-family: var(--font-form); color: var(--muted); font-variant-numeric: tabular-nums; }
.d-section { position: relative; display: grid; gap: 10px; padding-top: 16px; min-width: 0; }
.d-section::before {
  content: ""; position: absolute; left: 0; right: 0; top: -3px; height: 6px;
  background: var(--pencil-light) repeat-x 0 0 / 480px 6px; filter: var(--stroke-filter);
}
.d-head { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.d-head .icon { color: var(--kraft); }
.d-heading { margin: 0; font-size: var(--step-0); font-weight: 700; }
.d-count, .d-status { font-family: var(--font-form); color: var(--muted); font-variant-numeric: tabular-nums; }
.d-status { color: var(--focus); font-size: var(--step--1); }
.d-none { margin: 0; color: var(--muted); font-size: var(--step--1); }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px 4px 5px;
  border: 1.5px solid var(--rule); background: transparent; color: var(--muted);
}
.person:hover { background: var(--hover); }
.person.is-on { border-color: var(--ink); background: var(--kraft-light); color: var(--ink); font-weight: 600; }
.person:not(.is-on) .avatar { opacity: 0.55; filter: grayscale(0.5); }
.person-name { white-space: nowrap; }
.d-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; min-width: 0; }
.d-stack { grid-template-columns: minmax(0, 1fr); }
.d-due { display: flex; gap: 6px; min-width: 0; }
.d-due input[type="date"] { flex: 1 1 58%; min-width: 0; }
.d-due input[type="time"] { flex: 1 1 42%; min-width: 0; }
.d-clear { align-self: center; }
.field-hint.is-overdue { color: var(--error); font-weight: 600; }
.d-inline-add { display: flex; gap: 6px; min-width: 0; }
.d-inline-input { flex: 1; min-width: 0; min-height: 40px; }
.progress { height: 6px; background: var(--floor); }
.progress-fill { height: 100%; width: var(--done, 0%); background: var(--green); transition: width 0.25s var(--ease); }
.items { display: grid; }
.item { display: flex; align-items: center; gap: 4px; min-width: 0; border-bottom: 1px solid var(--rule); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; min-width: 0; }
.item-check { flex: 1; }
.check-box { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--green); }
.item-text { min-width: 0; overflow-wrap: anywhere; }
.item.is-done .item-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--kraft); }
.entries { display: grid; }
.entry { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.entry-text { flex: 1; min-width: 0; }
.entry-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.entry-who { font-weight: 600; }
.entry-when { font-family: var(--font-form); font-size: var(--step--1); color: var(--muted); }
.entry-note { margin: 0; color: var(--muted); font-size: var(--step--1); overflow-wrap: anywhere; }
.entry-minutes { font-family: var(--font-form); font-weight: 700; font-variant-numeric: tabular-nums; }
.entry-pad { width: 30px; flex: none; }
.tag {
  padding: 0 6px; border: 1px solid var(--rule); color: var(--muted); font-family: var(--font-form);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap; line-height: 1.5;
}
.tag-live { border-color: var(--live); color: var(--live); }
.d-form { display: grid; gap: 12px; padding: 14px; background: var(--wall); min-width: 0; }
.d-form-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.d-add-time { justify-self: start; }
.comments { display: grid; gap: 14px; }
.comment { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.comment-text, .d-comment-new { flex: 1; min-width: 0; }
.d-comment-new { display: grid; gap: 6px; }
.d-comment-box { min-height: 64px; }
.comment-top { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.comment-who { font-weight: 600; }
.comment-when { flex: 1; color: var(--muted); font-family: var(--font-form); font-size: var(--step--1); }
.comment-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.d-foot { display: flex; padding-top: 6px; }
.d-archive { color: var(--muted); }

/* ---- My cards ----------------------------------------------------------------------- */
.groups, .view-mine .page-body > .empty { max-width: 1100px; }
.group { margin-bottom: 26px; }
.group-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; }
.group-title {
  margin: 0; font-family: var(--font-form); font-size: 0.9375rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
}
.group-head.is-overdue .group-title { color: var(--error); }
.group-count { color: var(--muted); font-family: var(--font-form); font-weight: 700; }
.group-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ---- Boards (index) and the New board dialog ---------------------------------------- */
.tiles-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; max-width: 1100px; }
.tiles { display: contents; }
.tile {
  display: grid; align-content: start; gap: 4px; min-width: 0; min-height: 124px; padding: 16px 18px;
  border: 0; background: var(--card-bg); color: var(--ink); text-align: left; box-shadow: var(--card-edge);
}
.tile:hover { box-shadow: 0 0 0 1.5px var(--kraft), var(--card-edge); }
.tile-icon { font-size: 1.3rem; color: var(--kraft); margin-bottom: 4px; }
.tile-name { font-size: var(--step-1); font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; line-height: 1.25; }
.tile-project {
  font-family: var(--font-form); font-variant-caps: all-small-caps; letter-spacing: 0.08em; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-meta { font-family: var(--font-form); font-size: var(--step--1); color: var(--muted); }
.tile-new {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: transparent;
  box-shadow: none; outline: 1.5px dashed var(--rule); outline-offset: -1.5px; color: var(--muted); font-weight: 600;
}
.tile-new:hover { color: var(--ink); box-shadow: none; background: var(--hover); }
.tile-skeleton { height: 124px; }
.dialog .sheet-head { padding: 16px 12px 4px 20px; }
.dialog-title { margin: 0; font-size: var(--step-1); font-weight: 700; letter-spacing: -0.02em; }
.dialog-icon { color: var(--kraft); font-size: 1.3rem; }

/* ---- Time --------------------------------------------------------------------------- */
.time-head .page-title { margin-right: auto; }
.week-switch { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.week-label { display: grid; justify-items: center; min-width: 150px; line-height: 1.25; }
.week-name { font-weight: 700; }
.week-dates { font-family: var(--font-form); font-size: var(--step--1); color: var(--muted); white-space: nowrap; }
.time-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; max-width: 1240px; }
.time-main, .time-side { display: grid; gap: 20px; min-width: 0; }
.panel { display: grid; gap: 12px; min-width: 0; padding: 18px 20px 20px; background: var(--sheet); box-shadow: var(--panel-edge); }
.panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; min-width: 0; }
.panel-title { margin: 0; font-size: var(--step-1); font-weight: 700; letter-spacing: -0.02em; }
.panel-sub { font-family: var(--font-form); color: var(--muted); }
.stat { display: grid; justify-items: end; line-height: 1.2; }
.stat-label {
  font-family: var(--font-form); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.stat-value { font-family: var(--font-form); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats { display: flex; flex-wrap: wrap; gap: 10px 28px; padding-bottom: 4px; }
.stats .stat { justify-items: start; }
.ts-days { display: grid; }
.ts-day { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.ts-day-head { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.ts-day-name { font-weight: 600; }
.ts-day.is-empty .ts-day-name { color: var(--muted); font-weight: 400; }
.ts-day-total { font-family: var(--font-form); font-weight: 700; font-variant-numeric: tabular-nums; }
.ts-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 0; }
.ts-clock { width: 44px; flex: none; font-family: var(--font-form); color: var(--muted); font-variant-numeric: tabular-nums; }
.ts-text { flex: 1; min-width: 0; display: grid; }
.ts-what {
  min-width: 0; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: left; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ts-what.is-link:hover { text-decoration: underline; text-decoration-color: var(--kraft); text-underline-offset: 3px; }
.ts-what:disabled { cursor: default; opacity: 1; }
.ts-sub { font-size: var(--step--1); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-note { margin: 0; font-size: var(--step--1); color: var(--muted); overflow-wrap: anywhere; }
.ts-minutes { font-family: var(--font-form); font-weight: 700; font-variant-numeric: tabular-nums; }
.ts-edit { display: grid; gap: 12px; margin: 4px 0 8px; padding: 14px; background: var(--wall); }
.ts-delete { margin-right: auto; color: var(--error); }
.ts-add { display: grid; justify-items: start; gap: 12px; }
.ts-add .d-form { justify-self: stretch; }
.sum-body > div { display: grid; gap: 6px; }
.sum-heading {
  margin: 12px 0 0; font-family: var(--font-form); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.sum-list { display: grid; }
.sum-row { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 42px; padding: 4px 0; border-bottom: 1px solid var(--rule); }
.sum-name { flex: 0 1 150px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { flex: 1; min-width: 40px; height: 8px; background: var(--floor); }
.bar-fill { height: 100%; background: var(--kraft); }
.sum-value { width: 52px; flex: none; text-align: right; font-family: var(--font-form); font-weight: 700; font-variant-numeric: tabular-nums; }
.sum-text { flex: 1; min-width: 0; display: grid; }
.sum-text .sum-name { flex: none; }
.sum-sub { font-size: var(--step--1); color: var(--muted); font-family: var(--font-form); }
.sum-amount { font-family: var(--font-form); font-size: 1.0625rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum-client.is-none .sum-name { color: var(--muted); }
.dot { width: 10px; height: 10px; flex: none; background: var(--dot); }
.chips-tight .chip { min-height: 32px; }
.export .d-form-foot { justify-content: flex-start; }

/* ---- Clients & projects ------------------------------------------------------------- */
.cp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; max-width: 1240px; }
.cp-list { display: grid; }
.cp-row { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 56px; border-bottom: 1px solid var(--rule); }
.cp-text { flex: 1; min-width: 0; display: grid; }
.cp-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-sub { font-size: var(--step--1); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-rate { font-family: var(--font-form); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cp-rate.is-none { color: var(--muted); font-weight: 400; }
.cp-form { display: grid; gap: 12px; margin: 6px 0; padding: 14px; background: var(--wall); }
.cp .swatches { grid-template-columns: repeat(8, minmax(0, 32px)); }

/* ---- touch: fingers, not a pointer ---------------------------------------------------- */
@media (pointer: coarse) {
  .chip, .nav-item, .add-open, .menu-item, .list-tab, .tab, .person { min-height: 44px; }
  .btn-icon.btn-small { width: 44px; height: 44px; }
  .entry-pad { width: 44px; }
  .check { min-height: 44px; }
  .check-box { width: 22px; height: 22px; }
  .d-inline-input { min-height: 44px; }
  .board-project { min-height: 44px; }
  .chip:active, .nav-item:active, .add-open:active, .tab:active, .tile:active, .card:active { background: var(--hover); }
  .card:active { background: var(--card-bg); box-shadow: 0 0 0 1.5px var(--kraft), var(--card-edge); }
  .card:hover { box-shadow: var(--card-edge); }
  /* tablets in landscape: the columns snap gently */
  .board-cols { scroll-snap-type: x proximity; }
  .col { scroll-snap-align: start; }
}

/* ---- laptops, smaller: two-column pages stack ------------------------------------------ */
@media (max-width: 1180px) {
  .time-grid, .cp-grid { grid-template-columns: minmax(0, 1fr); }
  :root { --rail: 220px; }
}

/* ---- phones and tablets in portrait: top bar, bottom navigation, the rail as a drawer -- */
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar { display: flex; }
  .bottomnav { display: grid; }
  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 35; width: min(320px, 86vw);
    transform: translateX(-102%); transition: transform 0.24s var(--ease); box-shadow: var(--lift); visibility: hidden;
    padding-top: calc(16px + env(safe-area-inset-top)); padding-left: calc(14px + env(safe-area-inset-left));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .rail.is-open { transform: none; visibility: visible; }
  .rail-close { display: inline-grid; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 34; background: rgba(36, 32, 28, 0.4); }
  .view-page { padding: 20px calc(20px + env(safe-area-inset-right)) 40px calc(20px + env(safe-area-inset-left)); }
  .view-page .page-head > .page-title { display: none; }
  .view-page .page-head:not(:has(> :not(.page-title))) { display: none; }
  .board-head { padding: 12px calc(12px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left)); }
  .board-head .page-title { display: none; }
  .board-cols {
    gap: 12px; padding: 4px 16px 16px; scroll-padding: 0 16px; scroll-snap-type: x mandatory;
  }
  .col { scroll-snap-align: start; }
  .toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .toast { width: max-content; }
  .timerbar { padding-left: calc(16px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right)); }
  .time-head { justify-content: center; }
}

/* ---- phones: one list at a time, the card full screen ---------------------------------- */
@media (max-width: 599px) {
  .view-page { padding: 16px calc(16px + env(safe-area-inset-right)) 32px calc(16px + env(safe-area-inset-left)); }
  .board-head { padding: 8px 4px 2px 12px; gap: 2px; }
  .board-project-slot { flex: 1; }
  .board-project { max-width: 100%; width: 100%; }
  .board-head .grow { display: none; }
  .cp-row { flex-wrap: wrap; gap: 2px 10px; padding: 8px 0; }
  .cp-text { flex: 1 1 calc(100% - 30px); }
  .cp-rate { margin-right: auto; }
  .list-tabs {
    display: block; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--rule);
    padding: 0 calc(6px + env(safe-area-inset-right)) 0 calc(6px + env(safe-area-inset-left));
  }
  .list-tabs::-webkit-scrollbar { display: none; }
  .list-tabs-row { display: flex; width: max-content; }
  .list-tab {
    position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 12px;
    border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 600;
    white-space: nowrap;
  }
  .list-tab + .list-tab::before {
    content: "\00b7"; position: absolute; left: -3px; color: var(--rule); font-weight: 700;
  }
  .list-tab.is-on { color: var(--ink); border-bottom-color: var(--ink); }
  .tab-count { font-family: var(--font-form); font-weight: 700; font-variant-numeric: tabular-nums; }
  .board-cols { gap: 0; padding: 0; scroll-padding: 0; scroll-snap-type: x mandatory; }
  .col { flex: 0 0 100%; width: 100%; background: transparent; scroll-snap-align: start; scroll-snap-stop: always; }
  .col-head { display: none; }
  .col-body { padding: 12px calc(12px + env(safe-area-inset-right)) 4px calc(12px + env(safe-area-inset-left)); }
  .col-add { padding: 4px calc(12px + env(safe-area-inset-right)) 12px calc(12px + env(safe-area-inset-left)); }
  .col-new { outline: 0; padding: 16px; }
  .col-new .add-open { outline: 1.5px dashed var(--rule); outline-offset: -1.5px; }
  .card { padding: 12px 14px 13px; }
  .detail-scrim { display: none; }
  .detail {
    width: 100%; animation: sheet-up 0.22s var(--ease);
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .detail-head { padding: 4px 8px 4px 4px; }
  .d-back { display: inline-grid; }
  .d-close { display: none; }
  .d-body-inner { padding: 14px 16px 40px; }
  .d-actions .btn { flex: 1 1 auto; }
  .d-logged { width: 100%; margin-left: 0; }
  .group-cards { grid-template-columns: minmax(0, 1fr); }
  .tiles-wrap { grid-template-columns: minmax(0, 1fr); }
  .tile { min-height: 0; }
  .panel { padding: 16px 14px 18px; }
  .week-label { min-width: 0; flex: 1; }
  .week-switch { width: 100%; }
  .sum-name { flex-basis: 110px; }
  .cp .swatches { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .board-cols, .list-tabs { scroll-behavior: auto; }
}
