/* The new look of the Site PMC pages (ARCHITECTURE Part 6). Needs tokens.css before it.

   Order: 1 base, 2 frame (side menu, top bar, bottom bar), 3 the parts every page uses (buttons,
   pills, cards, panels, tables, forms, messages), 4 sheets and the search box, 5 the parts of single
   pages. A page that has no file of its own in ui2/pages/ is drawn from its classic file, so the
   class names of the classic pages (.panel, .card, .kv, .btn ...) are all styled here too. */

/* ================= 1. base ================= */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
.ui2 body {
  margin: 0; min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
.ui2 body::before {            /* a soft light behind the top of every page */
  content: ""; position: fixed; inset: 0 0 auto 0; height: 420px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 320px at 78% -80px, var(--brand-soft), transparent 70%),
    radial-gradient(600px 260px at 12% -120px, var(--spark-soft), transparent 70%);
  opacity: 0.75;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 650; letter-spacing: -0.011em; line-height: 1.25; }
p { margin: 0 0 10px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: var(--brand-soft); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-size: 0.94em; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.note { font-size: 13.5px; color: var(--ink-2); }
.lead { margin: 0 0 16px; font-size: 15px; color: var(--ink-2); max-width: 70ch; }
.lead strong { color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.s { width: 16px; height: 16px; }
.ic.l { width: 24px; height: 24px; }
/* ================= 2. frame ================= */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.shell.solo { grid-template-columns: minmax(0, 1fr); }
.shell.solo .top .brand { display: flex; }
.shell.solo .top .brand .brand-name { display: inline; }
.shell.solo .main { padding-bottom: 0; }
.shell.solo .content, .shell.solo .page-head { max-width: 760px; margin-left: auto; margin-right: auto; }
.main { min-width: 0; display: flex; flex-direction: column; --pad: clamp(16px, 3vw, 32px); }

/* ---- side menu (wide screens) ---- */
.side {
  position: sticky; top: 0; height: 100dvh; z-index: 35;
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 12px max(12px, env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-right: 1px solid var(--line);
  overflow-y: auto; scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 10px; box-shadow: 0 4px 10px rgba(47, 91, 234, 0.28); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand-name span { color: var(--ink-3); font-weight: 500; }

.switcher { position: relative; margin: 2px 0 8px; }
.switcher summary {
  list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.switcher summary::-webkit-details-marker { display: none; }
.switcher summary:hover { border-color: var(--line-strong); }
.switcher .p-badge, .p-badge {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px;
  background: hsl(var(--h, 225) 70% 94%); color: hsl(var(--h, 225) 55% 34%);
  font: 700 12.5px/1 var(--font-display); letter-spacing: 0.02em;
}
:root[data-theme="dark"] .p-badge { background: hsl(var(--h, 225) 35% 22%); color: hsl(var(--h, 225) 80% 80%); }
.switcher .p-text { min-width: 0; flex: 1 1 auto; line-height: 1.25; }
.switcher .p-name { display: block; font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher .p-role { display: block; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher .ic { color: var(--ink-3); transition: transform 0.15s var(--ease); }
.switcher[open] summary .ic { transform: rotate(180deg); }
.switcher-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-3);
  max-height: 50vh; overflow-y: auto;
}
.switcher-list a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-size: 14px; }
.switcher-list a:hover { background: var(--surface-2); }
.switcher-list a[aria-current="true"] { background: var(--brand-softer); }

.nav { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-title { margin: 14px 10px 4px; font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.nav a, .nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; text-align: left;
  color: var(--ink-2); text-decoration: none; font-size: 14.5px; font-weight: 550;
  transition: background 0.12s, color 0.12s;
}
.nav a:hover, .nav button:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); }
:root[data-theme="dark"] .nav a[aria-current="page"] { color: var(--brand); }
.nav .lbl { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .count {
  min-width: 22px; padding: 0 6px; border-radius: var(--r-full); background: var(--spark); color: #fff;
  font: 700 11.5px/20px var(--font-text); text-align: center;
}
.side-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-md); }
.me-text { min-width: 0; line-height: 1.25; flex: 1 1 auto; }
.me-name { display: block; font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-mail { display: block; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: hsl(var(--h, 225) 65% 46%); color: #fff; font: 700 13px/1 var(--font-display); letter-spacing: 0.02em;
}
.avatar.s { width: 28px; height: 28px; font-size: 11px; }

/* ---- top bar ---- */
.top {
  position: sticky; top: 0; z-index: 30; min-height: var(--top-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 max(var(--pad), env(safe-area-inset-right, 0px)) 0 max(var(--pad), env(safe-area-inset-left, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color 0.2s, box-shadow 0.2s;
}
.top.stuck { border-bottom-color: var(--line); box-shadow: 0 1px 0 rgba(15, 23, 40, 0.02), 0 6px 16px -12px var(--shadow); }
.top .brand { padding: 0; display: none; }
.top a.back, .round {
  position: relative; width: 40px; height: 40px; min-width: 40px; min-height: 40px; flex: none; padding: 0; overflow: hidden;
  display: inline-grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-1); transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.top a.back { text-indent: 300%; white-space: nowrap; font-size: 0; }
.top a.back::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 10px; height: 10px;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateX(2px) rotate(45deg); border-radius: 1px;
}
.top a.back:hover, .round:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.top a.back:active, .round:active { transform: scale(0.96); }
.round.plain { border-color: transparent; background: transparent; box-shadow: none; }
.round.plain:hover { background: var(--surface-2); border-color: transparent; }
.crumbs { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--ink-3); text-decoration: none; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-weight: 550; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { opacity: 0.5; flex: none; }
.crumbs a:last-of-type { color: var(--ink-2); }
.top-tools { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.searchbtn {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; min-width: 240px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); color: var(--ink-3);
  cursor: pointer; font-size: 14px; box-shadow: var(--shadow-1); transition: border-color 0.12s;
}
.searchbtn:hover { border-color: var(--line-strong); color: var(--ink-2); }
.searchbtn .lbl { flex: 1 1 auto; text-align: left; }
kbd {
  font: 600 11px/1 var(--font-text); color: var(--ink-3); padding: 4px 6px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.avatar-btn { padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.avatar-btn .avatar { box-shadow: 0 0 0 2px var(--surface), var(--shadow-1); }

/* ---- page head and content ---- */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px;
  padding: 10px var(--pad) 0; padding-left: max(var(--pad), env(safe-area-inset-left, 0px)); padding-right: max(var(--pad), env(safe-area-inset-right, 0px));
}
.page-head .titles { flex: 1 1 320px; min-width: 0; }
.page-head h1 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.022em; overflow-wrap: anywhere; }
.page-head .sub { margin-top: 4px; font-size: 14px; color: var(--ink-3); overflow-wrap: anywhere; }
.page-head .sub:empty { display: none; }
.content {
  flex: 1 1 auto; width: 100%; max-width: 1240px;
  padding: 18px var(--pad) 40px; padding-left: max(var(--pad), env(safe-area-inset-left, 0px)); padding-right: max(var(--pad), env(safe-area-inset-right, 0px));
}
.content.wide { max-width: none; }
.foot {
  padding: 16px var(--pad) 24px; font-size: 12.5px; color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center;
}
.foot a, .linklike { color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; }
.linklike { border: 0; background: none; padding: 0; cursor: pointer; font-size: inherit; }
.foot a:hover, .linklike:hover { color: var(--ink); }

/* ---- structure tabs under the page head ---- */
.subnav { display: flex; gap: 4px; padding: 14px var(--pad) 0; overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 38px; padding: 0 14px; border-radius: var(--r-full);
  color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 600; border: 1px solid transparent;
}
.subnav a:hover { background: var(--surface); border-color: var(--line); }
.subnav a[aria-current="page"] { background: var(--ink); color: var(--bg); }

/* ---- bottom bar (phones and tablets) ---- */
.tabbar { display: none; }
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .top .brand { display: flex; }
  .top .brand .brand-name { display: none; }
  .top .brand:has(+ .crumbs:empty) .brand-name { display: inline; }
  .top .back + .brand { display: none; }
  .searchbtn { min-width: 0; width: 40px; padding: 0; justify-content: center; }
  .searchbtn .lbl, .searchbtn kbd { display: none; }
  .searchbtn.dup { display: none; }
  .main { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 8px); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding: 0 max(6px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(6px, env(safe-area-inset-left, 0px));
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
    border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
    border: 0; background: none; cursor: pointer; color: var(--ink-3); text-decoration: none;
    font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  }
  .tabbar .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .tabbar .ic { width: 22px; height: 22px; }
  .tabbar .pip { display: grid; place-items: center; width: 52px; height: 30px; border-radius: var(--r-full); transition: background 0.15s; }
  .tabbar [aria-current="page"] { color: var(--brand); }
  .tabbar [aria-current="page"] .pip { background: var(--brand-soft); }
  .tabbar a:active .pip, .tabbar button:active .pip { background: var(--surface-3); }
}
@media (max-width: 599px) {
  .crumbs .hide-s { display: none; }
  .page-head { padding-top: 4px; }
}

/* ================= 3. parts ================= */
/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; min-width: 42px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font-size: 14.5px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.08s;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 2px rgba(15, 23, 40, 0.1), 0 4px 12px -2px rgba(47, 91, 234, 0.4); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--brand-ink); }
.btn.quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn.small { min-height: 36px; min-width: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.danger { border-color: color-mix(in srgb, var(--high) 45%, var(--line)); color: var(--high); }
.btn.danger:hover { background: var(--high-soft); border-color: var(--high); color: var(--high); }
.btn.outline { box-shadow: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: default; pointer-events: none; }
.btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn .ic { width: 18px; height: 18px; }
.btn.block { width: 100%; }
@media (pointer: coarse) { .btn { min-height: 46px; } .btn.small { min-height: 40px; } .btn.touch { min-height: 44px; min-width: 44px; } }

/* ---- pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: 12.5px; font-weight: 650; line-height: 1.45; white-space: nowrap; text-decoration: none;
  color: var(--ink-2); background: var(--surface-3);
}
a.pill:hover { filter: brightness(0.97); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; flex: none; }
.pill.bare::before, .pill.trial-pill::before { display: none; }
.pill.pass, .pill.status-approved, .pill.status-active, .pill.state-poured, .pill.state-done, .pill.state-ready, .pill.cube-pass, .pill.run-delivered { color: var(--pass); background: var(--pass-soft); }
.pill.pass-with-flags, .pill.medium { color: var(--warn); background: var(--warn-soft); }
.pill.fail, .pill.high, .pill.status-rejected, .pill.status-revoked, .pill.status-returned, .pill.state-on_hold, .pill.cube-fail, .pill.cube-overdue, .pill.run-failed, .pill.run-cancelled, .pill.run-paused { color: var(--high); background: var(--high-soft); }
.pill.pending, .pill.info, .pill.status-waiting, .pill.status-submitted, .pill.state-in_progress, .pill.cube-due, .pill.cube-pass_so_far, .pill.trial-pill { color: var(--info); background: var(--info-soft); }
.pill.status-superseded, .pill.status-expired, .pill.state-not_started, .pill.state-no_plan, .pill.cube-not_valid, .pill.cube-tested, .pill.run-draft { color: var(--ink-3); background: var(--surface-3); }
.pill.run-queued, .pill.run-uploading, .pill.run-starting, .pill.run-running, .pill.run-collecting, .pill.run-checking { color: var(--info); background: var(--info-soft); }
.pill.run-running::before, .pill.run-uploading::before, .pill.run-starting::before, .pill.run-collecting::before, .pill.run-checking::before, .pill.run-queued::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.8); } }
.state-pill { white-space: normal; font-size: 13.5px; padding: 5px 12px; }

/* ---- cards and panels ---- */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.card, .panel {
  min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card { display: block; padding: 18px; color: inherit; text-decoration: none; transition: box-shadow 0.18s var(--ease), transform 0.18s var(--ease), border-color 0.18s; }
.card:hover { box-shadow: var(--shadow-2); border-color: var(--line-strong); }
a.card:hover, .card.lift:hover { transform: translateY(-2px); }
.card-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.card h2 { font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.card h2 a { color: inherit; text-decoration: none; }
.card h2 a:hover { color: var(--brand); }
.card h3 { font-size: 13px; font-weight: 650; color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase; margin: 16px 0 6px; }
.card .pkg { font-size: 13px; color: var(--ink-3); margin-top: 3px; overflow-wrap: anywhere; }
.card .progress { font-size: 13.5px; margin: 10px 0 0; color: var(--ink-2); }
.card-flags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.card-flags .spacer { flex: 1 1 auto; }
.card-links { margin-top: 8px; }
.panel { padding: 20px; }
.panel + .panel, .section-gap, .entry + .entry, .query + .query, .stage + .stage, .revision + .revision { margin-top: 16px; }
.panel h2 { font-size: 17px; }
.panel > h2 + *, .panel-head + * { margin-top: 10px; }
.panel h3 { font-size: 12.5px; font-weight: 650; color: var(--ink-3); letter-spacing: 0.05em; text-transform: uppercase; margin: 18px 0 6px; }
.panel-head { display: flex; gap: 8px 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.panel-head h2 { min-width: 0; overflow-wrap: anywhere; }
.panel-head h2 a { color: inherit; text-decoration: none; }
.panel-head h2 a:hover { color: var(--brand); }
.panel.narrow { max-width: 460px; margin: 24px auto 0; }
.panel.totals { border-left: 4px solid var(--brand); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) { .panel { padding: 16px; border-radius: var(--r-md); } .card { padding: 16px; border-radius: var(--r-md); } .cards { gap: 12px; } }

/* ---- figures ---- */
.figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.fig { min-width: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.fig .k { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.fig .v { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.fig .u, .u { font-size: 0.68em; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
td .u { font-size: 0.85em; }

/* ---- meters ---- */
.meter { position: relative; height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.meter > i { position: absolute; inset: 0 auto 0 0; width: calc(var(--p, 0) * 1%); min-width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--sel))); transition: width 0.6s var(--ease); }
.meter.done > i { background: var(--pass); }
.ring { --size: 56px; width: var(--size); height: var(--size); flex: none; position: relative; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.ring .track { stroke: var(--surface-3); }
.ring .value { stroke: var(--brand); stroke-dasharray: calc(var(--p, 0) * 1.131) 113.1; transition: stroke-dasharray 0.8s var(--ease); }
.ring.done .value { stroke: var(--pass); }
.ring b { position: relative; font: 700 13px/1 var(--font-display); font-variant-numeric: tabular-nums; }

/* ---- tables ---- */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; font-weight: 650; color: var(--ink-3); white-space: nowrap; }
tbody tr:last-child > td { border-bottom: 0; }
td.n, th.n, td.num, th.num, .dash-progress .num, .mix-table .num, .figs-table .num, .req-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.kv td { padding: 8px 6px; }
.kv td:first-child { color: var(--ink-3); font-weight: 550; overflow-wrap: normal; hyphens: none; }
.kv td { overflow-wrap: break-word; word-break: normal; }
.kv td:first-child { padding-left: 0; }
.revision .kv td:first-child, .report-head .kv td:first-child { width: 9em; white-space: nowrap; }
.query .kv td:first-child, .pour .kv td:first-child { width: 8em; white-space: nowrap; }
.tscroll, .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; min-width: 0; }
.table-wrap { margin: 6px 0 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
table.rep { font-size: 13.5px; }
table.rep th { position: sticky; top: 0; background: var(--surface-2); }
table.rep th, table.rep td { padding: 9px 12px; }
table.rep tbody tr:hover td { background: var(--brand-softer); }
table.rep td.k-long { min-width: 14em; overflow-wrap: anywhere; }
table.rep .k-qty, table.rep .k-num1, table.rep .k-num2, table.rep .k-int, table.rep .k-pct, table.rep .k-days { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.rep .k-date { white-space: nowrap; }
table.rep tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
.figs-table th, .req-table th, .mix-table th { text-align: left; }
.figs-table tr.done td:first-child::after { content: " \2713"; color: var(--pass); font-weight: 700; }
.req-table td.basis { font-size: 12.5px; color: var(--ink-2); }
.mix-table { overflow-x: auto; display: block; }
.pours tr.cancelled td { color: var(--ink-3); text-decoration: line-through; }
.entry-lines td.num { text-align: right; white-space: nowrap; }
.entry-lines tr.mark-over_plan td, .entry-lines tr.mark-unmatched td { color: var(--high); }
@media (max-width: 640px) {
  .req-table .basis { display: none; }
  /* a label-and-value table: each row stacked, the label above its value */
  table.kv:not(:has(thead)):not(.entry-lines):not(.pours), table.kv:not(:has(thead)):not(.entry-lines):not(.pours) > tbody,
  table.kv:not(:has(thead)):not(.entry-lines):not(.pours) > tbody > tr, table.kv:not(:has(thead)):not(.entry-lines):not(.pours) > tbody > tr > td { display: block; width: 100%; }
  table.kv:not(:has(thead)):not(.entry-lines):not(.pours) > tbody > tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.kv:not(:has(thead)):not(.entry-lines):not(.pours) > tbody > tr:last-child { border-bottom: 0; }
  table.kv:not(:has(thead)):not(.entry-lines):not(.pours) > tbody > tr > td { border: 0; padding: 0; text-align: left; white-space: normal; }
  table.kv:not(:has(thead)):not(.entry-lines):not(.pours) > tbody > tr > td:first-child { font-size: 12.5px; width: auto; }
  /* a list table: one block per row, each value under its label */
  table.runs-list thead { display: none; }
  table.runs-list, table.runs-list tbody, table.runs-list tr, table.runs-list td { display: block; width: 100%; }
  table.runs-list tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.runs-list td { border: 0; padding: 1px 0; text-align: left; overflow-wrap: break-word; }
  table.runs-list td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); }
  .tscroll.runs-wrap { overflow-x: visible; }
  table.rep { font-size: 13px; }
}

/* ---- forms ---- */
.form { display: grid; gap: 14px; margin-top: 12px; max-width: 580px; }
.form label, .filters label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=search], input[type=file], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font: 400 16px/1.35 var(--font-text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 0.8; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
textarea { min-height: 76px; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input[type=file] { padding: 7px; font-size: 14px; }
input[type=file]::file-selector-button {
  margin-right: 12px; padding: 7px 14px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--brand-soft); color: var(--brand-strong); font: 600 13.5px/1.2 var(--font-text);
}
:root[data-theme="dark"] input[type=file]::file-selector-button { color: var(--brand); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); flex: none; }
.form label.check, label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--ink); line-height: 1.4; }
.form .btn { justify-self: start; }
.form p { margin: 0; }
fieldset.members { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; display: grid; gap: 8px; margin: 0; }
fieldset.members legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; max-width: none; }
.inline-form label { flex: 1 1 160px; max-width: 280px; }
form.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.filters {
  display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin: 0 0 16px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1);
}
.filters label { flex: 1 1 150px; max-width: 260px; font-size: 12.5px; color: var(--ink-3); }
.filters select { min-height: 40px; font-size: 14.5px; padding-top: 6px; padding-bottom: 6px; }
.secret {
  padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2);
  overflow-wrap: anywhere; user-select: all; font-family: var(--font-data); font-size: 14px;
}
.decide { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }
.dp-actions, .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dp-actions { margin-top: 12px; }
.actions { margin: 0 0 16px; }
.actions:empty { display: none; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 20px; }

/* ---- messages ---- */
.messages { list-style: none; margin: 12px var(--pad) 0; padding: 0; display: grid; gap: 8px; }
.msg, .callout, .flag {
  position: relative; margin: 12px 0; padding: 12px 14px 12px 44px; border-radius: var(--r-md);
  background: var(--info-soft); color: var(--ink); font-size: 14.5px; overflow-wrap: anywhere;
}
.messages .msg { margin: 0; box-shadow: var(--shadow-1); }
.msg::before, .callout::before, .flag::before {
  content: "i"; position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--info); color: var(--surface); font: 700 12.5px/1 var(--font-text);
}
.msg.success { background: var(--pass-soft); }
.msg.success::before { content: "\2713"; background: var(--pass); }
.msg.error, .flag.high { background: var(--high-soft); }
.msg.error::before, .flag.high::before { content: "!"; background: var(--high); }
.msg.warning, .callout, .flag.medium { background: var(--warn-soft); }
.msg.warning::before, .callout::before, .flag.medium::before { content: "!"; background: var(--warn); }
.flag .ref { font-size: 12.5px; color: var(--ink-3); }
.msg .x { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; cursor: pointer; color: var(--ink-3); font-size: 18px; line-height: 1; }
.msg .x:hover { background: rgba(127, 127, 127, 0.16); color: var(--ink); }
.messages .msg { padding-right: 44px; }
.ok { color: var(--pass); font-weight: 650; white-space: nowrap; }
.bad { color: var(--high); font-weight: 650; white-space: nowrap; }
.result { margin-bottom: 16px; }
.ok-result { border-left: 4px solid var(--pass); }
.bad-result { border-left: 4px solid var(--high); }

/* ---- nothing here ---- */
.state {
  margin: 28px auto; padding: 36px 24px; max-width: 520px; text-align: center;
  background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-xl);
}
.state::before {
  content: ""; display: block; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px;
  background:
    linear-gradient(135deg, var(--brand-soft), var(--spark-soft));
  box-shadow: inset 0 0 0 1px var(--line);
}
.state.error::before { background: var(--high-soft); }
.state h2 { font-size: 18px; margin-bottom: 6px; }
.state p { margin: 0 auto 14px; color: var(--ink-2); overflow-wrap: anywhere; max-width: 44ch; }
.state p:last-child { margin-bottom: 0; }
.loading-bar { height: 4px; background: var(--surface-3); overflow: hidden; border-radius: 2px; margin-top: 12px; }
.loading-bar::after { content: ""; display: block; height: 100%; width: 35%; background: var(--brand); border-radius: 2px; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---- lists and words ---- */
ul.plain { margin: 8px 0 0; padding-left: 20px; }
ul.plain li { margin: 4px 0; }
ul.warnings li, ul.rejections li, ul.marks li, ul.history li, .change ul.plain li { font-size: 13.5px; overflow-wrap: anywhere; }
ul.rejections li, ul.marks li { color: var(--high); }
.changes { display: grid; gap: 10px; }
.change { border-left: 3px solid var(--brand); padding: 2px 0 2px 12px; }
.change-title { font-weight: 650; font-size: 14px; }
p.pieces { font-size: 13px; overflow-wrap: anywhere; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 6px; flex: none; }
.tag { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; color: #fff; font: 650 12px/1 var(--font-data); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- photos ---- */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.thumbs a { display: block; border-radius: var(--r-sm); overflow: hidden; box-shadow: var(--shadow-1); transition: transform 0.15s var(--ease), box-shadow 0.15s; }
.thumbs a:hover { transform: translateY(-2px) scale(1.02); box-shadow: var(--shadow-2); }
.thumbs img { display: block; width: 96px; height: 96px; object-fit: cover; }
.photos { display: grid; gap: 12px; }
.photos img { max-width: 100%; height: auto; border-radius: var(--r-md); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-md); background: var(--surface-2); }
.photo-grid figcaption { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; margin-top: 4px; }
.sec-imgs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.sec-imgs figure { margin: 0; min-width: 0; }
.sec-imgs img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.sec-imgs figcaption { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* ================= 4. sheets, menus, search ================= */
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(10, 14, 24, 0.5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet {
  width: min(420px, calc(100vw - 24px)); max-height: min(86dvh, 720px); margin: 0; padding: 8px;
  position: fixed; inset: calc(var(--top-h) - 6px) max(var(--pad, 24px), 16px) auto auto;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-3);
  overflow-y: auto;
}
.sheet[open] { animation: pop 0.16s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.sheet .nav-title:first-child { margin-top: 6px; }
.sheet .only-narrow { display: none; }
.sheet .grab { display: none; }
.sheet-me { display: flex; align-items: center; gap: 12px; padding: 10px; }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 6px 10px 4px; border-radius: var(--r-sm); background: var(--surface-2); }
.seg3 button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg3 button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
@media (max-width: 1023px) {
  .sheet {
    inset: auto 0 0 0; width: 100%; max-width: none; max-height: 86dvh; padding: 6px 10px max(14px, env(safe-area-inset-bottom, 0px));
    border-radius: var(--r-xl) var(--r-xl) 0 0; border-width: 1px 0 0;
  }
  .sheet[open] { animation: rise 0.22s var(--ease); }
  .sheet .only-narrow { display: block; }
  .sheet .grab { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 6px auto 8px; }
  .sheet .nav a, .sheet .nav button { min-height: 48px; font-size: 15.5px; }
}
@keyframes rise { from { transform: translateY(40px); opacity: 0.4; } }

.palette {
  width: min(640px, calc(100vw - 24px)); max-height: min(70dvh, 560px); margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-3); overflow: hidden;
}
.palette[open] { display: flex; flex-direction: column; animation: pop 0.14s var(--ease); }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.palette-in input { border: 0; box-shadow: none; padding: 10px 0; min-height: 48px; font-size: 17px; background: transparent; }
.palette-in input:focus { box-shadow: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1 1 auto; }
.palette-list .grp { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.palette-list a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.palette-list a .ic { color: var(--ink-3); }
.palette-list a .t { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.palette-list a .d { flex: none; max-width: 45%; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list a[aria-selected="true"] { background: var(--brand-soft); }
.palette-list a[aria-selected="true"] .ic { color: var(--brand); }
.palette-empty { padding: 28px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
@media (max-width: 599px) { .palette { margin-top: max(12px, env(safe-area-inset-top, 0px)); max-height: 80dvh; } .palette-foot { display: none; } }

.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 10, 16, 0.94); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.lightbox .round { position: fixed; top: max(14px, env(safe-area-inset-top, 0px)); right: 14px; background: rgba(255, 255, 255, 0.14); color: #fff; border-color: transparent; }
.lightbox .nav-l, .lightbox .nav-r { position: fixed; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.14); color: #fff; border-color: transparent; }
.lightbox .nav-l { left: 14px; } .lightbox .nav-r { right: 14px; }
.lightbox .cap { position: fixed; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom, 0px)); text-align: center; color: #fff; font-size: 13px; opacity: 0.85; }

/* the bar of entries waiting to be sent (drawn by offline.js): a floating card in this look */
.ui2 .pmc-sendbar {
  position: fixed; top: auto; left: auto; right: 20px; bottom: 20px; z-index: 45; max-width: min(460px, calc(100vw - 24px));
  padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); font: 14px/1.4 var(--font-text);
}
.ui2 .pmc-sendbar[data-kind="high"] { background: var(--surface); border-left-color: var(--high); }
.ui2 .pmc-sendbar button, .ui2 .pmc-sendbar a { border-radius: var(--r-sm); min-height: 38px; padding: 4px 14px; font-weight: 600; border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.ui2 .pmc-sendbar a { background: transparent; color: var(--brand); }
@media (max-width: 1023px) { .ui2 .pmc-sendbar { left: 10px; right: 10px; max-width: none; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 10px); } }

/* ================= 5. single pages ================= */
/* ---- sign in ---- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  padding: clamp(24px, 5vw, 56px); color: #fff;
  background:
    radial-gradient(700px 500px at 110% 110%, rgba(255, 122, 26, 0.55), transparent 60%),
    radial-gradient(600px 500px at -10% -10%, rgba(120, 160, 255, 0.55), transparent 60%),
    linear-gradient(140deg, #1a2f8f, #2f5bea 55%, #1f3fb0);
}
.auth-art .brand { color: #fff; padding: 0; }
.auth-art .brand-name span { color: rgba(255, 255, 255, 0.7); }
.auth-art h2 { font-size: clamp(26px, 3.4vw, 42px); font-weight: 750; letter-spacing: -0.03em; line-height: 1.08; max-width: 14ch; }
.auth-art p { font-size: 16px; opacity: 0.88; max-width: 40ch; margin: 14px 0 0; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14.5px; }
.auth-points li { display: flex; align-items: center; gap: 12px; }
.auth-points .ic { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: rgba(255, 255, 255, 0.16); }
.auth-cube { position: absolute; right: -60px; top: 50%; width: 380px; height: 380px; transform: translateY(-50%); opacity: 0.2; stroke: #fff; fill: none; stroke-width: 0.6; stroke-linejoin: round; pointer-events: none; }
.auth-form { display: grid; place-items: center; padding: clamp(20px, 5vw, 56px); }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { font-size: 28px; font-weight: 750; letter-spacing: -0.025em; }
.auth-card .lead { margin-top: 6px; }
.auth-card .form { max-width: none; margin-top: 20px; }
.auth-card .btn { width: 100%; min-height: 48px; font-size: 15.5px; }
.auth-card .foot { padding: 20px 0 0; }
.auth .brand.only-narrow { display: none; }
@media (max-width: 859px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth .brand.only-narrow { display: flex; padding: 0 0 28px; }
  .auth-form { place-items: start center; padding-top: max(40px, 10vh); }
}

/* ---- dashboard ---- */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.hero h2 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 750; letter-spacing: -0.025em; }
.hero p { margin: 4px 0 0; color: var(--ink-3); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); color: var(--ink); text-decoration: none;
  transition: box-shadow 0.18s var(--ease), transform 0.18s var(--ease), border-color 0.18s;
}
a.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); color: var(--ink); }
.tile .tile-ic { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--brand-soft); color: var(--brand); }
.tile.warn .tile-ic { background: var(--high-soft); color: var(--high); }
.tile.good .tile-ic { background: var(--pass-soft); color: var(--pass); }
.tile.amber .tile-ic { background: var(--warn-soft); color: var(--warn); }
.tile b { font: 750 28px/1.05 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; color: var(--ink-3); line-height: 1.3; }
.tile.zero b { color: var(--ink-3); }
@media (max-width: 599px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px; border-radius: var(--r-md); }
  .tile b { font-size: 24px; }
  .tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 12px; }
  .tiles > :last-child:nth-child(odd) span:last-child { flex: 1 1 auto; }
}
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-title h2 { font-size: 18px; }
.section-title a { font-size: 13.5px; font-weight: 600; text-decoration: none; }
.dash-card { display: flex; flex-direction: column; }
.dash-card .who-line { display: flex; align-items: center; gap: 12px; }
.dash-card .who-line .p-badge { width: 44px; height: 44px; border-radius: 13px; font-size: 14px; }
.dash-card .who-line h2 { font-size: 18px; }
.progress-rows { display: grid; gap: 12px; margin: 16px 0 4px; }
.progress-row .top-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 6px; }
.progress-row .top-line .nm { font-weight: 650; }
.progress-row .top-line .qty { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-row .top-line .pc { font-weight: 700; font-variant-numeric: tabular-nums; margin-left: 8px; color: var(--ink); }
ul.dash-counts { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-size: 13px; }
ul.dash-counts li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 10px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); line-height: 1.3; }
ul.dash-counts li:has(> a) { padding: 0; }
ul.dash-counts li > a { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; padding: 9px 10px; border-radius: inherit; color: inherit; text-decoration: none; }
ul.dash-counts li > a:hover { background: var(--brand-soft); color: var(--ink); }
ul.dash-counts b { font: 750 18px/1 var(--font-display); color: var(--ink); min-width: 1.4em; text-align: center; font-variant-numeric: tabular-nums; }
ul.dash-counts b.warn { color: var(--high); }
ul.dash-counts .muted { font-size: 12px; }
@media (max-width: 420px) { ul.dash-counts { grid-template-columns: minmax(0, 1fr); } }
.datelist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.datelist li { display: flex; align-items: center; gap: 12px; min-width: 0; }
.datelist a { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; padding: 6px; margin: -6px; border-radius: var(--r-sm); color: inherit; text-decoration: none; }
.datelist a:hover { background: var(--surface-2); }
.datebox { width: 44px; flex: none; text-align: center; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); line-height: 1.1; }
.datebox i { display: block; font: 700 10px/16px var(--font-text); font-style: normal; letter-spacing: 0.06em; text-transform: uppercase; background: var(--spark); color: #fff; }
.datebox b { display: block; padding: 4px 0 5px; font: 750 16px/1 var(--font-display); }
.datelist .t { min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.datelist .d { display: block; font-size: 12.5px; font-weight: 400; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-progress { width: 100%; font-size: 13.5px; }
.dash-progress .bar { display: inline-block; width: 44px; height: 6px; margin-right: 8px; border-radius: 3px; vertical-align: middle; background: linear-gradient(90deg, var(--pass) calc(var(--p) * 1%), var(--surface-3) 0); }
.dash-pours li, .dash-structures li { font-size: 13.5px; overflow-wrap: anywhere; }
.rowlist { list-style: none; margin: 8px 0 0; padding: 0; }
.rowlist li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rowlist li:last-child { border-bottom: 0; }
.rowlist li > a:first-child { font-weight: 600; text-decoration: none; }
.card-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 16px; }

/* ---- project: structures ---- */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 20px; }
.quick a {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14.5px;
  transition: box-shadow 0.18s var(--ease), transform 0.18s var(--ease), border-color 0.18s;
}
.quick a:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.quick .q-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--brand-soft); color: var(--brand); }
.quick .q-t { min-width: 0; line-height: 1.25; }
.quick .q-t small { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.quick .q-t small.hot { color: var(--high); font-weight: 650; }
@media (min-width: 1024px) { .quick .q-extra { display: none; } }
@media (max-width: 599px) {
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick a { padding: 10px; gap: 10px; font-size: 14px; }
  .quick .q-t small:not(.hot) { display: none; }
}
.keepbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 18px; }
.keepbar .note { margin: 0; }
.s-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.s-pic {
  position: relative; display: block; aspect-ratio: 16 / 7; overflow: hidden;
  background:
    radial-gradient(260px 150px at 85% 0%, var(--brand-soft), transparent 70%),
    linear-gradient(135deg, var(--surface-2), var(--canvas-bg));
  color: var(--brand); border-bottom: 1px solid var(--line);
}
.s-pic svg.art { position: absolute; right: 8%; bottom: -10%; width: 40%; height: auto; opacity: 0.35; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linejoin: round; }
.s-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.s-pic .pill { position: absolute; left: 12px; top: 12px; box-shadow: var(--shadow-1); }
.s-pic .s-ring { position: absolute; right: 12px; top: 12px; background: var(--surface); border-radius: 50%; box-shadow: var(--shadow-2); }
.s-body { display: flex; flex-direction: column; flex: 1 1 auto; padding: 16px 18px 18px; }
.s-body .figs { margin-top: 12px; }
.s-body .card-foot { padding-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.linkrow { display: flex; flex-wrap: wrap; gap: 4px 2px; margin: 10px -8px -4px; }
.linkrow a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.linkrow a:hover { background: var(--surface-2); color: var(--ink); }
.linkrow .ic { width: 16px; height: 16px; color: var(--ink-3); }

/* ---- work entries ---- */
.entry .panel-head h2 { font-size: 16.5px; }
.entry-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13.5px; color: var(--ink-2); margin: 6px 0 8px; }
.entry-note { font-size: 14.5px; border-left: 3px solid var(--line-strong); padding: 2px 0 2px 12px; margin: 10px 0; overflow-wrap: anywhere; color: var(--ink-2); }
.entry.entry-submitted { border-left: 4px solid var(--info); }
.entry.entry-returned { border-left: 4px solid var(--high); }

/* ---- queries, pours ---- */
.query-text { font-size: 15px; overflow-wrap: anywhere; }
.query.query-open { border-left: 4px solid var(--high); }
.card-links { margin-top: 6px; }

/* ---- reports ---- */
.report-section h3 { font-size: 15px; margin: 18px 0 6px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.report-actions { margin-bottom: 10px; }
.report-dates, .reports .inline-form { margin: 8px 0 12px; }

/* ---- models from drawings ---- */
.trial-banner { border: 2px dashed var(--warn); }
.run-state-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
.run-log { max-height: 30em; overflow-y: auto; font-size: 13.5px; list-style: none; padding-left: 0; margin: 10px 0 0; }
.run-log li { position: relative; padding: 6px 0 6px 18px; border-left: 2px solid var(--line); margin-left: 5px; overflow-wrap: anywhere; }
.run-log li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); box-shadow: 0 0 0 3px var(--surface); }
.run-log li.ev-error, .run-log li.ev-warning { color: var(--high); }
.run-log li.ev-error::before, .run-log li.ev-warning::before { background: var(--high); }
.output-list, .drawing-list { list-style: none; padding-left: 0; }
.output-list li, .drawing-list li { overflow-wrap: anywhere; padding: 8px 0; border-bottom: 1px solid var(--line); }
.output-list li:last-child, .drawing-list li:last-child { border-bottom: 0; }
.drawing-list form.inline { margin-left: 6px; }
.output-list .kind-note { display: block; font-size: 13px; }
.rejections li, h1 { overflow-wrap: anywhere; }

/* ---- error page ---- */
.oops { min-height: 100dvh; display: grid; place-items: center; padding: 24px; text-align: center; }
.oops-card { max-width: 460px; }
.oops-code { font: 800 clamp(64px, 16vw, 120px)/1 var(--font-display); letter-spacing: -0.05em; background: linear-gradient(135deg, var(--brand), var(--spark)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.oops h1 { font-size: 24px; margin: 8px 0; }
.oops p { color: var(--ink-2); }
.oops .actions { justify-content: center; margin-top: 20px; }

/* ---- print ---- */
@media print {
  .ui2 body { background: #fff; }
  .ui2 body::before, .side, .top, .tabbar, .foot, .subnav, .messages, .pmc-sendbar { display: none !important; }
  .shell { display: block; }
  .content { max-width: none; padding: 0; }
  .card, .panel { box-shadow: none; break-inside: avoid; }
}

/* ================= 6. shared parts for the page files (p-*.css build on these) ================= */
/* ---- a row of choices that are links (All / Waiting / Approved ...) ---- */
.chipnav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 14px; padding: 2px; }
.chipnav::-webkit-scrollbar { display: none; }
.chipnav a, .chipnav button {
  display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 38px; padding: 0 14px; border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.chipnav a:hover, .chipnav button:hover { border-color: var(--line-strong); color: var(--ink); }
.chipnav [aria-current="true"], .chipnav [aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chipnav b { min-width: 20px; padding: 0 6px; border-radius: var(--r-full); background: var(--surface-3); color: var(--ink-2); font: 700 12px/20px var(--font-text); text-align: center; }
.chipnav [aria-current="true"] b, .chipnav [aria-pressed="true"] b { background: rgba(127, 127, 127, 0.35); color: inherit; }

/* ---- a part of the page that opens and closes (a form that is not needed every time) ---- */
details.fold { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); margin: 0 0 16px; }
details.fold > summary {
  list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; border-radius: inherit;
  font: 650 16px/1.3 var(--font-display); letter-spacing: -0.011em;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before {
  content: "+"; flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font: 600 19px/1 var(--font-text); transition: transform 0.18s var(--ease);
}
details.fold[open] > summary::before { transform: rotate(45deg); }
details.fold > summary:hover { background: var(--surface-2); }
details.fold[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; }
details.fold > summary small { margin-left: auto; font: 500 13px/1.3 var(--font-text); color: var(--ink-3); letter-spacing: 0; text-align: right; }
details.fold > .fold-body { padding: 4px 18px 18px; }
details.fold.plain { border: 0; box-shadow: none; background: none; }

/* ---- a person with their picture letters ---- */
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .who { min-width: 0; line-height: 1.3; }
.person .who b { display: block; font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .who span { display: block; font-size: 12.5px; color: var(--ink-3); }

/* ---- the main part and a narrower part beside it (under it on a narrow screen) ---- */
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1180px) { .split { grid-template-columns: minmax(0, 1fr) 360px; } .split > aside { position: sticky; top: calc(var(--top-h) + 12px); } }
.stack { display: grid; gap: 16px; min-width: 0; }

/* ---- steps of a job, one after the other ---- */
.steps { display: flex; gap: 0; margin: 14px 0 6px; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps li { position: relative; flex: 1 1 0; min-width: 78px; padding-top: 30px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.steps li::before { content: ""; position: absolute; top: 5px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 12px; left: -50%; right: 50%; height: 2px; background: var(--line-strong); }
.steps li:first-child::after { display: none; }
.steps li.done { color: var(--ink-2); }
.steps li.done::before { background: var(--pass); border-color: var(--pass); }
.steps li.done::after, .steps li.now::after { background: var(--pass); }
.steps li.now { color: var(--ink); }
.steps li.now::before { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 5px var(--brand-soft); }
.steps li.bad { color: var(--high); }
.steps li.bad::before { background: var(--high); border-color: var(--high); box-shadow: 0 0 0 5px var(--high-soft); }

/* ---- a list table that becomes one block per row on a phone: <td data-label="Cast"> ---- */
@media (max-width: 640px) {
  table.cards-s thead { display: none; }
  table.cards-s, table.cards-s tbody, table.cards-s tr, table.cards-s td { display: block; width: 100%; }
  table.cards-s tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.cards-s tr:last-child { border-bottom: 0; }
  table.cards-s td { border: 0; padding: 2px 0; text-align: left !important; white-space: normal !important; overflow-wrap: anywhere; }
  table.cards-s td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 7.5em; margin-right: 8px; color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
  table.cards-s td.lead-cell { font-weight: 650; font-size: 15px; padding-bottom: 4px; }
  table.cards-s td.lead-cell::before { display: none; }
  table.cards-s td:empty { display: none; }
}

/* ---- the buttons that decide, kept in reach at the bottom of a phone ---- */
@media (max-width: 1023px) {
  .sticky-actions {
    position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 8px); z-index: 20;
    margin: 12px -6px 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md);
    background: var(--surface); box-shadow: var(--shadow-3);
  }
}

/* ---- small things ---- */
.meter.warn > i { background: var(--warn); }
.meter.high > i { background: var(--high); }
.meter.thin { height: 5px; }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi b { font: 750 22px/1.1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12.5px; color: var(--ink-3); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.row .grow { flex: 1 1 auto; min-width: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.hint { font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
.timeline { list-style: none; margin: 10px 0 0; padding: 0; }
.timeline li { position: relative; padding: 4px 0 10px 20px; border-left: 2px solid var(--line); margin-left: 5px; font-size: 13.5px; overflow-wrap: anywhere; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); box-shadow: 0 0 0 3px var(--surface); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }

/* ---- dashboard: the welcome note and "jump back in" (both filled and shown by shell.js) ---- */
.welcome {
  display: flex; align-items: flex-start; gap: 14px; margin: 0 0 18px; padding: 16px 18px; border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line));
  background: linear-gradient(120deg, var(--brand-soft), var(--spark-soft));
}
.welcome-ic { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--brand); color: var(--brand-ink); }
.welcome-text { flex: 1 1 auto; min-width: 0; }
.welcome h2 { font-size: 17px; margin-bottom: 4px; }
.welcome p { margin: 0; font-size: 14px; color: var(--ink-2); max-width: 78ch; }
.welcome .btn { flex: none; }
@media (max-width: 599px) { .welcome { flex-wrap: wrap; } .welcome .btn { margin-left: 58px; } }
.recent { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.recent::-webkit-scrollbar { display: none; }
.recent-t { flex: none; font-size: 12.5px; font-weight: 650; color: var(--ink-3); margin-right: 2px; }
.recent a {
  display: inline-flex; align-items: center; gap: 8px; flex: none; max-width: 280px; min-height: 38px; padding: 0 14px 0 10px; border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-1);
}
.recent a:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.recent a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent a .ic { width: 16px; height: 16px; color: var(--brand); }
.s-pic.has-img svg.art { display: none; }
.s-pic img { opacity: 0; transition: opacity 0.35s var(--ease); }
.s-pic.has-img img { opacity: 1; }
.s-pic .pill, .s-pic .s-ring { z-index: 1; }

/* ================= 7. after the independent usability review ================= */
/* a figure is never cut short: when there is no room the unit goes under the number */
.fig .v { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: normal; line-height: 1.15; }
.fig .u { white-space: nowrap; }
@media (max-width: 420px) { .figs { gap: 6px; } .fig { padding: 8px; } .fig .v { font-size: 16px; } }

/* text on the orange is dark; the letters of a person read on every colour, in light and in dark */
.nav .count, .datebox i { color: var(--spark-ink); }
.datebox i { font-size: 10.5px; }
.avatar { background: hsl(var(--h, 225) 60% 30%); color: #fff; }
:root[data-theme="dark"] .avatar { background: hsl(var(--h, 225) 55% 74%); color: hsl(var(--h, 225) 70% 12%); }

/* fields: an edge that shows in sunlight, hints at full strength */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=search], input[type=file], select, textarea { border-color: var(--field-line); }
input::placeholder, textarea::placeholder { opacity: 1; }
.palette-in input { border-color: transparent; }

/* things to press are tall enough for a thumb, and small words are not smaller than 12 px */
.foot { gap: 0 4px; }
.foot a, .foot .linklike { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; }
.msg .x { width: 40px; height: 40px; right: 2px; top: 2px; }
.seg3 button { min-height: 44px; }
.linkrow { gap: 6px; }
.linkrow a { min-height: 42px; padding: 0 10px; }
.form label.check, fieldset.members label.check { min-height: 44px; align-items: center; }
.nav-title, .palette-list .grp { font-size: 12px; }
@media (max-width: 1023px) { .tabbar a, .tabbar button { font-size: 12px; } }
.decide .dp-actions, .sticky-actions { gap: 14px; }

/* a row that is swiped sideways fades at its right edge, so it shows that there is more */
.subnav, .chipnav, .recent {
  padding-right: 28px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent);
}
@media (max-width: 480px) {
  .subnav { gap: 2px; padding-right: 12px; }
  .subnav a { flex: 1 0 auto; justify-content: center; padding: 0 9px; }
  .subnav a .ic { display: none; }
}

/* a "Show" beside filters is not the main thing to press on a page */
.filters .btn.primary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow-1); }
.filters .btn.primary:hover { background: var(--surface); border-color: var(--ink-3); color: var(--ink); }
.btn.tonal { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); box-shadow: none; }
.btn.tonal:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
:root[data-theme="dark"] .btn.tonal { color: var(--brand); }

/* a list table on a phone: the whole block of a row opens it; other links in it stay their own, with room */
@media (max-width: 640px) {
  table.cards-s tr { position: relative; }
  table.cards-s td.lead-cell a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
  table.cards-s td:not(.lead-cell) a, table.cards-s td button, table.cards-s td form { position: relative; z-index: 1; }
  table.cards-s td:not(.lead-cell) a { display: inline-block; min-width: 40px; padding: 8px 6px; margin: -8px -6px; }
}

/* the project page on a phone: the shortcuts are one row to swipe, the structure cards are shorter */
.cap { margin: 14px 0 -6px; font-size: 12.5px; font-weight: 650; color: var(--ink-3); }
@media (max-width: 599px) {
  .quick {
    display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; padding: 2px 30px 4px 2px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent);
  }
  .quick::-webkit-scrollbar { display: none; }
  .quick a { flex: none; padding: 8px 14px 8px 8px; }
  .quick .q-ic { width: 32px; height: 32px; border-radius: 10px; }
  .quick .q-t small:not(.hot) { display: none; }
  .s-pic { aspect-ratio: 16 / 6; }
  .s-body { padding: 14px; }
  .s-card .progress-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin-top: 12px; }
  .s-card .card-foot { padding-top: 12px; }
}

/* for the keyboard: straight to the page, and into a table that scrolls */
.skip { position: absolute; left: 12px; top: -80px; z-index: 100; padding: 12px 18px; border-radius: var(--r-sm); background: var(--ink); color: var(--bg); font-weight: 650; text-decoration: none; }
.skip:focus { top: 12px; color: var(--bg); }
.tscroll:focus-visible, .table-wrap:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tile span em { display: block; margin-top: 2px; font-style: normal; font-size: 12px; color: var(--brand); font-weight: 600; }

/* light is the look's own colours; dark is a choice: a quick switch in the top bar, and two buttons in the menu */
.seg3.two { grid-template-columns: repeat(2, 1fr); }
.theme-toggle { color: var(--ink-2); }
@media (max-width: 599px) { .top-tools .theme-toggle { display: none; } }

/* A table of things to act on (the people of a project, the projects of the platform) becomes a list of cards on a
   narrow screen, so nothing has to be scrolled sideways to reach its buttons (Part 7; the same rules in both looks). */
.form label.check + .note { margin-top: -6px; padding-left: 28px; }
@media (max-width: 760px) {
  .table-wrap.stack-wrap { border: 0; background: none; overflow: visible; margin-top: 10px; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: auto; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stack tr { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 10px; background: var(--surface); }
  table.stack td, table.stack tbody tr:hover td { border: 0; padding: 3px 0; background: none; }
  table.stack td[data-th] { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 8px; overflow-wrap: anywhere; }
  table.stack td[data-th]::before { content: attr(data-th); color: var(--ink-3); font-size: 12.5px; font-family: inherit; }
  table.stack td.st-title { font-weight: 700; font-size: 15px; padding-bottom: 6px; }
  table.stack td[data-th] > * { justify-self: start; }
  table.stack td.st-acts { padding-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
  table.stack td.st-acts:empty { display: none; }
  table.stack td.st-acts .inline-form { width: auto; margin: 0; }
  table.stack td.st-acts .note, table.stack td.st-acts > span { flex: 1 1 100%; margin: 0; }
}
