/* Lila dashboard. Every colour, radius and shadow is a token here: a new look is a pass over :root, nothing else. */
:root {
  --bg: #f6f4ef;           /* warm paper canvas */
  --side: #fbfaf7;         /* light sidebar */
  --card: #ffffff;
  --ink: #1f2a27;
  --ink-2: #4c5a56;
  --muted: #8a948f;
  --line: #e8e4dc;
  --line-2: #f0ede6;
  --accent: #1d6356;       /* Lila teal */
  --accent-2: #2a7f6f;
  --accent-soft: #e3f1ec;
  --accent-ink: #ffffff;
  --sel: #eef6f3;
  --mint: #dff3ea;   --mint-ink: #1f6b52;
  --sky: #e1eefb;    --sky-ink: #285a8c;
  --lilac: #ece6fa;  --lilac-ink: #5b4597;
  --peach: #fde7dc;  --peach-ink: #a24d2a;
  --sand: #fbf0d4;   --sand-ink: #8a6413;
  --rose: #fbe3e6;   --rose-ink: #a6334a;
  --neutral: #efede8; --neutral-ink: #5b625f;
  --r: 16px; --r-sm: 10px; --r-xs: 7px;
  --shadow: 0 1px 2px rgba(31, 42, 39, .05), 0 8px 28px rgba(31, 42, 39, .07);
  --shadow-sm: 0 1px 2px rgba(31, 42, 39, .06);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --side-w: 236px;
  --pane-w: min(520px, 42vw);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
small { color: var(--ink-2); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- icons */
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.ic.xs { width: 13px; height: 13px; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; height: 100vh; height: 100dvh; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 6px; }
.brand b { display: block; font-size: 17px; }
.brand small { color: var(--muted); }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: #e7f3ee; font-weight: 700; font-size: 18px; position: relative; }
.brand-mark::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #f2b8a2; top: 6px; right: 6px; }
.navs { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; border: 0; background: none; cursor: pointer; text-align: left; }
.nav:hover { background: var(--line-2); text-decoration: none; color: var(--ink); }
.nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .badge:empty { display: none; }
.nav .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.who { display: flex; gap: 10px; align-items: center; min-width: 0; flex: 1; }
.who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--muted); font-size: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--lilac); color: var(--lilac-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; gap: 16px; padding: 20px 28px 14px; }
.top h1 { font-size: 26px; font-weight: 700; }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 12px; height: 40px; width: min(320px, 34vw); color: var(--muted); }
.search:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--ink); }
.content { flex: 1; min-height: 0; overflow: auto; padding: 4px 28px 28px; }
.bottom { display: none; }

/* ---------------------------------------------------------------- buttons, pills, chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #d6d0c4; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: none; border-color: transparent; }
.btn.icon { width: 38px; padding: 0; }
.btn.big { height: 48px; padding: 0 28px; font-size: 16px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-ink); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn:not(.primary).busy::after { border-color: var(--accent); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.t-mint { background: var(--mint); color: var(--mint-ink); } .t-sky { background: var(--sky); color: var(--sky-ink); }
.t-lilac { background: var(--lilac); color: var(--lilac-ink); } .t-peach { background: var(--peach); color: var(--peach-ink); }
.t-sand { background: var(--sand); color: var(--sand-ink); } .t-rose { background: var(--rose); color: var(--rose-ink); }
.t-neutral { background: var(--neutral); color: var(--neutral-ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip .n { color: var(--muted); font-weight: 600; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.on .n { background: rgba(255, 255, 255, .22); color: #fff; padding: 0 7px; border-radius: 10px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.month { height: 36px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); padding: 0 12px; }
.banner { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: var(--r-sm); background: var(--sand); color: var(--sand-ink); font-weight: 500; margin-bottom: 10px; }
.legend { display: flex; gap: 12px; margin-left: auto; flex-wrap: wrap; }
.dot { background: none !important; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2) !important; }
.dot::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: currentColor; }
.dot.t-mint::before { background: var(--mint-ink); } .dot.t-sky::before { background: var(--sky-ink); }
.dot.t-lilac::before { background: var(--lilac-ink); } .dot.t-peach::before { background: var(--peach-ink); }

/* ---------------------------------------------------------------- boxes */
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.box h3 { font-size: 15px; margin-bottom: 10px; }
.box-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.box-h h3 { margin: 0; }
.count { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 0 8px; font-weight: 700; font-size: 12.5px; }
.count:empty { display: none; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty p { margin: 10px 0 2px; color: var(--ink-2); font-weight: 600; }
.empty-dot { width: 42px; height: 42px; border-radius: 50%; margin: 0 auto; background: radial-gradient(circle at 35% 35%, var(--mint), var(--accent-soft)); }
.error-box { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-sm); background: var(--rose); color: var(--rose-ink); font-weight: 500; }
.skel { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.skel-row { height: 44px; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--line-2), #f8f6f1, var(--line-2)); background-size: 200% 100%; animation: shine 1.3s infinite linear; }
@keyframes shine { to { background-position: -200% 0; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; transition: .2s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.t-err { background: var(--rose-ink); }

/* ---------------------------------------------------------------- list · detail */
.ld { display: grid; grid-template-columns: minmax(0, 1fr) var(--pane-w); gap: 20px; align-items: start; min-height: 100%; }
.ld-left { min-width: 0; }
.list-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.list-head .toolbar { margin: 0; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; outline: none; box-shadow: var(--shadow-sm); }
.list:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: grid; align-items: center; gap: 14px; padding: 12px 12px; border-radius: 12px; cursor: pointer; min-height: 62px; }
.row + .row { border-top: 1px solid var(--line-2); }
.row:hover { background: #faf9f5; }
.row.sel { background: var(--sel); border-color: transparent; }
.row.sel + .row { border-top-color: transparent; }
.mrow { grid-template-columns: minmax(120px, 170px) auto minmax(0, 1fr) auto 64px; }
.mrow.unread .mfrom b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 2px; }
.mfrom { display: flex; align-items: center; gap: 5px; min-width: 0; }
.mfrom b, .cmain b, .msum b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msum, .cmain { display: flex; flex-direction: column; min-width: 0; }
.msum small, .cmain small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); }
.msum b { font-weight: 600; }
.row time { color: var(--muted); font-size: 13px; text-align: right; }
.crow { grid-template-columns: auto minmax(0, 1fr) auto 90px; }
.drow { grid-template-columns: 116px minmax(0, 1fr) auto 100px; }
.dnum { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-2); }
.amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.detail { position: sticky; top: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; max-height: calc(100vh - 110px); overflow: auto; }
.detail .close-pane, .scrim { display: none; }
.dcard { display: flex; flex-direction: column; gap: 14px; }
.dhead { display: flex; gap: 12px; align-items: flex-start; }
.dhead > div { flex: 1; min-width: 0; }
.dhead h2 { font-size: 20px; }
.dhead .sub { margin: 4px 0 0; color: var(--ink-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; padding: 8px 2px 10px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.lila-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.facts { margin: 0; display: grid; gap: 10px; }
.fact { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 10px; align-items: center; }
.fact dt { display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
.fact dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.next { background: var(--accent-soft); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.next h4 { display: flex; gap: 8px; align-items: center; color: var(--accent); font-size: 14px; }
.next.done { background: var(--line-2); }
.next.done h4 { color: var(--ink-2); }
.next .small, .small { font-size: 12.5px; color: var(--ink-2); margin: 0; }
.draft, .mailtext { white-space: pre-wrap; font: inherit; margin: 0; background: var(--card); border-radius: var(--r-sm); padding: 10px 12px; border: 1px solid var(--line); max-height: 260px; overflow: auto; }
.mailtext { max-height: none; background: #fcfbf8; }
.card-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.card-btns .btn { flex: 1 1 auto; }
.card-result { display: flex; gap: 6px; align-items: center; color: var(--mint-ink); font-weight: 600; margin: 4px 0 0; }
.summary { display: flex; gap: 12px; background: #fcfbf8; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.summary h4 { font-size: 14px; margin-bottom: 4px; }
.summary p { margin: 0; color: var(--ink-2); white-space: pre-wrap; }
.orig { display: flex; flex-direction: column; gap: 12px; }
details summary { cursor: pointer; padding: 6px 0; color: var(--ink-2); }
.link-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); color: var(--ink); }
.link-row:first-of-type { border-top: 0; }
.link-row:hover { text-decoration: none; color: var(--accent); }
.lr-main { display: flex; flex-direction: column; min-width: 0; }
.lr-main small { color: var(--muted); }
.lr-right { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 16px; align-items: start; }
.thumb { display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-sm); background: #fff; aspect-ratio: 794 / 1123; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
table.lines { width: 100%; border-collapse: collapse; margin-top: 12px; font-variant-numeric: tabular-nums; }
.lines th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.lines td { padding: 8px 4px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.lines td small { display: block; color: var(--muted); }
.lines .r { text-align: right; white-space: nowrap; }
.lines tfoot td { border: 0; padding: 4px; color: var(--ink-2); }
.lines tfoot .g td { font-weight: 700; color: var(--ink); border-top: 1px solid var(--line); padding-top: 8px; }
.lines tr.opt td { color: var(--muted); }
.pre { white-space: pre-wrap; margin: 0; }

/* ---------------------------------------------------------------- start: week + to-dos */
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.week-nav b { font-size: 15px; }
.wtable { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.wgrid, .wbody { display: grid; grid-template-columns: 54px repeat(7, minmax(0, 1fr)); }
.wcorner, .whead, .wallday-l, .wallday { border-bottom: 1px solid var(--line); }
.whead { padding: 6px 8px; display: flex; gap: 6px; align-items: baseline; border-left: 1px solid var(--line-2); }
.whead b { font-size: 16px; }
.whead.today b { background: var(--accent); color: #fff; border-radius: 8px; padding: 0 6px; }
.wallday-l { font-size: 11px; color: var(--muted); padding: 6px 4px; }
.wallday { padding: 4px; display: flex; flex-direction: column; gap: 3px; min-height: 30px; border-left: 1px solid var(--line-2); }
.wscroll { height: 46vh; min-height: 260px; overflow: auto; }
.wbody { position: relative; }
.whours { display: flex; flex-direction: column; }
.whour { height: 44px; font-size: 11px; color: var(--muted); padding: 2px 6px; text-align: right; }
.wcol { position: relative; border-left: 1px solid var(--line-2); }
.wcol.today { background: #fbfdfc; }
.wslot { height: 44px; border-bottom: 1px solid var(--line-2); }
.wev { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 4px 7px; overflow: hidden; font-size: 12px; line-height: 1.25; border-left: 3px solid currentColor; }
.wev b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wev small { color: inherit; opacity: .8; }
.wnow { position: absolute; left: 0; right: 0; height: 2px; background: var(--rose-ink); }
.wnow::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose-ink); }
.wchip { display: block; font-size: 11.5px; font-weight: 600; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wchip small { margin-right: 6px; color: inherit; opacity: .8; }
.agenda { display: none; }
.todo-list { display: flex; flex-direction: column; }
.todo-item { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 11px 6px; border-top: 1px solid var(--line-2); color: var(--ink); }
.todo-item:first-child { border-top: 0; }
.todo-item:hover { background: #faf9f5; text-decoration: none; border-radius: 10px; }
.lvl { width: 6px; height: 34px; border-radius: 3px; }
.lvl.t-rose { background: var(--rose-ink); } .lvl.t-sand { background: #e2b44a; } .lvl.t-neutral { background: var(--line); }
.todo-main { display: flex; flex-direction: column; min-width: 0; }
.todo-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-due { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- chat */
.v-chat { display: flex; flex-direction: column; padding-bottom: 0; }
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; max-width: 860px; width: 100%; margin: 0 auto; }
.chat-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 4px 16px; }
.msg { max-width: min(620px, 82%); padding: 10px 14px 6px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); align-self: flex-start; box-shadow: var(--shadow-sm); }
.msg.owner { align-self: flex-end; background: var(--accent-soft); border-color: transparent; border-bottom-right-radius: 6px; }
.msg.lila { border-bottom-left-radius: 6px; }
.msg.tap { opacity: .75; font-size: 13px; }
.msg.has-card { border-color: #cfe3dc; }
.msg-card-h { display: flex; gap: 6px; align-items: center; color: var(--accent); font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-file { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.msg .card-btns { margin: 10px 0 4px; }
.msg time { display: block; text-align: right; font-size: 11px; color: var(--muted); margin-top: 3px; }
.typing { display: flex; gap: 4px; padding: 14px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .25; } }
.chat-foot { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 18px; }
.composer { display: flex; gap: 10px; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--accent-2); }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: none; padding: 9px 0; max-height: 180px; }
.chat-hint { text-align: center; font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* ---------------------------------------------------------------- board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--line-2); border-radius: var(--r); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.col header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 4px; }
.col header .n { color: var(--muted); font-weight: 700; }
.col-empty { text-align: center; color: var(--muted); margin: 10px 0; }
.kcard { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; box-shadow: var(--shadow-sm); }
.kcard:hover { border-color: #cfe3dc; }
.kfoot > * { white-space: nowrap; }
.kfoot { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }
.v-cases .detail.floating { position: fixed; top: 16px; right: 16px; bottom: 16px; width: var(--pane-w); max-height: none; transform: translateX(110%); transition: transform .22s ease; z-index: 30; }
.v-cases.pane-open .detail.floating { transform: none; }
.v-cases.pane-open .scrim { display: block; position: fixed; inset: 0; background: rgba(31, 42, 39, .18); z-index: 20; }
.v-cases .detail .close-pane { display: inline-flex; float: right; }

/* ---------------------------------------------------------------- staff, finance, documents */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 16px; }
.person { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin: 0; }
.person small { display: block; }
.person.inactive { opacity: .6; }
.big { text-align: right; }
.big b { font-size: 22px; display: block; line-height: 1; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.tile { border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.tile b { font-size: 24px; font-variant-numeric: tabular-nums; }
.tile small { color: inherit; opacity: .85; }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; height: 200px; align-items: end; padding-top: 8px; }
.bar-g { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-g small { color: var(--muted); }
.bar-g.on small { color: var(--ink); font-weight: 700; }
.bar-pair { flex: 1; width: 100%; display: flex; gap: 4px; align-items: flex-end; justify-content: center; }
.bar { width: 38%; max-width: 30px; border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar.rev { background: var(--mint-ink); } .bar.exp { background: #e7a589; }
.doc-list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; margin-top: 14px; }
.doc-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 90px 100px; gap: 14px; align-items: center; padding: 12px; border-radius: 12px; color: var(--ink); }
.doc-item + .doc-item { border-top: 1px solid var(--line-2); }
.doc-item:hover { background: #faf9f5; text-decoration: none; }

/* ---------------------------------------------------------------- login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: radial-gradient(circle at 20% 10%, var(--mint), transparent 40%), radial-gradient(circle at 85% 90%, var(--lilac), transparent 45%), var(--bg); }
.login-card { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 36px 32px; max-width: 420px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login-card .brand-mark { width: 54px; height: 54px; font-size: 26px; border-radius: 16px; }
.login-card h1 { font-size: 22px; }
.login-card p { color: var(--ink-2); margin: 0 0 6px; }
.login-card form { width: 100%; }
.login-card .btn { width: 100%; }

/* ---------------------------------------------------------------- tablets and phones */
@media (max-width: 1180px) {
  :root { --pane-w: min(440px, 44vw); }
  .mrow { grid-template-columns: minmax(110px, 150px) minmax(0, 1fr) 56px; }
  .mrow .pill, .mrow .mstate { display: none; }
  .lila-view { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .side { display: none; }
  .top { padding: 14px 16px 10px; flex-wrap: wrap; }
  .top h1 { font-size: 22px; }
  .top-right { width: 100%; margin: 0; }
  .search { flex: 1; width: auto; }
  .content { padding: 4px 16px 16px; }
  .bottom { display: flex; justify-content: space-around; position: relative; background: var(--side); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom .nav { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; flex: 1; align-items: center; }
  .bottom .nav .badge { position: absolute; margin: 0 0 0 22px; height: 17px; min-width: 17px; font-size: 10px; }
  .sheet { display: none; position: absolute; bottom: 100%; right: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; min-width: 200px; z-index: 40; }
  .sheet.open { display: flex; flex-direction: column; }
  .sheet .nav { flex-direction: row; font-size: 14px; }
  .ld { grid-template-columns: 1fr; }
  .detail { position: fixed; inset: 0 0 0 auto; width: min(100vw, 560px); max-height: none; border-radius: 0; transform: translateX(105%); transition: transform .22s ease; z-index: 30; padding-top: 56px; }
  .pane-open .detail { transform: none; }
  .pane-open .scrim { display: block; position: fixed; inset: 0; background: rgba(31, 42, 39, .2); z-index: 20; }
  .detail .close-pane { display: inline-flex; position: absolute; top: 10px; right: 10px; }
  .v-cases .detail.floating { inset: 0 0 0 auto; width: min(100vw, 560px); top: 0; right: 0; bottom: 0; border-radius: 0; }
  .mrow { grid-template-columns: minmax(0, 1fr) 52px; grid-template-areas: "from time" "sum sum"; row-gap: 2px; }
  .mrow .mfrom { grid-area: from; } .mrow time { grid-area: time; } .mrow .msum { grid-area: sum; }
  .crow { grid-template-columns: auto minmax(0, 1fr) auto; } .crow > .muted { display: none; }
  .drow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main amt" "num pill"; row-gap: 2px; }
  .drow .dnum { grid-area: num; } .drow .cmain { grid-area: main; } .drow .amt { grid-area: amt; } .drow .pill { grid-area: pill; justify-self: end; }
  .doc-grid { grid-template-columns: 1fr; } .thumb { max-width: 220px; }
  .fact { grid-template-columns: 110px minmax(0, 1fr); }
  .wtable { display: none; }
  .agenda { display: flex; flex-direction: column; }
  .aday { padding: 10px 0; border-top: 1px solid var(--line-2); display: grid; grid-template-columns: 76px 1fr; gap: 10px; }
  .aday:first-child { border-top: 0; }
  .aday.today .aday-h b { color: var(--accent); }
  .aday-h { display: flex; flex-direction: column; } .aday-h span { font-size: 12px; color: var(--muted); }
  .aday-l { display: flex; flex-direction: column; gap: 4px; }
  .aday-l .wchip { font-size: 13px; padding: 5px 8px; white-space: normal; }
  .legend { display: none; }
  .todo-item { grid-template-columns: 6px minmax(0, 1fr) auto; } .todo-item .todo-due { display: none; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; } .tile b { font-size: 19px; }
  .doc-item { grid-template-columns: auto minmax(0, 1fr) auto; } .doc-item > .pill, .doc-item > .muted { display: none; }
  .board { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; } .col { scroll-snap-align: start; }
  .msg { max-width: 90%; }
  .chat-foot { padding-bottom: 8px; }
  .toast { bottom: 84px; }
}
