/* LADD OS · Mission Control
   Brand: #FAF8FF bg · #1F2937 ink · #D8B4FE purple · #F9A8D4 pink · #A5F3FC cyan · DM Sans */
:root {
  --bg: #FAF8FF;
  --surface: #FFFFFF;
  --ink: #1F2937;
  --ink-2: #4B5563;
  --muted: #6B7280;
  --line: #ECE8F5;
  --line-2: #E2DCF0;
  --purple: #D8B4FE;
  --purple-ink: #6D28D9;
  --purple-soft: #F5EEFF;
  --pink: #F9A8D4;
  --pink-soft: #FDF0F7;
  --cyan: #A5F3FC;
  --cyan-soft: #ECFEFF;
  --grad: linear-gradient(120deg, var(--purple) 0%, var(--pink) 60%, #FBC7E4 100%);
  --ok: #047857;   --ok-bg: #ECFDF5;
  --warn: #92400E; --warn-bg: #FFFBEB;
  --bad: #B42318;  --bad-bg: #FEF3F2;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(31,41,55,.04), 0 8px 24px rgba(109,40,217,.06);
  --focus: 0 0 0 3px #FFFFFF, 0 0 0 5px #7C3AED;
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.55 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
code, .mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .86em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.prewrap { white-space: pre-wrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52ch; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; z-index: 50; text-decoration: none; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.shell--bare { grid-template-columns: 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px;
  padding: 24px 18px; background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 4px 8px; }
.brand__mark { border-radius: 11px; flex: none; }
.brand__logo { max-width: 180px; height: auto; display: block; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-size: 16px; letter-spacing: -.01em; }
.brand__text small { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav__link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav__link svg { width: 20px; height: 20px; fill: currentColor; opacity: .75; }
.nav__link:hover { background: var(--purple-soft); color: var(--ink); }
.nav__link.is-active { background: var(--purple-soft); color: var(--purple-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--purple); }
.nav__link.is-active svg { opacity: 1; }
.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px 8px 0; border-top: 1px solid var(--line); }
.sidebar__dept { font-size: 12px; color: var(--muted); }
.sidebar__user { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { padding: 36px 40px 64px; min-width: 0; }
.main:focus { outline: none; }
.page { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.page--narrow { max-width: 760px; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page__sub { color: var(--muted); margin-top: 6px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--purple-ink); margin-bottom: 6px; }
.crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; }
.card--flush { padding: 0; overflow: hidden; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font: 600 14px/1 inherit; font-family: inherit; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn--primary { background: var(--grad); color: var(--ink); box-shadow: 0 6px 18px rgba(216,180,254,.45); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(216,180,254,.6); }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn--secondary:hover { border-color: var(--purple); background: var(--purple-soft); }
.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--purple-soft); color: var(--ink); }
.btn--sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn--block { width: 100%; }
.link { color: var(--purple-ink); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ---------- Pills / tags ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--active { background: var(--ok-bg); color: var(--ok); }
.pill--prospect { background: var(--cyan-soft); color: #0E7490; }
.pill--paused { background: var(--warn-bg); color: var(--warn); }
.pill--former { background: #F3F4F6; color: #4B5563; }
.pill--unknown { background: var(--purple-soft); color: var(--purple-ink); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 8px; background: #F3F4F6; color: var(--ink-2); font-size: 12px; font-weight: 600; }
.tag--soft { background: var(--cyan-soft); color: #0E7490; }
.health { font-size: 12px; font-weight: 600; }
.health::before { content: '●'; margin-right: 4px; }
.health--green { color: var(--ok); } .health--yellow { color: #B45309; } .health--red { color: var(--bad); } .health--unknown { color: var(--muted); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--purple-soft); color: var(--purple-ink); font-size: 12px; text-align: center; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 4px; text-decoration: none; position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--grad); opacity: .18; }
a.stat:hover { border-color: var(--purple); }
.stat__label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat__value { font-size: 32px; font-weight: 700; letter-spacing: -.03em; }
.stat__value small { font-size: 16px; color: var(--muted); font-weight: 500; }
.stat__hint { font-size: 12px; color: var(--muted); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
fieldset + fieldset { padding-top: 18px; border-top: 1px solid var(--line); }
legend { font-weight: 600; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; padding: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--grow { flex: 1 1 260px; }
label { font-weight: 600; font-size: 14px; }
.req { font-weight: 500; font-size: 12px; color: var(--purple-ink); margin-left: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=search], input[type=password], input[type=date], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #FFFFFF; color: var(--ink); font: inherit; font-size: 15px;
}
textarea { resize: vertical; min-height: 120px; }
input:hover, select:hover, textarea:hover { border-color: #CFC4E8; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: #A78BFA; box-shadow: 0 0 0 4px rgba(216,180,254,.45); border-radius: var(--radius-sm); }
[aria-invalid=true] { border-color: var(--bad) !important; background: var(--bad-bg); }
.field__hint { font-size: 13px; color: var(--muted); }
.field__error { font-size: 13px; color: var(--bad); font-weight: 500; }
.field__error a { color: var(--bad); font-weight: 700; }
.form__actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; }
.toolbar .field { flex-direction: row; }
.inline-form { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.inline-form .btn { margin-top: 27px; }

/* ---------- Flash ---------- */
.flashes { max-width: 1120px; margin: 0 auto 16px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; font-weight: 500; font-size: 14px; }
.flash--success { background: var(--ok-bg); border-color: #A7F3D0; color: var(--ok); }
.flash--error { background: var(--bad-bg); border-color: #FECDCA; color: var(--bad); }
.flash--info { background: var(--cyan-soft); border-color: #A5F3FC; color: #155E75; }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 14px 20px; background: #FCFBFF; border-bottom: 1px solid var(--line); }
.table td { padding: 16px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FCFAFF; }
.table__primary { font-weight: 600; text-decoration: none; color: var(--ink); }
.table__primary:hover { color: var(--purple-ink); text-decoration: underline; }
.table__meta { display: block; font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.table__action { text-align: right; }

/* ---------- Client workspace ---------- */
.client-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: linear-gradient(120deg, #FFFFFF 55%, var(--purple-soft) 100%); }
.client-head__id { display: flex; align-items: center; gap: 16px; min-width: 0; }
.client-head__meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); font-size: 13px; }
.avatar { width: 56px; height: 56px; flex: none; border-radius: 16px; background: var(--grad); display: grid; place-items: center; font-weight: 700; font-size: 24px; color: var(--ink); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-2); overflow-x: auto; scrollbar-width: none; }
.tabs__tab { padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: 10px 10px 0 0; }
.tabs__tab:hover { color: var(--ink); background: var(--purple-soft); }
.tabs__tab.is-active { color: var(--purple-ink); border-bottom-color: #A78BFA; }
.dl { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.dl > div { display: flex; flex-direction: column; gap: 4px; }
.dl dt { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.dl dd { margin: 0; }
.dl--compact > div { flex-direction: row; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.dl--compact > div:last-child { border-bottom: 0; padding-bottom: 0; }
.dl--compact dd { text-align: right; overflow-wrap: anywhere; }
.plist, .refs, .feed, .tasks { list-style: none; margin: 0; padding: 0; }
.plist__item, .refs__item { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.plist__item:first-child, .refs__item:first-child { border-top: 0; padding-top: 0; }
.plist__main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.plist__name { font-weight: 600; }
.plist__meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.plist__next { font-size: 14px; color: var(--ink-2); }
.tasks { counter-reset: t; display: flex; flex-direction: column; gap: 12px; }
.tasks__item { counter-increment: t; position: relative; padding: 14px 16px 14px 52px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #FCFBFF; }
.tasks__item::before { content: counter(t); position: absolute; left: 16px; top: 14px; width: 24px; height: 24px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.note { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--cyan-soft); color: #155E75; font-size: 13px; }
.feed__item { display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line); }
.feed__item:first-child { border-top: 0; }
.feed__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--purple); transform: translateY(1px); }
.feed__dot--client_created { background: #34D399; } .feed__dot--project_linked { background: var(--cyan); } .feed__dot--project_unlinked, .feed__dot--reference_removed { background: #D1D5DB; } .feed__dot--reference_added { background: var(--pink); }
.feed__client { font-weight: 600; text-decoration: none; margin-right: 6px; }
.feed__client:hover { color: var(--purple-ink); text-decoration: underline; }
.feed__text { color: var(--ink-2); }
.feed time { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty p { color: var(--muted); max-width: 46ch; }
.empty .btn { margin-top: 8px; }
.empty--inline { padding: 18px 0; text-align: left; align-items: flex-start; }
.empty__code { font-size: 44px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; background:
  radial-gradient(600px 400px at 10% 0%, rgba(216,180,254,.45), transparent 60%),
  radial-gradient(500px 380px at 95% 10%, rgba(165,243,252,.45), transparent 60%),
  radial-gradient(520px 420px at 60% 110%, rgba(249,168,212,.4), transparent 60%), var(--bg); }
.auth__wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 18px; }
.auth__card { width: 100%; max-width: 420px; background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 60px rgba(109,40,217,.12); padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.auth__brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.auth__brand img { border-radius: 14px; }
.auth__logo { max-width: 220px; height: auto; border-radius: 0 !important; }
.auth__brand p { color: var(--muted); font-size: 14px; }
.auth__foot { font-size: 12px; color: var(--muted); }


/* ---------- Workspace (v3) ---------- */
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.spacer { height: 18px; } .spacer-sm { margin-top: 12px; } .spacer-xs { margin-top: 6px; }
.form--tight { gap: 14px; }
.lead { font-size: 16px; line-height: 1.6; }
.text-bad { color: var(--bad); }
.card--accent { background: linear-gradient(120deg, #FFFFFF 40%, var(--pink-soft) 100%); border-color: #F6D3E8; }
.tag--pink { background: var(--pink-soft); color: #9D174D; }
a.tag { text-decoration: none; } a.tag:hover { background: var(--purple-soft); color: var(--purple-ink); }
.prio { display: inline-block; padding: 2px 9px; border-radius: 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.prio--now { background: var(--grad); color: var(--ink); }
.prio--next { background: var(--purple-soft); color: var(--purple-ink); }
.prio--later { background: #F3F4F6; color: var(--ink-2); }
.prio--parked { background: #F3F4F6; color: var(--muted); }
.stat--alert { border-color: #FECDCA; background: var(--bad-bg); }
.stat--alert .stat__value { color: var(--bad); }
.stat__value--sm { font-size: 20px; padding: 7px 0; }
.sync-line { padding: 0 6px; }

.task-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.task-form .field:not(.field--grow) { flex: 0 1 170px; }
.todo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.todo__item { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.todo__item:first-child { border-top: 0; }
.todo__check { width: 26px; height: 26px; margin-top: 1px; border-radius: 8px; border: 2px solid var(--line-2); background: #fff; cursor: pointer; font-weight: 700; color: var(--ink); display: grid; place-items: center; padding: 0; }
.todo__check:hover { border-color: #A78BFA; background: var(--purple-soft); }
.todo__item--done .todo__check { background: var(--grad); border-color: transparent; }
.todo__item--done .todo__title { text-decoration: line-through; color: var(--muted); }
.todo__main { min-width: 0; }
.todo__title { font-weight: 500; overflow-wrap: anywhere; }
.todo__meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 2px; }
.due { font-weight: 600; }
.due--overdue { color: var(--bad); } .due--today { color: #B45309; } .due--later { color: var(--ink-2); }
.todo__item--overdue .todo__check { border-color: #FDA29B; }

.notes { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.notes__item { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #FCFBFF; overflow-wrap: anywhere; }
.notes__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.notes__meta form { margin-left: auto; }

.slist { list-style: none; margin: 0; padding: 0; }
.slist__item { padding: 12px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.slist__item:first-child { border-top: 0; padding-top: 0; }
.slist__title { font-weight: 600; color: var(--ink); text-decoration: none; }
.slist__title:hover { color: var(--purple-ink); text-decoration: underline; }

.ccards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ccard { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; background: #FCFBFF; }
.ccard:hover { border-color: var(--purple); background: var(--purple-soft); }
.ccard__name { font-weight: 600; }
.ccard__meta { font-size: 13px; color: var(--muted); }

.details { margin-top: 12px; }
.details > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); padding: 6px 0; list-style-position: outside; }
.details > summary:hover { color: var(--purple-ink); }
.details--section { border-top: 1px solid var(--line); margin-top: 0; padding: 6px 0; }
.details--section:first-of-type { border-top: 0; }
.details--section > summary { font-size: 15px; color: var(--ink); }
.details--section[open] > summary { margin-bottom: 8px; }

.md { font-size: 14px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.md p, .md ul, .md ol, .md blockquote, .md .md-table { margin: 0 0 10px; }
.md ul, .md ol { padding-left: 20px; }
.md li { margin-bottom: 4px; }
.md h2, .md h3, .md h4, .md h5 { font-size: 15px; color: var(--ink); margin: 14px 0 6px; }
.md strong { color: var(--ink); font-weight: 600; }
.md code { background: #F3F0FA; padding: 1px 5px; border-radius: 6px; }
.md blockquote { padding: 8px 12px; border-left: 3px solid var(--purple); background: var(--purple-soft); border-radius: 8px; }
.md .md-table { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.md th { background: #FCFBFF; color: var(--ink); }
.md-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.md-foot p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand__text small { display: none; }
  .nav { flex-direction: row; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav__link { padding: 8px 10px; font-size: 14px; }
  .nav__link.is-active { box-shadow: inset 0 -2px 0 var(--purple); }
  .sidebar__foot { margin-left: auto; margin-top: 0; padding: 0; border: 0; flex-direction: row; align-items: center; }
  .sidebar__dept, .sidebar__user { display: none; }
  .sidebar__foot .btn { min-height: 36px; padding: 0 12px; width: auto; }
  .main { padding: 24px 16px 48px; }
  h1 { font-size: 24px; }
}
@media (max-width: 640px) {
  .brand__text { display: none; }
  .nav__link svg { display: none; }
  .sidebar { gap: 6px; padding: 10px 12px; }
  .nav__link { padding: 8px 7px; }
  .sidebar__foot .btn { padding: 0 9px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat__value { font-size: 26px; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .page__head .btn { width: 100%; }
  .toolbar .field, .toolbar .btn { width: 100%; }
  .inline-form .btn { margin-top: 0; width: 100%; }
  .form__actions { flex-direction: column-reverse; }
  .form__actions .btn { width: 100%; }
  /* table -> cards */
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; text-align: left; }
  .table td[data-label="Client"]:first-child, .table td[data-label="Project"] { display: block; text-align: left; padding-bottom: 6px; }
  .table td[data-label="Client"]:first-child::before, .table td[data-label="Project"]::before { content: none; }
  .table__action { padding-top: 10px !important; }
  .table__action .btn { width: 100%; }
  .todo__item { grid-template-columns: 30px 1fr; }
  .todo__item > form:last-child { grid-column: 2; }
  .task-form .field:not(.field--grow) { flex: 1 1 100%; }
  .task-form .btn { width: 100%; }
  .head-actions { width: 100%; }
  .head-actions .btn, .head-actions form { flex: 1 1 auto; }
  .head-actions form .btn { width: 100%; }
  .feed__item { grid-template-columns: 12px 1fr; }
  .feed time { grid-column: 2; }
  .plist__item, .refs__item { flex-direction: column; }
  .client-head .btn { width: 100%; }
  .auth__card { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:hover { transform: none; } }

.table__note { display: block; font-size: 13px; color: var(--ink-2); margin-top: 4px; max-width: 46ch; }
.grid-main > .stack:last-child .feed__item { grid-template-columns: 12px 1fr; }
.grid-main > .stack:last-child .feed__item time { grid-column: 2; }
