/*
 * Feeder Estimator 2.0 layer styles — only loaded with ?v2.
 * Uses the same CSS variables as styles.css so dark and light themes both work.
 */

/* ---------------------------------------------------------------------------
 * Hide the classic chrome — the 2.0 shell replaces it
 * ------------------------------------------------------------------------- */
.v2 .app-header {
  display: none;
}

.v2 .work-tabs-bar {
  display: none;
}

.v2 .site-chrome {
  display: none;
}

.v2 .panel-project {
  display: none !important;
}

.v2 .why-feeder-app-strip {
  display: none;
}

#v2Dash[hidden] {
  display: none !important;
}

/* Plan drop zone only on the import step (or welcome dashboard) — html.v2-import-step */
html.v2:not(.v2-import-step) #planDropZone {
  display: none !important;
}

html.v2.v2-import-step #planDropZone:not([hidden]) {
  display: block !important;
}

/* Import step — plan drop + alt actions only; hide legacy spreadsheet until data exists */
html.v2.v2-import-focus #work-view-runs .work-view-runs-head,
html.v2.v2-import-focus #work-view-runs .runs-guide,
html.v2.v2-import-focus #work-view-runs .runs-table-toolbar,
html.v2.v2-import-focus #work-view-runs .runs-scroll-host {
  display: none !important;
}

html.v2.v2-import-focus #planDropZone {
  margin: 0.35rem 0 0.5rem;
  border: 1px dashed color-mix(in srgb, var(--blue) 35%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--blue) 4%, var(--surface));
  box-shadow: none;
}

html.v2.v2-import-focus #planDropZone .plan-drop-inner {
  padding: 1.75rem 1.25rem 1.5rem;
  max-width: 42rem;
  margin: 0 auto;
}

html.v2.v2-import-focus #planDropZone .plan-drop-title {
  font-size: 1.35rem;
  font-weight: 800;
}

html.v2.v2-import-focus #planDropZone .plan-drop-text {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--muted);
}

.v2-import-alt {
  text-align: center;
  padding: 0.75rem 0 1.25rem;
  margin: 0 0 0.5rem;
  border-bottom: 1px solid var(--border);
}

.v2-import-alt-lead {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.v2-import-alt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

/* Classic schedule table is replaced on screen by the 2.0 feeders table
   (it comes back for printing below). */
.v2 #work-view-schedule .hscroll-host,
.v2 #scheduleReviewAbbrevKey,
.v2 #scheduleReviewBtn,
.v2 #scheduleReviewAllBtn,
.v2 #scheduleReviewSummary,
.v2 #work-view-schedule .schedule-toolbar {
  display: none;
}

/* ---------------------------------------------------------------------------
 * Top app bar
 * ------------------------------------------------------------------------- */
.v2-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  padding: 0.55rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 60;
}

.v2-bar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.v2-bar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 0 0 auto;
  margin-left: auto;
  overflow: visible;
}

.v2-bar-actions {
  overflow: visible;
}

.v2-bar-project {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.v2-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.v2-brand-bolt {
  font-size: 1.05rem;
}

.v2-badge {
  font-size: 0.66rem;
  font-weight: 800;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
}

.v2-bar-project-label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.v2-bar-company {
  max-width: min(14rem, 28vw);
  border: none;
  background: none;
  padding: 0;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.v2-bar-company:hover {
  color: var(--blue);
  text-decoration: underline;
}

.v2-bar-company-empty {
  font-weight: 500;
  color: var(--muted);
}

.v2-proj-wrap {
  position: relative;
}

.v2-import-btn {
  margin-right: 0.35rem;
  white-space: nowrap;
}

.v2-bar-plans {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.35rem;
}

.v2-plans-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-row);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.v2-plans-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.v2-plans-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.v2-plans-count {
  font-size: 0.68rem;
  font-weight: 800;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.v2-proj-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.32rem 0.65rem;
  min-width: clamp(10rem, 22vw, 18rem);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.v2-proj-btn:hover {
  border-color: var(--blue);
}

.v2-proj-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-proj-caret {
  color: var(--muted);
  font-size: 0.7rem;
}

.v2-proj-menu {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 26rem;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  padding: 0.3rem;
  z-index: 80;
}

.v2-proj-item-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.15rem;
}

.v2-proj-item-wrap .v2-proj-item {
  flex: 1;
  min-width: 0;
}

.v2-proj-item-delete {
  flex-shrink: 0;
  align-self: center;
  width: 1.65rem;
  height: 1.65rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.v2-proj-item-delete:hover {
  background: rgba(255, 107, 107, 0.15);
  color: var(--red);
}

.v2-proj-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  width: 100%;
  border: none;
  background: none;
  font-family: var(--font);
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text);
}

.v2-proj-item:hover {
  background: var(--surface-2);
}

.v2-proj-item.current .v2-proj-item-name {
  color: var(--blue);
}

.v2-proj-item-name {
  font-size: 0.82rem;
  font-weight: 700;
}

.v2-proj-item-sub {
  font-size: 0.7rem;
  color: var(--muted);
}

.v2-proj-empty {
  margin: 0.4rem 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.v2-proj-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0.2rem;
}

.v2-bar-actions {
  margin-left: 0;
}

.v2-bar-actions .header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.v2 .header-import-plans-btn {
  display: none;
}

.v2-stock-btn {
  font-weight: 600;
}

/* ---------------------------------------------------------------------------
 * Workflow stepper
 * ------------------------------------------------------------------------- */
.v2-stepper {
  /* Blends into the top of the work panel — stretches to its edges with a
     divider underneath instead of being its own boxed card. */
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin: -0.4rem -0.85rem 0.45rem;
  padding: 0.5rem 0.85rem;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow-x: auto;
  scrollbar-width: thin;
}

.v2-stepper.v2-stepper-pinned {
  position: sticky;
  top: var(--v2-bar-h, 56px);
  z-index: 55;
  background: var(--surface);
  margin-bottom: 0;
  box-shadow: 0 1px 0 var(--border);
}

.v2 .panel-runs.panel-work {
  padding-top: 0.4rem;
}

/* Full-bleed workspace — feeder panel flush with the browser edges */
html.v2 body.app-shell .layout {
  padding: 0;
  gap: 0;
}

html.v2 body.app-shell .panel-runs.panel-work {
  border-top: none;
}

html.v2 body.app-shell .v2-dash {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

html.v2 body.app-shell .v2-export {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.v2-step-pin {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.5rem;
  flex-shrink: 0;
  order: 12;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.v2-step-pin:hover {
  border-color: var(--blue);
  color: var(--text);
}

.v2-step-pin.active {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 16%, var(--surface-2));
  color: var(--text);
}

.v2-step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: none;
  background: none;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  white-space: nowrap;
  color: var(--text);
  flex-shrink: 0;
}

.v2-step:hover {
  background: var(--surface-2);
}

.v2-step-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
  color: var(--muted);
  background: var(--surface-2);
}

.v2-step-done .v2-step-dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.v2-step-current .v2-step-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.v2-step-warn .v2-step-dot {
  background: var(--warning);
  border-color: var(--warning);
  color: #14110b;
}

.v2-step-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.v2-step-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.v2-step-todo .v2-step-name {
  color: var(--muted);
}

.v2-step-current .v2-step-name {
  color: var(--blue);
}

.v2-step-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.v2-step-line {
  flex: 1 1 0.7rem;
  min-width: 0.7rem;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
}

.v2-step-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  padding-left: 0.6rem;
  order: 10;
}

.v2-step-back,
.v2-step-nav .btn {
  font-size: 0.78rem;
  padding: 0.32rem 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.v2-step-back {
  margin-right: 0.6rem;
}

.v2-step-back[disabled],
.v2-step-nav .btn[disabled] {
  opacity: 0.45;
  cursor: default;
}

.v2-step-optional {
  flex: 1 0 100%;
  order: 20;
  width: 100%;
  margin: 0.15rem 0 0;
  padding: 0 0.15rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}

@media (max-width: 960px) {
  .v2-step-sub {
    display: none;
  }

  .v2-step-line {
    flex: 0 0 0.5rem;
    min-width: 0.5rem;
  }
}

.v2-step-tool-link {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.v2-step-tool-link:hover {
  color: var(--text);
}

.v2-export-head-po {
  border-left: 3px solid var(--blue);
  padding-left: 0.75rem;
}

.v2-export-card-email-focus {
  border-color: color-mix(in srgb, var(--blue) 35%, var(--border));
  background: color-mix(in srgb, var(--blue) 6%, var(--surface));
}

.v2-stock-link {
  margin-left: 0.5rem;
  flex-shrink: 0;
  order: 11;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.v2-stock-link:hover {
  color: var(--text);
  border-color: var(--blue);
}

/* ---------------------------------------------------------------------------
 * Feeders review table (Verify Sizing)
 * ------------------------------------------------------------------------- */
.v2-feeders {
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.v2-feeders-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.v2-feeders-count {
  font-size: 0.95rem;
  font-weight: 800;
  margin-right: 0.3rem;
  white-space: nowrap;
}

.v2-feeders-search {
  width: clamp(9rem, 24vw, 16rem);
  padding: 0.32rem 0.65rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
}

.v2-feeders-filter {
  width: auto;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
}

.v2-feeders-warnbtn {
  border: 1px solid var(--warning);
  background: var(--warning-bg);
  color: var(--warning);
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.v2-feeders-warnbtn.active {
  background: var(--warning);
  color: #14110b;
}

.v2-feeders-spacer {
  flex: 1;
}

.v2-feeders-tablewrap {
  overflow-x: auto;
}

.v2-ftable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.v2-ftable thead th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: none;
  color: var(--muted);
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

.v2-th-sub {
  display: block;
  font-weight: 500;
  font-size: 0.62rem;
  color: var(--muted);
  opacity: 0.8;
}

.v2-ftable tbody td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border-row);
  white-space: nowrap;
  vertical-align: middle;
}

tr.v2-frow {
  cursor: pointer;
}

tr.v2-frow:hover td {
  background: var(--surface-2);
}

tr.v2-frow-open td {
  background: var(--surface-2);
  border-bottom: none;
}

.v2-fid-name {
  color: var(--blue);
  font-weight: 700;
}

.v2-cell-sub {
  display: block;
  font-size: 0.66rem;
  color: var(--muted);
}

.v2-frow-actions {
  width: 1%;
  padding-left: 0.35rem !important;
  padding-right: 0.35rem !important;
}

.v2-why-size-btn {
  font-size: 0.68rem;
  padding: 0.18rem 0.5rem;
  white-space: nowrap;
  line-height: 1.25;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.v2-why-size-btn:hover,
.v2-why-size-btn:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--surface-2);
}

tr.v2-frow-open .v2-why-size-btn {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(59, 130, 246, 0.08);
}

.v2-chev {
  color: var(--muted);
  width: 1.4rem;
  text-align: center;
}

.v2-ftable-empty {
  text-align: center;
  color: var(--muted);
  padding: 1.4rem !important;
  white-space: normal !important;
}

tr.v2-floor-header td.v2-floor-header-cell {
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 88%, var(--accent) 12%);
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

/* Status pills */
.v2-pill {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.v2-pill-ok {
  background: color-mix(in srgb, var(--success) 16%, transparent);
  color: var(--success);
  border: 1px solid var(--success);
}

.v2-pill-warn {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.v2-pill-error {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.v2-pill-input {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.v2-voltage-defaulted {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.2;
  color: color-mix(in srgb, var(--warning) 85%, #000);
  background: var(--warning-bg);
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
  cursor: help;
}

.v2-run-manual-override {
  margin-left: 0.35rem;
}

.v2-manual-override-banner {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
  background: var(--warning-bg);
  color: color-mix(in srgb, var(--warning) 85%, #000);
}

.v2-manual-override-banner strong {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.v2-manual-override-banner p {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.v2-manual-override-banner ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Legend footer */
.v2-feeders-legend {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
}

.v2-feeders-legend > span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ---------------------------------------------------------------------------
 * Expanded feeder detail (tabs + reasoning cards)
 * ------------------------------------------------------------------------- */
.v2-detail-row > td {
  padding: 0 !important;
  background: var(--surface-2) !important;
  white-space: normal !important;
}

.v2-detail {
  padding: 0.8rem 1rem 1rem;
  border-left: 3px solid var(--blue);
  /* the table can scroll horizontally — keep the reasoning pinned in view */
  position: sticky;
  left: 0;
  width: min(1280px, calc(100vw - 1.7rem));
  max-width: 100%;
  box-sizing: border-box;
}

.v2-detail-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.v2-detail-head .v2-edit-run {
  margin-left: auto;
  font-size: 0.74rem;
  padding: 0.22rem 0.7rem;
}

.v2-why-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.v2-why-summary {
  font-size: 0.78rem;
  color: var(--muted);
}

.v2-detail-tabs {
  display: flex;
  gap: 0.15rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.7rem;
}

.v2-detail-tab {
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.v2-detail-tab:hover {
  color: var(--text);
}

.v2-detail-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.v2-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.7rem;
  align-items: stretch;
}

.v2-controlling-reason {
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 8px;
}

.v2-controlling-lead {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.v2-controlling-proof {
  display: grid;
  gap: 0.1rem;
}

.v2-controlling-proof .v2-kv {
  font-size: 0.74rem;
}

.v2-card-subhead {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0.35rem 0 0.15rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-row);
}

.v2-card-subhead:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.v2-cards-single {
  grid-template-columns: minmax(260px, 480px);
}

.v2-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
}

.v2-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-row);
}

.v2-card-body {
  flex: 1;
}

.v2-kv {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.76rem;
  padding: 0.12rem 0;
}

.v2-kv-label {
  color: var(--muted);
}

.v2-kv-value {
  font-weight: 600;
  text-align: right;
}

.v2-card-result {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-row);
  display: flex;
  justify-content: flex-end;
}

.v2-chip {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.v2-chip-pass {
  background: color-mix(in srgb, var(--success) 16%, transparent);
  color: var(--success);
  border: 1px solid var(--success);
}

.v2-chip-warn {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.v2-chip-fail {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.v2-chip-muted {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* Compliance issue lines */
.v2-issue {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.76rem;
  padding: 0.18rem 0;
}

.v2-issue-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-top: 0.28rem;
  flex-shrink: 0;
}

.v2-issue-error .v2-issue-dot { background: var(--danger); }
.v2-issue-warn .v2-issue-dot { background: var(--warning); }
.v2-issue-ok .v2-issue-dot { background: var(--success); }

/* Jump-to-edit flash on the input sheet */
@keyframes v2RowFlash {
  0%, 60% { box-shadow: inset 0 0 0 99rem rgba(74, 144, 226, 0.18); }
  100% { box-shadow: none; }
}

#runsBody tr.v2-row-flash td {
  animation: v2RowFlash 1.8s ease-out;
}

/* ---------------------------------------------------------------------------
 * Print: drop the 2.0 chrome and bring the classic schedule table back
 * ------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------
   Save / Export page — replaces the work views while open
   --------------------------------------------------------------------------- */
@media screen {
  body.v2-export-open .work-view {
    display: none !important;
  }

  /* Plan drop zone visibility is controlled by the [hidden] attribute in JS —
     not by blanket display:none rules that broke New Project import. */
  body.v2-dash-open:not(.v2-dash-welcome) #planDropZone {
    display: none !important;
  }

  body.v2-dash-open.v2-dash-welcome #planDropZone:not([hidden]) {
    display: block !important;
  }
}

/* ---------------------------------------------------------------------------
   Dashboard — recent-projects workspace shown when 2.0 opens
   --------------------------------------------------------------------------- */
@media screen {
  body.v2-dash-open .work-view,
  body.v2-dash-open .work-tabs-bar,
  body.v2-dash-open .v2-stepper,
  body.v2-dash-open .panel-project,
  body.v2-dash-open:not(.v2-dash-welcome) #planDropZone {
    display: none !important;
  }

  body.v2-dash-open.v2-dash-welcome #planDropZone:not([hidden]) {
    display: block !important;
  }

  /* The layout grid reserves named rows for hidden panels — collapse it so
     the dashboard sits right under the top bar */
  body.v2-dash-open main.layout {
    display: block;
  }
}

.v2-brand-home {
  cursor: pointer;
  border-radius: 8px;
}

.v2-brand-home:hover {
  background: rgba(255, 255, 255, 0.06);
}

.v2-dash {
  margin-top: 0.25rem;
  padding: 0.5rem 0 1.5rem;
}

.v2-dash-head h3 {
  margin: 0 0 0.3rem;
  font-size: 1.45rem;
}

.v2-dash-head p {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.v2-dash-head-brand .v2-dash-product {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
}

.v2-dash-tagline {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.v2-dash-footnote {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  max-width: 52rem;
}

.v2-dash-command {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.v2-dash-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel, rgba(255, 255, 255, 0.03));
  padding: var(--space-3) var(--space-3);
}

.v2-dash-panel-title {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.v2-dash-stepper-mini {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-x: auto;
}

.v2-dash-step {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.25rem 0.35rem;
  cursor: pointer;
  border-radius: 8px;
  white-space: nowrap;
}

.v2-dash-step:hover {
  background: rgba(255, 255, 255, 0.06);
}

.v2-dash-step-dot {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.v2-dash-step-done .v2-dash-step-dot {
  background: rgba(76, 175, 125, 0.2);
  border-color: rgba(76, 175, 125, 0.45);
  color: #8fd4a8;
}

.v2-dash-step-current .v2-dash-step-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #111;
}

.v2-dash-step-line {
  width: 1rem;
  height: 1px;
  background: var(--border);
  margin: 0 0.15rem;
  flex-shrink: 0;
}

.v2-dash-job-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.v2-dash-job-meta {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.v2-dash-job-name {
  font-size: 1.05rem;
  font-weight: 700;
}

.v2-dash-job-loc,
.v2-dash-job-feeders {
  font-size: 0.85rem;
  color: var(--muted);
}

.v2-dash-job-empty p {
  margin: 0 0 0.65rem;
  color: var(--muted);
}

.v2-dash-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-2);
}

.v2-dash-health-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: default;
}

button.v2-dash-health-card {
  cursor: pointer;
}

button.v2-dash-health-card:hover {
  border-color: var(--muted);
}

.v2-dash-health-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
}

.v2-dash-health-label {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.25;
}

.v2-dash-health-warning {
  border-color: color-mix(in srgb, var(--warning) 45%, transparent);
  background: var(--warning-bg);
}

.v2-dash-health-danger {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.v2-dash-next-action {
  border-width: 1px;
}

.v2-dash-next-msg {
  margin: 0 0 var(--space-3);
  font-size: 0.95rem;
  line-height: 1.45;
}

.v2-dash-next-warning {
  border-color: color-mix(in srgb, var(--warning) 45%, transparent);
}

.v2-dash-next-danger {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

.v2-dash-continue {
  font-size: 0.95rem;
  padding: 0.55rem 1.2rem;
  margin-bottom: 0;
}

.v2-dash-group-title {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.v2-dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 1.2rem;
}

.v2-dash-grid-first {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.v2-dash-card-wrap {
  position: relative;
  min-width: 0;
}

.v2-dash-card-wrap .v2-dash-card {
  width: 100%;
  height: 100%;
  padding-right: 2.35rem;
}

.v2-dash-card-delete {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.55rem;
  height: 1.55rem;
  border: none;
  border-radius: 6px;
  background: rgba(15, 20, 25, 0.55);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.v2-dash-card-wrap:hover .v2-dash-card-delete,
.v2-dash-card-delete:focus-visible {
  opacity: 1;
}

.v2-dash-card-delete:hover {
  background: rgba(255, 107, 107, 0.2);
  color: var(--red);
}

.v2-dash-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel, rgba(255, 255, 255, 0.03));
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.v2-dash-card:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.v2-dash-card-current {
  border-color: var(--blue);
}

.v2-dash-card-name {
  font-size: 1rem;
  font-weight: 700;
}

.v2-dash-card-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.v2-dash-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
  padding-right: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.v2-dash-card-badge {
  position: absolute;
  top: auto;
  bottom: 10px;
  left: 12px;
  right: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.v2-dash-card-new {
  border-style: dashed;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.v2-dash-card-plus {
  font-size: 1.5rem;
  line-height: 1;
}

.v2-dash-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media print {
  .v2-dash {
    display: none !important;
  }
}

/* Empty feeders table — quick start */
.v2-ftable-empty-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
}

.v2-ftable-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.v2-export {
  margin-top: 0.25rem;
}

.v2-export-head h3 {
  margin: 0 0 0.3rem;
  font-size: 1.25rem;
}

.v2-export-head p {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.v2-po-sanity-wrap {
  margin: -0.35rem 0 1rem;
}

.v2-po-sanity-wrap .po-sanity-check {
  margin: 0;
}

.v2-export-group-title {
  margin: 1.3rem 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.v2-export-group-hint {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.v2-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 0.7rem;
}

.v2-export-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.v2-export-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.v2-export-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.v2-export-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.v2-export-desc {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.v2-export-btns {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.v2-export-btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  white-space: nowrap;
}

.v2-export-card-action {
  border-left: 3px solid var(--blue);
}

/* The email card carries extra Attach / Format controls, so give it the full
   row width instead of cramming it into a narrow grid cell. */
.v2-export-card-email {
  grid-column: 1 / -1;
}

/* "Include pricing" toggle in the page header */
.v2-export-pricing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input, rgba(0, 0, 0, 0.04));
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.v2-export-pricing input {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.v2-export-pricing-off {
  border-color: var(--warn, #b58900);
  color: var(--warn, #b58900);
}

/* Cost card greyed out when pricing is excluded */
.v2-export-card-off {
  opacity: 0.55;
}

.v2-export-card-off .v2-export-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Email attachment picker */
.v2-export-attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.v2-export-attach {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
  font-size: 0.88rem;
}

.v2-export-format select {
  max-width: 150px;
}

.v2-export-format-off {
  opacity: 0.5;
}

.v2-export-attach-label {
  font-weight: 600;
  color: var(--muted, inherit);
  white-space: nowrap;
}

.v2-export-attach select {
  flex: 1;
  min-width: 0;
  max-width: 280px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input, #fff);
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

/* Supplier send review modal */
.v2-supplier-review {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem 1rem;
}

.v2-supplier-review[hidden] {
  display: none;
}

.v2-supplier-review-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.v2-supplier-review-dialog {
  position: relative;
  width: min(640px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.v2-supplier-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.v2-supplier-review-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.v2-supplier-review-body {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.v2-supplier-review-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.v2-supplier-review-sanity .po-sanity-check {
  margin: 0;
}

.v2-supplier-review-blocked {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
  font-size: 0.9rem;
}

.v2-supplier-review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 560px) {
  .v2-supplier-review-grid {
    grid-template-columns: 1fr;
  }
}

.v2-supplier-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.v2-supplier-field-body {
  flex: 1;
}

.v2-supplier-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.v2-supplier-optional {
  font-weight: 500;
  opacity: 0.85;
}

.v2-supplier-field input,
.v2-supplier-field textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input, #fff);
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
}

.v2-supplier-field textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.45;
}

.v2-supplier-review-sub {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
}

.v2-supplier-review-attach-summary {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
}

.v2-supplier-review-formats {
  margin: 0 0 0.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.v2-supplier-review-formats legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.25rem;
}

.v2-supplier-format-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.v2-supplier-review-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

body.v2-supplier-review-open {
  overflow: hidden;
}

/* Plan import evidence drawer (Review Extraction step) */
.v2-plan-evidence {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.v2-plan-evidence[hidden] {
  display: none !important;
}

.v2-plan-evidence-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, 0.72);
}

.v2-plan-evidence-dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--v2-surface, #151b24);
  border: 1px solid var(--v2-border, #2a3444);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.v2-plan-evidence-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--v2-border, #2a3444);
}

.v2-plan-evidence-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.v2-plan-evidence-body {
  padding: 1rem 1.1rem 1.25rem;
  overflow: auto;
  font-size: 0.92rem;
  line-height: 1.5;
}

.v2-plan-evidence-body code {
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--v2-surface-2, #1c2430);
}

.v2-plan-evidence-body .hint {
  color: var(--v2-muted, #8b98a8);
  font-size: 0.88em;
}

body.v2-plan-evidence-open {
  overflow: hidden;
}

.v2 .plan-import-evidence-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.v2 .plan-import-evidence-btn {
  font-size: 0.72rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--v2-border, #2a3444);
  background: var(--v2-surface-2, #1c2430);
  color: var(--v2-accent, #6eb6ff);
}


/* ---------------------------------------------------------------------------
 * Calculators — top-bar menu + modal
 * ------------------------------------------------------------------------- */
.v2-bar-calc {
  position: relative;
}

.v2-calc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.v2-calc-btn:hover {
  border-color: var(--blue);
}

.v2-calc-caret {
  color: var(--muted);
  font-size: 0.7rem;
}

.v2-calc-menu {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  min-width: 14rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  padding: 0.3rem;
  z-index: 80;
}

.v2-calc-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text);
}

.v2-calc-menu-item:hover {
  background: var(--surface-2);
}

.v2-calc-menu-icon {
  font-size: 1rem;
}

.v2-calc-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem 1rem;
}

.v2-calc-modal[hidden] {
  display: none;
}

.v2-calc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.v2-calc-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.v2-calc-dialog-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

/* The brand banner only appears in phone mode (full-screen calculators). */
.v2-calc-mobile-brand {
  display: none;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.7rem 0.9rem 0.55rem;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.v2-calc-mobile-brand .v2-brand-bolt {
  color: var(--blue);
}

.v2-calc-mobile-sub {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: auto;
}

.v2-calc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
}

.v2-calc-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  background: none;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  white-space: nowrap;
}

.v2-calc-tab:hover {
  color: var(--text);
}

.v2-calc-tab.active {
  background: var(--surface);
  border-color: var(--blue);
  color: var(--text);
}

.v2-calc-x {
  flex-shrink: 0;
  border: none;
  background: none;
  font-size: 1rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 7px;
}

.v2-calc-x:hover {
  background: var(--surface);
  color: var(--text);
}

.v2-calc-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  flex: 1;
}

.v2-calc-hero {
  flex-shrink: 0;
  padding: 0.85rem 1rem 0.75rem;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

.v2-calc-hero-card {
  text-align: center;
}

.v2-calc-hero-card.ok {
  border-left: none;
}

.v2-calc-hero-card.bad {
  border-left: none;
}

.v2-calc-hero-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.v2-calc-hero-value {
  font-size: clamp(1.65rem, 5.5vw, 2.15rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.v2-calc-hero-card.ok .v2-calc-hero-value {
  color: var(--green, #16a34a);
}

.v2-calc-hero-card.bad .v2-calc-hero-value {
  color: var(--red, #dc2626);
}

.v2-calc-hero-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
  line-height: 1.35;
}

.v2-calc-hero-status {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-2);
}

.v2-calc-hero-card.ok .v2-calc-hero-status {
  color: var(--green, #16a34a);
  background: color-mix(in srgb, var(--green, #16a34a) 12%, var(--surface-2));
}

.v2-calc-hero-card.bad .v2-calc-hero-status {
  color: var(--red, #dc2626);
  background: color-mix(in srgb, var(--red, #dc2626) 12%, var(--surface-2));
}

.v2-calc-hero-empty {
  color: var(--muted);
  font-size: 0.88rem;
}

.v2-calc-hero-empty p {
  margin: 0;
}

.v2-calc-hero-ground {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
}

.v2-calc-hero .v2-calc-fill-verdict {
  margin: 0;
  padding: 0.5rem 0 0.25rem;
  border-bottom: none;
}

.v2-calc-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.v2-calc-tab-hint {
  margin: 0;
  padding: 0.65rem 1rem 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.v2-calc-form-essentials {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.v2-calc-fill-auto-note {
  margin: 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.v2-calc-advanced {
  margin: 0.75rem 1rem 0;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.v2-calc-advanced-summary {
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.v2-calc-advanced-summary::-webkit-details-marker {
  display: none;
}

.v2-calc-advanced-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0 0.75rem 0.75rem;
  border-top: 1px dashed var(--border);
}

.v2-calc-details-panel {
  margin: 0.75rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.v2-calc-details-summary {
  padding: 0.6rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.v2-calc-details-summary::-webkit-details-marker {
  display: none;
}

.v2-calc-details-panel .v2-calc-result {
  padding: 0 0.75rem 0.75rem;
  background: transparent;
}

.v2-calc-inline-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.v2-calc-driver {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}

.v2-calc-driver-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.45rem 0.35rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
}

.v2-calc-driver-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.v2-calc-driver-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
}

.v2-calc-tab-short {
  display: none;
}

.v2-calc-tab-icon {
  flex-shrink: 0;
}

.v2-calc-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.65rem 1rem 0.75rem;
  border-right: none;
}

.v2-calc-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
}

.v2-calc-field-label {
  font-weight: 600;
  color: var(--muted);
}

.v2-calc-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.v2-calc-drive-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
}

.v2-calc-drive-btn:hover {
  border-color: var(--blue);
  color: var(--text);
}

.v2-calc-drive-btn.active {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 18%, var(--surface-2));
  color: var(--text);
}

.v2-calc-field-drive {
  padding: 0.45rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--blue) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--blue) 22%, var(--border));
}

.v2-calc-amp-link-hint {
  margin: 0.15rem 0 0.35rem;
  line-height: 1.4;
}

.v2-calc-field-hint {
  font-size: 0.72rem;
  color: var(--muted);
}

.v2-calc-field select,
.v2-calc-field input,
.v2-calc-cond-row select,
.v2-calc-cond-row input {
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-input, var(--surface-2));
  color: var(--text);
}

.v2-calc-cond-row [data-calc="cond-count"] {
  min-width: 0;
  padding-left: 0.35rem;
  padding-right: 1.4rem;
}

.v2-calc-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.v2-calc-subhead {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 0.2rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}

.v2-calc-conductors {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.v2-calc-cond-head {
  display: grid;
  grid-template-columns: 4.2rem 1fr 4rem 1.6rem;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.v2-calc-cond-row {
  display: grid;
  grid-template-columns: 4.2rem 1fr 4rem 1.6rem;
  gap: 0.35rem;
  align-items: center;
}

.v2-calc-cond-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.15;
}

.v2-calc-cond-row.is-ground .v2-calc-cond-label {
  color: var(--accent);
}

.v2-calc-cond-row.is-neutral .v2-calc-cond-label {
  color: var(--blue, #3b82f6);
}

.v2-calc-fill-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.v2-calc-fill-actions .btn {
  flex: 1;
  min-width: 10rem;
}

.v2-calc-fill-calc-btn {
  width: 100%;
  margin: 0.35rem 0 0.65rem;
}

.v2-calc-cond-spacer {
  display: block;
  min-height: 2rem;
}

.v2-calc-cond-del {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  padding: 0.35rem 0;
  font-size: 0.8rem;
}

.v2-calc-cond-del:hover {
  border-color: var(--red);
  color: var(--red);
}

.v2-calc-cond-add {
  align-self: flex-start;
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
}

.v2-calc-fill-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}

.v2-calc-fill-override.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  font-weight: 700;
}

.v2-calc-fill-nec-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
}

.v2-calc-fill-nec-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-right: 0.15rem;
}

.v2-calc-fill-verdict {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.15rem;
  margin: -0.25rem -1rem 1rem;
  padding: 1.35rem 1rem 1.15rem;
  border-bottom: 3px solid transparent;
}

.v2-calc-fill-verdict.ok {
  background: color-mix(in srgb, var(--green, #16a34a) 14%, var(--surface-2));
  border-bottom-color: var(--green, #16a34a);
}

.v2-calc-fill-verdict.bad {
  background: color-mix(in srgb, var(--red, #dc2626) 14%, var(--surface-2));
  border-bottom-color: var(--red, #dc2626);
}

.v2-calc-fill-verdict-pct {
  font-size: clamp(1.75rem, 6vw, 2.35rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.v2-calc-fill-verdict.ok .v2-calc-fill-verdict-pct {
  color: var(--green, #16a34a);
}

.v2-calc-fill-verdict.bad .v2-calc-fill-verdict-pct {
  color: var(--red, #dc2626);
}

.v2-calc-fill-verdict-label {
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.05;
}

.v2-calc-fill-verdict.ok .v2-calc-fill-verdict-label {
  color: var(--green, #16a34a);
}

.v2-calc-fill-verdict.bad .v2-calc-fill-verdict-label {
  color: var(--red, #dc2626);
}

.v2-calc-fill-verdict-limit {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.v2-calc-result {
  padding: 1rem;
  background: var(--surface-2);
}

.v2-calc-result-grid {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.v2-calc-stat {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.v2-calc-stat:last-child {
  border-bottom: none;
}

.v2-calc-stat-label {
  flex: 1;
  min-width: 8rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.v2-calc-stat-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.v2-calc-stat-extra {
  width: 100%;
  font-size: 0.74rem;
  color: var(--muted);
}

.v2-calc-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.v2-calc-badge.ok {
  background: color-mix(in srgb, var(--success) 22%, transparent);
  color: var(--success);
}

.v2-calc-badge.bad {
  background: color-mix(in srgb, var(--danger) 22%, transparent);
  color: var(--danger);
}

.v2-calc-warn {
  margin: 0.7rem 0 0;
  font-size: 0.78rem;
  color: var(--warning);
}

.v2-calc-note {
  margin: 0.7rem 0 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--muted);
}

.v2-calc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.v2-calc-math {
  margin-top: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  overflow: hidden;
}

.v2-calc-math-summary {
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--text);
}

.v2-calc-math-summary::-webkit-details-marker {
  display: none;
}

.v2-calc-math-summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.45rem;
  color: var(--blue);
  transition: transform 0.15s ease;
}

.v2-calc-math[open] .v2-calc-math-summary::before {
  transform: rotate(90deg);
}

.v2-calc-math-body {
  padding: 0 0.75rem 0.75rem;
  border-top: 1px solid var(--border);
}

.v2-calc-math-step {
  padding-top: 0.65rem;
}

.v2-calc-math-step + .v2-calc-math-step {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
}

.v2-calc-math-step-title {
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.4rem;
}

.v2-calc-math-line {
  font-family: var(--font);
  font-size: 0.84rem;
  line-height: 1.55;
  margin: 0 0 0.35rem;
  color: var(--muted);
}

.v2-calc-math-answer {
  font-family: var(--font);
  font-size: 0.86rem;
  line-height: 1.5;
  margin: 0.4rem 0 0;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--blue) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--border));
  color: var(--text);
}

.v2-calc-math-answer strong {
  font-weight: 650;
  color: var(--text);
}

.v2-calc-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.v2-calc-temp-table {
  margin-top: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.v2-calc-temp-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  font-size: 0.8rem;
}

.v2-calc-temp-row span {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
}

.v2-calc-temp-row:last-child span {
  border-bottom: none;
}

.v2-calc-temp-head {
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
}

@media (max-width: 720px) {
  .v2-calc-tab-text {
    display: none;
  }

  .v2-calc-tab-short {
    display: inline;
  }

  .v2-calc-tab {
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.45rem 0.55rem;
    min-width: 3.1rem;
  }

  .v2-calc-driver {
    grid-template-columns: 1fr;
  }
}

@media print {
  .v2-bar,
  .v2-stepper,
  .v2-feeders,
  .v2-calc-modal,
  .v2-export {
    display: none !important;
  }

  .v2 #work-view-schedule .hscroll-host {
    display: block !important;
  }
}

@media (max-width: 1100px) {
  .v2-step-sub { display: none; }
}

/* ---------------------------------------------------------------------------
   Mid-size screens (tablets / small laptops) — let the chrome breathe and
   wrap instead of overflowing. The wide data tables keep their own
   horizontal scroll, so they stay usable here.
   --------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .v2-bar {
    row-gap: 0.4rem;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  .v2-bar-right {
    flex-wrap: wrap;
    justify-content: flex-end;
    width: 100%;
  }

  .v2-export-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------------
   Phone mode — the workspace is hidden and the standalone calculators take
   over the whole screen. Toggled by body.v2-mobile (set in v2.js) so the
   layout only collapses when the calculators are actually mounted.
   --------------------------------------------------------------------------- */
body.v2-mobile .app-header,
body.v2-mobile #v2Bar,
body.v2-mobile main.layout {
  display: none !important;
}

body.v2-mobile {
  overflow: hidden;
}

body.v2-mobile .v2-calc-modal {
  padding: 0;
  z-index: 400;
}

body.v2-mobile .v2-calc-backdrop {
  display: none;
}

body.v2-mobile .v2-calc-dialog {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

body.v2-mobile .v2-calc-mobile-brand {
  display: flex;
}

body.v2-mobile .v2-calc-x {
  display: none;
}

/* Single-column body + roomier touch targets on phones. */
body.v2-mobile .v2-calc-body {
  flex: 1;
  min-height: 0;
}

body.v2-mobile .v2-calc-hero {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

body.v2-mobile .v2-calc-form {
  border-right: none;
  padding-bottom: 0.5rem;
}

body.v2-mobile .v2-calc-tab-text {
  display: none;
}

body.v2-mobile .v2-calc-tab-short {
  display: inline;
}

body.v2-mobile .v2-calc-tab {
  flex-direction: column;
  gap: 0.08rem;
  padding: 0.4rem 0.5rem;
  min-width: 2.85rem;
  font-size: 0.68rem;
}

body.v2-mobile .v2-calc-tab-icon {
  font-size: 1rem;
}

body.v2-mobile .v2-calc-driver {
  grid-template-columns: 1fr;
}

body.v2-mobile .v2-calc-details-panel {
  margin-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
}

body.v2-mobile .v2-calc-tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
}

body.v2-mobile .v2-calc-tab {
  font-size: 0.82rem;
  padding: 0.5rem 0.7rem;
}

body.v2-mobile .v2-calc-form input,
body.v2-mobile .v2-calc-form select {
  font-size: 16px; /* keeps iOS from auto-zooming on focus */
  min-height: 2.4rem;
}

/* ---------------------------------------------------------------------------
   Calculator-only PWA (calc.html) — slim header + full-screen calculators,
   no auth, no project workspace. Works on all screen sizes.
   --------------------------------------------------------------------------- */
:root {
  --calc-only-bar-height: 2.75rem;
}

body.calc-only {
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0);
}

body.calc-only .site-chrome,
body.calc-only .app-header,
body.calc-only #accountGate,
body.calc-only main.layout,
body.calc-only #v2Bar,
body.calc-only .v2-stepper,
body.calc-only .v2-feeders {
  display: none !important;
}

.calc-only-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--calc-only-bar-height);
  padding: 0.45rem 0.75rem;
  padding-top: calc(0.45rem + env(safe-area-inset-top, 0));
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.calc-only-brand {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}

.calc-only-bolt {
  color: var(--blue);
  font-size: 1.05rem;
}

.calc-only-name {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.calc-only-tag {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.calc-only-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.calc-only-full-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.calc-only-full-link:hover {
  color: var(--text);
}

.calc-install-btn[hidden] {
  display: none;
}

body.calc-only .v2-calc-modal {
  inset: var(--calc-only-bar-height) 0 0;
  padding: 0;
  z-index: 400;
}

body.calc-only .v2-calc-backdrop {
  display: none;
}

body.calc-only .v2-calc-dialog {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

body.calc-only .v2-calc-hero {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

body.calc-only .v2-calc-tab-text {
  display: none;
}

body.calc-only .v2-calc-tab-short {
  display: inline;
}

body.calc-only .v2-calc-tab {
  flex-direction: column;
  gap: 0.08rem;
  padding: 0.4rem 0.5rem;
  min-width: 2.85rem;
  font-size: 0.68rem;
}

body.calc-only .v2-calc-mobile-brand,
body.calc-only .v2-calc-x {
  display: none;
}

body.calc-only .v2-calc-body {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}

@media (max-width: 720px) {
  body.calc-only .v2-calc-body {
    grid-template-columns: minmax(0, 1fr);
  }

  body.calc-only .v2-calc-form {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .calc-only-tag {
    display: none;
  }
}

/* PWA install prompt — shared by calc.html and index.html */
.pwa-install-sheet {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
  background: rgba(0, 0, 0, 0.45);
}

.pwa-install-sheet[hidden] {
  display: none;
}

.pwa-install-card {
  width: min(420px, 100%);
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.pwa-install-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 800;
}

.pwa-install-body {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.pwa-install-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* PO lock + field foreman sheet */
.po-lock-banner {
  margin: 0.5rem 0 0.75rem;
  padding: 0.65rem 0.85rem;
  background: color-mix(in srgb, var(--amber, #c8860a) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--amber, #c8860a) 35%, var(--border));
  border-radius: 10px;
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.v2-po-lock-banner {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.92rem;
}

.v2-po-lock-banner--locked {
  background: color-mix(in srgb, #c8860a 10%, var(--surface));
  border-color: color-mix(in srgb, #c8860a 30%, var(--border));
}

.po-quote-block {
  margin: 0.5rem 0 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--blue) 6%, var(--surface));
}

.po-quote-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}

.po-quote-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.po-quote-status-ok { color: var(--green, #22c55e); }
.po-quote-status-warn { color: var(--amber, #c8860a); }

.po-quote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0;
}

.po-quote-drop {
  margin-top: 0.35rem;
  padding: 0.65rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
  border-radius: 8px;
  border: 1px dashed color-mix(in srgb, var(--muted) 40%, transparent);
}

.po-quote-drop-active {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 8%, transparent);
}

.cost-est-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--amber) 18%, transparent);
  color: var(--amber, #c8860a);
  vertical-align: middle;
  margin-right: 0.15rem;
}

.card-est-was {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.v2-foreman-preview-wrap {
  margin: 0 0 1.25rem;
  overflow-x: auto;
}

.foreman-sheet-title {
  font-size: 1.35rem;
  margin: 0;
}

.foreman-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.05rem;
}

.foreman-sheet-table th,
.foreman-sheet-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.foreman-row-delivered {
  background: color-mix(in srgb, #2e7d4a 8%, transparent);
}

.foreman-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 600;
}

.foreman-check input {
  width: 1.25rem;
  height: 1.25rem;
}

.foreman-lock-note {
  font-size: 0.9rem;
  color: var(--muted);
}

.foreman-row-note td {
  padding-top: 0;
  padding-bottom: 0.85rem;
  border-bottom: none;
}

.foreman-delivery-note-wrap {
  margin-top: -0.15rem;
  padding: 0.55rem 0.65rem 0.7rem;
  background: color-mix(in srgb, var(--surface) 90%, var(--border));
  border-radius: 8px;
}

.foreman-delivery-note-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.foreman-delivery-note {
  width: 100%;
  box-sizing: border-box;
  font-size: 0.95rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  min-height: 2.5rem;
  font-family: inherit;
  background: var(--surface);
}

.foreman-delivery-note:focus {
  outline: 2px solid color-mix(in srgb, var(--accent, #1a3a5c) 35%, transparent);
  outline-offset: 1px;
}

.foreman-delivery-note-print {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
