/* Sign Shop Proof Approval Packet — application styles
   Quiet neutral chrome, fine dividers, compact rows, proof-first layout. */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-2: #f4f4f5;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --text: #18181b;
  --muted: #52525b;
  --focus: #1d4ed8;
  --ok-bg: #f0fdf4; --ok-fg: #166534; --ok-line: #bbf7d0;
  --warn-bg: #fffbeb; --warn-fg: #92400e; --warn-line: #fde68a;
  --bad-bg: #fef2f2; --bad-fg: #b91c1c; --bad-line: #fecaca;
  --info-bg: #eff6ff; --info-fg: #1e40af; --info-line: #bfdbfe;
  --radius: 6px;
  --radius-lg: 8px;
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.04);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }

a { color: var(--info-fg); }

button, select, input[type="file"], summary, a, label[for], [role="tab"] { cursor: pointer; }
button:disabled { cursor: not-allowed; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.num, .mono, td.num, th.num, dd.num { font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px; top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
}
.skip-link:focus { top: 8px; }

/* ---------- Buttons & fields ---------- */
.btn, .btn-primary, .link-btn, .icon-btn, .feature-chip {
  font-family: inherit;
  font-size: 14px;
  min-height: 44px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--surface-2); border-color: #a1a1aa; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn.btn-primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn-primary:hover, .btn.btn-primary:hover { background: #3f3f46; border-color: #3f3f46; }

.btn:active, .btn-quiet:active { background: #e4e4e7; border-color: #a1a1aa; }
.btn-primary:active, .btn.btn-primary:active { background: #27272a; border-color: #27272a; }
.btn:active, .btn-primary:active, .link-btn:active, .icon-btn:active, .feature-chip:active, .view-tab:active { transform: translateY(1px); }

.btn-quiet { border-color: transparent; background: transparent; padding: 0 10px; }
.btn-quiet:hover { background: var(--surface-2); border-color: var(--line); }

.btn[aria-busy="true"] { opacity: .75; }
.btn[aria-busy="true"]::before {
  content: "";
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--info-fg);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
  white-space: nowrap;
}
.field-label-row label { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.req, .opt { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.req.is-error { color: var(--bad-fg); font-weight: 600; }

.field-input, .field-select, .field-file {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.35;
}
.field-file { padding: 8px; font-size: 16px; }
textarea.field-input { resize: vertical; min-height: 64px; }
.field-input:hover, .field-select:hover { border-color: #a1a1aa; }
.field-input:focus, .field-select:focus { border-color: var(--text); outline: 2px solid var(--focus); outline-offset: 1px; }
.field-input[aria-invalid="true"], .field-select[aria-invalid="true"] { border-color: var(--bad-fg); background: var(--bad-bg); }
.field-select { padding-right: 28px; }
.field-select.compact { width: auto; max-width: 260px; }
.mono { font-family: var(--font-mono); font-size: 16px; }

/* ---------- Top bar ---------- */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.topbar-left { display: flex; align-items: center; gap: 20px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark-mark { width: 22px; height: 22px; flex-shrink: 0; }

.app-topbar #saas-shell-bar:not(.saas-sidebar-nav) {
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 0;
  min-width: 0;
  font-size: 14px;
  z-index: auto;
}
.view-tabs { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.view-tabs::-webkit-scrollbar { display: none; }
.view-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
}
.view-tab:hover { background: var(--surface-2); color: var(--text); }
.view-tab.is-active, .view-tab[aria-selected="true"] { color: var(--text); font-weight: 600; }
.view-tab.is-active::after, .view-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}
.tab-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
  text-align: center;
}
.btn-plan { font-weight: 600; }
html[data-pro="true"] .btn-plan::after { content: " · Active"; color: var(--ok-fg); }

.customer-banner { display: none; }

/* ---------- Page ---------- */
#utility {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 16px;
}
.page-title { min-width: 0; flex: 1 1 260px; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
#packet-heading {
  margin-top: 2px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.toolbar-actions-menu { position: relative; }
.toolbar-actions-toggle { list-style: none; cursor: pointer; user-select: none; }
.toolbar-actions-toggle::-webkit-details-marker { display: none; }
.toolbar-actions-toggle svg { width: 16px; height: 16px; transition: transform .12s ease; }
.toolbar-actions-menu[open] > .toolbar-actions-toggle { background: var(--surface-2); border-color: #a1a1aa; }
.toolbar-actions-menu[open] > .toolbar-actions-toggle svg { transform: rotate(180deg); }
.toolbar-actions-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: grid;
  gap: 2px;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 8px 24px rgba(24, 24, 27, 0.10);
}
.btn.btn-menu-item { justify-content: flex-start; width: 100%; border-color: transparent; background: transparent; }
.btn.btn-menu-item:hover { background: var(--surface-2); border-color: transparent; }
.page-sub {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.sync-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--muted); font-size: 13px; min-width: 0; }
#sync-state { color: var(--text); font-weight: 500; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #a1a1aa; flex-shrink: 0; }
.sync-dot[data-state="ok"] { background: #16a34a; }
.sync-dot[data-state="error"] { background: #d97706; }
.sync-dot[data-state="loading"] { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.action-status {
  flex: 1 1 100%;
  min-height: 20px;
  height: 20px;
  max-width: 100%;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.action-status[data-tone="error"] { color: var(--bad-fg); }
.action-status[data-tone="ok"] { color: var(--ok-fg); }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 24px;
  align-items: start;
}
.work-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 12px;
  min-height: 44px;
}
.panel-title { font-size: 15px; font-weight: 650; }
.panel-hint { color: var(--muted); font-size: 13px; }
.panel-tools { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; }
.proof-panel .panel-head { flex-wrap: nowrap; }
.proof-panel .panel-tools .btn { flex-shrink: 0; }
.file-name { color: var(--muted); font-size: 13px; max-width: 220px; min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 14px; font-weight: 650; margin: 0 0 8px; }

/* Job details */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
}
.field-wide { grid-column: span 2; }
.meta-grid .field-input, .meta-grid .field-select { width: 100%; min-width: 0; }

/* KPI strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi-value { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Proof stage */
.proof-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: #f4f4f5;
  background-image: linear-gradient(45deg, #ececee 25%, transparent 25%), linear-gradient(-45deg, #ececee 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ececee 75%), linear-gradient(-45deg, transparent 75%, #ececee 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  overflow: hidden;
}
.proof-stage.is-dragover { outline: 2px dashed var(--focus); outline-offset: -6px; }
.proof-image { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.proof-empty { text-align: center; padding: 24px; }
.proof-empty-title { font-size: 15px; font-weight: 600; }
.proof-empty-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.proof-stage[data-state="ready"] .proof-empty { display: none; }
.proof-error { min-height: 20px; margin-top: 6px; color: var(--bad-fg); font-size: 13px; }
.visually-hidden-file { font-size: 16px; position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Production items table */
.table-region {
  position: relative;
  height: 352px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overscroll-behavior-x: contain;
}
.schedule-table {
  width: 100%;
  min-width: 984px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 14px;
}
.c-item { width: 21%; }
.c-qty { width: 64px; }
.c-size { width: 96px; }
.c-mat { width: 15%; }
.c-fin { width: 14%; }
.c-rate { width: 100px; }
.c-amt { width: 104px; }
.c-status { width: 128px; }
.c-del { width: 48px; }
.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 40px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-table th.num, .schedule-table td.num { text-align: right; }
.schedule-table td {
  padding: 4px 2px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.schedule-table tbody tr:hover td { background: #fcfcfd; }
.cell-input, .cell-select, .cell-textarea {
  width: 100%;
  min-height: 44px;
  padding: 6px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.3;
}
.cell-textarea { display: block; height: 52px; resize: none; overflow: hidden; }
.cell-input.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-select { padding-right: 18px; text-overflow: ellipsis; }
.cell-input:hover, .cell-select:hover, .cell-textarea:hover { border-color: var(--line-strong); background: #fff; }
.cell-input:focus, .cell-select:focus, .cell-textarea:focus { border-color: var(--text); background: #fff; outline: 2px solid var(--focus); outline-offset: 0; }
.cell-input[aria-invalid="true"] { border-color: var(--bad-fg); background: var(--bad-bg); }
.cell-amount { padding: 0 8px; font-weight: 600; white-space: nowrap; }
.cell-amount.is-credit { color: var(--ok-fg); }
.table-empty {
  position: absolute;
  left: 0; right: 0; top: 40px;
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
}
.totals-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 28px;
  margin: 12px 0 0;
  padding: 0 4px;
}
.totals-bar div { display: flex; align-items: baseline; gap: 10px; }
.totals-bar dt { color: var(--muted); font-size: 13px; }
.totals-bar dd { margin: 0; font-size: 15px; font-weight: 600; min-width: 84px; text-align: right; }
.totals-bar .total dd { font-size: 17px; font-weight: 700; }

/* CSV drawer */
.csv-import-drawer {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
}
.csv-import-drawer > summary {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 650;
  list-style: none;
}
.csv-import-drawer > summary::-webkit-details-marker { display: none; }
.csv-import-drawer > summary::before {
  content: "";
  width: 8px; height: 8px;
  margin-right: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .15s ease;
}
.csv-import-drawer[open] > summary::before { transform: rotate(45deg); }
.csv-body { display: flex; flex-direction: column; gap: 16px; padding: 0 16px 16px; }
.csv-sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.csv-source {
  display: flex; flex-direction: column; gap: 10px;
  margin: 0; padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.csv-source legend { padding: 0 6px; font-weight: 650; }
.csv-paste { font-family: var(--font-mono); font-size: 16px; }
.csv-status { min-height: 40px; color: var(--muted); font-size: 13px; }
.csv-status[data-tone="error"] { color: var(--bad-fg); }
.csv-status[data-tone="ok"] { color: var(--ok-fg); }
.csv-map-scroll, .csv-preview-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.csv-preview-scroll { height: 236px; overflow-y: auto; }
.csv-map-table, .csv-preview-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.csv-map-table { min-width: 520px; }
.csv-preview-table { min-width: 640px; }
.csv-map-table th, .csv-map-table td, .csv-preview-table th, .csv-preview-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.csv-map-table thead th, .csv-preview-table thead th {
  position: sticky; top: 0;
  height: 36px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.csv-preview-table td { height: 36px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.csv-preview-table .num { text-align: right; }
.csv-map-table td:first-child { font-weight: 500; }
.csv-map-table .field-select { min-width: 180px; }
.csv-summary { color: var(--muted); font-size: 13px; font-weight: 400; }
.match-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.match-tag[data-match="matched"] { background: var(--ok-bg); color: var(--ok-fg); }
.match-tag[data-match="only-a"] { background: var(--info-bg); color: var(--info-fg); }
.match-tag[data-match="only-b"] { background: var(--warn-bg); color: var(--warn-fg); }
.csv-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.csv-profile-field { flex: 1 1 240px; max-width: 360px; }
.csv-action-gap { flex: 1 1 auto; }
.csv-feedback { min-height: 20px; font-size: 13px; color: var(--muted); }
.csv-feedback[data-tone="error"] { color: var(--bad-fg); }
.csv-feedback[data-tone="ok"] { color: var(--ok-fg); }

/* Notes */
.notes-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.notes-panel textarea { height: 112px; resize: none; }

/* History */
.history-list {
  height: 176px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border-top: 1px solid var(--line);
}
.history-item {
  display: grid;
  grid-template-columns: 44px 150px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.history-rev { font-weight: 650; font-variant-numeric: tabular-nums; }
.history-note { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-date { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-empty { padding: 16px 4px; color: var(--muted); font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge[data-kind="approved"] { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.badge[data-kind="changes"] { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.badge[data-kind="sent"] { background: var(--info-bg); border-color: var(--info-line); color: var(--info-fg); }

/* ---------- Right-hand packet ---------- */
.packet-col {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}
.card-title { font-size: 13px; font-weight: 650; margin-bottom: 8px; }
.packet-brand { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.deliverable-logo { max-height: 32px; max-width: 120px; object-fit: contain; }
.packet-kicker { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.packet-generated { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.verdict {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  height: 3.1em;
  margin: 8px 0 10px;
  padding: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: -0.01em;
}
.status-card { border-left-width: 4px; }
.status-card[data-verdict-state="loading"] { border-left-color: #a1a1aa; }
.status-card[data-verdict-state="incomplete"] { border-left-color: var(--bad-fg); }
.status-card[data-verdict-state="incomplete"] .verdict { color: var(--bad-fg); }
.status-card[data-verdict-state="ready"] { border-left-color: var(--info-fg); }
.status-card[data-verdict-state="ready"] .verdict { color: var(--info-fg); }
.status-card[data-verdict-state="approved"] { border-left-color: var(--ok-fg); background: var(--ok-bg); }
.status-card[data-verdict-state="approved"] .verdict { color: var(--ok-fg); }
.status-card[data-verdict-state="changes"] { border-left-color: #b45309; background: var(--warn-bg); }
.status-card[data-verdict-state="changes"] .verdict { color: var(--warn-fg); }

.kv { margin: 0; display: flex; flex-direction: column; }
.kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  padding: 4px 0;
  border-top: 1px solid var(--line);
}
.kv > div:first-child { border-top: 0; }
.kv dt { color: var(--muted); font-size: 13px; white-space: nowrap; }
.kv dd { margin: 0; font-size: 13px; font-weight: 600; text-align: right; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv .kv-total dt { color: var(--text); font-weight: 600; }
.kv .kv-total dd { font-size: 16px; font-weight: 700; }

.proof-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}
.proof-thumb-img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.proof-thumb-empty { color: var(--muted); font-size: 13px; }
.proof-thumb-title { margin-top: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; min-height: 44px; }
.inline-msg { color: var(--ok-fg); font-size: 12px; font-weight: 500; }

.caveat-list {
  height: 112px;
  margin: 0;
  padding: 0 0 0 18px;
  overflow-y: auto;
  font-size: 13px;
}
.caveat-list li { margin-bottom: 6px; }
.caveat-list .empty { list-style: none; margin-left: -18px; color: var(--muted); }
.customer-note {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  height: calc(3em + 9px);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  font-style: italic;
}

.decision-card form { display: flex; flex-direction: column; gap: 10px; }
.decision-card textarea { height: 64px; resize: none; }
.decision-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-approve { background: var(--ok-fg); border-color: var(--ok-fg); color: #fff; font-weight: 600; }
.btn-approve:hover { background: #14532d; border-color: #14532d; }
.btn-changes { border-color: #b45309; color: var(--warn-fg); font-weight: 600; }
.btn-changes:hover { background: var(--warn-bg); border-color: #92400e; }
.decision-feedback { min-height: 40px; font-size: 13px; color: var(--muted); }
.decision-feedback[data-tone="error"] { color: var(--bad-fg); }
.decision-feedback[data-tone="ok"] { color: var(--ok-fg); }
.response-import-copy { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.response-import-card .decision-feedback { min-height: 38px; margin-bottom: 0; }

.decision-list {
  height: 150px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.decision-item { padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.decision-item:first-child { border-top: 0; padding-top: 0; }
.decision-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.decision-meta { margin-top: 2px; color: var(--muted); font-variant-numeric: tabular-nums; }
.decision-note { margin-top: 2px; color: var(--text); overflow-wrap: anywhere; }
.decision-empty { color: var(--muted); font-size: 13px; }

.print-watermark, .print-footnote { display: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 6px 6px 6px 16px;
  border-radius: var(--radius-lg);
  background: var(--text);
  color: #fff;
  box-shadow: 0 8px 24px rgba(24, 24, 27, .2);
  transform: translateX(-50%);
  font-size: 14px;
}
.toast[hidden] { display: none; }
.toast .btn-quiet { color: #fff; font-weight: 600; text-decoration: underline; }
.toast .btn-quiet:hover { background: #3f3f46; }
.toast .icon-btn { color: #e4e4e7; }
.toast .icon-btn:hover { background: #3f3f46; color: #fff; }

/* ---------- Dialogs ---------- */
dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 24px 48px rgba(24, 24, 27, .18);
}
dialog::backdrop { background: rgba(24, 24, 27, .45); }
.pro-dialog { width: min(760px, calc(100vw - 24px)); }
.dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.dialog-lead { color: var(--muted); font-size: 14px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.dialog-actions.spread { justify-content: space-between; align-items: center; }
.paywall-reason {
  padding: 10px 12px;
  border: 1px solid var(--info-line);
  border-radius: var(--radius);
  background: var(--info-bg);
  color: var(--info-fg);
  font-size: 14px;
  font-weight: 500;
}
.pro-features { display: flex; flex-wrap: wrap; gap: 6px; }
.feature-chip {
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 13px;
}
.feature-chip:hover, .feature-chip[aria-pressed="true"] { background: var(--surface-2); border-color: var(--text); }
.compare-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.free-vs-pro-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13px; }
.free-vs-pro-table th, .free-vs-pro-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.free-vs-pro-table thead th { background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; }
.free-vs-pro-table tbody th { font-weight: 500; }
.free-vs-pro-table tr:last-child th, .free-vs-pro-table tr:last-child td { border-bottom: 0; }
.branding-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.logo-preview-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 44px; }
.logo-preview { max-height: 40px; max-width: 140px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 2px; }
.logo-preview-row .inline-msg { color: var(--muted); flex: 1 1 220px; }
.restore-status { min-height: 20px; font-size: 13px; }
.restore-status[data-tone="error"] { color: var(--bad-fg); }
.restore-status[data-tone="ok"] { color: var(--ok-fg); }

/* ---------- Footer ---------- */
.site-footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 32px;
  border-top: 1px solid var(--line);
}
.trust-footer { color: var(--muted); font-size: 13px; }

/* ---------- Shared management hub: quiet the shared chrome ---------- */
#saas-management-hub .saas-panel-card { border-color: var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
#saas-management-hub .saas-panel-header { background: #fff; border-bottom-color: var(--line); }
#saas-management-hub .saas-panel-title { font-size: 18px; letter-spacing: -0.01em; }
#saas-management-hub .saas-status-tab,
#saas-management-hub .saas-page-btn,
#saas-management-hub .saas-table-action-btn,
#saas-management-hub .saas-clear-filter-btn {
  background: #fff !important;
  border-color: var(--line-strong) !important;
  color: var(--text) !important;
  font-weight: 500;
  font-size: 14px;
}
#saas-management-hub .saas-status-tab[aria-pressed="true"] { background: var(--text) !important; border-color: var(--text) !important; color: #fff !important; }
#saas-management-hub .saas-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--text); border-radius: var(--radius);
  background: var(--text); color: #fff;
  font: 600 14px var(--font-sans);
}
#saas-management-hub .saas-search-input { border-color: var(--line-strong) !important; font-size: 16px !important; }
#saas-management-hub .saas-table th { background: var(--surface) !important; color: var(--muted) !important; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; }
#saas-management-hub .saas-table th, #saas-management-hub .saas-table td { border-bottom-color: var(--line); }
#saas-management-hub .saas-table td { font-variant-numeric: tabular-nums; }
#saas-management-hub .saas-status-badge { text-transform: none; font-weight: 600; border-color: var(--line-strong); }
#saas-management-hub .saas-pagination-bar { border-top-color: var(--line); font-weight: 500; }
#saas-management-hub .hub-plan { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
#saas-management-hub .hub-plan-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
#saas-management-hub .hub-plan-card h3 { font-size: 15px; }
#saas-management-hub .hub-plan-card p, #saas-management-hub .hub-plan-card li { color: var(--muted); font-size: 14px; }
#saas-management-hub .hub-plan-card ul { margin: 0; padding-left: 18px; }
#saas-management-hub .hub-plan-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.saas-modal-card input { font-size: 16px !important; }

/* ---------- Customer preview mode ---------- */
html.customer-mode .app-topbar #saas-shell-bar,
html.customer-mode .topbar-right,
html.customer-mode .page-head,
html.customer-mode .meta-panel,
html.customer-mode .kpi-strip,
html.customer-mode .editor-only { display: none !important; }
html.customer-mode .customer-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  max-width: 1440px;
  margin: 12px auto 0;
  padding: 6px 12px 6px 16px;
  border: 1px solid var(--info-line);
  border-radius: var(--radius-lg);
  background: var(--info-bg);
  color: var(--info-fg);
  font-size: 14px;
}
html.customer-mode .customer-banner { width: calc(100% - 48px); }

/* Free reassurance */
.free-reassurance {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--ok-line);
  border-radius: var(--radius-lg);
  background: var(--ok-bg);
  color: var(--ok-fg);
  font-size: 13px;
}
.free-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--ok-fg); }

/* Deliverable line items */
.line-items-card .line-items-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.line-items-table th { color: var(--muted); font-weight: 600; text-align: left; padding: 4px 0; border-bottom: 1px solid var(--line); }
.line-items-table td { padding: 5px 0; border-top: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-items-table tr:first-child td { border-top: 0; }
.line-items-table th:nth-child(2), .line-items-table td:nth-child(2) { width: 44px; }
.line-items-table th:nth-child(3), .line-items-table td:nth-child(3) { width: 92px; }
.line-items-table .num { text-align: right; }
.line-items-empty { color: var(--muted); font-size: 13px; padding-top: 6px; }

/* Pro pricing card */
.pricing-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pricing-head .card-title { margin-bottom: 4px; }
.pricing-price { font-size: 13px; color: var(--muted); }
.pricing-price .num { font-size: 17px; font-weight: 700; color: var(--text); }
.pricing-copy { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.pricing-cta { width: 100%; }
.pricing-disclosure { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 312px; gap: 20px; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-wide { grid-column: 1 / -1; }
}

@media (max-width: 959px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .packet-col { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .packet-col .status-card, .packet-col .decision-card { grid-column: 1 / -1; }
  .app-topbar { flex-wrap: wrap; padding: 4px 16px 0; }
  .topbar-left { flex-wrap: wrap; gap: 0 12px; width: 100%; justify-content: space-between; }
  .topbar-right { position: absolute; right: 16px; top: 8px; }
  .app-topbar { position: relative; }
  .app-topbar #saas-shell-bar:not(.saas-sidebar-nav) { width: 100%; }
  #utility { padding: 16px 16px 32px; }
  .page-actions { justify-content: flex-start; }
  .history-item { grid-template-columns: 40px 140px minmax(0, 1fr); }
  .history-item .history-date { grid-column: 2 / -1; }
}

@media (max-width: 640px) {
  .app-topbar #saas-shell-bar:not(.saas-sidebar-nav) { padding: 0; }
  .wordmark span { font-size: 14px; white-space: normal; line-height: 1.2; max-width: 190px; }
  .meta-grid { grid-template-columns: minmax(0, 1fr); }
  .field-wide { grid-column: auto; }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 17px; }
  .page-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .page-actions .field-select.compact { grid-column: 1 / -1; max-width: none; width: 100%; }
  .page-actions .btn { white-space: normal; line-height: 1.2; text-align: center; padding: 8px 10px; }
  .page-actions #dock-save-run { grid-column: 1 / -1; }
  .page-actions .toolbar-actions-toggle { width: 100%; }
  .page-actions .btn.btn-menu-item { text-align: left; justify-content: flex-start; }
  .packet-col { grid-template-columns: minmax(0, 1fr); }
  .csv-sources, .notes-panel { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 12px; }
  .table-region { height: 352px; }
  .history-item { grid-template-columns: 36px minmax(0, 1fr); }
  .history-item .badge { justify-self: start; }
  .history-item .history-note, .history-item .history-date { grid-column: 2 / -1; }
  .history-list { height: 224px; }
  .dialog-actions.spread { flex-direction: column-reverse; align-items: stretch; }
  .dialog-actions .btn-primary { width: 100%; }
  .site-footer { padding: 16px; }
  html.customer-mode .customer-banner { width: calc(100% - 32px); }
}

/* ---------- Print: short customer packet only ---------- */
@media print {
  @page { margin: 12mm; }
  body { font-size: 11pt; background: #fff; }
  .no-print, .app-topbar, .site-footer, .toast, dialog, .editor-only, .skip-link,
  #saas-management-hub, .customer-banner, .decision-card, .share-row { display: none !important; }
  #utility { max-width: none; padding: 0; }
  #utility.saas-workbench-hidden { display: block !important; }
  .workspace-grid { display: block; }
  .work-col, .proof-stage { display: none !important; }
  .panel, .card { box-shadow: none; break-inside: avoid; }
  .proof-panel { margin-bottom: 10px; border: 0; padding: 0; }
  .proof-panel .panel-head { display: none; }
  .proof-error { display: none; }
  .packet-col { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .packet-col .status-card { grid-column: 1 / -1; }
  .proof-card { grid-column: 1 / -1; }
  .proof-card:has(#proof-thumb[hidden]) { display: none; }
  .line-items-card { grid-column: 1 / -1; }
  .line-items-table td { white-space: normal; }
  .caveat-list, .decision-list { height: auto; overflow: visible; }
  .verdict { height: auto; }
  html[data-pro="locked"] .print-watermark {
    display: block;
    position: fixed;
    top: 45%;
    left: 0; right: 0;
    text-align: center;
    transform: rotate(-24deg);
    color: rgba(82, 82, 91, .16);
    font-size: 64pt;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    pointer-events: none;
    z-index: 5;
  }
  html[data-pro="locked"] .print-footnote { display: block; grid-column: 1 / -1; color: #52525b; font-size: 9pt; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* File pickers are activated through their named, full-size buttons. */
.visually-hidden-file{display:none}
@media(max-width:899px){#preset-select,#meta-revStatus{min-height:44px;height:44px}}

@media(max-width:899px){.toast{width:calc(100vw - 32px);min-width:0;box-sizing:border-box}.toast>span{min-width:0;flex:1;overflow-wrap:anywhere}.toast .icon-btn,.toast .btn{min-height:44px;min-width:44px;flex-shrink:0}}

/* Status copy cannot contribute an intrinsic minimum wider than the task column. */
.page-sub,.sync-note,.sync-honesty,.action-status{min-width:0;max-width:100%;overflow-wrap:anywhere}
