:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #182033;
  --muted: #6b7280;
  --line: #e2e6ee;
  --blue: #2859e8;
  --blue-dark: #1f46b8;
  --blue-soft: #eef3ff;
  --green: #087b52;
  --green-soft: #eaf8f1;
  --amber: #8b5d00;
  --amber-soft: #fff7df;
  --red: #b4233c;
  --red-soft: #fff0f2;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }

.topbar, main { width: min(900px, calc(100% - 32px)); margin-inline: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 34px 0 22px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--blue); color: #fff; font-weight: 900; letter-spacing: -.04em; box-shadow: 0 9px 22px rgba(40, 89, 232, .22); }
.eyebrow, .kicker { margin: 0 0 5px; color: var(--blue); font-size: 11px; font-weight: 850; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(25px, 4vw, 33px); line-height: 1.1; letter-spacing: -.035em; }
.badge { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 750; white-space: nowrap; }
.badge.online { border-color: #9ed8bd; background: var(--green-soft); color: var(--green); }

main { padding-bottom: 64px; }
.workspace { display: grid; gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 24px; box-shadow: 0 8px 22px rgba(26, 39, 69, .04); }
.muted { margin: 0; color: var(--muted); line-height: 1.5; }

input, select { width: 100%; border: 1px solid #cfd6e1; border-radius: 11px; background: #fff; color: var(--ink); padding: 12px 13px; outline: none; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40, 89, 232, .11); }
label { display: grid; gap: 7px; color: #4b5568; font-size: 13px; font-weight: 650; }
button { border: 1px solid #c8d1df; border-radius: 11px; background: #fff; color: var(--ink); padding: 11px 16px; font-weight: 780; transition: .16s ease; }
button:hover:not(:disabled) { transform: translateY(-1px); border-color: #9da9ba; box-shadow: 0 5px 14px rgba(26, 39, 69, .09); }
.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.primary:hover:not(:disabled) { border-color: var(--blue-dark); background: var(--blue-dark); }
.ghost { background: transparent; }

.auth-panel { display: flex; align-items: center; justify-content: space-between; gap: 30px; max-width: 760px; margin: 34px auto 0; padding: 28px; }
.auth-panel h2 { margin: 0 0 6px; font-size: 22px; }
.auth-controls { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: center; gap: 10px; width: min(440px, 100%); }
.auth-controls .primary { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; min-width: 112px; }
.check { display: flex; align-items: center; gap: 7px; font-weight: 500; }
.check input { width: auto; }

.setup-notice { display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid #efd28a; border-radius: 14px; background: var(--amber-soft); color: #714e09; padding: 14px 17px; }
.setup-notice strong { flex: 0 0 auto; }
.setup-notice span { color: #7c6534; font-size: 13px; text-align: right; }

.release-board { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 16px; padding: 18px 20px; }
.environment { display: flex; align-items: center; gap: 12px; min-width: 0; }
.environment-name { flex: 0 0 auto; border-radius: 999px; padding: 6px 9px; font-size: 10px; font-weight: 850; letter-spacing: .05em; }
.test-name { background: var(--blue-soft); color: var(--blue-dark); }
.prod-name { background: var(--green-soft); color: var(--green); }
.environment small, .environment code { display: block; }
.environment small { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.environment code { max-width: 210px; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.flow-arrow { color: #a5adba; font-size: 20px; }
.promote { border-color: #acd9c4; background: var(--green-soft); color: var(--green); white-space: nowrap; }
.release-hint { grid-column: 1 / -1; margin: -3px 0 0; border-top: 1px solid var(--line); padding-top: 11px; color: var(--muted); font-size: 12px; }
.release-hint.pending { color: var(--blue-dark); font-weight: 650; }
.release-hint.complete { color: var(--green); }

.upload-panel { padding: 26px; }
.upload-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.upload-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.base-label { max-width: 320px; overflow: hidden; border-radius: 999px; background: #f1f3f7; color: #626b7a; padding: 7px 11px; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.zip-drop { position: relative; display: grid; justify-items: center; gap: 7px; margin-top: 20px; border: 2px dashed #b9c7de; border-radius: 16px; background: #fafcff; padding: 42px 20px; text-align: center; cursor: pointer; transition: .18s ease; }
.zip-drop:hover, .zip-drop.dragging { border-color: var(--blue); background: var(--blue-soft); }
.zip-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.zip-drop strong { font-size: 18px; }
.zip-drop > span:last-child { color: var(--muted); font-weight: 500; }
.zip-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--blue); color: #fff; font-size: 13px; font-weight: 900; letter-spacing: .08em; }
.progress-line { min-height: 20px; margin-top: 11px; color: var(--muted); font-size: 12px; text-align: center; }

.package-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 16px; }
.package-summary > div, .selection-summary > div { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: #fafbfc; padding: 12px; }
.package-summary span, .selection-summary span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.package-summary strong, .selection-summary strong { display: block; overflow-wrap: anywhere; font-size: 13px; }
.package-warning { margin-top: 12px; border: 1px solid #efd28a; border-radius: 11px; background: var(--amber-soft); color: #76510a; padding: 11px 13px; font-size: 12px; font-weight: 650; line-height: 1.5; }

.publish-ready { margin-top: 14px; border: 1px solid #a9dcc5; border-radius: 14px; background: #fbfffd; padding: 16px; }
.ready-heading, .ready-heading > div { display: flex; align-items: center; gap: 12px; }
.ready-heading { justify-content: space-between; }
.ready-heading strong, .ready-heading small { display: block; }
.ready-heading small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.ready-check { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 900; }
.file-details { margin-top: 13px; border-top: 1px solid #dbece4; padding-top: 12px; }
details > summary { cursor: pointer; color: #435069; font-weight: 750; }
.diff-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.diff-grid div { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 10px; }
.diff-grid strong, .diff-grid span { display: block; }
.diff-grid strong { font-size: 18px; }
.diff-grid span { color: var(--muted); font-size: 10px; }
.file-list, .history { display: grid; max-height: 320px; overflow: auto; }
.file-row, .history-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding: 9px 2px; font-size: 12px; }
.file-row code, .history-row code { overflow-wrap: anywhere; }

.advanced-zone { margin-top: 2px; }
.advanced-zone > summary { font-size: 15px; }
.advanced-zone[open] > summary { margin-bottom: 4px; }
.advanced-section { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.advanced-section h3 { margin: 0 0 5px; font-size: 16px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.big-field { margin-top: 14px; }
.selection-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 10px; }
.endpoint-links { display: flex; align-items: center; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.endpoint-links a { color: var(--blue); }
.nested-details { margin-top: 15px; }
.nested-details[open] > summary { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin: 12px 0; }
.drop-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.drop-row input[type=file] { padding: 15px; border-style: dashed; }
.history-row > div { min-width: 0; }
.history-row small { display: block; margin-top: 4px; color: var(--muted); }
.history-row button { flex: 0 0 auto; padding: 7px 10px; }

#toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: min(520px, calc(100% - 40px)); border: 1px solid #8ad2b1; border-radius: 12px; background: #123b2c; color: #fff; padding: 13px 16px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s; white-space: pre-wrap; box-shadow: 0 15px 35px rgba(0,0,0,.18); }
#toast.show { opacity: 1; transform: none; }
#toast.error { border-color: #f0a0ad; background: #5c1d29; }

@media (max-width: 760px) {
  .auth-panel { align-items: stretch; flex-direction: column; }
  .auth-controls { width: 100%; }
  .release-board { grid-template-columns: 1fr auto 1fr; }
  .release-board .promote { grid-column: 1 / -1; }
  .package-summary { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .topbar { padding-top: 22px; }
  .brand-mark { display: none; }
  .panel { padding: 18px; }
  .auth-controls { grid-template-columns: 1fr; }
  .auth-controls .primary { grid-column: auto; grid-row: auto; }
  .setup-notice { align-items: flex-start; flex-direction: column; }
  .setup-notice span { text-align: left; }
  .release-board { grid-template-columns: 1fr; }
  .flow-arrow { display: none; }
  .release-board .promote { grid-column: auto; }
  .environment code { max-width: 100%; }
  .upload-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .base-label { max-width: 100%; }
  .zip-drop { padding: 34px 14px; }
  .ready-heading { align-items: stretch; flex-direction: column; }
  .ready-heading > .primary { width: 100%; }
  .diff-grid { grid-template-columns: repeat(2, 1fr); }
  .selection-summary, .form-grid { grid-template-columns: 1fr; }
  .endpoint-links, .drop-row { align-items: stretch; flex-direction: column; }
}
