
:root {
  color-scheme: dark;
  --bg: #07110f;
  --panel: rgba(15, 31, 27, .88);
  --panel-strong: #10251f;
  --line: rgba(142, 203, 178, .18);
  --text: #edf8f2;
  --muted: #8eaa9f;
  --accent: #b9f573;
  --accent-strong: #d3ff9f;
  --danger: #ff8b7b;
  --warning: #f1c86b;
  --success: #8fe0b6;
  --shadow: 0 30px 80px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(83, 151, 110, .24), transparent 38rem),
    radial-gradient(circle at 95% 10%, rgba(185, 245, 115, .1), transparent 32rem),
    linear-gradient(145deg, #06100e, #091613 52%, #07100e);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body.manager-open { overflow: hidden; }
button, input { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 70px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow, .step {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2em;
}

h1, h2, h3 { margin: 0; letter-spacing: -.03em; }
h1 { font-size: clamp(34px, 5vw, 58px); line-height: .98; }
h2 { font-size: 23px; }
h3 { font-size: 17px; }

.subtitle {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-panel {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto auto;
  gap: 16px;
  align-items: end;
  padding: 22px 24px;
  margin-bottom: 22px;
}

.auth-copy { padding-right: 18px; }
.token-field { min-width: 0; }

.badge {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.badge-offline { color: var(--muted); border-color: var(--line); }
.badge-online {
  color: var(--accent);
  border-color: rgba(185,245,115,.42);
  background: rgba(185,245,115,.08);
}

.catalog-panel { padding: 27px; }
.catalog-heading, .heading-line, .catalog-actions, .versions-heading,
.version-editor-heading, .section-title, .editor-actions, .divider {
  display: flex;
  align-items: center;
}

.catalog-heading, .versions-heading, .version-editor-heading, .divider {
  justify-content: space-between;
}

.catalog-heading { gap: 24px; margin-bottom: 24px; }
.heading-line { gap: 12px; }
.catalog-actions { gap: 10px; }
.count {
  padding: 4px 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
}

.search-field input { width: 230px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { color: #c8d9d1; font-size: 13px; font-weight: 700; }
.field small { color: var(--muted); font-size: 11px; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  color: var(--text);
  border: 1px solid rgba(151, 196, 177, .22);
  border-radius: 10px;
  outline: none;
  background: rgba(3, 13, 10, .66);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(185, 245, 115, .65);
  box-shadow: 0 0 0 3px rgba(185, 245, 115, .1);
  background: rgba(4, 18, 13, .82);
}

input:invalid:not(:placeholder-shown) { border-color: rgba(255, 139, 123, .65); }
textarea { resize: vertical; }
.inline-check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #c8d9d1;
  font-size: 13px;
  font-weight: 700;
}
.inline-check input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}
.country-picker {
  display: grid;
  gap: 9px;
}
.country-picker[hidden] { display: none; }
.country-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 6px;
  max-height: 260px;
  padding: 9px;
  overflow: auto;
  border: 1px solid rgba(151, 182, 166, .16);
  border-radius: 10px;
  background: rgba(4, 15, 11, .46);
}
.country-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 7px;
  border-radius: 7px;
  color: #d8e6df;
  font-size: 12px;
  cursor: pointer;
}
.country-option:hover { background: rgba(185, 245, 115, .07); }
.country-option input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}
.country-empty {
  grid-column: 1 / -1;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.button {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
  transition: transform .16s ease, border-color .16s ease, opacity .16s ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button-primary { color: #10200d; background: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-strong); }
.button-secondary {
  color: var(--text);
  border-color: rgba(185,245,115,.45);
  background: rgba(185,245,115,.1);
}
.button-ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.button-danger {
  color: #2b0c08;
  border-color: rgba(255,139,123,.7);
  background: var(--danger);
}

.app-table-head, .app-row {
  display: grid;
  grid-template-columns: 66px minmax(240px, 1.5fr) 105px 130px 110px 90px 82px;
  gap: 14px;
  align-items: center;
}

.app-table-head {
  padding: 0 16px 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 750;
}

.app-row {
  padding: 17px 16px;
  border-bottom: 1px solid var(--line);
  transition: background .15s ease;
}

.app-row:last-child { border-bottom: 0; }
.app-row:hover { background: rgba(185,245,115,.035); }

.sequence {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--accent);
  border: 1px solid rgba(185,245,115,.3);
  border-radius: 9px;
  background: rgba(185,245,115,.06);
  font-size: 11px;
  font-weight: 900;
}

.package-cell strong { display: block; overflow-wrap: anywhere; }
.package-cell small, .table-muted { color: var(--muted); font-size: 11px; }
.request-url-preview {
  display: block;
  max-width: 520px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--accent);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.latest-version { font-weight: 800; }

.status-pill {
  display: inline-flex;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
}
.status-ACTIVE, .status-enabled { color: var(--success); background: rgba(143,224,182,.12); }
.status-DRAFT { color: var(--warning); background: rgba(241,200,107,.12); }
.status-DISABLED, .status-disabled { color: var(--muted); background: rgba(142,170,159,.1); }

.empty-state {
  padding: 58px 20px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.manager-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  background: rgba(2, 8, 6, .72);
  backdrop-filter: blur(5px);
}

.manager-panel {
  width: min(820px, 92vw);
  height: 100%;
  overflow: auto;
  color: var(--text);
  border-left: 1px solid var(--line);
  background: #0a1713;
  box-shadow: -30px 0 80px rgba(0,0,0,.38);
}

.manager-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 23, 19, .96);
  backdrop-filter: blur(16px);
}

.manager-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 25px;
}

.manager-body { padding: 28px; }
.editor-section, .version-editor {
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(15, 34, 28, .62);
}

.editor-section + .editor-section,
.application-summary + .editor-section,
.version-editor { margin-top: 18px; }

.section-title { gap: 12px; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.section-number {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--accent);
  border: 1px solid rgba(185,245,115,.28);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 19px;
}
.span-2 { grid-column: 1 / -1; }

.application-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 21px;
  border: 1px solid rgba(185,245,115,.2);
  border-radius: 14px;
  background: rgba(185,245,115,.055);
}
.application-summary span:first-child,
.application-summary small { display: block; color: var(--muted); font-size: 11px; }
.application-summary strong { display: block; margin: 4px 0; overflow-wrap: anywhere; }

.routing-policy-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-top: 19px;
}
.request-url-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.request-url-notice { margin-left: 0; margin-right: 0; }

.versions-heading, .version-editor-heading { gap: 18px; }
.version-list { margin-top: 18px; }
.version-empty {
  padding: 22px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 11px;
  text-align: center;
  font-size: 12px;
}
.version-row {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) minmax(160px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 3px;
  border-bottom: 1px solid var(--line);
}
.version-row:last-child { border-bottom: 0; }
.version-code { font-weight: 850; }
.version-meta { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.version-delete { min-height: 34px; padding: 7px 10px; color: var(--danger); }

.version-editor { padding: 0; border-color: rgba(185,245,115,.26); }
.version-editor[hidden] { display: none; }
.version-editor > * { margin-left: 23px; margin-right: 23px; }
.version-editor-heading { margin: 0; padding: 23px 0; }

fieldset { min-width: 0; border: 0; }

.divider {
  gap: 16px;
  margin-top: 25px;
  padding-top: 19px;
  color: var(--accent);
  border-top: 1px solid var(--line);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.reveal {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.reveal input { width: 15px; min-height: 15px; accent-color: var(--accent); }

.file-button { position: relative; display: inline-flex; align-items: center; }
.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.notice {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  padding: 14px;
  color: var(--muted);
  border: 1px solid rgba(241,200,107,.22);
  border-radius: 11px;
  background: rgba(241,200,107,.06);
  font-size: 12px;
  line-height: 1.55;
}
.notice strong { color: var(--warning); white-space: nowrap; }
.editor-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding: 18px 0 23px;
  border-top: 1px solid var(--line);
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 8, 6, .82);
  backdrop-filter: blur(8px);
}
.confirm-panel {
  width: min(500px, 100%);
  padding: 27px;
  border: 1px solid rgba(255,139,123,.32);
  border-radius: 16px;
  background: #111c18;
  box-shadow: var(--shadow);
}
.confirm-message {
  margin: 14px 0 20px;
  color: var(--muted);
  line-height: 1.65;
}
.confirm-actions { padding-bottom: 0; }

.status {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: min(430px, calc(100% - 44px));
  padding: 14px 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.5;
}
.status-visible { opacity: 1; transform: translateY(0); }
.status-info { color: var(--text); border-color: var(--line); background: #163128; }
.status-success { color: #082216; border-color: rgba(143,224,182,.5); background: var(--success); }
.status-error { color: #2b0c08; border-color: rgba(255,139,123,.6); background: var(--danger); }

@media (max-width: 980px) {
  .auth-panel { grid-template-columns: 1fr auto auto; }
  .auth-copy { grid-column: 1 / -1; }
  .catalog-heading { align-items: stretch; flex-direction: column; }
  .catalog-actions { flex-wrap: wrap; }
  .search-field { flex: 1; }
  .search-field input { width: 100%; }
  .app-table-head { display: none; }
  .app-row { grid-template-columns: 50px 1fr auto auto; }
  .app-row > :nth-child(3), .app-row > :nth-child(4),
  .app-row > :nth-child(6) { display: none; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 22px, 1440px); padding-top: 28px; }
  .hero, .auth-panel, .catalog-actions, .versions-heading,
  .version-editor-heading { align-items: stretch; flex-direction: column; }
  .hero { margin-bottom: 20px; }
  .badge { align-self: flex-start; }
  .auth-panel { display: flex; }
  .catalog-panel { padding: 19px; border-radius: 15px; }
  .catalog-actions .button { width: 100%; }
  .app-row { grid-template-columns: 42px 1fr; padding: 15px 3px; }
  .app-row > :nth-child(5), .app-row > :nth-child(6) { display: none; }
  .app-row > :last-child { grid-column: 2; }
  .manager-panel { width: 100%; }
  .manager-header, .manager-body { padding: 20px; }
  .editor-section, .version-editor { padding: 18px; }
  .version-editor { padding: 0; }
  .version-editor > * { margin-left: 18px; margin-right: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .routing-policy-editor { grid-template-columns: 1fr; }
  .request-url-actions { flex-wrap: wrap; }
  .span-2 { grid-column: auto; }
  .version-row { grid-template-columns: 1fr auto; }
  .version-row > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .version-delete { grid-column: 2; }
  .notice { flex-direction: column; }
}
