/* Product Advance Projects. Light is the default; dark is one attribute away. */

@font-face { font-family: 'Switzer'; src: url('fonts/switzer-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Switzer'; src: url('fonts/switzer-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Switzer'; src: url('fonts/switzer-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --bar: #060a14;
  --bar-ink: #e9edf5;
  --bar-dim: #9aa6bd;
  --accent: #2f7bff;
  --accent-deep: #1c5fe0;
  --accent-soft: #e8f0ff;

  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #dfe3ea;
  --line-strong: #c5ccd8;
  --ink: #131722;
  --ink-dim: #5b6576;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);

  --late-bg: #fde7e5;  --late-fg: #a8200f;  --late-line: #f1aaa2;  --late-bar: #d9382a;
  --soon-bg: #fff1cf;  --soon-fg: #7a4d00;  --soon-line: #ecc873;  --soon-bar: #e2a100;
  --ok-bg:   #e1f5e7;  --ok-fg:   #17602f;  --ok-line:   #9fd8b0;  --ok-bar:   #2f9e55;
  --done-bg: #eceef2;  --done-fg: #5b6576;  --done-line: #d3d8e0;  --done-bar: #b5bcc8;

  --radius: 10px;
  --font: 'Switzer', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent-soft: #14233f;
  --bg: #0b0b0c;
  --surface: #141416;
  --surface-2: #1a1a1d;
  --line: #29292e;
  --line-strong: #3a3a41;
  --ink: #e8e6e1;
  --ink-dim: #9a9894;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .45);

  --late-bg: #3b1613;  --late-fg: #ffa59b;  --late-line: #6e2a23;  --late-bar: #f2594b;
  --soon-bg: #3a2b08;  --soon-fg: #ffd167;  --soon-line: #6a4f10;  --soon-bar: #f0b429;
  --ok-bg:   #10301c;  --ok-fg:   #84dd9c;  --ok-line:   #1f5a34;  --ok-bar:   #3fbf6c;
  --done-bg: #202024;  --done-fg: #9a9894;  --done-line: #323238;  --done-bar: #4a4a52;
}

/* Signed-out pages have no saved choice, so they follow the device. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --accent-soft: #14233f;
    --bg: #0b0b0c; --surface: #141416; --surface-2: #1a1a1d;
    --line: #29292e; --line-strong: #3a3a41; --ink: #e8e6e1; --ink-dim: #9a9894;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 var(--font);
  min-height: 100vh;
}
h1 { font-size: 22px; font-weight: 600; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); }
a { color: var(--accent); }
[data-theme="dark"] a { color: #7db0ff; }
[hidden] { display: none !important; }
.muted { color: var(--ink-dim); }
.small, small { font-size: 12.5px; }
small { color: var(--ink-dim); font-weight: 400; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px;
  height: 56px; padding: 0 20px;
  background: var(--bar); color: var(--bar-ink);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--bar-ink); flex: none; }
.brand img { height: 26px; width: auto; display: block; }
.brand span {
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: #7db0ff; border-left: 1px solid rgba(255, 255, 255, .18); padding-left: 12px;
}
.nav { display: flex; gap: 4px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.nav a {
  color: var(--bar-dim); text-decoration: none; font-weight: 500; font-size: 14px;
  padding: 7px 12px; border-radius: 7px; white-space: nowrap;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.nav a[aria-current="page"] { color: #fff; background: rgba(47, 123, 255, .28); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bare .topbar { justify-content: center; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer;
}
.topbar .icon-btn { color: var(--bar-dim); }
.topbar .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .i-moon { display: none; }

.menu { position: relative; }
.menu summary {
  list-style: none; cursor: pointer; color: var(--bar-ink); font-weight: 500; font-size: 14px;
  padding: 7px 12px; border-radius: 7px; white-space: nowrap;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: '▾'; margin-left: 6px; color: var(--bar-dim); }
.menu summary:hover { background: rgba(255, 255, 255, .08); }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px; padding: 6px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu-pop a, .menu-pop button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--ink); font: inherit; text-decoration: none; cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.menu-pop form { margin: 0; }

/* ---------- shared pieces ---------- */

.wrap { max-width: 1280px; margin: 0 auto; padding: 22px 20px 80px; }
.wrap.narrow { max-width: 760px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 500 14px/1 var(--font);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-dim); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.danger { color: var(--late-fg); border-color: var(--late-line); }
.btn.danger:hover { background: var(--late-bg); }
.btn.small { height: 30px; padding: 0 11px; font-size: 13px; }
.btn.wide { width: 100%; height: 42px; margin-top: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
[data-theme="dark"] .link { color: #7db0ff; }
.link.danger { color: var(--late-fg); }

input, select, textarea {
  font: 400 15px/1.3 var(--font); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 0 11px; height: 38px; width: 100%; min-width: 0;
}
textarea { height: auto; padding: 10px 11px; line-height: 1.5; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
input[type="file"] { height: auto; padding: 8px; }
input::placeholder, textarea::placeholder { color: var(--ink-dim); opacity: .75; }
:is(input, select, textarea, button, a, .row, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-dim); }
label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-dim); }
label > input, label > select, label > textarea { margin-top: 5px; }

.flash {
  margin: 14px auto 0; max-width: 1240px; width: calc(100% - 40px); padding: 10px 14px; border-radius: 8px;
  background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-line); font-weight: 500;
}
.flash.err { background: var(--late-bg); color: var(--late-fg); border-color: var(--late-line); }
.form-error {
  margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; font-size: 14px;
  background: var(--late-bg); color: var(--late-fg); border: 1px solid var(--late-line);
}
.note {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between;
  margin: 0 0 14px; padding: 10px 14px; border-radius: 8px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ---------- deadline colours ---------- */

.pill {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 5px 11px; border-radius: 999px;
  font-size: 13px; line-height: 1.2; white-space: nowrap; border: 1px solid transparent;
}
.pill b { font-weight: 600; }
.pill.late { background: var(--late-bg); color: var(--late-fg); border-color: var(--late-line); }
.pill.soon { background: var(--soon-bg); color: var(--soon-fg); border-color: var(--soon-line); }
.pill.ok   { background: var(--ok-bg);   color: var(--ok-fg);   border-color: var(--ok-line); }
.pill.done, .pill.none { background: var(--done-bg); color: var(--done-fg); border-color: var(--done-line); }

.chip {
  display: inline-block; max-width: 100%; padding: 3px 9px; border-radius: 6px; font-size: 13px;
  background: var(--accent-soft); color: var(--accent-deep); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle;
}
[data-theme="dark"] .chip { color: #9cc3ff; }
.tag {
  font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-dim); border: 1px dashed var(--line-strong); border-radius: 5px; padding: 1px 6px;
}

/* ---------- quick add ---------- */

.quick {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.2fr) 170px auto; gap: 12px; align-items: end;
  padding: 16px; margin-bottom: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.quick label span { display: block; }
.quick .btn { height: 38px; }

/* ---------- toolbar ---------- */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.tabs { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tabs button {
  height: 32px; padding: 0 14px; border: 0; border-radius: 7px; background: none; color: var(--ink-dim);
  font: 500 14px/1 var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--accent); color: #fff; }
.count { font-size: 12px; font-weight: 600; opacity: .85; }
.count:empty { display: none; }
.filters { display: flex; gap: 8px; flex: 1; justify-content: flex-end; min-width: 260px; }
.filters input { max-width: 320px; }
.filters select { width: auto; max-width: 200px; }

.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.legend .pill { font-size: 12px; padding: 3px 9px; }

/* ---------- project list ---------- */

.list {
  --cols: 40px 62px minmax(0, 1fr) 200px 268px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.list.with-owner { --cols: 40px 62px minmax(0, 1fr) 190px 268px 130px; }

.head, .row { display: grid; grid-template-columns: var(--cols); align-items: center; column-gap: 12px; padding: 0 14px 0 12px; }
.head { height: 40px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.head button {
  background: none; border: 0; padding: 0; text-align: left; cursor: pointer;
  font: 600 12px/1 var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-dim);
}
.head button:hover, .head button.on { color: var(--ink); }
.head button i { font-style: normal; font-size: 9px; margin-left: 5px; color: var(--accent); }

.group {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px 14px 6px 16px;
  font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-dim);
  background: var(--surface);
}
.group i { font-style: normal; font-weight: 500; opacity: .7; }
.group.g-late span { color: var(--late-fg); }
.group.g-today span { color: var(--soon-fg); }

.row {
  position: relative; min-height: 54px; padding-top: 7px; padding-bottom: 7px;
  border-top: 1px solid var(--line); cursor: pointer;
}
.row::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--done-bar); }
.row.s-late::before { background: var(--late-bar); }
.row.s-soon::before { background: var(--soon-bar); }
.row.s-ok::before { background: var(--ok-bar); }
.row:hover { background: var(--surface-2); }
.row.is-open { background: var(--accent-soft); }
.row.is-new { animation: flash-in 1.6s ease-out; }
@keyframes flash-in { from { background: var(--soon-bg); } to { background: transparent; } }
.group + .row { border-top: 0; }

.check, .check-space { width: 26px; height: 26px; margin-left: 6px; }
.check {
  border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); cursor: pointer; padding: 0;
  display: grid; place-items: center; transition: border-color .12s, background .12s;
}
.check::after {
  content: ''; width: 10px; height: 5px; border-left: 2px solid transparent; border-bottom: 2px solid transparent;
  transform: rotate(-45deg) translate(1px, -1px);
}
.check:hover { border-color: var(--ok-bar); background: var(--ok-bg); }
.check:hover::after { border-color: var(--ok-bar); }
.check.is-done { border-color: var(--ok-bar); background: var(--ok-bar); }
.check.is-done::after { border-color: #fff; }

.c-id { font-size: 12.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.c-name { min-width: 0; }
.name-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.name-line b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.clip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--ink-dim); flex: none; }
.c-client { min-width: 0; }
.c-owner { font-size: 13px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { grid-column: 3 / -1; display: flex; gap: 8px; padding-top: 6px; }
.s-done .name-line b { color: var(--ink-dim); }
.list-foot { padding: 12px 16px; margin: 0; border-top: 1px solid var(--line); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 20px; text-align: center; }
.empty b { font-size: 17px; font-weight: 600; }
.empty span { color: var(--ink-dim); max-width: 420px; }
.empty .btn { margin-top: 8px; }

/* ---------- side panel ---------- */

.scrim { position: fixed; inset: 56px 0 0 0; background: rgba(6, 10, 20, .45); z-index: 39; display: none; }
.panel {
  position: fixed; top: 56px; right: 0; bottom: 0; z-index: 40; width: min(480px, 100vw);
  display: flex; flex-direction: column; background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(6, 10, 20, .12);
}
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.panel-head .icon-btn { margin-left: auto; color: var(--ink-dim); }
.panel-head .icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.save-state { font-size: 12.5px; color: var(--ink-dim); }
.save-state.ok { color: var(--ok-fg); }
.save-state.bad { color: var(--late-fg); font-weight: 600; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.panel-body .note { margin: 0; }
.panel-body #p-name { font-size: 17px; font-weight: 500; height: 42px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.panel-foot .danger { margin-left: auto; }

.drop {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px;
  border: 2px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-dim); font-size: 14px;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.drop.busy { opacity: .6; pointer-events: none; }
.drop.busy::after { content: 'Uploading…'; font-weight: 600; color: var(--ink); }
.file-list { list-style: none; margin: 10px 0 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.file-list li:first-child { border-top: 0; }
.thumb {
  flex: none; width: 52px; height: 52px; padding: 0; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); overflow: hidden; cursor: zoom-in; display: grid; place-items: center;
}
.thumb:hover { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ext { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--ink-dim); }
.ext.k-pdf { color: var(--late-fg); }
.ext.k-text { color: var(--ok-fg); }
.f-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.f-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; text-decoration: none; text-align: left; }
.f-name:hover { text-decoration: underline; }

.dialog.preview { width: min(1100px, calc(100vw - 32px)); height: min(860px, calc(100vh - 32px)); padding: 0; overflow: hidden; }
.dialog.preview[open] { display: flex; flex-direction: column; }
.preview-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.preview-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.preview-body { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; background: var(--surface-2); }
.preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-body.k-pdf { display: block; overflow: hidden; }
.preview-body.k-text { display: block; background: var(--surface); }
.preview-body pre { margin: 0; padding: 16px; font: 13px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.file-list .none { color: var(--ink-dim); font-size: 14px; }

@media (min-width: 1500px) {
  body.panel-open .wrap { margin-right: 500px; margin-left: auto; }
}
@media (max-width: 900px) {
  .scrim { display: block; }
}

/* ---------- dialog + toast ---------- */

.dialog {
  border: 1px solid var(--line); border-radius: 12px; padding: 22px; width: min(400px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(6, 10, 20, .5); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 10px; background: #131722; color: #fff; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
[data-theme="dark"] .toast { background: #e8e6e1; color: #131722; }
.toast.error { background: #a8200f; color: #fff; }
.toast button {
  border: 0; background: none; color: #7db0ff; font: 600 14px/1 var(--font); cursor: pointer; padding: 4px 2px;
  text-decoration: underline;
}
[data-theme="dark"] .toast button { color: #1c5fe0; }

/* ---------- sign-in / setup card ---------- */

.card-page { display: grid; place-items: start center; padding: 48px 16px; }
.card {
  width: min(430px, 100%); padding: 28px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.card h1 { margin: 0; }
.card p { margin: 0; }
.check-line { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 14px; }
.check-line input { margin: 0; flex: none; }
.checks { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.checks li { display: flex; gap: 10px; justify-content: space-between; padding: 8px 12px; font-size: 13px; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks b { font-weight: 500; }
.checks span { color: var(--ink-dim); text-align: right; }
.checks .ok b::before { content: '● '; color: var(--ok-bar); }
.checks .bad b::before { content: '● '; color: var(--late-bar); }

/* ---------- admin pages ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin: 0; color: var(--ink-dim); }
.box {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px;
}
.box > :last-child { margin-bottom: 0; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.form-row .btn { justify-self: start; }
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th {
  text-align: left; font: 600 12px/1 var(--font); letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-dim); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.grid td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.grid tr:first-child td { border-top: 0; }
table.grid td.actions { white-space: nowrap; text-align: right; }
table.grid td.actions form { display: inline-flex; gap: 6px; margin: 0 0 0 6px; align-items: center; }
table.grid input, table.grid select { height: 32px; font-size: 14px; }
table.grid tr.off td { color: var(--ink-dim); }
table.grid tr.bad td { background: var(--late-bg); }
table.grid .problem { color: var(--late-fg); font-weight: 500; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; background: var(--done-bg); color: var(--done-fg); }
.badge.admin { background: var(--accent-soft); color: var(--accent-deep); }
[data-theme="dark"] .badge.admin { color: #9cc3ff; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.cards .box { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.cards .box p { margin: 0; color: var(--ink-dim); }
.cards .box .btn { align-self: flex-start; margin-top: auto; }
details.inline > summary { cursor: pointer; color: var(--accent); font-size: 13px; }
details.inline[open] > summary { margin-bottom: 8px; }

/* ---------- phones ---------- */

@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 0 12px; height: auto; min-height: 52px; flex-wrap: wrap; }
  .brand { height: 52px; }
  .brand span { display: none; }
  .brand img { height: 22px; }
  .nav { order: 3; width: 100%; margin: 0 -4px; padding-bottom: 8px; } /* its own row, so every page stays reachable */
  .nav a { padding: 7px 10px; font-size: 14px; }
  .menu summary { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
  .wrap { padding: 14px 12px 90px; }

  .quick { grid-template-columns: 1fr 1fr; }
  .quick .q-name { grid-column: 1 / -1; }
  .quick .btn { grid-column: 1 / -1; height: 44px; }
  input, select, textarea { font-size: 16px; height: 42px; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .tabs { align-self: flex-start; }
  .filters { flex-wrap: wrap; justify-content: stretch; min-width: 0; }
  .filters input { max-width: none; flex: 1 1 100%; }
  .filters select { flex: 1; max-width: none; }

  .head { display: none; }
  .list, .list.with-owner { --cols: 40px minmax(0, 1fr); }
  .row { row-gap: 6px; padding-top: 11px; padding-bottom: 11px; align-items: start; }
  .row .c-id, .row .c-owner { display: none; }
  .row .c-name { grid-column: 2; }
  .row .c-name small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .name-line b { white-space: normal; }
  .row .c-client, .row .c-due { grid-column: 2; }
  .row-actions { grid-column: 2; }
  .panel { top: 0; z-index: 50; }
  .scrim { inset: 0; z-index: 49; }
  .two { grid-template-columns: 1fr; }
  .panel-foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
