/*
 * Bases, the web UI (src/web): Warm Paper, the Coworkers dashboard's system without coworkers. The design
 * canvas's bases.css (tokens and every component) plus the pieces of Coworkers' app.css that editing in
 * place needs (menus, pickers, the board's drag, the view panel). One file; served as /assets/app-<hash>.css.
 */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --ground: #f5f3ef; --card: #fff; --linen: #efebe3; --ink: #10262c; --secondary: #46545a; --muted: #665f55;
  --brand: #047857; --brand-hover: #036848;
  --border: #e7e0d3; --border-strong: #d9cfbd; --hover: #faf8f5; --field: #f4f6f7; --field-border: #e2e6e9;
  --ok-bg: #dbf0e6; --ok-ink: #046a4d; --warn-bg: #fdf3e0; --warn-ink: #9a4a0b; --bad-bg: #fde8e8; --bad-ink: #9b1c1c;
  --blue-bg: #e3ecfb; --blue-ink: #1d4c9e; --vio-bg: #ede7fb; --vio-ink: #5b2bb5; --gray-bg: #efebe3; --gray-ink: #46545a;
  --dark: #101c1f; --dark-ink: #f2efe9;
  --shadow-pop: 0 2px 6px rgba(20, 25, 20, .06), 0 16px 36px -12px rgba(20, 25, 20, .28);
  --sans: "Space Grotesk", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
  --tap: 44px; --gutter: 24px;
  color-scheme: light;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
:where(p, h1, h2, h3, ul, ol, dl, dd, figure) { margin: 0; padding: 0; }
:where(ul, ol) { list-style: none; }
h1, h2, h3 { font-weight: inherit; font-size: inherit; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
img, svg { max-width: 100%; }
.sr { position: absolute; 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: 16px; top: -60px; z-index: 100; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.skip:focus { top: 12px; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* text roles */
.t-xl { font-size: 24px; font-weight: 300; letter-spacing: -.02em; line-height: 1.2; }
.t-l { font-size: 16px; font-weight: 500; letter-spacing: -.01em; }
.meta { font-size: 12px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.label { font-size: 13px; font-weight: 500; color: var(--ink); }
.sec { font-size: 12px; color: var(--muted); font-family: var(--mono); font-weight: 400; letter-spacing: .04em; text-transform: uppercase; }
.m { color: var(--muted); font-size: 12px; }
.mono { font-family: var(--mono); }
.late { color: var(--bad-ink); }

/* ── Top bar ────────────────────────────────────────────────────────────── */
.top { height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 var(--gutter); border-bottom: 1px solid var(--border); background: var(--ground); position: relative; z-index: 20; }
.mark { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 16px; letter-spacing: -.01em; color: var(--ink); white-space: nowrap; }
.mark:hover { color: var(--ink); }
.mark svg { width: 20px; height: 20px; color: var(--brand); }
.top .grow { flex: 1; }
.who { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--secondary); min-width: 0; }
.who .who-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.av { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--linen); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; color: var(--ink); line-height: 1; }
.av.sm { width: 24px; height: 24px; font-size: 11px; }
.who form { margin: 0; }

/* the switcher (the Base's name in the top bar) */
.sw-wrap { position: relative; min-width: 0; }
.crumb-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; max-width: 100%; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--card); font-weight: 500; min-width: 0; }
.crumb-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-btn svg { width: 14px; height: 14px; flex: none; }
.crumb-btn:hover { background: var(--hover); }
.crumb-space { color: var(--secondary); font-size: 14px; white-space: nowrap; }
.sw { margin: 0; padding: 0; width: min(380px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); color: var(--ink); max-height: min(560px, calc(100dvh - 80px)); }
.sw:popover-open { display: flex; flex-direction: column; }
.sw-s { padding: 10px; border-bottom: 1px solid var(--border); }
.sw-l { padding: 6px; display: flex; flex-direction: column; overflow: auto; min-height: 0; }
.sw-g { font-size: 11px; font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.sw-i { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.sw-i:hover, .sw-i:focus-visible { background: var(--hover); color: var(--ink); }
.sw-i[aria-current="page"] { background: var(--linen); }
.sw-i .bicon { width: 30px; height: 30px; border-radius: 8px; }
.sw-i .bicon svg { width: 16px; height: 16px; }
.sw-i b { font-weight: 500; display: block; font-size: 14px; }
.sw-i span.s { font-size: 12px; color: var(--muted); display: block; }
.sw-f { border-top: 1px solid var(--border); padding: 8px; }
.sw-empty { padding: 10px; font-size: 13px; color: var(--muted); }
@supports (anchor-name: --a) {
  .sw { inset: auto; position-anchor: --sw; top: anchor(bottom); left: anchor(left); margin: 8px 0 0; position-try-fallbacks: flip-inline; }
}

/* ── Page ───────────────────────────────────────────────────────────────── */
.page { max-width: 1360px; margin: 0 auto; padding: 28px var(--gutter) 48px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-l { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.title-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.title-row h1 { overflow-wrap: anywhere; }
.bicon { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--card); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--brand); font-size: 20px; line-height: 1; }
.bicon svg { width: 20px; height: 20px; }
.bicon .em { font-size: 18px; }
.bicon .lt { font-size: 16px; font-weight: 500; color: var(--ink); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; position: relative; }
.actions form { margin: 0; }
.notice { background: var(--ok-bg); color: var(--ok-ink); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.bad { background: var(--bad-bg); color: var(--bad-ink); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn { position: relative; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--card); color: var(--ink); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none; line-height: 1.2; transition: background-color .12s, border-color .12s; }
.btn:hover { background: var(--hover); color: var(--ink); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.p { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.p:hover { background: var(--brand-hover); color: #fff; }
.btn.g { border-color: transparent; background: transparent; color: var(--secondary); }
.btn.g:hover { background: var(--linen); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn.danger, .menu-item.danger { color: var(--bad-ink); }
.btn.lg { height: 44px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.is-pending { color: transparent !important; cursor: progress; pointer-events: none; }
.btn.is-pending > * { visibility: hidden; }
.btn.is-pending::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.p.is-pending::after { border-color: #fff; border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Fields ─────────────────────────────────────────────────────────────── */
.field { height: 40px; border: 1px solid var(--field-border); background: var(--field); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--ink); width: 100%; min-width: 0; }
textarea.field { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.field { padding-right: 28px; }
.field:hover { border-color: var(--border-strong); }
.field:focus { background: var(--card); border-color: var(--brand); outline: 2px solid rgba(4, 120, 87, .2); outline-offset: 1px; }
.field::placeholder { color: var(--muted); }
.field.code { font-family: var(--mono); font-size: 20px; letter-spacing: .3em; height: 52px; text-align: center; }
.field.key { font-family: var(--mono); }
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack.lg { gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row > .field { flex: 1 1 200px; }

/* ── Tabs (views) ───────────────────────────────────────────────────────── */
.tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 40px; padding: 0 12px; border: 0; background: none; display: inline-flex; align-items: center; gap: 8px; color: var(--secondary); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; flex: none; }
.tab svg { width: 16px; height: 16px; flex: none; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; padding-right: 4px; }
.tab.add { color: var(--muted); }
.tab-opt { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; color: var(--muted); }
.tab-opt:hover { background: var(--linen); color: var(--ink); }
.tab-opt svg { width: 12px; height: 12px; }

/* ── Toolbar ────────────────────────────────────────────────────────────── */
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.search { height: 32px; min-width: 240px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--field-border); background: var(--field); border-radius: 8px; color: var(--muted); font-size: 13px; margin: 0; }
.search:focus-within { border-color: var(--brand); background: var(--card); }
.search svg { width: 14px; height: 14px; flex: none; }
.search input { border: 0; background: transparent; font: inherit; color: var(--ink); width: 100%; min-width: 0; height: 100%; outline: none; }
.search input::placeholder { color: var(--muted); }
.chip { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: 12px; color: var(--secondary); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
a.chip:hover, button.chip:hover { border-color: var(--border-strong); color: var(--ink); background: var(--hover); }
.chip svg { width: 14px; height: 14px; flex: none; }
.chip.set { border-color: #bfe3d1; background: var(--ok-bg); color: var(--ok-ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
a.chip.set:hover { color: var(--ok-ink); background: #cfeadc; }
.tools .grow { flex: 1; }
.count { font-size: 12px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }

/* ── Pills (choices) ────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; background: var(--gray-bg); color: var(--gray-ink); }
.pill::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill.rel::before, .pill.plain::before { display: none; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; max-width: 100%; }
.t-gray { background: var(--gray-bg); color: var(--gray-ink); }
.t-amber { background: var(--warn-bg); color: var(--warn-ink); }
.t-blue { background: var(--blue-bg); color: var(--blue-ink); }
.t-red { background: var(--bad-bg); color: var(--bad-ink); }
.t-vio { background: var(--vio-bg); color: var(--vio-ink); }
.t-green { background: var(--ok-bg); color: var(--ok-ink); }
.tag { display: inline-flex; height: 22px; align-items: center; padding: 0 8px; border-radius: 6px; background: var(--linen); font-size: 12px; color: var(--secondary); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cbx { display: inline-block; width: 16px; height: 16px; border: 1.5px solid var(--border-strong); border-radius: 4px; vertical-align: middle; background: var(--card) center / 12px no-repeat; }
.cbx.on { background-color: var(--brand); border-color: var(--brand); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6 9.6 3.6' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.pill.rel { background: var(--card); border: 1px solid var(--border); color: var(--ink); font-weight: 400; padding: 0 8px; }
a.pill.rel:hover { border-color: var(--border-strong); color: var(--ink); }
.pill.rel.gone { color: var(--muted); font-style: italic; }

/* ── Cards, empty states ────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.card.pad { padding: 20px; }
.scroll { overflow-x: auto; overscroll-behavior-x: contain; position: relative; }
.foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.empty { padding: 32px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--secondary); }
.empty b { color: var(--ink); font-weight: 500; font-size: 16px; }
.empty p { max-width: 520px; }
.empty .row { justify-content: center; margin-top: 4px; }
.group-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--hover); }
.group-h .count { margin-left: 2px; }
.groups { display: flex; flex-direction: column; gap: 16px; }
.groups > section > .group-h { border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0; }
.groups > section > .card { border-radius: 0 0 12px 12px; }
.groups > section > .gal { padding-top: 12px; }
.groups > section > .gtitle { display: flex; align-items: center; gap: 8px; padding: 0 2px 8px; }

/* ── Table ──────────────────────────────────────────────────────────────── */
.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; table-layout: fixed; }
.grid th { position: relative; background: var(--hover); text-align: left; font-weight: 500; font-size: 12px; color: var(--secondary); padding: 0 12px; height: 36px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid th .ty { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.grid th .ty > span { overflow: hidden; text-overflow: ellipsis; }
.grid th svg { width: 13px; height: 13px; color: var(--muted); flex: none; }
.grid td { padding: 0 12px; height: 42px; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--ink); overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.grid td + td, .grid th + th { border-left: 1px solid var(--border); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: var(--hover); }
.grid tr[aria-current="true"] td { background: var(--ground); }
.grid td.n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.grid th.n { padding: 0 8px; }
.grid td.num, .grid th.num { text-align: right; }
.grid td.num { font-family: var(--mono); font-size: 12px; }
.grid td.mono { font-family: var(--mono); font-size: 12px; color: var(--secondary); }
.grid td.tcell { font-weight: 500; position: relative; padding-right: 40px; }
.grid td a.cell { color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; line-height: 41px; }
.grid td a.cell:hover { color: var(--brand); }
.grid td a:not(.cell), .r .s a { color: var(--secondary); }
.grid td a:not(.cell):hover { color: var(--brand); }
.grid th .th-in { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; }
.grid th.addcol, .grid td.addcol { padding: 0 4px; }
.grid td[data-prop] { cursor: pointer; }
.grid td[data-prop].ro { cursor: default; }
.grid td[data-prop]:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
.grid td.editing { padding: 4px 6px; overflow: visible; }
.grid td .pills { flex-wrap: nowrap; overflow: hidden; }
.col-resize { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; touch-action: none; }
.col-resize:hover, .col-resize.is-active { background: linear-gradient(to right, transparent 3px, var(--brand) 3px, var(--brand) 5px, transparent 5px); }
.th-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); opacity: 0; flex: none; padding: 0; }
.grid th:hover .th-btn, .grid th:focus-within .th-btn { opacity: 1; }
.th-btn:hover { background: var(--linen); color: var(--ink); }
.th-btn svg { width: 12px; height: 12px; }
.th-add { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.th-add:hover { background: var(--linen); color: var(--ink); }
.th-add svg { width: 14px; height: 14px; }
@media (hover: none) { .th-btn { opacity: 1; } }
.cell-in { width: 100%; min-width: 120px; min-height: 32px; border: 1px solid var(--brand); border-radius: 6px; padding: 4px 8px; background: var(--card); color: var(--ink); font: inherit; font-size: 14px; }
textarea.cell-in { min-height: 96px; line-height: 1.5; resize: vertical; }
.saving { opacity: .6; }
.cell-edit { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: var(--linen); color: var(--secondary); opacity: 0; }
.grid tr:hover .cell-edit, .grid td:focus .cell-edit, .grid td:focus-within .cell-edit { opacity: 1; }
@media (hover: none) { .cell-edit { opacity: 1; } }
form.newrow, form.col-new { display: block; margin: 0; padding: 4px 6px; border-top: 1px solid var(--border); }
form.col-new { border-top: 0; padding: 0; }
form.newrow .btn, form.col-new .btn { color: var(--muted); font-weight: 400; }
form.newrow .btn:hover, form.col-new .btn:hover { color: var(--ink); }

/* ── Rows: a list view, and the table on a phone ────────────────────────── */
.rows > li + li { border-top: 1px solid var(--border); }
.r { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--ink); min-width: 0; }
a.r:hover { background: var(--hover); color: var(--ink); }
.r[aria-current="true"] { background: var(--ground); }
.r b { font-weight: 500; min-width: 160px; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r .s { color: var(--secondary); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrows { display: none; }
.mrow { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; color: var(--ink); }
.mrow:hover { color: var(--ink); background: var(--hover); }
.mrows > li + li { border-top: 1px solid var(--border); }
.mrow .l1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.mrow b { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .l2 { font-size: 12px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Board ──────────────────────────────────────────────────────────────── */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(232px, 1fr); gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; align-items: start; padding-bottom: 4px; position: relative; }
.col { background: var(--linen); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; border: 1px solid transparent; transition: border-color .12s, background-color .12s; }
.col-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px; }
.col-n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.col ul { display: flex; flex-direction: column; gap: 8px; min-height: 4px; }
.kc-li { position: relative; }
.kc { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 40px 10px 12px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); transition: border-color .12s, opacity .12s; }
.kc:hover { border-color: var(--border-strong); color: var(--ink); }
.kc[aria-current="true"] { border-color: var(--brand); }
.kc[draggable="true"] { cursor: grab; }
.kc .t { font-weight: 500; overflow-wrap: anywhere; }
.kc .line { font-size: 12px; color: var(--secondary); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; min-width: 0; }
.kc .line > span { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-move { position: absolute; top: 6px; right: 6px; }
.kc-mv { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.kc-mv svg { width: 14px; height: 14px; }
.kc-mv:hover, .kc-mv[aria-expanded="true"] { background: var(--linen); color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .kc-mv { opacity: 0; transition: opacity .12s; }
  .kc-li:hover .kc-mv, .kc-li:focus-within .kc-mv, .kc-mv[aria-expanded="true"] { opacity: 1; }
}
.kc-li.is-dragging .kc { opacity: .4; }
.kc-li.is-saving .kc { opacity: .7; }
.col.is-over { border-color: var(--brand); background: var(--hover); }
.board.is-dragging .col ul:empty::after { content: "Soltalo acá"; display: block; padding: 16px; border: 1px dashed var(--border-strong); border-radius: 8px; text-align: center; color: var(--muted); font-size: 12px; }

/* ── Gallery ────────────────────────────────────────────────────────────── */
.gal { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.gcard { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; color: var(--ink); }
.gcard:hover { border-color: var(--border-strong); color: var(--ink); }
.gcover { height: 84px; background: var(--linen); display: flex; align-items: flex-end; padding: 10px 12px; position: relative; }
.gcover.img { height: 140px; padding: 0; }
.gcover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ginit { width: 40px; height: 40px; border-radius: 50%; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 500; margin-bottom: -28px; }
.gbody { padding: 24px 12px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gcover.img + .gbody { padding-top: 12px; }
.gbody b { font-weight: 500; overflow-wrap: anywhere; }
.gbody .s { font-size: 12px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; }

/* gallery covers from other sites: off until asked */
.imgbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* ── Calendar ───────────────────────────────────────────────────────────── */
.calbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.calbar b { font-weight: 500; font-size: 16px; }
.calbar .grow { flex: 1; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal .dow { padding: 8px 10px; font-size: 12px; color: var(--secondary); border-bottom: 1px solid var(--border); background: var(--hover); }
.cal .day { min-height: 104px; padding: 6px 8px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.last { border-bottom: 0; }
.cal .d { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cal .day.out { background: var(--hover); }
.cal .day.out .d { opacity: .45; }
.cal .day.today .d { color: #fff; background: var(--brand); border-radius: 999px; padding: 0 6px; align-self: flex-start; }
.ev { display: block; font-size: 12px; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.ev:hover { filter: brightness(.96); }
.ev.more { color: var(--muted); padding: 0 6px; background: none; }
.undated { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.undated ul { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Timeline ───────────────────────────────────────────────────────────── */
.tl { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-width: 640px; }
.tl .lab { padding: 0 12px; height: 40px; display: flex; align-items: center; border-bottom: 1px solid var(--border); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); min-width: 0; }
.tl a.lab:hover { color: var(--brand); }
.tl .lab > span { overflow: hidden; text-overflow: ellipsis; }
.tl .lane { position: relative; height: 40px; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); background-image: linear-gradient(to right, var(--border) 1px, transparent 1px); }
.tl .bar { position: absolute; top: 9px; height: 22px; min-width: 6px; border-radius: 6px; font-size: 12px; padding: 0 8px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; }
.tl .bar.open { opacity: .7; }
.tl .hd { height: 36px; border-bottom: 1px solid var(--border); background-color: var(--hover); font-weight: 400; color: var(--secondary); font-size: 12px; }
.tl .scale { display: grid; font-family: var(--mono); font-size: 11px; color: var(--muted); align-items: center; }
.tl .scale span { padding-left: 4px; overflow: hidden; white-space: nowrap; }
.tl .tl-last { border-bottom: 0; }

/* ── Chart ──────────────────────────────────────────────────────────────── */
.chart { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ch { padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ch h3 { font-size: 16px; font-weight: 500; }
.ch svg { display: block; width: 100%; max-width: 760px; height: auto; overflow: visible; }
.ch svg text { font-family: var(--sans); font-size: 12px; fill: var(--secondary); }
.ch svg text.v { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.ch svg text.big { font-size: 28px; font-weight: 300; fill: var(--ink); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--border); border-radius: 10px; padding: 14px; min-width: 0; }
.kpi .n { font-size: 28px; font-weight: 300; letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi .l { font-size: 12px; color: var(--secondary); }
.dtab { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtab th, .dtab td { text-align: left; padding: 6px 0; border-bottom: 1px solid var(--border); }
.dtab th { font-size: 12px; font-weight: 400; color: var(--muted); }
.dtab td.v, .dtab th.v { text-align: right; font-family: var(--mono); font-size: 12px; }
.dtab tr:last-child td { border-bottom: 0; }
.dtab .sw8 { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }

/* ── Menus and popovers ─────────────────────────────────────────────────── */
.menu-pop { margin: 0; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--ink); box-shadow: var(--shadow-pop); width: max-content; min-width: 220px; max-width: min(340px, calc(100vw - 32px)); max-height: min(440px, calc(100dvh - 96px)); overflow-y: auto; overscroll-behavior: contain; }
.menu-pop.is-fallback { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; }
.mhint { font-size: 12px; color: var(--muted); padding: 6px 10px 2px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; text-align: left; text-decoration: none; }
.menu-item > span:first-child { flex: 1; min-width: 0; }
.menu-item svg { width: 16px; height: 16px; color: var(--secondary); flex: none; }
.menu-item:hover, .menu-item:focus-visible, .menu-item.is-active { background: var(--hover); color: var(--ink); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.menu-item[aria-checked="true"], .menu-item[aria-current] { color: var(--brand); }
.menu-sep { margin: 6px 4px; border: 0; border-top: 1px solid var(--border); }
.menu-pop form { margin: 0; }
.acct-check { visibility: hidden; display: inline-flex; color: var(--brand); }
.menu-item[aria-checked="true"] .acct-check, .menu-item[aria-selected="true"] .acct-check { visibility: visible; }
@supports (anchor-name: --a) {
  .menu-pop.anch { inset: auto; top: anchor(bottom); right: anchor(right); margin: 6px 0 0; position-try-fallbacks: flip-inline, flip-block; }
  .menu-pop.anch.l { right: auto; left: anchor(left); }
}
.picker { padding: 6px; }
.picker .picker-q { height: 36px; margin-bottom: 4px; }
.picker-list { max-height: 280px; overflow-y: auto; }
.picker .menu-item { min-height: 34px; }
.picker-add { color: var(--brand); }
.rel-picker { width: min(340px, calc(100vw - 32px)); }
.rel-chips:not(:empty) { padding: 2px 2px 8px; }
.rel-chips .rels { flex-wrap: wrap; }
.rel-chips .pill.rel { padding-right: 2px; }
.rel-x { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 14px; line-height: 1; padding: 0; }
.rel-x:hover { background: var(--linen); color: var(--ink); }
.rel-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.rel-row .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-status { color: var(--muted); font-size: 12px; }
.rel-status:not(:empty) { padding: 4px 10px; }
.pmenu { width: min(300px, calc(100vw - 32px)); font-weight: 400; color: var(--ink); white-space: normal; }
.pm-head { display: flex; flex-direction: column; padding: 6px 10px 8px; }
.pm-head b { font-weight: 500; }
.pm-form { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); margin: 0; }
.pm-form .field { height: 34px; }
.pm-form .row { flex-wrap: nowrap; }

/* ── Dialogs and the record's sheet (open from the server: ?vista=nueva, ?compartir=1, /r/:rid) ── */
.scrim { position: fixed; inset: 0; background: rgba(16, 38, 44, .18); z-index: 40; display: block; }
.dialog { position: fixed; left: 50%; top: 96px; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 128px); background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; z-index: 50; margin: 0; padding: 0; color: var(--ink); }
.dialog.wide { width: min(780px, calc(100vw - 32px)); }
.dialog-h { padding: 18px 20px 6px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog-h h2 { font-size: 16px; font-weight: 500; }
.dialog-b { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.dialog-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--card); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; z-index: 50; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border); min-width: 0; }
.sheet-h .count { overflow: hidden; text-overflow: ellipsis; }
.sheet-h .back { display: none; }
.sheet-acts { display: flex; gap: 4px; align-items: center; position: relative; }
.sheet-b { padding: 20px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 1; }
.sheet-b h2.t-xl { overflow-wrap: anywhere; }
h2.ed { cursor: text; border-radius: 6px; margin-left: -6px; padding: 0 6px; }
h2.ed:hover { background: var(--hover); }
.props { display: grid; grid-template-columns: 140px minmax(0, 1fr); row-gap: 2px; }
.props dt { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13px; color: var(--secondary); min-width: 0; }
.props dt svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.props dt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.props dd { display: flex; align-items: center; min-height: 36px; padding: 4px 8px; border-radius: 6px; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.props dd.ed { cursor: text; }
.props dd.ed:hover { background: var(--hover); }
.props dd.ed:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }
.props dd.ed:empty::before { content: "Vacío"; color: var(--muted); }
.props dd.ro { color: var(--secondary); }
.props dd.editing { background: transparent; }
.props dd .md { white-space: pre-line; }
.hist li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.hist li:last-child { border-bottom: 0; }
.hist b { font-weight: 500; }
.hist .when { font-size: 12px; color: var(--muted); }
.hist .pill { vertical-align: middle; }
.comments li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 8px 0; font-size: 13px; }
.comments .txt { white-space: pre-line; overflow-wrap: anywhere; }
.comment-f { display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.comment-f .field { flex: 1; }
.deleted-note { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 10px 12px; font-size: 13px; }

/* the view dialog: the type picker and the per-type settings */
.vgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.vtypes { display: flex; flex-direction: column; gap: 8px; }
.vt { position: relative; display: block; }
.vt input { position: absolute; opacity: 0; pointer-events: none; }
.vt > span { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); cursor: pointer; }
.vt > span:hover { background: var(--hover); }
.vt input:checked + span { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.vt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.vt input:disabled + span { opacity: .5; cursor: not-allowed; }
.vt i { width: 36px; height: 36px; border-radius: 8px; background: var(--linen); display: flex; align-items: center; justify-content: center; color: var(--ink); }
.vt i svg { width: 18px; height: 18px; }
.vt b { font-weight: 500; display: block; }
.vt small { font-size: 12px; color: var(--muted); display: block; }
.vset { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.vset fieldset, .vset .f { display: flex; flex-direction: column; gap: 6px; }
.vset legend { padding: 0; margin-bottom: 6px; }
.only { display: none !important; }
form:has(input[name="tipo"][value="board"]:checked) .only.for-board,
form:has(input[name="tipo"][value="gallery"]:checked) .only.for-gallery,
form:has(input[name="tipo"][value="calendar"]:checked) .only.for-calendar,
form:has(input[name="tipo"][value="timeline"]:checked) .only.for-timeline,
form:has(input[name="tipo"][value="chart"]:checked) .only.for-chart,
form:has(input[name="tipo"][value="table"]:checked) .only.for-table,
form:has(input[name="tipo"][value="list"]:checked) .only.for-list { display: flex !important; }
form:has(input[name="tipo"][value="chart"]:checked) .not-chart { display: none !important; }
form:has(select[name="grafico.medida"] option[value="count"]:checked) .chart-prop { display: none !important; }
.icons { display: grid; grid-template-columns: repeat(auto-fill, 36px); gap: 4px; }
.ico { position: relative; }
.ico input { position: absolute; opacity: 0; pointer-events: none; }
.ico > span { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--secondary); cursor: pointer; }
.ico > span svg { width: 16px; height: 16px; }
.ico > span:hover { background: var(--hover); color: var(--ink); }
.ico input:checked + span { border-color: var(--brand); background: var(--ok-bg); color: var(--ok-ink); }
.ico input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { position: relative; min-width: 0; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt > span { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--secondary); font-size: 12px; cursor: pointer; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.opt:hover > span { border-color: var(--border-strong); background: var(--hover); color: var(--ink); }
.opt input:checked + span { border-color: var(--brand); background: var(--ok-bg); color: var(--ok-ink); }
.opt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.vf-list { border: 1px solid var(--border); border-radius: 8px; }
.vf + .vf { border-top: 1px solid var(--border); }
.vf > summary { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; font-size: 14px; }
.vf > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); flex: none; }
.vf[open] > summary::after { transform: rotate(45deg); }
.vf > summary:hover { background: var(--hover); }
.vf > summary .d { color: var(--brand); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vf-body { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 12px; }
.vf:has(input[name$=".op"][value=""]:checked, input[name$=".op"][value="empty"]:checked, input[name$=".op"][value="not_empty"]:checked) .vf-val { display: none; }
.vfields { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; }
.vfield { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 4px 0 12px; }
.vfield + .vfield { border-top: 1px solid var(--border); }
.vfield label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; cursor: pointer; }
.vfield .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vfield .btn { width: 28px; padding: 0; }
.kept { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--secondary); }
.choices-ed { display: flex; flex-direction: column; gap: 6px; }

/* share */
.people li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.people li:last-child { border-bottom: 0; }
.people .who2 { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.people .who2 b { font-weight: 500; overflow-wrap: anywhere; }
.people .who2 span { font-size: 12px; color: var(--muted); }
.people form { margin: 0; }
.role { font-size: 12px; color: var(--secondary); }

/* ── Index (Tus Bases) ──────────────────────────────────────────────────── */
.bgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bcard { display: flex; flex-direction: column; gap: 14px; padding: 18px; color: var(--ink); }
.bcard:hover { background: var(--hover); color: var(--ink); }
.bcard .bt { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bcard .bt > div { min-width: 0; display: flex; flex-direction: column; }
.bcard b { font-weight: 500; font-size: 16px; overflow-wrap: anywhere; }
.stats { display: flex; gap: 16px; font-size: 12px; color: var(--secondary); flex-wrap: wrap; }
.tpls { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.tpl { position: relative; min-width: 0; }
.tpl input { position: absolute; opacity: 0; pointer-events: none; }
.tpl > span { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; background: var(--card); height: 100%; }
.tpl b { font-weight: 500; }
.tpl small { color: var(--secondary); font-size: 12px; }
.tpl:hover > span { border-color: var(--border-strong); background: var(--hover); }
.tpl input:checked + span { border-color: var(--brand); background: var(--ok-bg); }
.tpl input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.trash li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.trash li:last-child { border-bottom: 0; }
.trash .tm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trash .tm b { font-weight: 500; overflow-wrap: anywhere; }
.trash .tm span { font-size: 12px; color: var(--muted); }
.trash form { margin: 0; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 96px 16px 48px; }
.login .card { width: 100%; max-width: 420px; padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.login p.lead { color: var(--secondary); }
.login p.lead b { font-weight: 500; color: var(--ink); }
.login form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.login .alt { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.login .alt form { flex-direction: row; }
.bare { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 95; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 8px 8px 8px 16px; border-radius: 8px; background: var(--dark); color: var(--dark-ink); font-size: 14px; box-shadow: var(--shadow-pop); }
.toast > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { flex: none; min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: #86cfa9; font-weight: 500; }
.toast button:hover { background: rgba(255, 255, 255, .08); }

/* phone-only pieces */
.phone-only { display: none !important; }
.mbar { display: none; }

/* ── Touch targets ──────────────────────────────────────────────────────── */
@media (pointer: coarse) {
  .menu-item, .opt > span { min-height: var(--tap); }
}

/* ── Up to 960 px ───────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .gal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart { grid-template-columns: minmax(0, 1fr); }
  .bgrid { grid-template-columns: minmax(0, 1fr); }
  .crumb-space { display: none; }
  .vgrid { grid-template-columns: minmax(0, 1fr); }
  .who .who-n { max-width: 160px; }
}

/* ── Up to 640 px: the phone ────────────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .top { gap: 10px; }
  .page { padding: 16px 16px 96px; gap: 12px; }
  .who .who-n, .who .role-l { display: none; }
  .t-xl { font-size: 22px; }
  .head { align-items: center; flex-wrap: nowrap; }
  .head .meta { display: none; }
  .bicon { width: 32px; height: 32px; }
  .phone-only { display: inline-flex !important; }
  .desk-only { display: none !important; }
  .tabs { margin: 0 -16px; padding: 0 12px; }
  .search { min-width: 0; flex: 1 1 100%; }
  .tools .chip.opt-chip { display: none; }
  .tools .grow { display: none; }
  .gal { grid-template-columns: minmax(0, 1fr); }
  /* the table becomes rows; the board's columns one under the other */
  .tablewrap { display: none; }
  .mrows { display: block; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .tl { grid-template-columns: 116px minmax(0, 1fr); min-width: 560px; }
  .cal .day { min-height: 64px; padding: 4px; }
  .cal .ev { font-size: 11px; padding: 1px 4px; }
  .cal .dow { padding: 6px 4px; }
  .props { grid-template-columns: minmax(0, 1fr); }
  .props dt { min-height: 0; padding-top: 8px; }
  .props dd { padding: 4px 0 8px; border-bottom: 1px solid var(--border); border-radius: 0; font-size: 15px; }
  .sheet { width: 100vw; border-left: 0; }
  .sheet-h { padding: 6px 8px; height: 56px; }
  .sheet-h .back { display: inline-flex; }
  .sheet-h .count.crumbish { display: none; }
  .scrim.rec { display: none; }
  .dialog { top: auto; bottom: 0; left: 0; transform: none; width: 100vw; max-height: 90dvh; border-radius: 14px 14px 0 0; }
  .dialog.wide { width: 100vw; }
  .mbar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--ground); }
  .mbar form { margin: 0; }
  .mbar .btn { width: 100%; height: 44px; }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .bcard { padding: 14px; }
  .login { padding-top: 40px; }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .btn.is-pending::after { animation: spin 1.6s linear infinite !important; }
}
