/* Production adapters for docs/multi-program-wireframe.html.
   Keep layout and tokens synchronized with the approved reference. */
:root {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, .10);
  --line-strong: rgba(0, 0, 0, .18);
  --bg: #fff9f2;
  --page: #fff9f2;
  --panel: #ffffff;
  --panel-tint: #f3e6d5;
  --soft: #f3e6d5;
  --accent: #800020;
  --accent-strong: #65001a;
  --accent-dark: #65001a;
  --blue: #800020;
  --rose: #d45060;
  --shadow: 0 12px 40px rgba(0, 0, 0, .07);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, rgba(128, 0, 32, .10), transparent 28rem),
    radial-gradient(circle at 95% 10%, rgba(212, 80, 96, .08), transparent 25rem),
    var(--page);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", sans-serif;
}

.bar.topbar {
  position: sticky;
  inset: 0 0 auto;
  min-height: 64px;
  padding: 0 28px;
  gap: 0;
  border: 0;
  border-bottom: .5px solid var(--line);
  background: rgba(250, 250, 252, .78);
  backdrop-filter: saturate(180%) blur(22px);
}

.brand-lockup { min-width: auto; gap: 10px; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(145deg, #1d1d1f, #55555a); }
.brand { font-size: 16px; }
.bar .app-nav { margin-left: 24px; padding: 3px; gap: 3px; border: 0; background: rgba(118, 118, 128, .12); }
.bar .app-nav button { min-height: auto; padding: 6px 13px; color: var(--muted); font-weight: 700; }
.bar .app-nav button.active { color: var(--ink); background: white; box-shadow: 0 1px 4px rgba(0, 0, 0, .10); }
.topbar-note { margin-left: 30px; color: var(--muted); }
.identity { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.identity .who { margin: 0; color: var(--ink); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--accent-dark); background: var(--soft); font-weight: 800; }
.identity .signin { margin: 0; }

main { width: min(1220px, calc(100% - 40px)); max-width: none; margin: 0 auto; padding: 34px 0 70px; }
.view { gap: 0; }
.section-heading { align-items: end; margin-bottom: 26px; }
.section-heading h1 { margin: 0 0 10px; font-size: clamp(34px, 5vw, 52px); line-height: 1; letter-spacing: -.045em; font-weight: 720; }
.section-heading h2 { font-size: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 12px; letter-spacing: .1em; }
.lead { max-width: 690px; color: var(--muted); font-size: 16px; }
.home-actions, .action-row { gap: 9px; }
button, .button { min-height: 40px; padding: 9px 15px; border: 1px solid var(--line-strong); border-radius: 980px; color: var(--ink); background: white; font-weight: 700; }
button.primary, .primary { border-color: var(--accent); color: white; background: var(--accent); }
button.primary:hover, .primary:hover { background: var(--accent-dark); }
.secondary-action { background: var(--soft); }
.portfolio-scope-select {
  min-height: 40px;
  padding: 9px 38px 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 980px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d1d1f' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 15px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.portfolio-list-heading { margin: 26px 0 12px; }
.portfolio-list-heading h2 { font-size: 12px; letter-spacing: .1em; }
.portfolio-list-heading span { font-size: 12px; }

.security-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding: 13px 15px;
  border: 1px solid rgba(128, 0, 32, .18);
  border-radius: 18px;
  background: rgba(232, 244, 255, .82);
}
.security-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--accent-dark); background: #dcebff; font-weight: 900; }
.security-strip strong { display: block; }
.security-strip div span { color: #4f6558; }
.connection { padding: 5px 9px; border-radius: 999px; color: var(--accent-dark); background: #dcebff; font-size: 12px; font-weight: 800; white-space: nowrap; }

.ops-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 18px; }
.metric-card { min-height: 0; padding: 18px; border: .5px solid var(--line); border-radius: 20px; background: rgba(255, 255, 255, .92); box-shadow: 0 5px 24px rgba(0, 0, 0, .035); }
.metric-card span { color: var(--muted); font-size: 12px; }
.metric-card strong { margin-top: 5px; font-size: 25px; }
.metric-card small { display: none; }

.program-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.program-card {
  display: flex;
  flex-direction: column;
  min-height: 270px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.program-card:hover { transform: translateY(-2px); border-color: rgba(128, 0, 32, .35); }
.program-card.active { border-color: rgba(128, 0, 32, .55); box-shadow: 0 0 0 3px rgba(128, 0, 32, .10); }
.program-card-body { display: flex; flex: 1; flex-direction: column; align-items: stretch; padding: 20px; }
.program-card-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.program-card-heading strong { display: block; margin-top: 3px; font-size: 22px; line-height: 1.15; }
.program-code { color: var(--accent); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.program-revision { display: block; margin-top: 8px; color: var(--muted); }
.program-gate { display: grid; place-items: center; min-width: 58px; min-height: 48px; padding: 7px; border: 0; border-radius: 10px; font-size: 12px; font-weight: 900; }
.program-gate.green { color: #155d3e; background: #dff3e7; }
.program-gate.amber { color: #81510e; background: #fff0cf; }
.program-gate.red { color: #8e2d24; background: #fbe2de; }
.program-gate.grey, .program-gate.unknown { color: #58615b; background: #e9ecea; }
.program-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.program-card-meta span { display: block; color: var(--muted); font-size: 11px; }
.program-card-meta strong { display: block; margin-top: 2px; }
.program-card-source { margin-top: 14px; color: var(--muted); font-size: 12px; }
.program-card-actions { display: grid; grid-template-columns: 1fr 1fr; margin: auto -20px -20px; padding: 12px 20px; border-top: 1px solid var(--line); background: #fbfcfb; }
.program-card-actions button { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.program-card-actions .primary { grid-column: 1 / -1; order: -1; color: white; border-color: var(--accent); background: var(--accent); }
.program-card-actions .play-button { padding-left: 30px; }
.program-card-actions .primary:hover { color: white; background: var(--accent-strong); }
.program-card-media { height: 100px; }

.surface-panel, .sync-panel, .status-box { border: .5px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.program-portfolio-panel, .monitor-portfolio-panel { padding: 18px; margin-bottom: 18px; }
.program-portfolio-panel .program-card-grid { margin-top: 14px; }
.back-link { justify-self: start; margin-bottom: 16px; padding: 0; min-height: 0; border: 0; color: var(--accent); background: transparent; }
.selected-program-summary {
  display: grid;
  gap: 3px;
  padding: 18px;
  border: 1px solid rgba(128, 0, 32, .16);
  border-radius: 16px;
  background: var(--soft);
}
.automatic-evidence-panel { margin-bottom: 18px; }
.automatic-evidence-panel .panel-heading { align-items: start; }
.automatic-evidence-panel .panel-heading p { max-width: 760px; margin-bottom: 0; }
.automatic-program-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 180px 110px; gap: 12px; margin-top: 18px; }
.automatic-program-toolbar label { margin: 0; }
.automatic-program-toolbar input, .automatic-program-toolbar select { margin-top: 5px; }
.automatic-program-summary { display: flex; align-items: center; gap: 14px; min-height: 52px; }
.automatic-program-summary > span { color: var(--muted); }
.automatic-program-summary .action-row { margin: 0 0 0 auto; }
.automatic-program-summary button { min-height: 34px; padding: 7px 11px; }
.automatic-program-list { min-height: 220px; max-height: 470px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.automatic-program-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.automatic-program-table th { position: sticky; top: 0; z-index: 1; padding: 11px 14px; color: var(--muted); font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .05em; background: #f8f8f7; border-bottom: 1px solid var(--line); }
.automatic-program-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.automatic-program-table tbody tr:last-child td { border-bottom: 0; }
.automatic-program-table tbody tr.selected { background: rgba(128, 0, 32, .04); }
.automatic-program-table tbody tr:hover { background: var(--soft); }
.automatic-program-table th:nth-child(3), .automatic-program-table td:nth-child(3) { width: 130px; }
.automatic-program-table th:nth-child(4), .automatic-program-table td:nth-child(4) { width: 170px; }
.automatic-program-table td:nth-child(3), .automatic-program-table td:nth-child(4) { color: var(--muted); }
.automatic-program-table .automatic-check-column { width: 48px; }
.automatic-program-table input { width: 18px; height: 18px; margin: 0; }
.automatic-program-empty { padding: 36px 20px; color: var(--muted); text-align: center; }
.automatic-program-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 0; }
.automatic-program-pagination button { min-height: 34px; padding: 7px 12px; }
.automatic-save-bar { position: sticky; bottom: 12px; z-index: 3; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .96); box-shadow: 0 8px 28px rgba(0, 0, 0, .09); backdrop-filter: blur(10px); }
.automatic-save-bar span { color: var(--muted); }
.selected-program-summary strong { font-size: 20px; }
.selected-program-summary > span:last-child { color: var(--muted); font-size: 12px; }
#view-settings .settings-grid { align-items: start; }
#view-settings .setup-form { padding: 20px; }
#view-settings .setup-form > label,
#view-settings .setup-form > .form-grid,
#view-settings .setup-form > .selected-program-summary,
#view-settings .setup-form > .action-row { margin-top: 16px; }
.field-help { display: block; margin-top: 6px; color: var(--muted); font-weight: 400; }
.selected-program-heading { align-items: center; }
.program-media, .program-initials { border-radius: 16px; }
.program-toolbar { margin-bottom: 14px; padding: 4px; border: .5px solid var(--line); border-radius: 14px; background: rgba(226, 226, 231, .72); }
.detail-tabs { margin-bottom: 14px; padding: 4px; border: .5px solid var(--line); border-radius: 14px; background: rgba(226, 226, 231, .72); }
.detail-tab { flex: 1 0 auto; min-height: auto; padding: 9px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; }
.detail-tab.active { color: var(--ink); background: white; box-shadow: 0 2px 6px rgba(0, 0, 0, .06); }
#program-detail-panel { border-radius: 24px; }
#view-program:has(#program-detail-workspace:not([hidden])) .program-picker-heading,
#view-program:has(#program-detail-workspace:not([hidden])) .program-portfolio-panel { display: none; }

.monitor-program-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.monitor-program-card { border: .5px solid var(--line); border-radius: 20px; background: rgba(255, 255, 255, .92); box-shadow: 0 5px 24px rgba(0, 0, 0, .035); }
.monitor-program-card.active { border-color: rgba(128, 0, 32, .55); box-shadow: 0 0 0 3px rgba(128, 0, 32, .10); }
.stages { grid-template-columns: repeat(3, 1fr); }
.stage { border-radius: 12px; }

@media (max-width: 900px) {
  .program-card-grid, .monitor-program-grid { grid-template-columns: 1fr 1fr; }
  .topbar-note { display: none; }
  .automatic-program-toolbar { grid-template-columns: 1fr 1fr; }
  .automatic-program-search { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  main { width: min(100% - 24px, 1220px); padding-top: 22px; }
  .bar.topbar { padding: 0 12px; }
  .identity .avatar, .identity .who { display: none; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .program-card-grid, .monitor-program-grid, .ops-grid { grid-template-columns: 1fr; }
  .security-strip { grid-template-columns: auto 1fr; }
  .connection { grid-column: 2; justify-self: start; }
  .automatic-program-toolbar { grid-template-columns: 1fr; }
  .automatic-program-search { grid-column: auto; }
  .automatic-program-summary { align-items: flex-start; flex-wrap: wrap; padding: 10px 0; }
  .automatic-program-summary .action-row { width: 100%; margin-left: 0; }
  .automatic-program-table th:nth-child(3), .automatic-program-table td:nth-child(3),
  .automatic-program-table th:nth-child(4), .automatic-program-table td:nth-child(4) { display: none; }
  .automatic-save-bar { align-items: stretch; flex-direction: column; }
}
