/* ==========================================================================
   Fabricata Flow: design system

   Sibling to Fabricata Cut and Fabricata Inspect, not a twin. The structure is
   the family's: the neutral ramp, radii 6/12/14/18/24, the soft wide shadows,
   Inter for text and Montserrat 800 for display, 15px body, gradient primary
   buttons at weight 800, 4px focus halos, a white-to-tint sidebar with the
   page header inside the content column, and the pill vocabulary.

   What is Flow's own:
   - Violet (#7C3AED), the one hue no status uses, so the brand never reads
     as a state.
   - The stage rail: a segmented bar showing where a job is in its route.
     It appears on every job row, every board card, the job card and the PDF.
   - Denser tables. Flow is used to scan dozens of jobs at once.
   ========================================================================== */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 800; font-display: swap; src: url("/static/fonts/inter-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 800; font-display: swap; src: url("/static/fonts/montserrat-latin-800-normal.woff2") format("woff2"); }

:root {
  /* Neutrals: the family's */
  --bg: #f4f7fb;
  --bg-2: #eef3f9;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --surface-3: #eef4ff;
  --border: #dbe5f0;
  --border-strong: #c5d2e0;
  --text: #0f172a;
  --muted: #64748b;
  --muted-ink: #55657a;
  --muted-2: #94a3b8;
  --steel: #475569;

  /* Flow's accent */
  --primary: #7c3aed;
  --primary-strong: #6d28d9;
  --primary-deep: #5b21b6;
  --primary-soft: #f3eefe;
  --primary-line: #dccffb;
  --on-primary: #ffffff;
  --btn-from: #6d28d9;
  --btn-to: #5b21b6;

  /* States */
  --success: #15803d; --success-soft: #ebf9ef; --success-line: #c9e9d2;
  --warning: #b45309; --warning-soft: #fef4e6; --warning-line: #f8d7a3;
  --danger: #b91c1c;  --danger-soft: #fef2f2;  --danger-line: #f3cfcf;
  --info: #1d4ed8;    --info-soft: #eaf1ff;    --info-line: #c9d9fb;
  --neutral-soft: #f1f5f9; --neutral-line: #e2e8f0;

  /* Stage rail */
  --rail-done: #16a34a;
  --rail-active: #2563eb;
  --rail-blocked: #dc2626;
  --rail-pending: #dbe3ee;
  --rail-skipped: #e8edf3;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 10px 24px rgba(15, 23, 42, .06);
  --shadow-md: 0 20px 48px rgba(15, 23, 42, .09);
  --shadow-lg: 0 28px 70px rgba(15, 23, 42, .14);

  --radius-xl: 24px; --radius-lg: 18px; --radius-md: 14px; --radius-sm: 12px; --radius-xs: 6px;

  --content: 1280px;
  --sidebar: 264px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Montserrat", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --focus-outline: #6d28d9;
  --ring: 0 0 0 4px rgba(124, 58, 237, .16);
  --sidebar-bg: linear-gradient(180deg, #ffffff 0%, #f8f7ff 100%);
  --scrim: rgba(15, 23, 42, .45);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --bg-2: #0e1626; --surface: #131c2b; --surface-2: #172232; --surface-3: #1d293b;
    --border: #26344a; --border-strong: #35455e;
    --text: #e8eef8; --muted: #94a3b8; --muted-ink: #a7b4c7; --muted-2: #64748b; --steel: #a7b4c7;
    --primary: #a78bfa; --primary-strong: #c4b5fd; --primary-deep: #ddd6fe;
    --primary-soft: #221a3d; --primary-line: #3b2d66; --on-primary: #ffffff;
    --btn-from: #7c3aed; --btn-to: #6d28d9;
    --success: #4ade80; --success-soft: #0e2a1a; --success-line: #1c4a30;
    --warning: #fbbf24; --warning-soft: #2c2008; --warning-line: #4d3a10;
    --danger: #f87171;  --danger-soft: #2e1216;  --danger-line: #5a2229;
    --info: #93b4ff;    --info-soft: #14203d;    --info-line: #243a6b;
    --neutral-soft: #1a2436; --neutral-line: #2a3850;
    --rail-done: #22c55e; --rail-active: #60a5fa; --rail-blocked: #f87171; --rail-pending: #2a3850; --rail-skipped: #1f2a3d;
    --focus-outline: #c4b5fd;
    --ring: 0 0 0 4px rgba(167, 139, 250, .22);
    --sidebar-bg: linear-gradient(180deg, #111a29 0%, #0f1726 100%);
    --shadow-sm: 0 10px 24px rgba(0, 0, 0, .25);
    --shadow-md: 0 20px 48px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text);
  background: var(--bg); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
img, svg { vertical-align: middle; }
img { max-width: 100%; height: auto; }
a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus-outline); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--primary-line); }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-md); }
.skip:focus { left: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.muted { color: var(--muted-ink); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.label-caps { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar-bg);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 14px 14px; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand img { height: 26px; width: auto; }
.brand-dark { display: none; }
@media (prefers-color-scheme: dark) { .brand-light { display: none !important; } .brand-dark { display: inline-block; } }

.workspace-chip {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); margin-bottom: 8px; min-width: 0;
}
.workspace-chip .org-initial {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-strong); font-weight: 800; font-size: 13px;
}
.workspace-chip strong { display: block; font-size: 13px; line-height: 1.2; }
.workspace-chip span { font-size: 12px; color: var(--muted); }
.workspace-chip details { position: relative; margin-left: auto; }

.sidebar-search { position: relative; margin: 0 0 8px; }
.sidebar-search input[type="search"] { padding-left: 34px; min-height: 38px; height: 38px; font-size: 14px; }
.sidebar-search svg { position: absolute; left: 11px; top: 10px; color: var(--muted-2); pointer-events: none; }

.nav-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); padding: 14px 10px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--steel);
  font-weight: 600; font-size: 14px;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary-strong); }
.nav a.active svg { color: var(--primary); }
.nav a svg { color: var(--muted-2); flex: none; }
.nav .count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 800;
  display: inline-grid; place-items: center; background: var(--neutral-soft); color: var(--steel);
}
.nav .count.alert { background: var(--danger); color: #fff; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 6px; color: inherit; border-radius: 10px; }
.me:hover { background: var(--surface-3); text-decoration: none; }
.me strong { display: block; font-size: 13px; line-height: 1.2; }
.me span { font-size: 12px; color: var(--muted); }

.content { min-width: 0; display: flex; flex-direction: column; }
.page { width: 100%; max-width: var(--content); margin: 0 auto; padding: 24px 32px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .kicker { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.page-head .kicker a { color: var(--muted-ink); }
.page-head .kicker .sep { color: var(--muted-2); }
.page-head h1 { word-break: break-word; }
.page-head .sub { color: var(--muted-ink); margin-top: 6px; font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Mobile chrome */
.mobile-bar, .tabbar { display: none; }
.scrim { display: none; }

@media (max-width: 1023px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 60; transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 55; }
  .mobile-bar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40; height: 56px; padding: 0 12px;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
  }
  .mobile-bar .brand { padding: 0; }
  .mobile-bar .brand img { height: 22px; }
  .mobile-bar .spacer { flex: 1; }
  .page { padding: 18px 16px 104px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 0; background: none;
    font: inherit; font-size: 11px; font-weight: 700; color: var(--muted); border-radius: 10px; position: relative;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .is-active { color: var(--primary-strong); }
  .tabbar .dot { position: absolute; top: 3px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { text-decoration: none; border-color: var(--muted-2); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
  --btn-fg: var(--on-primary); border: 0; background: linear-gradient(135deg, var(--btn-from), var(--btn-to));
  font-weight: 800; box-shadow: 0 8px 20px rgba(109, 40, 217, .22);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--btn-from), var(--btn-to)); transform: translateY(-1px); box-shadow: 0 12px 26px rgba(109, 40, 217, .28); }
.btn-dark { --btn-bg: #0f172a; --btn-fg: #fff; --btn-border: #0f172a; }
.btn-dark:hover { background: #1e293b; }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; color: var(--steel); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: var(--danger); }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }
.btn-danger-soft { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-border: var(--danger-line); }
.btn-success { --btn-bg: var(--success); --btn-fg: #fff; --btn-border: var(--success); }
.btn-success:hover { background: #166534; border-color: #166534; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 10px; gap: 6px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; min-height: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; min-height: 32px; }
.btn .spinner { display: none; }
.btn.is-busy { pointer-events: none; opacity: .8; }
.btn.is-busy .spinner { display: inline-block; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-strong); cursor: pointer; font-weight: 600; }
.link-button:hover { text-decoration: underline; }
.link-button.danger { color: var(--danger); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
label { font-weight: 700; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field .hint { font-size: 12.5px; color: var(--muted-ink); font-weight: 400; }
.field .error { font-size: 12.5px; color: var(--danger); font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.req { color: var(--danger); margin-left: 2px; }
.optional { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"],
input[type="date"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%2364748b'%3E%3Cpath d='M213.66 101.66l-80 80a8 8 0 01-11.32 0l-80-80a8 8 0 0111.32-11.32L128 164.69l74.34-74.35a8 8 0 0111.32 11.32z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; background-size: 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; flex: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: 14px; cursor: pointer; }
.check input { margin-top: 2px; }
.check .hint { display: block; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 6px; }
.form-section + .form-section { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.form-section > h2 { margin-bottom: 4px; }
.form-section > .muted { margin-bottom: 16px; font-size: 13.5px; }
@media (max-width: 720px) {
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
  input, select, textarea { font-size: 16px !important; } /* stops iOS zooming on focus */
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
}

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card-body { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { font-size: 16px; }
.card-head .count { font-weight: 700; color: var(--muted); font-size: 13px; margin-left: 6px; }
.card-foot { padding: 12px 22px; border-top: 1px solid var(--border); font-size: 13px; }
.card.pad-lg .card-body { padding: 28px; }
@media (max-width: 720px) { .card-body { padding: 16px; } .card-head { padding: 14px 16px; } .card-foot { padding: 12px 16px; } }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.layout-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.layout-main-side > * { min-width: 0; }
@media (max-width: 1180px) { .layout-main-side { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Metric tiles */
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric {
  display: block; padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border);
  color: inherit; transition: border-color .12s, box-shadow .12s;
}
a.metric:hover { text-decoration: none; border-color: var(--primary-line); box-shadow: var(--shadow-sm); }
.metric .label { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.metric .value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.metric.is-danger .value { color: var(--danger); }
.metric.is-warning .value { color: var(--warning); }
.metric .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.metric.is-danger .dot { background: var(--danger); }
.metric.is-warning .dot { background: var(--warning); }
.metric.is-info .dot { background: var(--rail-active); }
.metric.is-success .dot { background: var(--rail-done); }
@media (max-width: 1180px) { .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .metric .value { font-size: 22px; } }

/* --------------------------------------------------------------------------
   Pills and status
   -------------------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid var(--neutral-line); background: var(--neutral-soft); color: var(--steel);
}
.pill-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill-info { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }
.pill-success { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.pill-warning { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning); }
.pill-danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.pill-primary { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-strong); }
.pill-muted { color: var(--muted); }
.pill-lg { height: 30px; padding: 0 12px; font-size: 13px; }

.priority { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; }
.priority.urgent { color: var(--danger); }
.priority.high { color: var(--warning); }
.priority.low { color: var(--muted); font-weight: 600; }

.due { font-size: 13px; font-weight: 600; white-space: nowrap; }
.due.overdue { color: var(--danger); font-weight: 800; }
.due.today, .due.soon { color: var(--warning); font-weight: 700; }
.due.none { color: var(--muted-2); font-weight: 400; }

/* --------------------------------------------------------------------------
   The stage rail and progress
   -------------------------------------------------------------------------- */
.rail { display: flex; gap: 3px; width: 100%; min-width: 72px; }
.rail span { flex: 1 1 0; height: 6px; border-radius: 3px; background: var(--rail-pending); }
.rail .done { background: var(--rail-done); }
.rail .in_progress { background: var(--rail-active); }
.rail .blocked { background: var(--rail-blocked); }
.rail .skipped { background: repeating-linear-gradient(135deg, var(--rail-skipped) 0 3px, var(--rail-pending) 3px 6px); }
.rail.rail-lg span { height: 10px; border-radius: 5px; }
.rail-empty { font-size: 12px; color: var(--muted-2); }

.progress { display: flex; align-items: center; gap: 10px; }
.progress .bar { flex: 1; height: 8px; border-radius: 999px; background: var(--rail-pending); overflow: hidden; }
.progress .bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--primary-strong)); }
.progress .bar.is-complete i { background: var(--rail-done); }
.progress .pct { font-weight: 800; font-size: 13px; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Tables. Below 800px each row becomes a card: the job number and title
   lead, and the rest stack as labelled lines. No sideways scrolling.
   -------------------------------------------------------------------------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .row-link { color: inherit; font-weight: 700; }
.table .row-link::after { content: ""; position: absolute; inset: 0; }
.table tr.linked { position: relative; }
.table tr.linked td:first-child { position: static; }
.table .job-code { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--primary-strong); font-size: 13px; }
.table .job-title { font-weight: 700; color: var(--text); display: block; }
.table .sub { color: var(--muted-ink); font-size: 12.5px; display: block; }
.table .col-rail { width: 150px; }
.table .col-narrow { width: 1%; white-space: nowrap; }
.table .actions { text-align: right; position: relative; z-index: 2; }
.table tr.is-muted td { color: var(--muted); }
.th-sort { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.th-sort.active { color: var(--primary-strong); }

@media (max-width: 800px) {
  .table-wrap { background: none; border: 0; overflow: visible; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tbody tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px;
    margin-bottom: 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  }
  .table td { border: 0; padding: 2px 0; }
  .table td[data-label]:not([data-primary])::before {
    content: attr(data-label); display: inline-block; min-width: 96px; font-size: 11px; font-weight: 800; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted-2); margin-right: 8px;
  }
  .table td[data-primary] { grid-column: 1 / -1; }
  .table td[data-side] { grid-column: 2; grid-row: 1; text-align: right; }
  .table td.hide-sm { display: none; }
  .table .col-rail { width: auto; }
  .table td[data-full] { grid-column: 1 / -1; }
}

/* --------------------------------------------------------------------------
   Toolbar, filters and pagination
   -------------------------------------------------------------------------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1 1 260px; max-width: 420px; }
.toolbar .search input { padding-left: 36px; }
.toolbar .search svg { position: absolute; left: 12px; top: 13px; color: var(--muted-2); pointer-events: none; }
.seg { display: inline-flex; background: var(--neutral-soft); border: 1px solid var(--neutral-line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 700;
  color: var(--steel); border: 0; background: none; cursor: pointer; font-family: inherit;
}
.seg a:hover { text-decoration: none; background: var(--surface); }
.seg .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.seg .n { font-size: 11px; color: var(--muted); font-weight: 700; }
.filter-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; padding: 16px; margin-bottom: 14px; }
.filter-panel .field label { font-size: 12px; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 11px; border-radius: 999px;
  background: var(--primary-soft); border: 1px solid var(--primary-line); color: var(--primary-strong); font-size: 12.5px; font-weight: 700;
}
.chip a { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: inherit; }
.chip a:hover { background: var(--primary-line); text-decoration: none; }
.result-count { font-size: 13px; color: var(--muted-ink); margin-left: auto; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted-ink); }
.pagination .pages { display: flex; gap: 6px; }

/* --------------------------------------------------------------------------
   Menus and dialogs
   -------------------------------------------------------------------------- */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.menu-panel.left { left: 0; right: auto; }
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; border: 0; background: none;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; text-align: left;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-3); text-decoration: none; }
.menu-panel .danger { color: var(--danger); }
.menu-panel hr { margin: 6px 4px; }
.menu-panel form { margin: 0; }

dialog.dialog {
  border: 0; padding: 0; border-radius: var(--radius-lg); width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
dialog.dialog.wide { width: min(640px, calc(100vw - 32px)); }
.dialog-body { padding: 22px 24px; }
.dialog-body h2 { margin-bottom: 8px; }
.dialog-body > p { color: var(--muted-ink); font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
@media (max-width: 560px) {
  dialog.dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
}

/* --------------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid; font-size: 14px; font-weight: 600; }
.flash svg { flex: none; margin-top: 1px; }
.flash-success { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.flash-error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.flash-info { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }
.flash .grow { color: var(--text); font-weight: 600; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); font-size: 14px; }
.callout.warning { background: var(--warning-soft); border-color: var(--warning-line); }
.callout.warning > svg { color: var(--warning); }
.callout.danger { background: var(--danger-soft); border-color: var(--danger-line); }
.callout.danger > svg { color: var(--danger); }
.callout.success { background: var(--success-soft); border-color: var(--success-line); }
.callout.success > svg { color: var(--success); }
.callout.info { background: var(--primary-soft); border-color: var(--primary-line); }
.callout.info > svg { color: var(--primary); }
.callout > svg { flex: none; margin-top: 1px; }
.callout strong { display: block; margin-bottom: 2px; }

/* Empty states */
.empty { text-align: center; padding: 40px 20px; max-width: 460px; margin: 0 auto; }
.empty svg.art { width: 150px; height: auto; margin-bottom: 14px; }
.empty h2, .empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted-ink); font-size: 14px; margin-bottom: 16px; }
.empty-inline { padding: 18px 22px; color: var(--muted-ink); font-size: 14px; }

/* Avatars */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 12px; font-weight: 800;
  background: var(--primary-soft); color: var(--primary-strong); border: 1px solid var(--primary-line);
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.person .name { font-weight: 600; font-size: 13.5px; }
.unassigned { color: var(--muted-2); font-size: 13px; }

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-grid > * { min-width: 0; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 22px; color: inherit; min-width: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { font-size: 12.5px; color: var(--muted-ink); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list-item .aside { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
@media (max-width: 720px) { .list-item { padding: 12px 16px; } }
.reason { font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.reason.blocked { color: var(--danger); }
.reason.overdue { color: var(--danger); }
.reason.soon { color: var(--warning); }
.reason.hold { color: var(--warning); }

.wip { padding: 8px 22px 18px; }
.wip-row { display: grid; grid-template-columns: 130px 1fr 34px; gap: 10px; align-items: center; padding: 6px 0; color: inherit; font-size: 13.5px; }
a.wip-row:hover { text-decoration: none; }
a.wip-row:hover .wip-name { color: var(--primary-strong); }
.wip-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wip-bar { height: 18px; border-radius: 6px; background: var(--surface-3); overflow: hidden; display: flex; }
.wip-bar i { display: block; height: 100%; background: var(--rail-active); }
.wip-bar i.blocked { background: var(--rail-blocked); }
.wip-count { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.setup { padding: 20px 22px; background: linear-gradient(135deg, var(--primary-soft), var(--surface)); }
.setup ol { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.setup li { display: flex; gap: 10px; align-items: center; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; font-weight: 700; font-size: 14px; }
.setup li a { color: inherit; }
.setup .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; color: #fff; }
.setup .done .tick { background: var(--rail-done); border-color: var(--rail-done); }
.setup .done span.t { color: var(--muted); text-decoration: line-through; }
@media (max-width: 720px) { .setup ol { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Job card
   -------------------------------------------------------------------------- */
.job-hero { padding: 20px 22px; }
.job-hero .facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; margin-top: 18px; }
.fact .k { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.fact .v { font-weight: 600; font-size: 14px; word-break: break-word; }
.fact .v a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
@media (max-width: 900px) { .job-hero .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.job-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 16px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.job-progress .why { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted-ink); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.job-progress .big { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.banner-ready { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.stage-list { list-style: none; margin: 0; padding: 0; counter-reset: stage; }
.stage { border-bottom: 1px solid var(--border); position: relative; scroll-margin-top: 80px; }
.stage:last-child { border-bottom: 0; }
.stage:target { background: var(--primary-soft); }
.stage-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 22px; }
.stage-marker {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12.5px;
  border: 2px solid var(--rail-pending); color: var(--muted); background: var(--surface);
}
.stage.done .stage-marker { background: var(--rail-done); border-color: var(--rail-done); color: #fff; }
.stage.in_progress .stage-marker { border-color: var(--rail-active); color: var(--rail-active); box-shadow: 0 0 0 4px var(--info-soft); }
.stage.blocked .stage-marker { background: var(--rail-blocked); border-color: var(--rail-blocked); color: #fff; }
.stage.skipped .stage-marker { border-style: dashed; color: var(--muted-2); }
.stage-name { font-weight: 800; font-size: 15px; }
.stage.skipped .stage-name { color: var(--muted); text-decoration: line-through; }
.stage-meta { font-size: 12.5px; color: var(--muted-ink); display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; margin-top: 3px; }
.stage-meta .item { display: inline-flex; gap: 5px; align-items: center; }
.stage-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.stage-blocker { margin: 0 22px 14px 70px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger); font-size: 13.5px; font-weight: 600; }
.stage-notes { margin: -4px 22px 14px 70px; font-size: 13.5px; color: var(--steel); white-space: pre-wrap; }
.stage-edit { margin: 0 22px 16px 70px; padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.stage-edit[hidden] { display: none; }
@media (max-width: 720px) {
  .stage-row { grid-template-columns: 30px minmax(0, 1fr); padding: 14px 16px; gap: 12px; }
  .stage-actions { grid-column: 1 / -1; justify-content: stretch; }
  .stage-actions > .btn, .stage-actions > form { flex: 1 1 auto; }
  .stage-actions > form .btn { width: 100%; }
  .stage-actions .btn { min-height: 44px; }
  .stage-blocker, .stage-notes, .stage-edit { margin-left: 16px; margin-right: 16px; }
}

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 6px 22px 16px; }
.timeline li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 10px 0; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 13px; top: 38px; bottom: -10px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--neutral-soft); color: var(--steel); position: relative; z-index: 1; }
.timeline .ico.success { background: var(--success-soft); color: var(--success); }
.timeline .ico.danger { background: var(--danger-soft); color: var(--danger); }
.timeline .ico.warning { background: var(--warning-soft); color: var(--warning); }
.timeline .ico.info { background: var(--info-soft); color: var(--info); }
.timeline .what { font-size: 13.5px; }
.timeline .what strong { font-weight: 700; }
.timeline .when { font-size: 12px; color: var(--muted); }
.note { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-top: 4px; }
.note .body { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.note .body p { margin: 0 0 8px; }
.note-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted-ink); }
.composer { padding: 16px 22px; border-bottom: 1px solid var(--border); }
.composer textarea { min-height: 72px; }
.composer .row-between { margin-top: 10px; }
@media (max-width: 720px) { .timeline { padding: 6px 16px 12px; } .composer { padding: 14px 16px; } }

/* Files */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 16px 22px 20px; }
.file {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; min-width: 0;
  position: relative;
}
.file .thumb { aspect-ratio: 4 / 3; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .thumb .ext { font-weight: 800; font-size: 12px; letter-spacing: .08em; margin-top: 6px; }
.file .thumb .kind { display: flex; flex-direction: column; align-items: center; }
.file .info { padding: 8px 10px 10px; font-size: 12px; color: var(--muted-ink); }
.file .info .fname { font-weight: 700; color: var(--text); font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file > a.cover { position: absolute; inset: 0; z-index: 1; }
.file .file-menu { position: absolute; top: 6px; right: 6px; z-index: 2; }
.file .file-menu summary { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-xs); }
.dropzone {
  margin: 16px 22px 0; border: 2px dashed var(--border-strong); border-radius: 14px; padding: 18px; text-align: center; color: var(--muted-ink);
  font-size: 14px; transition: border-color .12s, background .12s;
}
.dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .row { justify-content: center; }
.uploads { list-style: none; margin: 10px 22px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.uploads li { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 10px; align-items: center; font-size: 13px; }
.uploads .bar { height: 6px; border-radius: 3px; background: var(--rail-pending); overflow: hidden; }
.uploads .bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.uploads li.failed { color: var(--danger); grid-template-columns: 1fr; }
.uploads li.done .bar i { background: var(--rail-done); }
@media (max-width: 720px) { .files { padding: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); } .dropzone { margin: 14px 16px 0; } }

/* Tabs (within a card) */
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a, .tabs button {
  padding: 13px 10px; font-weight: 700; font-size: 14px; color: var(--muted); border: 0; background: none; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs .active, .tabs [aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* --------------------------------------------------------------------------
   Workshop board
   -------------------------------------------------------------------------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity; }
.board-col { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); min-height: 200px; display: flex; flex-direction: column; scroll-snap-align: start; }
.board-col.is-empty { opacity: .78; }
.board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-weight: 800; font-size: 13.5px; border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.board-col-head .n { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.board-cards { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.bcard { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; box-shadow: var(--shadow-xs); transition: box-shadow .12s, border-color .12s; }
.bcard:hover { box-shadow: var(--shadow-sm); border-color: var(--primary-line); }
.bcard.is-blocked { border-color: var(--danger-line); box-shadow: inset 3px 0 0 var(--rail-blocked); }
.bcard .code { font-weight: 800; font-size: 12px; color: var(--primary-strong); }
.bcard .title { font-weight: 700; font-size: 14px; margin: 2px 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bcard .title a { color: inherit; }
.bcard .title a::after { content: ""; position: absolute; inset: 0; }
.bcard .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted-ink); margin-top: 8px; }
.board-empty { padding: 14px; font-size: 12.5px; color: var(--muted-2); text-align: center; }
@media (max-width: 720px) { .board { grid-auto-columns: 86vw; } }

/* --------------------------------------------------------------------------
   Settings
   -------------------------------------------------------------------------- */
.settings-nav { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.settings-nav a { padding: 10px 12px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 14px; }
.settings-nav a.active { color: var(--text); border-bottom-color: var(--primary); }
.settings-nav a:hover { text-decoration: none; color: var(--text); }
.stage-lib { list-style: none; margin: 0; padding: 0; }
.stage-lib li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 22px; border-bottom: 1px solid var(--border); }
.stage-lib li:last-child { border-bottom: 0; }
.stage-lib li.is-archived { opacity: .6; }
.stage-lib .pos { color: var(--muted-2); font-weight: 800; font-size: 12px; text-align: center; }
.stage-lib form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stage-lib form.inline input[name="name"] { max-width: 240px; }
.stage-lib form.inline input[name="default_hours"] { max-width: 110px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr) 130px auto; gap: 10px; align-items: center; }
.steps .n { font-weight: 800; color: var(--muted); text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .pill { height: 26px; }
.link-box { display: flex; gap: 8px; }
.link-box input { font-family: var(--mono); font-size: 13px; }
.stage-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.stage-picker .check { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); align-items: center; }
.stage-picker .check:has(input:checked) { border-color: var(--primary-line); background: var(--primary-soft); }
@media (max-width: 720px) { .steps li { grid-template-columns: 22px minmax(0, 1fr) 90px auto; gap: 6px; } .stage-lib li { padding: 10px 16px; } }

/* --------------------------------------------------------------------------
   Auth pages
   -------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); background: var(--surface); }
.auth-form { display: flex; flex-direction: column; padding: 32px clamp(20px, 5vw, 64px); }
.auth-form .inner { width: 100%; max-width: 420px; margin: auto; padding: 32px 0; }
.auth-form h1 { font-family: var(--display); font-size: 30px; letter-spacing: -.02em; margin-bottom: 8px; }
.auth-form .lede { color: var(--muted-ink); margin-bottom: 26px; }
.auth-form form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .foot { margin-top: 22px; font-size: 14px; color: var(--muted-ink); }
.auth-aside {
  position: relative; overflow: hidden; background: radial-gradient(120% 90% at 100% 0%, #2e1065 0%, #1e1b4b 38%, #0f172a 100%);
  color: #e2e8f0; display: flex; flex-direction: column; justify-content: center; padding: 56px;
}
.auth-aside h2 { font-family: var(--display); font-size: 30px; line-height: 1.15; color: #fff; max-width: 440px; margin-bottom: 14px; }
.auth-aside p { color: #cbd5e1; max-width: 420px; }
.auth-aside .art { margin-top: 36px; max-width: 460px; }
@media (max-width: 960px) { .auth { grid-template-columns: 1fr; } .auth-aside { display: none; } }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 70px; }
.password-wrap button { position: absolute; right: 6px; top: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--surface-3); color: var(--steel); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }

/* Errors page */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 40px 20px; }
.error-page .code { font-family: var(--display); font-size: 64px; color: var(--primary); line-height: 1; margin-bottom: 12px; }

/* Print: the job page prints as a readable document */
@media print {
  .sidebar, .mobile-bar, .tabbar, .page-actions, .stage-actions, .composer, .dropzone, .no-print { display: none !important; }
  .app-shell { display: block; }
  .page { padding: 0; max-width: none; }
  .card { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* --------------------------------------------------------------------------
   Illustrations (see templates/_art.html)
   -------------------------------------------------------------------------- */
.art-soft { fill: var(--surface-3); }
.art-soft2 { fill: var(--surface-2); }
.art-card { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.art-blocked-edge { stroke: var(--rail-blocked); stroke-width: 2; }
.art-accent { fill: var(--primary); }
.art-accent-stroke { stroke: var(--primary); }
.art-on-accent { stroke: #fff; fill: none; }
.art-line { fill: var(--border-strong); }
.art-line2 { fill: var(--border); }
.art-line2-stroke { stroke: var(--border-strong); }
.art-stroke { stroke: var(--steel); }
.art-done { fill: var(--rail-done); }
.art-active { fill: var(--rail-active); }
.art-blocked { fill: var(--rail-blocked); }
.art-idle { fill: var(--rail-pending); }
.art-pill-info { fill: var(--info-soft); stroke: var(--info-line); }
.art-text-strong { fill: var(--text); font: 800 21px var(--font); }
.art-text-muted { fill: var(--muted); font: 600 14px var(--font); }
.art-text-on { fill: #fff; font: 800 12px var(--font); }
.art-text-info { fill: var(--info); font: 700 13px var(--font); }
.art-text-strong.small { font-size: 14px; }
.art-text-muted.small, .art-text-on.small { font-size: 12px; }
.job-code-inline { color: var(--primary-strong); font-weight: 800; font-variant-numeric: tabular-nums; }

/* Notifications */
.notif { width: 100%; border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.notif:hover { background: var(--surface-2); }
.notif.is-unread { background: var(--primary-soft); }
.notif .title { white-space: normal; font-weight: 600; }
.notif.is-unread .title { font-weight: 800; }
.notif-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--primary-strong); }
.notif-ico.is-danger { color: var(--danger); background: var(--danger-soft); }
.assign-btn { background: none; border: 1px dashed transparent; border-radius: 8px; padding: 1px 6px 1px 2px; margin-left: -3px; font: inherit; color: inherit; cursor: pointer; }
.assign-btn:hover { border-color: var(--border-strong); background: var(--surface); }
.assign-btn .unassigned { color: var(--primary-strong); font-weight: 600; }
@media (max-width: 560px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 10px 10px; }
  .metric .label { font-size: 11px; gap: 4px; }
  .metric .value { font-size: 20px; }
}
.print-ready { align-items: center; }
.print-ready .btn { flex: none; }
@media (max-width: 720px) { .print-ready { flex-wrap: wrap; } .print-ready .btn { width: 100%; } }
/* The printed card in the hero illustration: paper stays paper-white in both themes. */
.paper { fill: #ffffff; stroke: #cbd5e1; stroke-width: 1; }
.paper-shadow { fill: rgba(15, 23, 42, .10); }
.paper-ink { fill: #0f172a; }
.paper-qr { fill: #ffffff; stroke: #0f172a; stroke-width: 1.5; }
.paper-grid { stroke: #334155; stroke-width: .8; fill: none; }
.paper-grid-strong { stroke: #0f172a; stroke-width: 2; }
.paper-line { fill: #cbd5e1; }
.paper-muted { fill: #64748b; font: 800 9px var(--font); letter-spacing: .1em; }
.paper-strong { fill: #0f172a; font: 800 20px var(--font); }
.pen { stroke: #1d4ed8; stroke-width: 1.4; stroke-linecap: round; }
.pen-tick { stroke: #0f172a; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.art-text-muted.tiny { font-size: 11px; }
h1.display, h2.display { text-wrap: balance; }
.art-text-strong.medium { font-size: 17px; }

/* --------------------------------------------------------------------------
   Plan and billing
   -------------------------------------------------------------------------- */
.plan-notice { margin-bottom: 16px; align-items: center; }
.plan-notice strong { display: inline; margin: 0; }
.plan-notice .btn { flex: none; }
@media (max-width: 720px) { .plan-notice { flex-wrap: wrap; } .plan-notice .btn { width: 100%; } }
.narrow-card { max-width: 640px; }
.plan-now { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.plan-name { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.plan-sentence { margin: 0; color: var(--muted-ink); line-height: 1.55; }
.plan-sentence strong { color: var(--text); }
.meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.meter { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.meter-head .num { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted-ink); }
.meter-head .num strong { font-size: 18px; color: var(--text); }
.meter .bar { height: 6px; border-radius: 999px; background: var(--rail-pending); overflow: hidden; }
.meter .bar i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.meter.is-full .bar i { background: var(--warning); }
@media (max-width: 720px) { .meters { grid-template-columns: 1fr; } }
.section-head { margin: 4px 0 12px; gap: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 18px; }
.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1280px) { .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .plan-grid { grid-template-columns: 1fr; } }
.plan-card {
  display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.plan-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-card h3 { margin: 0; font-size: 16px; }
.plan-card.is-featured { border-color: var(--primary-line); box-shadow: 0 0 0 1px var(--primary-line), var(--shadow-sm); }
.plan-card.is-current { background: var(--surface-2); }
.plan-card.is-quiet { background: var(--surface-2); box-shadow: none; }
.plan-card .price { display: flex; align-items: baseline; gap: 4px; margin-top: 4px; }
.plan-card .price .amount { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plan-card .price .per { color: var(--muted); font-weight: 700; font-size: 13px; }
.plan-card p { margin: 4px 0; color: var(--muted-ink); }
.plan-card form, .plan-card > .btn { margin-top: auto; }
.checks-sm { list-style: none; padding: 0; margin: 4px 0 10px; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.checks-sm li { display: flex; gap: 8px; align-items: flex-start; }
.checks-sm li svg { flex: none; margin-top: 2px; color: var(--success); }
.plan-footnote { margin: 12px 2px 0; line-height: 1.6; }
.table-wrap.flush { border: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.spinner.is-visible { display: inline-block; color: var(--primary); }
