/* Form 4562 MACRS Workpaper: Sovereign Tax & Inline CPA Spreadsheet.
 * Square workpaper geometry, exposed hairlines, greenbar rows, double rules. */

:root {
  --canvas: #E6F4EA;
  --paper: #FFFFFF;
  --chrome: #064E3B;
  --chrome-ink: #ECFDF5;
  --ink: #111827;
  --muted: #334155;
  --primary: #047857;
  --primary-ink: #FFFFFF;
  --accent: #B45309;
  --grid-accent: #6EE7B7;
  --hairline: #94A3B8;
  --greenbar: #F0FDF4;
  --focus-fill: #ECFDF5;
  --display: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --row-h: 52px;
  /* Input tracks hold >= 196px so every cell control stays >= 186px wide
     (no clipped dates, class names or amounts); the sheet scrolls sideways. */
  --sheet-cols: 40px minmax(130px, 1.8fr) 110px minmax(95px, 1fr) minmax(105px, 1fr) 74px;
  --sheet-min: 100%;
}

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

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.5 var(--body);
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; margin: 0; color: var(--ink); }

.wrap { width: 100%; max-width: 1420px; margin: 0 auto; padding: 0 12px; }

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

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  background: var(--paper); color: var(--ink); padding: 10px 14px; border: 2px solid var(--primary);
}
.skip-link:focus { top: 8px; }

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

.mono, .num-input, .kpi-value, .kpi-bottom, .amt, .c-out, .num, .ref-code, .wp-ref {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.wp-ref {
  display: inline-block;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 1px 5px;
  white-space: nowrap;
  vertical-align: middle;
}

/* ---------------------------------------------------------------- header */

.app-header {
  background-color: #F0FDF4;
  color: #064E3B;
  height: 56px;
  border-bottom: 2px solid #047857;
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand {
  color: #064E3B;
  font-size: 18px; font-weight: 700;
  white-space: nowrap; line-height: 1.2;
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.wp-code {
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 8px;
  background: #DCFCE7; color: #064E3B;
  border: 1px solid #047857;
  font: 600 12px/1 var(--mono); letter-spacing: 0.04em;
}
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-tools { display: flex; align-items: center; border-left: 1px solid #94A3B8; padding-left: 12px; gap: 4px; }
.plan-status { color: #064E3B; font-size: 13px; white-space: nowrap; }
body.is-pro .plan-status { font-weight: 600; }

/* --------------------------------------------------------------- buttons */

button, .btn-primary, .btn-secondary, .btn-upgrade, .btn-header, .chip {
  font: inherit;
  cursor: pointer;
  border-radius: 0;
}

.btn-header {
  background: #047857; color: #FFFFFF;
  border: 1px solid #047857;
  font-weight: 700; font-size: 14px;
  padding: 10px 16px; min-height: 44px; min-width: 44px;
  white-space: nowrap; line-height: 1.2;
}
.btn-header:hover { background: #065F46; border-color: #065F46; }
.btn-header:active { background: #064E3B; transform: translateY(1px); }
.btn-header-cta { display: inline-flex; align-items: center; text-decoration: none; }
.btn-header-ghost { background: transparent; color: #064E3B; border-color: #047857; }
.btn-header-ghost:hover { background: #DCFCE7; border-color: #047857; }
.btn-header-ghost:active { background: #BBF7D0; }
.btn-tool {
  background: transparent; color: #064E3B;
  border: 1px solid transparent;
  font: 600 13px/1.2 var(--body);
  padding: 10px 12px; min-height: 44px; min-width: 44px;
  white-space: nowrap; cursor: pointer;
}
.btn-tool:hover { background: #DCFCE7; border-color: #94A3B8; }
.btn-tool:active { background: #BBF7D0; transform: translateY(1px); }
body.is-pro .btn-header-cta { display: none; }
@media (max-width: 1080px) {
  .header-tools { display: none; }
}
@media (max-width: 420px) {
  .header-actions { gap: 8px; }
  .btn-header { padding: 10px 12px; font-size: 13px; }
  body:not(.is-pro) .btn-header-ghost { display: none; }
}
@media (max-width: 360px) {
  .header-inner { gap: 8px; }
  .app-header .brand { font-size: 13px; }
  .btn-header { padding: 8px 10px; font-size: 12px; }
}

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--primary-ink);
  border: 1px solid var(--primary);
  font-weight: 700; text-decoration: none;
  padding: 12px 20px; min-height: 48px; min-width: 44px;
  line-height: 1.25;
}
.btn-primary:hover { background: #065F46; }
.btn-primary:active { background: #064E3B; transform: translateY(1px); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper); color: var(--chrome);
  border: 1px solid var(--primary);
  font-weight: 600; font-size: 14px;
  padding: 10px 14px; min-height: 44px; min-width: 44px;
  line-height: 1.25;
}
.btn-secondary:hover { background: var(--focus-fill); }
.btn-secondary:active { background: #D1FAE5; transform: translateY(1px); }
.btn-secondary:disabled { cursor: not-allowed; color: var(--muted); border-color: var(--hairline); background: var(--paper); transform: none; }

.btn-upgrade {
  background: var(--primary); color: var(--primary-ink);
  border: 1px solid var(--primary);
  font-weight: 700; font-size: 14px;
  padding: 10px 16px; min-height: 44px; min-width: 44px;
  line-height: 1.25; text-align: left;
}
.btn-upgrade:hover { background: #065F46; }
.btn-upgrade:active { background: #064E3B; transform: translateY(1px); }

.btn-link {
  background: none; border: 0; color: var(--chrome); text-decoration: underline;
  padding: 10px 0; min-height: 44px; font-size: 14px;
}
.btn-link:active { color: var(--ink); }

.chip {
  background: var(--paper); color: var(--chrome);
  border: 1px solid var(--primary);
  font-size: 13px; font-weight: 600;
  padding: 8px 12px; min-height: 44px; min-width: 44px;
  white-space: nowrap; line-height: 1.2;
}
.chip:hover { background: var(--focus-fill); }
.chip:active { background: #D1FAE5; transform: translateY(1px); }
.chip[aria-pressed="true"] {
  background: var(--chrome); color: #ECFDF5; border-color: var(--chrome);
  box-shadow: inset 0 -3px 0 var(--grid-accent);
}

/* ---------------------------------------------------------------- ribbon */

.ribbon { background: var(--paper); border-bottom: 1px solid var(--hairline); }
.ribbon-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(180px, auto);
  grid-template-areas:
    "year presets convention bottom"
    "caps caps caps bottom";
  align-items: stretch;
}
.ribbon-cell { padding: 8px 14px; border-right: 1px solid var(--hairline); min-width: 0; }
.ribbon-year { grid-area: year; display: flex; flex-direction: column; gap: 2px; position: relative; padding-left: 0; }
.ribbon-presets { grid-area: presets; }
.ribbon-convention { grid-area: convention; display: flex; flex-direction: column; gap: 2px; position: relative; }
.ribbon-caps {
  grid-area: caps; margin: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--hairline); padding-left: 0;
}
.ribbon-caps > div { padding-right: 12px; }
.ribbon-caps dd { margin: 0; }
.ribbon-bottom {
  grid-area: bottom; border-right: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-end;
  background: var(--greenbar);
  border-left: 1px solid var(--hairline);
}
.ribbon-ref { position: absolute; right: 14px; top: 8px; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.kpi-value { font-size: 14px; font-weight: 600; color: var(--ink); }
.kpi-sub { font-size: 12px; color: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-bottom {
  font-size: 22px; font-weight: 600; color: var(--ink);
  border-bottom: 3px double #111827; padding-bottom: 1px; line-height: 1.3;
  white-space: nowrap;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

.ribbon-select, .signoff-fields input, .key-form input, .sheet select, .sheet input {
  font: inherit; color: var(--ink);
  border: 0;
  border-bottom: 1.5px solid #047857;
  border-radius: 0;
  background: transparent;
  min-height: 44px;
  padding: 6px 4px;
  width: 100%;
}
.ribbon-select { font-weight: 600; min-width: 188px; cursor: pointer; }
select { cursor: pointer; }
.ribbon-select:focus, .signoff-fields input:focus, .key-form input:focus, .sheet select:focus, .sheet input:focus {
  background: #ECFDF5;
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
input::placeholder { color: #475569; opacity: 1; }
input:disabled { color: var(--muted); border-bottom-color: var(--hairline); cursor: not-allowed; }
[aria-invalid="true"] { border-bottom-color: var(--accent) !important; background: #FFFBEB !important; }

/* ------------------------------------------------------------- workpaper */

.workpaper { margin-top: 12px; }
.paper { background: var(--paper); border: 1px solid var(--hairline); }
.wp-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--hairline);
}
.wp-head h2 { font-size: 18px; }
.wp-hint { margin: 0; color: var(--muted); font-size: 13px; }
.req-key { font-weight: 600; }

.engagement-row {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  background: #f8fafc;
}
.field { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.opt { font-weight: 400; font-style: italic; }
.opt:empty::after { content: "optional"; }

.engagement-row input,
.engagement-row select {
  height: 40px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.engagement-row input:focus,
.engagement-row select:focus {
  border-color: #047857;
  outline: 2px solid rgba(4, 120, 87, 0.25);
  outline-offset: 0;
  background: #ffffff;
}

/* ----------------------------------------------------------------- sheet */

.results { position: relative; }
.sheet-scroll { overflow-x: hidden; }
.sheet { width: 100%; min-width: 100%; font-size: 13px; }
.sheet-row { display: grid; grid-template-columns: var(--sheet-cols); }
.asset-primary-row { display: grid; grid-template-columns: var(--sheet-cols); width: 100%; }
.cell {
  position: relative;
  border-right: 1px solid #94A3B8;
  border-bottom: 1px solid #94A3B8;
  padding: 4px 6px;
  min-width: 0;
  display: flex; flex-direction: column; justify-content: center;
}
.cell:last-child { border-right: 0; }
.head-row .cell {
  background: var(--chrome); color: #ECFDF5;
  font-size: 12px; font-weight: 600; line-height: 1.25;
  padding: 6px; min-height: 46px;
  border-color: #3F6F62;
  font-family: var(--body);
}
.head-row .cell.out-head { background: #065F46; }
.head-row .num { text-align: right; align-items: flex-end; }

.sheet-body {
  min-height: calc(var(--row-h) * 5);
}
.asset-row {
  width: 100%;
  border-bottom: 1.5px solid #94A3B8;
  background: #FFFFFF;
}
.asset-row:nth-child(even) { background: #F0FDF4; }
.asset-row:focus-within { box-shadow: inset 3px 0 0 var(--primary); }

.c-ref { align-items: center; }
.ref-code { font-size: 12px; font-weight: 600; color: var(--accent); }
.c-in { padding: 2px 4px; }
.sheet input, .sheet select { min-height: 40px; padding: 4px; font-size: 13px; }
.sheet .num-input { text-align: right; }
.c-out { text-align: right; align-items: flex-end; background: rgba(110, 231, 183, 0.08); }
.c-out .v { font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.3; }
.c-out .sub { font-size: 10.5px; color: var(--muted); white-space: nowrap; min-height: 14px; line-height: 1.3; }
.is-limited .c-s179 .sub { color: var(--accent); font-weight: 600; }
.c-total .v { font-weight: 700; color: var(--primary); }
.c-act { align-items: center; padding: 3px; display: flex; flex-direction: row; gap: 4px; justify-content: center; }
.btn-toggle-drawer {
  width: 32px; height: 32px; min-width: 32px; min-height: 32px;
  padding: 0; background: #ECFDF5; border: 1px solid #047857; color: #047857;
  font-size: 14px; border-radius: 4px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.btn-toggle-drawer:hover { background: #047857; color: #FFFFFF; }
.btn-toggle-drawer[aria-expanded="true"] { background: #047857; color: #FFFFFF; }

.row-remove {
  width: 32px; height: 32px; min-width: 32px; min-height: 32px;
  padding: 0;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  font-size: 20px; line-height: 1; border-radius: 4px;
}
.row-remove:hover { border-color: var(--accent); color: var(--accent); background: #FFFBEB; }
.row-remove:active { transform: translateY(1px); }
.row-remove:disabled { cursor: not-allowed; opacity: 0.35; }

/* Asset details drawer */
.asset-details-drawer {
  display: none;
  background: #F8FAFC;
  border-top: 1px dashed #CBD5E1;
  padding: 10px 14px;
  font-size: 12px;
}
.asset-row.is-drawer-open .asset-details-drawer {
  display: block;
}
.drawer-header {
  margin-bottom: 8px;
}
.drawer-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #047857;
}
.drawer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px 12px;
  align-items: flex-end;
}
.drawer-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.drawer-label {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
}
.drawer-input, .drawer-select, .drawer-item input[type="text"] {
  min-height: 36px !important;
  font-size: 12px !important;
  padding: 4px 6px !important;
  border: 1px solid #94A3B8;
  background: #FFFFFF;
}
.drawer-item-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: 36px;
}
.drawer-check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #1E293B;
  cursor: pointer;
}
.drawer-outputs-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  padding: 6px 10px;
  border-top: 1px solid #E2E8F0;
  background: rgba(110, 231, 183, 0.08);
  border-radius: 4px;
}
.drawer-outputs-strip .c-out {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 4px;
  background: transparent;
  font-size: 12px;
}
.drawer-outputs-strip .out-lbl {
  font-weight: 600;
  color: #065F46;
  font-size: 11px;
}
.drawer-outputs-strip .v {
  font-weight: 700;
  font-family: var(--mono);
}
.drawer-outputs-strip .sub {
  font-size: 10px;
  color: #64748B;
  margin-left: 2px;
}

.foot-row .cell { min-height: 44px; background: #FFFFFF; }
.foot-label {
  grid-column: 1 / 5;
  font-weight: 600; font-size: 13px; text-align: right; align-items: flex-end;
  color: var(--ink);
  padding-right: 12px;
}
.foot-totals .cell { border-top: 1px solid #111827; font-weight: 700; }
.foot-totals .num span { font-size: 12px; }
.foot-subbreakdown-strip {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  padding: 6px 14px;
  background: #F0FDF4;
  border-bottom: 1px solid #94A3B8;
  font-size: 12px;
  font-family: var(--mono);
}
.foot-subbreakdown-strip .sub-item strong {
  color: #047857;
}
.total-double span, .double-under {
  border-bottom: 3px double #111827;
  padding-bottom: 1px;
  white-space: nowrap;
}
.foot-row .num span { font-size: 12px; white-space: nowrap; }
.foot-bottom .cell { border-bottom: 3px double #111827; background: var(--greenbar); }
.asset-row > .c-total, .asset-row > .c-act { background: inherit; }
.foot-bottom .double-under { font-size: 13px; font-weight: 700; }

.sheet-actions {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px;
}
.sheet-status { margin: 0; font-size: 13px; color: var(--muted); min-height: 20px; }
body[data-calc="held"] .sheet-status { color: var(--accent); font-weight: 600; }

.validation-cue {
  position: absolute; left: 4px; top: calc(100% - 4px); z-index: 6;
  background: #B45309; color: #FFFFFF;
  font: 600 11px/1.3 var(--body);
  padding: 3px 6px;
  width: max-content; max-width: 220px; min-width: 80px;
  white-space: normal;
  pointer-events: none;
}

/* ------------------------------------------------------- deliverable */

.deliverable-section { margin-top: 14px; }
.signoff-toolbar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 16px;
  padding: 10px 14px; border-bottom: 1px solid var(--hairline);
  background: var(--greenbar);
}
.toolbar-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.toolbar-title h2 { font-size: 18px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.toolbar-note { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--ink); text-align: right; }
.toolbar-msg { grid-column: 1 / -1; margin: 0; min-height: 20px; font-size: 13px; color: var(--chrome); font-weight: 600; text-align: right; }

.signoff-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
}
.mini-head { font-size: 14px; width: 100%; padding: 0 0 4px; }
.field-action { display: flex; align-items: flex-end; }
.pro-tag {
  display: inline-block; font: 700 10px/1.4 var(--body); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent); padding: 0 4px; vertical-align: middle;
}
body.is-pro .pro-tag { color: var(--primary); border-color: var(--primary); }

.deliverable { position: relative; padding: 18px 20px 20px; overflow: hidden; }
/* Draft watermark is print-only: on screen it sat over live figures. */
body:not(.is-pro) .deliverable::after {
  display: none;
  content: "DRAFT - WATERMARKED";
  position: absolute; left: 50%; top: 42%;
  transform: translate(-50%, -50%) rotate(-24deg);
  font: 700 72px/1 var(--display); letter-spacing: 0.08em;
  color: rgba(4, 120, 87, 0.07);
  white-space: nowrap; pointer-events: none;
}
.d-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px;
  border-bottom: 3px double #111827; padding-bottom: 12px;
}
.d-kicker { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.d-title { font-size: 20px; }
.d-meta { margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--hairline); }
.d-meta > div { padding: 6px 8px; border-right: 1px solid var(--hairline); min-width: 0; }
.d-meta > div:last-child { border-right: 0; }
.d-meta dt { font-size: 11px; font-weight: 600; color: var(--muted); }
.d-meta dd { margin: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }

.d-block { margin-top: 18px; }
.d-block h4 { font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.d-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.d-table th, .d-table td { border: 1px solid #94A3B8; padding: 6px 8px; text-align: left; vertical-align: top; }
.d-table thead th { background: var(--chrome); color: #ECFDF5; font-size: 11.5px; font-weight: 600; border-color: #3F6F62; }
.d-table tbody tr:nth-child(even) { background: #F0FDF4; }
.d-table .amt { text-align: right; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.d-assets tbody tr, .d-projection tbody tr { height: 52px; }
.d-assets td:nth-child(4), .d-assets td:nth-child(3), .d-assets thead th { white-space: nowrap; }
.d-assets .total-cell { font-weight: 700; }
.d-assets .line-cell { font-family: var(--mono); }
.lines-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.d-lines caption { text-align: left; font-weight: 700; font-size: 12.5px; padding: 0 0 6px; color: var(--ink); }
.d-lines th { width: 48px; font-family: var(--mono); color: var(--accent); font-weight: 600; }
.d-lines td.amt { width: 34%; }
.d-lines .basis { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.d-lines .line-22 td, .d-lines .line-22 th { border-top: 1px solid #111827; border-bottom: 3px double #111827; font-weight: 700; }
.d-lines .line-22 .amt { text-decoration: underline double; text-underline-offset: 3px; }
.d-footnote { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.d-notes { list-style: none; margin: 0; padding: 0; border: 1px solid var(--hairline); min-height: calc(3 * 44px); }
.note { padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--hairline); }
.note:last-child { border-bottom: 0; }
.note:nth-child(even) { background: #F0FDF4; }
.note-tag {
  display: inline-block; font: 700 10.5px/1.4 var(--body); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0 5px; margin-right: 4px; border: 1px solid currentColor;
}
.note-warning .note-tag { color: var(--accent); }
.note-notice .note-tag { color: var(--primary); }
.note-clear { color: var(--muted); }

.lock-note { margin: 6px 0 0; font-size: 12px; color: var(--accent); font-weight: 600; }
body.is-pro .lock-note { visibility: hidden; }
.upgrade-after {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px;
  padding: 12px 14px; border-top: 1px solid var(--hairline); background: var(--greenbar);
}
.upgrade-copy { min-width: 0; flex: 1 1 320px; }
.upgrade-copy .mini-head { padding: 0; }
.upgrade-copy p { margin: 4px 0 0; font-size: 13px; color: var(--ink); }
.upgrade-price { font-weight: 700; }
body.is-pro .upgrade-after { display: none; }

.d-sign { position: relative; }
.sign-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 24px; padding-right: 170px; }
.sign-line { display: flex; flex-direction: column; border-bottom: 1px solid #111827; min-height: 48px; justify-content: flex-end; }
.sign-label { font-size: 11px; font-weight: 600; color: var(--muted); }
.sign-value { font-size: 14px; font-weight: 600; min-height: 22px; }
.ptin-stamp {
  position: absolute; right: 8px; top: 34px; width: 150px;
  border: 3px double #047857; color: #047857; padding: 10px 8px;
  font: 700 12px/1.4 var(--display); text-align: center; text-transform: uppercase; letter-spacing: 0.06em;
  transform: rotate(-4deg);
  visibility: hidden;
}
body.is-stamped .ptin-stamp { visibility: visible; }
.d-disclaimer { margin: 18px 0 0; font-size: 12px; color: var(--muted); border-top: 1px solid var(--hairline); padding-top: 10px; }

/* ----------------------------------------------------------------- modal */

.pro-modal {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border: 1px solid var(--hairline); border-top: 5px solid var(--chrome);
  padding: 0 22px 20px; background: var(--paper); color: var(--ink);
  overflow-y: auto;
}
.pro-modal::backdrop { background: rgba(6, 78, 59, 0.6); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--hairline); }
.modal-close {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 8px 0;
  background: transparent; border: 1px solid var(--hairline); color: var(--ink); font-size: 22px; line-height: 1;
}
.modal-close:hover { background: var(--focus-fill); }
.modal-close:active { background: #D1FAE5; transform: translateY(1px); }
.pro-modal h2 { font-size: 22px; margin-top: 14px; }
.modal-lede { color: var(--muted); margin: 6px 0 10px; }
.modal-features { margin: 0 0 12px; padding: 0; list-style: none; border-top: 1px solid var(--hairline); }
.modal-features li { padding: 7px 0 7px 22px; border-bottom: 1px solid var(--hairline); position: relative; font-size: 14px; }
.modal-features li::before { content: "\2713"; position: absolute; left: 2px; color: var(--primary); font-weight: 700; }
.modal-price { margin: 8px 0 10px; }
.price { font: 700 24px/1.2 var(--mono); font-variant-numeric: tabular-nums; border-bottom: 3px double #111827; }
.pro-modal .btn-primary { width: 100%; }
.modal-fine { font-size: 12px; color: var(--muted); margin: 6px 0 14px; }
.key-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; border-top: 1px solid var(--hairline); padding-top: 8px; }
.key-form .field { padding: 6px 0 8px; }
.key-form input { font-family: var(--mono); text-transform: uppercase; }
.key-status { font-size: 13px; color: var(--muted); margin: 6px 0 0; min-height: 18px; }
body.is-pro [data-pro-state] { color: var(--primary); font-weight: 600; }

/* ---------------------------------------------------------------- footer */

.site-footer { margin-top: 18px; border-top: 1px solid var(--hairline); background: var(--paper); }
.footer-inner { padding-top: 14px; padding-bottom: 18px; font-size: 13px; color: var(--muted); }
.footer-inner p { margin: 0 0 8px; max-width: 980px; }
.free-watermark { font-family: var(--display); color: var(--ink); font-size: 13px; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1240px) {
  .ribbon-inner {
    grid-template-columns: auto minmax(0, 1fr) minmax(180px, auto);
    grid-template-areas:
      "year presets bottom"
      "convention caps bottom";
  }
  .ribbon-convention { border-top: 1px solid var(--hairline); padding-left: 0; }
  .ribbon-caps { padding-left: 14px; }
}

@media (max-width: 1180px) {
  .signoff-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mini-head { grid-column: 1 / -1; padding-bottom: 0; }
  .field-action { grid-column: 1 / -1; padding-bottom: 12px; }
  .d-head { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .lines-grid { grid-template-columns: minmax(0, 1fr); }
  .engagement-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .engagement-row .field:nth-child(3) { border-left: 0; }
  .engagement-row .field:nth-child(n + 3) { border-top: 1px solid var(--hairline); }
  .signoff-toolbar { grid-template-columns: minmax(0, 1fr); }
  .toolbar-actions { justify-content: flex-start; }
  .toolbar-msg, .toolbar-note { text-align: left; }
  .d-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-meta > div { border-bottom: 1px solid var(--hairline); }
  .sign-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-right: 0; padding-top: 70px; }
  .ptin-stamp { top: 30px; right: auto; left: 0; }
}

@media (max-width: 760px) {
  .ribbon-inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "year convention"
      "presets presets"
      "caps caps"
      "bottom bottom";
  }
  .ribbon-cell { border-right: 0; padding: 8px 0; }
  .ribbon-convention { border-top: 0; padding-left: 12px; border-left: 1px solid var(--hairline); }
  .ribbon-presets { border-top: 1px solid var(--hairline); }
  .ribbon-caps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 0; padding-left: 0; }
  .ribbon-bottom { flex-direction: row; justify-content: space-between; align-items: center; border-left: 0; border-top: 1px solid var(--hairline); padding: 8px; }
  .ribbon-ref { display: none; }
  .ribbon-select { min-width: 0; }
  .chip { flex: 1 1 calc(50% - 6px); white-space: normal; }

  .wrap { padding: 0 8px; }
  .wp-head, .sheet-actions, .signoff-toolbar { padding-left: 10px; padding-right: 10px; }
  .engagement-row { grid-template-columns: minmax(0, 1fr); }
  .engagement-row .field + .field { border-left: 0; border-top: 1px solid var(--hairline); }
  .field { padding-left: 10px; padding-right: 10px; }

  .sheet-scroll { overflow: visible; }
  .sheet { min-width: 0; }
  .sheet-head { display: none; }
  .sheet-body { min-height: 0; background: none; }
  .asset-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border-bottom: 3px double #111827;
    padding: 4px 0 10px;
  }
  .asset-row .cell { border-right: 0; border-bottom: 1px solid #94A3B8; padding: 4px 10px; }
  .asset-row .cell::before {
    content: attr(data-label);
    font: 600 11px/1.3 var(--body); color: var(--muted);
    text-align: left; align-self: flex-start;
  }
  .asset-row .c-ref { order: -2; align-items: flex-start; border-bottom: 1px solid #111827; }
  .asset-row .c-act { order: -1; align-items: flex-end; border-bottom: 1px solid #111827; }
  .asset-row .c-in:nth-child(2) { grid-column: 1 / -1; }
  .c-out { align-items: stretch; }
  .c-out .v, .c-out .sub { text-align: right; }
  .foot-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .foot-row .cell { border-right: 0; }
  .foot-label, .foot-totals .foot-label { grid-column: 1 / -1; text-align: left; align-items: flex-start; }
  .foot-totals .cell[aria-hidden="true"], .foot-row .c-act { display: none; }
  .foot-totals .cell[data-label]::before { content: attr(data-label); font: 600 11px/1.3 var(--body); color: var(--muted); }
  .foot-row:not(.foot-totals) .foot-label { grid-column: 1 / 2; }
  .validation-cue { max-width: calc(100% - 8px); min-width: 0; }

  .signoff-fields { grid-template-columns: minmax(0, 1fr); }
  .deliverable { padding: 14px 10px; }
  body:not(.is-pro) .deliverable::after { font-size: 40px; }
  .d-meta { grid-template-columns: minmax(0, 1fr); }
  .sign-grid { grid-template-columns: minmax(0, 1fr); }
  .header-actions .plan-status { display: none; }
  .brand { font-size: 15px; }
  .brand-mark { display: none; }
  .key-form { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .asset-row .c-in { grid-column: 1 / -1; }
}

/* ----------------------------------------------------------------- print */

@media print {
  @page { size: letter landscape; margin: 10mm; }
  html, body { background: #FFFFFF !important; color: #111827 !important; }
  body { font-size: 10.5pt; }
  .skip-link, .app-header, .ribbon, .workpaper, .signoff-toolbar, .signoff-fields, .pro-modal, .upgrade-after,
  .footer-inner > p:not(.free-watermark), button, input, select, textarea, form, fieldset, label,
  dialog, .field, .key-form, .key-status, .toolbar-msg, .modal-fine, .modal-price, .modal-features,
  a[data-checkout], .btn-primary, .btn-header, .btn-tool, .sheet-actions,
  .deliverable-dock, .no-print, .cockpit-horizon-bar, .mobile-hud { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .paper { border: 0; }
  #executive-deliverable { display: block !important; margin: 0; }
  .deliverable { padding: 0; overflow: visible; }
  .deliverable *, .site-footer * { color: #111827 !important; border-color: #111827 !important; }
  .d-table thead th { background: #FFFFFF !important; color: #111827 !important; border-color: #111827; }
  .d-table th, .d-table td { border-color: #111827; }
  .d-table tbody tr:nth-child(even), .note:nth-child(even) { background: #FFFFFF !important; }
  .d-table tr, .note, .sign-line, .d-head { break-inside: avoid; page-break-inside: avoid; }
  .d-block { break-inside: auto; }
  .d-sign { break-inside: avoid; }
  .d-assets tbody tr, .d-projection tbody tr { height: auto; }
  .d-notes { min-height: 0; }
  .table-scroll { overflow: visible; }
  .lines-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-meta { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .d-head { grid-template-columns: minmax(0, 1fr); }
  .sign-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-right: 170px; padding-top: 0; }
  .ptin-stamp { right: 8px; left: auto; top: 34px; border-color: #111827; }
  .lock-note { display: none; }
  body:not(.is-pro) .d-projection-block { display: none; }
  body:not(.is-pro) .deliverable::after {
    display: block;
    position: fixed; top: 50%; color: rgba(17, 24, 39, 0.08); font-size: 44pt;
  }
  .site-footer { border: 0; margin: 10mm 0 0; background: #FFFFFF; }
  .footer-inner { padding: 0; }
  .free-watermark { display: block !important; font-size: 9.5pt; }
  body.is-pro .free-watermark { display: none !important; }
}

/* Fixed column tracks keep the printed schedule from reflowing between engagements. */
.d-assets { table-layout: fixed; min-width: 1010px; }
.d-assets th:nth-child(1) { width: 48px; }
.d-assets th:nth-child(3) { width: 104px; }
.d-assets th:nth-child(4) { width: 172px; }
.d-assets th:nth-child(n + 5):nth-child(-n + 8), .d-assets th:nth-child(10), .d-assets th:nth-child(11) { width: 106px; }
.d-assets th:nth-child(9) { width: 66px; }
.d-assets th:nth-child(12) { width: 60px; }
.d-assets thead th, .d-table thead th.amt { white-space: normal; font-family: var(--body); }
.d-projection { table-layout: fixed; min-width: 720px; }
.d-projection th:nth-child(1) { width: 48px; }
.d-projection th:nth-child(2) { width: 24%; }
@media print {
  .d-assets { min-width: 0; font-size: 7.5pt; }
  .d-assets th, .d-assets td { padding: 4px 3px; }
  .d-assets th:nth-child(1) { width: 34px; }
  .d-assets th:nth-child(3) { width: 78px; }
  .d-assets th:nth-child(4) { width: 96px; }
  .d-assets td:nth-child(4) { white-space: normal; }
  .d-assets th:nth-child(n + 5):nth-child(-n + 8), .d-assets th:nth-child(10), .d-assets th:nth-child(11) { width: 84px; }
  .d-assets th:nth-child(9) { width: 50px; }
  .d-assets th:nth-child(12) { width: 40px; }
  .d-projection { min-width: 0; }
}

/* Calc notice: year-conversion + returning-user bonus banner */
.calc-note {
  margin: 10px 0 0;
  padding: 10px 14px;
  border-left: 3px solid #B45309;
  background: #FFFBEB;
  color: #7C4A03;
  font-size: 13px;
}

/* Conflict banner: engine guidance renders verbatim; excluded rows dim */
.conflict-banner {
  margin: 10px 0 0;
  padding: 12px 16px;
  border-left: 3px solid #B45309;
  background: #FFFBEB;
  color: #7C4A03;
  font-size: 13.5px;
}
.conflict-banner p { margin: 0 0 6px; }
.conflict-banner p:last-child { margin-bottom: 0; }
.row-excluded td, .row-excluded .cell { opacity: 0.55; }
.row-excluded .cell .sub { color: #7C4A03; opacity: 1; font-size: 11px; }

/* Sample-data honesty + blank-start */
.sample-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border: 1px solid #B45309;
  border-radius: 3px;
  color: #7C4A03;
  background: #FFFBEB;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.chip[data-reset-blank][aria-pressed="true"] {
  background: var(--primary, #047857);
  color: #fff;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* Honest locked affordances */
.lock-note {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7C4A03;
}
input[readonly][data-sign-input] {
  color: var(--muted, #64748b);
  cursor: not-allowed;
  border-bottom-style: dashed;
}

/* Free reassurance + comparison matrix */
.free-reassurance {
  background: #ECFDF5;
  border-bottom: 1px solid #A7F3D0;
  color: #064E3B;
  font-size: 13.5px;
  padding: 8px 0;
}
.free-reassurance .wrap { padding: 0 12px; }
.free-vs-pro { width: 100%; border-collapse: collapse; margin-block: 12px; font-size: 13px; }
.free-vs-pro th, .free-vs-pro td { border: 1px solid #D1FAE5; padding: 6px 10px; text-align: left; }
.free-vs-pro thead th { background: #ECFDF5; color: #064E3B; }

/* Sign-off fields */
.signoff-fields .field {
  flex: 1 1 calc(33.333% - 12px);
  min-width: 130px;
}
.signoff-fields .field input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}
.signoff-fields .field-action {
  flex: 1 1 100%;
  margin-top: 4px;
}

/* ==========================================================================
   Option B+ Cockpit & Unified Toolbar Quality Gate Standards
   ========================================================================== */

/* Unified 46px Flex Toolbar */
.unified-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 46px;
  padding: 6px 20px;
  background: #111827;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #f4f4f5;
  z-index: 100;
  box-sizing: border-box;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mode-tabs {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 2px;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.mode-tab.active {
  color: #fff;
  background: #0f766e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.preset-strip-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preset-strip-inline .preset-chip {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-strip-inline .preset-chip:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.preset-strip-inline .preset-chip.active,
.preset-strip-inline .preset-chip[aria-pressed="true"] {
  background: rgba(15, 118, 110, 0.3);
  border-color: #0f766e;
  color: #a7f3d0;
  font-weight: 600;
}

.engine-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono, monospace);
  font-size: 11px;
  color: #34d399;
}

.engine-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.6);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.free-badge {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 4px;
}

/* Workflow Directional Vector Bar */
.workflow-direction-bar {
  background: #1f2937;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 20px;
  font-size: 11px;
  color: #9ca3af;
}

.wf-track {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.wf-step strong {
  color: #f3f4f6;
}

.wf-arrow {
  color: #10b981;
  font-weight: bold;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono, monospace);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 2px;
  line-height: 1;
  vertical-align: middle;
}

.role-badge-in {
  background: #fef3c7;
  color: #78350f;
  border: 1px solid #f59e0b;
  margin-right: 6px;
}

.role-badge-out {
  background: #d1fae5;
  color: #064e3b;
  border: 1px solid #10b981;
  margin-right: 6px;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline, #cbd5e1);
}

.pane-subtitle {
  font-size: 11px;
  color: var(--muted, #64748b);
  font-family: var(--mono, monospace);
}

/* KPI Card Grid */
.kpi-card-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.kpi-card-hero {
  background: #111827;
  border: 1px solid #374151;
  border-left: 4px solid #0f766e;
  padding: 12px 16px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-card-hero .kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  font-family: var(--mono, monospace);
}

.kpi-hero-val {
  font-size: 26px;
  font-weight: 800;
  color: #34d399;
  font-family: var(--mono, monospace);
}

.kpi-card-hero .kpi-sub {
  font-size: 11px;
  color: #9ca3af;
  font-family: var(--mono, monospace);
}

.kpi-card-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
  background: #1f2937;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #374151;
}

.kpi-card-metrics > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-card-metrics .kpi-label {
  font-size: 10px;
  color: #9ca3af;
  text-transform: uppercase;
  font-family: var(--mono, monospace);
}

.kpi-card-metrics .kpi-val {
  font-size: 13px;
  font-weight: 700;
  color: #f3f4f6;
  margin: 0;
  font-family: var(--mono, monospace);
}

/* In-Flow Action Shelf at Form End */
.dock-jump-shelf {
  position: static;
  background: #111827;
  border: 1px solid rgba(15, 118, 110, 0.5);
  border-radius: 8px;
  padding: 12px;
  margin-top: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dock-jump-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
  background: #0f766e !important;
  color: #fff !important;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dock-jump-btn:hover {
  background: #115e59 !important;
  transform: translateY(-1px);
}

.dock-scroll-cue {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 12px;
  background: transparent;
  border: 1px dashed #374151;
  color: #9ca3af;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dock-scroll-cue:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e5e7eb;
  border-color: #6b7280;
}

.action-msg {
  min-height: 18px;
  font-size: 11px;
  font-weight: 600;
  color: #34d399;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.action-msg.msg-flash {
  opacity: 1;
}

/* Spotlight Pulse Animation */
@keyframes spotlightPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.7);
  }
  50% {
    box-shadow: 0 0 24px 8px rgba(15, 118, 110, 0.9);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0);
  }
}

.spotlight-pulse {
  animation: spotlightPulse 0.9s cubic-bezier(0.25, 1, 0.5, 1);
  border-color: #0f766e !important;
}

/* Anchored Cockpit Horizon Bar */
.cockpit-horizon-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: #0b0f17;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 11px;
  color: #71717a;
  z-index: 900;
}

.horizon-left,
.horizon-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.horizon-status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.horizon-link {
  color: #a1a1aa;
  text-decoration: none;
}

.horizon-dim {
  color: #52525b;
}

/* Mobile Sticky HUD */
.mobile-hud {
  display: none;
}

/* Option B+ Desktop Cockpit (100dvh Zero Window Scroll) */
@media screen and (min-width: 901px) {
  html, body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden !important;
  }

  .app-header {
    height: 48px;
    padding: 0 20px;
    margin: 0;
    max-width: 100%;
    border-radius: 0;
    flex-shrink: 0;
  }

  .page-shell {
    height: calc(100dvh - 48px - 46px - 32px);
    overflow: hidden;
    padding: 0 20px;
    max-width: 1720px;
    margin: 0 auto;
    width: 100%;
  }

  .workbench {
    height: 100%;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(500px, 1.1fr) minmax(460px, 1fr);
    gap: 24px;
    padding: 16px 0 34px 0;
    margin: 0;
    max-width: 100%;
  }

  .inspector-pane {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    border-radius: 8px;
    background: #111827;
    border: 1px solid rgba(15, 118, 110, 0.4);
  }

  .inspector-pane .pane-header {
    flex: 0 0 auto;
    padding: 10px 16px;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #111827;
  }

  .inspector-scroll-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    mask-image: linear-gradient(to bottom, black calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 24px), transparent 100%);
  }

  .dock-jump-shelf {
    flex: 0 0 auto;
    padding: 12px 16px;
    background: #111827;
    border-top: 1.5px solid rgba(15, 118, 110, 0.4);
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    border-radius: 0 0 8px 8px;
  }

  .deliverable-dock {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #111827;
    padding: 10px 14px;
    margin: 0 0 14px 0;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .deliverable-dock .sheet-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .deliverable-dock .primary-action {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    background: #0d9488;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .deliverable-dock .primary-action:hover {
    background: #0f766e;
  }

  .deliverable-dock .compact-action {
    padding: 8px 12px;
    font-size: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #e4e4e7;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .deliverable-dock .compact-action:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
  }

  .deliverable-dock .dock-scroll-cue {
    padding: 7px 12px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #a1a1aa;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
  }

  .deliverable-dock .dock-scroll-cue:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
  }

  .deliverable-zone {
    height: 100%;
    overflow-y: auto;
    padding-right: 12px;
    scroll-padding-top: 80px;
    padding-bottom: 96px;
  }
}

@media (max-width: 900px) {
  html, body {
    height: auto;
    overflow-y: auto;
  }

  .workflow-direction-bar {
    display: none !important;
  }

  .preset-strip-inline {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
    padding: 2px 0;
  }
  .preset-strip-inline::-webkit-scrollbar {
    display: none;
  }

  .workbench {
    display: flex;
    flex-direction: column;
    padding-bottom: 80px;
  }

  .inspector-pane {
    height: auto;
    overflow: visible;
    padding: 0;
    border: none;
    background: transparent;
  }

  .inspector-scroll-body {
    overflow-y: visible;
    max-height: none;
    min-height: 0;
    padding: 0;
    mask-image: none !important;
    -webkit-mask-image: none !important;
  }

  .dock-jump-shelf {
    display: block;
    margin: 16px 0 20px 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .deliverable-dock {
    position: static;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 12px;
  }

  .mobile-hud {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #111827;
    border-top: 1px solid rgba(15, 118, 110, 0.5);
    padding: 8px 16px;
    z-index: 999;
  }

  .mobile-hud-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 480px;
    margin: 0 auto;
  }

  .hud-kpi {
    display: flex;
    flex-direction: column;
  }

  .hud-label {
    font-size: 10px;
    color: #9ca3af;
    font-family: var(--mono, monospace);
  }

  .hud-value {
    font-size: 16px;
    font-weight: 700;
    color: #34d399;
  }

  .hud-jump-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    background: #0f766e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }
}

/* Fleet review 2026-10-18 additions */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.66);
}
.modal-backdrop[hidden] { display: none; }
.sample-badge[hidden] { display: none !important; }
.sample-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fbbf24;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
/* pane subtitle measured dark-on-dark */
.pane-subtitle { color: #94A3B8; }

/* Spoke-to-Hub Arrival & Hydration Styles */
#workspace {
  scroll-margin-top: 1.5rem;
}

.wp-arrival-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 14px;
  padding: 10px 14px;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 6px;
  color: #065f46;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.wp-arrival-banner[hidden] {
  display: none !important;
}

.wp-arrival-banner .banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wp-arrival-banner .banner-icon {
  font-weight: 700;
  color: #059669;
}

.wp-arrival-banner .banner-dismiss {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.wp-arrival-banner .banner-dismiss:hover {
  background: #d1fae5;
}

@keyframes row-arrival-pulse {
  0% { background-color: #dcfce7; }
  70% { background-color: #dcfce7; }
  100% { background-color: transparent; }
}

.asset-row.row-arrival-highlight,
.sheet-row.row-arrival-highlight {
  animation: row-arrival-pulse 2.5s ease-out forwards;
}


/* Repair pass 2026-10-18: probe-flagged contrast, width, touch, print, sticky */
.unified-toolbar { position: sticky; top: 0; }
.pane-subtitle { color: #334155; }
@media screen and (min-width: 901px) {
  .inspector-pane .pane-subtitle { color: #CBD5E1; }
}
.deliverable-dock .primary-action { background: #047857; color: #FFFFFF; }
.deliverable-dock .primary-action:hover { background: #065F46; }
.signoff-fields .field { flex: 1 1 200px; min-width: 186px; }
.signoff-fields .field input[type="text"] { min-width: 175px; }

@media (max-width: 900px) {
  .signoff-fields .field { flex-basis: 100%; min-width: 0; }
  .signoff-fields .field input[type="text"] { min-width: 0; }
  button, select, [role="tab"], .preset-chip, .chip, a.btn-header, a[data-checkout],
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
    min-height: 44px;
  }
  button, [role="tab"], .preset-chip, .chip, a.btn-header { min-width: 44px; }
  .mode-tab, .preset-strip-inline .preset-chip { flex-shrink: 0; }
  .ribbon-select, .sheet input, .sheet select,
  .engagement-row input, .engagement-row select { height: auto; min-height: 44px; }
  .btn-toggle-drawer, .row-remove { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .dock-scroll-cue, .deliverable-dock .dock-scroll-cue { color: #334155; border-color: #94A3B8; }
}
.cockpit-horizon-bar { color: #D4D4D8; }
.horizon-dim { color: #A1A1AA; }
.horizon-link { color: #E4E4E7; }

@media print {
  .unified-toolbar, .workflow-direction-bar, nav, .inspector-pane, .pane-header, .dock-jump-shelf,
  .wp-arrival-banner, .modal-backdrop, [role="dialog"], .related-tools-grid, .kpi-card-grid,
  .calc-note, .conflict-banner, [data-free-reassurance] { display: none !important; }
  html, body { height: auto !important; overflow: visible !important; }
  .page-shell, .workbench, .deliverable-zone { display: block !important; height: auto !important; overflow: visible !important; padding: 0 !important; }
}

a.nav-tools-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 12px;
  line-height: 1.2;
}
