:root {
  color-scheme: dark;
  --bg: #070a10;
  --bg-soft: #0b111b;
  --panel: rgba(15, 23, 36, .94);
  --panel-strong: #111b2a;
  --panel-muted: #0b1320;
  --line: rgba(156, 178, 207, .18);
  --line-strong: rgba(214, 107, 95, .46);
  --text: #f5f7fb;
  --muted: #91a0b4;
  --muted-strong: #bcc7d6;
  --coral: #d66b5f;
  --coral-bright: #f08a7b;
  --coral-deep: #a94c49;
  --mint: #72dfb1;
  --sky: #79b9e8;
  --danger: #ff8b8b;
  --shadow: 0 28px 80px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #0a0e15 0, var(--bg) 260px);
  color: var(--text);
  font: 14px/1.55 Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .015) 1px, transparent 1px);
  background-size: 48px 48px;
}

a { color: inherit; }

.center-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px 18px;
}

.auth-card,
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card {
  width: min(460px, 100%);
  padding: clamp(24px, 5vw, 38px);
  border-radius: 26px;
  overflow: hidden;
}

.auth-card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  pointer-events: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(240, 138, 123, .55);
  border-radius: 17px;
  background: var(--coral-deep);
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 14px 34px rgba(214, 107, 95, .24);
}

.eyebrow {
  margin: 18px 0 5px;
  color: var(--coral-bright);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.auth-card h1,
.panel h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(21px, 2.3vw, 28px);
  line-height: 1.22;
  letter-spacing: 0;
}

.muted {
  margin: 9px 0 24px;
  color: var(--muted);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 21px clamp(16px, 3vw, 30px) 15px;
  color: var(--muted-strong);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand-mark.compact {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 12px;
  box-shadow: 0 8px 20px rgba(214, 107, 95, .2);
}

.brand-lockup > span:last-child {
  display: grid;
  line-height: 1.2;
}

.brand-lockup strong { font-size: 14px; }

.brand-lockup small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-actions form { display: block; }

.topbar-actions .ghost { font: 700 13px/1.2 inherit; }

.session-state {
  display: inline-flex;
  align-items: center;
  max-width: 180px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid rgba(114, 223, 177, .17);
  border-radius: 12px;
  background: rgba(114, 223, 177, .05);
  color: var(--muted-strong);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 16px rgba(114, 223, 177, .7);
  flex-shrink: 0;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(370px, .88fr);
  align-items: start;
  gap: 18px;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 6px clamp(16px, 3vw, 30px) 42px;
}

.panel {
  min-width: 0;
  padding: clamp(20px, 2.6vw, 30px);
  border-radius: 24px;
  overflow: hidden;
}

.panel h1 + .muted { margin-bottom: 20px; }

.panel:first-child { border-color: rgba(121, 185, 232, .2); }

.panel:nth-child(2) { border-color: rgba(214, 107, 95, .28); }

.panel:last-child {
  grid-column: 1 / -1;
  border-color: rgba(114, 223, 177, .2);
}

.flash-stack {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.flash-stack .alert { margin: 0; }

.release-overview { grid-column: 1; }

.publish-panel { grid-column: 1 / -1; }

.preview-panel {
  grid-column: 2;
  border-color: rgba(214, 107, 95, .3);
}

.preview-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid rgba(114, 223, 177, .25);
  border-radius: 9px;
  background: rgba(114, 223, 177, .07);
  color: #a5edcf;
  font-size: 10px;
  font-weight: 800;
}

.preview-live span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px rgba(114, 223, 177, .8);
}

.app-dialog-preview {
  width: min(760px, 100%);
  margin: 18px auto 0;
  padding: 20px;
  border: 1px solid rgba(214, 107, 95, .48);
  border-radius: 20px;
  background: #0b1019;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .28), 0 0 28px rgba(214, 107, 95, .06) inset;
}

.app-dialog-preview.large { width: min(820px, 100%); margin-top: 20px; }

.app-dialog-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.app-cloud-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(214, 107, 95, .45);
  border-radius: 12px;
  background: rgba(214, 107, 95, .18);
  color: var(--coral-bright);
  font-size: 20px;
}

.app-dialog-brand {
  display: grid;
  flex: 1;
  gap: 2px;
}

.app-dialog-brand strong { font-size: 14px; }

.app-dialog-brand small {
  color: var(--muted);
  font-size: 9px;
}

.preview-state {
  padding: 6px 9px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 800;
}

.preview-state.is-forced {
  background: rgba(214, 107, 95, .25);
  color: #ffb3a7;
}

.preview-state.is-optional {
  background: rgba(214, 107, 95, .12);
  color: var(--coral-bright);
}

.app-dialog-preview h2 {
  margin: 19px 0 5px;
  text-align: center;
  font-size: 21px;
}

.preview-version {
  margin: 0 0 17px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.preview-version b {
  margin: 0 7px;
  color: var(--coral-bright);
}

.preview-columns {
  display: grid;
  grid-template-columns: minmax(150px, .38fr) minmax(0, .62fr);
  gap: 10px;
}

.preview-version-card,
.preview-notes-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(156, 178, 207, .18);
  border-radius: 13px;
  background: rgba(22, 32, 48, .7);
}

.preview-version-card { display: grid; align-content: start; gap: 5px; }

.preview-version-card span,
.preview-notes-card > span {
  color: var(--muted);
  font-size: 10px;
}

.preview-version-card strong {
  color: var(--coral-bright);
  font-size: 27px;
}

.preview-version-card small { color: var(--muted); font-size: 10px; }

.preview-notes {
  min-height: 72px;
  margin-top: 8px;
  padding: 9px;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(3, 8, 15, .42);
  color: #d9e1ec;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-line;
}

.preview-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.preview-actions span,
.preview-actions strong {
  display: grid;
  place-items: center;
  min-height: 35px;
  border: 1px solid rgba(156, 178, 207, .16);
  border-radius: 9px;
  background: rgba(255, 255, 255, .04);
  color: var(--muted-strong);
  font-size: 11px;
}

.preview-actions strong {
  border-color: transparent;
  background: var(--coral);
  color: #fff;
}

.preview-expand {
  display: block;
  width: min(760px, 100%);
  margin: 12px auto 0;
  border: 1px solid rgba(214, 107, 95, .35);
  background: rgba(214, 107, 95, .1);
  color: var(--coral-bright);
  box-shadow: none;
}

.preview-modal-card {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  max-height: calc(100vh - 36px);
  padding: 26px;
  overflow: auto;
  border: 1px solid rgba(214, 107, 95, .42);
  border-radius: 23px;
  background: #101a29;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .56);
  animation: modal-in .2s ease-out both;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading .eyebrow { margin-top: 0; }

.release-badge {
  flex-shrink: 0;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
}

.release-badge.forced {
  border: 1px solid rgba(255, 139, 139, .34);
  background: rgba(255, 139, 139, .1);
  color: #ffb0a7;
}

.release-badge.optional {
  border: 1px solid rgba(114, 223, 177, .28);
  background: rgba(114, 223, 177, .08);
  color: #a5edcf;
}

.version-number {
  display: inline-flex;
  align-items: baseline;
  min-height: 90px;
  margin: 10px 0 19px;
  color: #fff;
  font-size: clamp(58px, 8vw, 92px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.release-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 18px;
}

.release-meta > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .025);
}

.release-meta span {
  color: var(--muted);
  font-size: 10px;
}

.release-meta strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

pre {
  max-height: 380px;
  margin: 0;
  padding: 17px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--panel-muted);
  border: 1px solid rgba(121, 185, 232, .16);
  border-radius: 16px;
  color: #dce8f8;
  font: 12px/1.65 Consolas, "Cascadia Code", monospace;
}

.endpoint {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.endpoint code {
  display: block;
  min-width: 0;
  padding: 11px 13px;
  overflow-wrap: anywhere;
  background: #111d2d;
  border: 1px solid rgba(121, 185, 232, .15);
  border-radius: 12px;
  color: #d9e8f8;
  font: 12px/1.45 Consolas, "Cascadia Code", monospace;
}

.config-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 12, 20, .45);
  overflow: hidden;
}

.config-details summary {
  padding: 13px 15px;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style-position: inside;
  user-select: none;
}

.config-details[open] summary {
  border-bottom: 1px solid var(--line);
  color: var(--coral-bright);
}

.config-details pre {
  max-height: 330px;
  border: 0;
  border-radius: 0;
}

form { display: grid; gap: 15px; }

label {
  display: grid;
  gap: 7px;
  color: #dce5f0;
  font-size: 13px;
  font-weight: 650;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #29384e;
  border-radius: 12px;
  outline: none;
  background: #080e18;
  color: #f7f9fc;
  padding: 12px 14px;
  font: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:hover,
textarea:hover { border-color: #3a4d68; }

input:focus,
textarea:focus {
  border-color: var(--coral-bright);
  background: #0b121e;
  box-shadow: 0 0 0 3px rgba(214, 107, 95, .14);
}

textarea { min-height: 150px; resize: vertical; }

button,
.ghost {
  border-radius: 12px;
  cursor: pointer;
  font: 700 13px/1.2 inherit;
  transition: transform .16s ease, filter .16s ease, border-color .16s ease;
}

button {
  border: 0;
  padding: 13px 18px;
  background: var(--coral);
  color: #fff;
  box-shadow: 0 10px 22px rgba(214, 107, 95, .16);
}

button:hover,
.ghost:hover { filter: brightness(1.08); }

button:active,
.ghost:active { transform: translateY(1px); }

button.ghost,
.ghost {
  display: inline-block;
  border: 1px solid #2b3b52;
  background: #141e2d;
  color: #d1dbe8;
  padding: 9px 13px;
  text-decoration: none;
  box-shadow: none;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid rgba(214, 107, 95, .2);
  border-radius: 12px;
  background: rgba(214, 107, 95, .06);
}

.toggle input {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--coral);
}

.toggle span {
  display: grid;
  gap: 2px;
}

.toggle span strong {
  color: var(--text);
  font-size: 12px;
}

.toggle span small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.primary-action { min-height: 46px; }

.modal-shell[hidden] { display: none; }

.modal-shell {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 10, .78);
  backdrop-filter: blur(7px);
}

.password-modal {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  padding: 27px;
  overflow: hidden;
  border: 1px solid rgba(214, 107, 95, .42);
  border-radius: 23px;
  background: #101a29;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .56), 0 0 0 1px rgba(255, 255, 255, .025) inset;
  animation: modal-in .2s ease-out both;
}

.password-modal::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--coral-deep), var(--coral-bright), transparent);
}

.modal-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(240, 138, 123, .5);
  border-radius: 13px;
  background: rgba(214, 107, 95, .2);
  color: var(--coral-bright);
  font-size: 12px;
  font-weight: 900;
}

.password-modal .eyebrow { margin-top: 18px; }

.password-modal h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
}

.modal-copy {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 12px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(156, 178, 207, .18);
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  color: var(--muted-strong);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  box-shadow: none;
}

.modal-close:hover { color: #fff; }

.modal-actions {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 9px;
  margin-top: 4px;
}

.modal-actions button { min-height: 44px; }

.modal-actions .ghost {
  border: 1px solid #2b3b52;
  background: #182438;
  color: var(--muted-strong);
  box-shadow: none;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.alert {
  margin: 0 0 16px;
  padding: 11px 13px;
  border-radius: 11px;
  font-size: 13px;
}

.alert.error {
  border: 1px solid rgba(255, 139, 139, .28);
  background: rgba(255, 93, 93, .1);
  color: #ffd0d0;
}

.alert.success {
  border: 1px solid rgba(114, 223, 177, .25);
  background: rgba(72, 210, 148, .1);
  color: #c7ffe6;
}

@media (max-width: 1040px) {
  .dashboard { grid-template-columns: 1fr; }
  .release-overview,
  .publish-panel { grid-column: auto; }
  .panel:last-child { grid-column: auto; }
  .flash-stack { grid-column: auto; }
  .preview-panel { grid-column: auto; }
}

@media (max-width: 560px) {
  .topbar { align-items: flex-start; padding-top: 15px; }
  .topbar-actions { gap: 6px; }
  .session-state { display: none; }
  .topbar-actions .ghost { padding: 8px 9px; font-size: 12px; }
  .split { grid-template-columns: 1fr; }
  .endpoint-grid { grid-template-columns: 1fr; }
  .preview-columns { grid-template-columns: 1fr; }
  .preview-actions { grid-template-columns: 1fr; }
  .release-meta { grid-template-columns: 1fr 1fr; }
  .dashboard { padding: 2px 12px 28px; }
  .panel { padding: 20px 17px; border-radius: 19px; }
  .auth-card { border-radius: 20px; }
  .version-number { min-height: 70px; font-size: 62px; }
}

@media (max-width: 390px) {
  .brand-lockup small { display: none; }
  .brand-lockup strong { font-size: 12px; }
  .release-meta { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
