:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #142536;
  background: #eef3f7;
  font-synthesis: none;
  --ink: #142536;
  --muted: #6a7c8c;
  --line: #d9e3ea;
  --panel: #ffffff;
  --soft: #f6f9fb;
  --blue: #135f8f;
  --blue-dark: #123f60;
  --staging: #9c2e3f;
  --production: #174f72;
  --ok: #167a55;
  --warn: #a66b0e;
  --danger: #b32d3e;
  --shadow: 0 12px 38px rgba(28, 56, 78, .07);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #eef3f7; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 0, rgba(205, 225, 238, .72) 0, transparent 30%),
    linear-gradient(180deg, #f5f8fa 0, #edf3f7 260px, #edf3f7 100%);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.shell { max-width: 1240px; margin: 0 auto; padding: 0 28px 64px; }
.topbar {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #d7e1e8;
}
.brand, .top-actions, .overview-head, .panel-head, .section-caption, .audit-toolbar,
.job-dialog-header, .detail-title, .copy-actions { display: flex; align-items: center; }
.brand { gap: 12px; min-width: 0; }
.brand-mark {
  width: 43px; height: 43px; display: grid; place-items: center;
  border-radius: 13px; background: #153c5a; color: #fff; font-weight: 900;
  box-shadow: 0 8px 22px rgba(18, 63, 96, .15);
}
.brand-copy small, .brand-copy strong { display: block; }
.brand-copy small { font-size: 9px; letter-spacing: .16em; color: #748596; }
.brand-copy strong { margin-top: 1px; font-size: 17px; color: #17364d; }
.version-pill {
  padding: 5px 8px; border-radius: 999px; border: 1px solid #cfdce5;
  background: rgba(255,255,255,.75); color: #446177; font-size: 10px; font-weight: 800;
}
.top-actions { justify-content: flex-end; gap: 11px; flex-wrap: wrap; }
.secure-badge {
  padding: 6px 9px; border-radius: 999px; background: #e9f5ef; border: 1px solid #c8e6d7;
  color: var(--ok); font-size: 11px; font-weight: 750;
}
.current-user { color: #506779; font-size: 12px; font-weight: 700; }
.back-link { color: #145f8c; font-size: 12px; font-weight: 800; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.back-link.unavailable { color: #8d9aa4; pointer-events: none; }

.compact-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end;
  gap: 26px; padding: 34px 0 22px;
}
.eyebrow {
  margin: 0 0 7px; color: #3e7296; font-size: 10px; font-weight: 900;
  letter-spacing: .13em; text-transform: uppercase;
}
.compact-hero h1 {
  max-width: 820px; margin: 0; color: #142f44; font-size: clamp(28px, 3.8vw, 44px);
  line-height: 1.06; letter-spacing: -.035em;
}
.compact-hero > div > p:last-child {
  max-width: 790px; margin: 14px 0 0; color: #5e7180; font-size: 14px; line-height: 1.55;
}
.hero-badges { display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; max-width: 340px; }
.hero-badges span {
  padding: 7px 9px; border-radius: 9px; background: rgba(255,255,255,.78);
  border: 1px solid #d6e1e8; color: #536b7c; font-size: 10px; font-weight: 800;
}

.overview-grid { display: grid; grid-template-columns: 1fr 1fr .82fr; gap: 13px; margin: 3px 0 17px; }
.overview-card {
  min-height: 125px; padding: 18px 20px; border-radius: 17px; color: #fff;
  box-shadow: 0 12px 30px rgba(24, 58, 82, .12); overflow: hidden; position: relative;
}
.overview-card::after {
  content: ""; position: absolute; width: 150px; height: 150px; border-radius: 50%;
  right: -65px; top: -73px; background: rgba(255,255,255,.08);
}
.overview-card.staging { background: linear-gradient(135deg, #7f2636, #b03d50); }
.overview-card.production { background: linear-gradient(135deg, #173e5d, #1d6589); }
.overview-card.portal-card { background: linear-gradient(135deg, #30495a, #537183); }
.overview-head { justify-content: space-between; gap: 10px; margin-bottom: 16px; position: relative; z-index: 1; }
.overview-head span { font-size: 10px; font-weight: 900; letter-spacing: .13em; }
.overview-head b {
  padding: 5px 8px; border: 1px solid rgba(255,255,255,.32); border-radius: 999px;
  font-size: 9px; letter-spacing: .05em;
}
.overview-card > strong { display: block; font-size: 18px; position: relative; z-index: 1; }
.overview-card > small { display: block; margin-top: 6px; color: rgba(255,255,255,.78); font-size: 11px; position: relative; z-index: 1; }
.overview-card.offline { filter: saturate(.45); }
.overview-card.maintenance { background: linear-gradient(135deg, #845815, #c18423); }

.panel {
  margin-top: 16px; padding: 23px; border: 1px solid var(--line); border-radius: 19px;
  background: var(--panel); box-shadow: var(--shadow);
}
.panel-head { justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel h2, .dialog-card h2 { margin: 0; color: #18364d; font-size: 21px; letter-spacing: -.012em; }
.panel-head small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.step {
  width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; background: #e8f1f6; color: #236a93; font-size: 11px; font-weight: 900;
}
.release-layout { display: grid; grid-template-columns: minmax(300px, .82fr) minmax(420px, 1.18fr); gap: 18px; }
.upload-column { min-width: 0; }
.current-release-column {
  min-width: 0; padding: 17px; border: 1px solid #e0e8ed; border-radius: 15px; background: #f9fbfc;
}
.section-caption { justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-caption > span { color: #60798a; font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.section-caption small { color: #8495a1; font-size: 10px; text-align: right; }
.drop-zone {
  min-height: 176px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; text-align: center; border: 2px dashed #bdd0da; border-radius: 15px;
  background: #f7fafc; cursor: pointer; transition: border-color .18s, background .18s, transform .18s;
}
.drop-zone:hover, .drop-zone.drag { border-color: #277ca8; background: #eef7fc; }
.drop-zone.locked { opacity: .6; cursor: not-allowed; }
.drop-zone input { display: none; }
.upload-icon {
  width: 41px; height: 41px; display: grid; place-items: center; margin-bottom: 9px;
  border-radius: 12px; background: #dfeef6; color: #126b98; font-size: 23px; font-weight: 900;
}
.drop-zone strong { color: #26485f; font-size: 14px; }
.drop-zone small { max-width: 570px; margin-top: 5px; color: #738796; font-size: 11px; line-height: 1.45; }
.primary, .secondary, .danger, .filter-chip {
  appearance: none; border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer;
  font-size: 12px; font-weight: 800; transition: transform .12s, opacity .12s, background .12s;
}
.primary { background: #126892; color: #fff; }
.primary:hover:not(:disabled), .danger:hover:not(:disabled) { transform: translateY(-1px); }
.secondary { background: #eef4f7; color: #27556f; border: 1px solid #d4e0e7; }
.secondary:hover:not(:disabled) { background: #e7f0f5; }
.danger { background: var(--danger); color: #fff; }
.primary:disabled, .secondary:disabled, .danger:disabled { opacity: .43; cursor: not-allowed; transform: none; }
.wide { width: 100%; margin-top: 12px; }
.hidden { display: none !important; }
.progress { height: 6px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #dce7ed; }
.progress span { display: block; width: 42%; height: 100%; border-radius: inherit; background: #1f80ad; animation: loading 1.2s infinite ease-in-out; }
@keyframes loading { 0% { transform: translateX(-115%); } 100% { transform: translateX(255%); } }

.release-list, .job-list { display: grid; gap: 10px; }
.empty { padding: 28px; text-align: center; color: #7d8f9d; border: 1px dashed #d5e0e7; border-radius: 12px; font-size: 12px; }
.empty.compact { padding: 18px; }
.release-card { padding: 15px; border: 1px solid #dae5eb; border-radius: 13px; background: #fff; }
.release-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.release-top h3 { margin: 0 0 4px; color: #17374e; font-size: 15px; }
.release-meta { color: #6f8392; font-size: 10px; line-height: 1.4; }
.signature { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; background: #e7f5ee; color: var(--ok); font-size: 9px; font-weight: 900; }
.release-notes { margin: 11px 0 0; padding-left: 18px; color: #566e7f; font-size: 11px; line-height: 1.5; }
.release-notes li + li { margin-top: 2px; }
.promotion-flow { display: grid; grid-template-columns: 1fr 30px 1fr; align-items: stretch; gap: 8px; margin-top: 13px; }
.target-box { padding: 12px; border: 1px solid #dbe6eb; border-radius: 11px; background: #fbfdfe; min-width: 0; }
.target-box > small, .target-box > strong, .target-box > span { display: block; }
.target-box > small { color: #7d8f9d; font-size: 9px; letter-spacing: .06em; }
.target-box > strong { margin: 4px 0; color: #24465e; font-size: 12px; overflow-wrap: anywhere; }
.target-box button { width: 100%; margin-top: 8px; }
.flow-arrow { display: grid; place-items: center; color: #8aa0ad; font-size: 19px; }
.certified { color: var(--ok); font-size: 10px; font-weight: 850; }
.locked { color: #976312; font-size: 10px; font-weight: 800; }
.strategy-badge { margin-top: 7px; padding: 6px 7px; border-radius: 8px; font-size: 9px; font-weight: 850; line-height: 1.35; }
.strategy-badge.safe_fast { background: #e8f5ee; color: #166e4e; }
.strategy-badge.complete { background: #fff0e3; color: #9a5910; }
.strategy-badge.protected, .strategy-badge.unknown { background: #edf3f7; color: #527082; }

.audit-head { margin-bottom: 13px; }
.history-actions { justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.audit-toolbar { justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.filter-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.filter-chip { padding: 7px 10px; background: #f2f6f8; color: #607789; border: 1px solid #dce5ea; font-size: 10px; }
.filter-chip.active { background: #1b5f84; border-color: #1b5f84; color: #fff; }
.job-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 11px; align-items: center;
  padding: 13px 15px; border: 1px solid #dce5ea; border-radius: 12px; background: #fbfdfe;
}
.job-card.active-job { border-color: #bad7e6; box-shadow: inset 3px 0 0 #267ca5; }
.job-main { min-width: 0; }
.job-main h3 { margin: 0 0 3px; color: #24465d; font-size: 13px; }
.job-main small { display: block; color: #7a8c99; font-size: 10px; overflow-wrap: anywhere; }
.job-side-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.mini-tag { padding: 4px 6px; border-radius: 7px; background: #edf3f6; color: #5c7485; font-size: 9px; font-weight: 750; }
.status { display: inline-flex; align-items: center; justify-content: center; padding: 6px 8px; border-radius: 999px; font-size: 9px; font-weight: 900; white-space: nowrap; }
.status.queued { background: #fff2cf; color: #88600a; }
.status.running { background: #e2f0f8; color: #12678f; }
.status.succeeded { background: #e6f5ee; color: #14734f; }
.status.failed { background: #fde9ec; color: #ab2c3c; }
.job-card > .status { grid-column: 2; grid-row: 1; }
.job-card > button { grid-column: 3; grid-row: 1; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 440px;
  padding: 12px 15px; border-radius: 11px; background: #18384e; color: #fff;
  box-shadow: 0 14px 36px rgba(0,0,0,.2); opacity: 0; transform: translateY(10px);
  pointer-events: none; transition: .2s; font-size: 12px;
}
.toast.show { opacity: 1; transform: none; }

dialog { width: min(620px, calc(100% - 26px)); padding: 0; border: 0; border-radius: 20px; background: transparent; }
dialog::backdrop { background: rgba(12, 27, 39, .58); backdrop-filter: blur(4px); }
.dialog-card { position: relative; padding: 27px; border-radius: 19px; background: #fff; box-shadow: 0 30px 90px rgba(0,0,0,.22); }
.dialog-card > p:not(.eyebrow):not(.dialog-error) { color: #607485; line-height: 1.5; font-size: 12px; }
.dialog-close {
  position: absolute; top: 13px; right: 13px; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: #eef3f6; color: #4b6575; font-size: 21px; cursor: pointer; z-index: 2;
}
.danger-text { color: var(--danger); }
.reauth-actions { display: grid; gap: 9px; margin: 17px 0; }
.reauth-actions details { padding: 11px; border: 1px solid #dbe5ea; border-radius: 11px; }
.reauth-actions summary { cursor: pointer; color: #405d70; font-size: 11px; font-weight: 850; }
.reauth-actions label, .production-confirm { display: grid; gap: 5px; margin-top: 9px; color: #607687; font-size: 11px; }
.reauth-actions input, .production-confirm input { width: 100%; padding: 10px; border: 1px solid #c9d7df; border-radius: 9px; outline: none; }
.reauth-actions input:focus, .production-confirm input:focus { border-color: #3c82a8; box-shadow: 0 0 0 3px rgba(60,130,168,.1); }
.production-confirm { margin: 17px 0 5px; }
.dialog-error { min-height: 17px; margin: 7px 0; color: var(--danger); font-size: 11px; }
.migration-note { margin: 0; padding: 9px 11px; border-radius: 9px; background: #fff7e5; color: #795711; font-size: 10px; line-height: 1.45; }

.job-dialog-shell { width: min(1120px, calc(100% - 24px)); max-width: 1120px; }
.job-dialog { max-height: min(92vh, 920px); overflow: auto; padding: 25px; }
.job-dialog-header { justify-content: space-between; gap: 16px; padding-right: 38px; }
.job-dialog-header .status { font-size: 10px; }
.job-summary { margin-top: 5px; color: #6e8190; font-size: 11px; }
.copy-actions { gap: 7px; flex-wrap: wrap; margin: 16px 0 14px; padding: 10px; border: 1px solid #e0e8ed; border-radius: 12px; background: #f8fafb; }
.copy-actions .secondary { padding: 8px 10px; font-size: 10px; }
.job-kpi-grid { display: grid; grid-template-columns: .7fr 1.25fr .7fr 1.6fr; gap: 9px; margin-bottom: 12px; }
.job-kpi-grid > div { min-width: 0; padding: 11px; border: 1px solid #dfe8ed; border-radius: 11px; background: #fbfdfe; }
.job-kpi-grid small, .job-kpi-grid strong { display: block; }
.job-kpi-grid small { color: #7a8c99; font-size: 9px; text-transform: uppercase; letter-spacing: .07em; }
.job-kpi-grid strong { margin-top: 4px; color: #294b62; font-size: 11px; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.compact-mono { font-size: 9px !important; }
.job-detail-grid { display: grid; grid-template-columns: 1.06fr .94fr; gap: 12px; margin-top: 12px; }
.detail-section { min-width: 0; padding: 14px; border: 1px solid #dce6eb; border-radius: 13px; background: #fff; }
.detail-title { justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.detail-title span { color: #244960; font-size: 12px; font-weight: 900; }
.detail-title small { color: #8495a1; font-size: 9px; }
.log-section { margin-top: 12px; border: 1px solid #d9e4e9; border-radius: 13px; overflow: hidden; background: #f8fafb; }
.log-section summary { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; color: #31536a; font-size: 11px; font-weight: 850; }
.log-section summary::-webkit-details-marker { display: none; }
.log-section summary small { color: #82939f; font-size: 9px; font-weight: 600; }
.log-section pre {
  max-height: 48vh; margin: 0; overflow: auto; padding: 15px; border-top: 1px solid #223e50;
  background: #102837; color: #d6e8f2; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

@media (max-width: 940px) {
  .release-layout { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .portal-card { grid-column: 1 / -1; min-height: 104px; }
  .job-kpi-grid { grid-template-columns: 1fr 1fr; }
  .job-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { padding: 0 13px 40px; }
  .topbar { min-height: 70px; align-items: center; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy strong { font-size: 15px; }
  .secure-badge, .current-user { display: none; }
  .back-link { font-size: 10px; }
  .compact-hero { grid-template-columns: 1fr; padding: 27px 2px 18px; }
  .compact-hero h1 { font-size: 30px; }
  .hero-badges { justify-content: flex-start; max-width: none; }
  .overview-grid { grid-template-columns: 1fr; }
  .portal-card { grid-column: auto; }
  .overview-card { min-height: 112px; }
  .panel { padding: 16px; border-radius: 16px; }
  .panel-head { align-items: flex-start; }
  .panel h2, .dialog-card h2 { font-size: 18px; }
  .release-layout { gap: 12px; }
  .current-release-column { padding: 12px; }
  .promotion-flow { grid-template-columns: 1fr; }
  .flow-arrow { height: 18px; transform: rotate(90deg); }
  .release-top { display: block; }
  .signature { display: inline-block; margin-top: 7px; }
  .audit-toolbar { align-items: flex-start; flex-direction: column; }
  .job-card { grid-template-columns: 1fr auto; padding: 12px; }
  .job-card > .status { grid-column: 2; }
  .job-card > button { grid-column: 1 / -1; grid-row: auto; width: 100%; }
  .job-progress-row { grid-column: 1 / -1; }
  .job-dialog-shell { width: calc(100% - 12px); }
  .job-dialog { padding: 17px; max-height: 95vh; }
  .job-dialog-header { align-items: flex-start; padding-right: 31px; }
  .copy-actions { align-items: stretch; }
  .copy-actions .secondary { flex: 1 1 45%; }
  .job-kpi-grid { grid-template-columns: 1fr 1fr; }
  .detail-section { padding: 12px; }
  .dialog-card { padding: 20px; }
}

@media (max-width: 440px) {
  .version-pill { display: none; }
  .compact-hero h1 { font-size: 27px; }
  .hero-badges span { font-size: 9px; }
  .job-kpi-grid { grid-template-columns: 1fr; }
  .copy-actions .secondary { flex-basis: 100%; }
  .section-caption { align-items: flex-start; flex-direction: column; }
  .section-caption small { text-align: left; }
}
