:root {
  --bg: #0c0c0d;
  --panel: #111113;
  --panel-2: #151518;
  --line: #26262b;
  --line-soft: #1d1d21;
  --text: #f2f2f3;
  --muted: #8d8d95;
  --muted-2: #67676f;
  --accent: #d9e9ff;
  --good: #78c791;
  --warn: #d6ad62;
  --bad: #d97979;
}

* { box-sizing: border-box; }
html { color-scheme: dark; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: #27374b; color: #fff; }

.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  width: min(920px, calc(100% - 36px));
  height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}
.brand, .sidebar-logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.nav-actions { display: flex; align-items: center; gap: 22px; }
.text-link { color: #75757e; font-size: 12px; }
.text-link:hover, .active-link { color: #f0f0f2; }

.portal-page {
  width: min(620px, calc(100% - 36px));
  margin: 0 auto;
  padding: 92px 0 110px;
  flex: 1;
}
.portal-intro { margin-bottom: 28px; }
.portal-intro h1 {
  margin: 0 0 9px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -.035em;
  font-weight: 700;
}
.portal-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.portal-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 7px;
  overflow: hidden;
}
.card-head {
  min-height: 70px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.card-title { font-size: 13px; font-weight: 700; }
.card-subtitle { margin-top: 5px; font-size: 11px; color: var(--muted); }
.service-line { display: flex; align-items: center; gap: 7px; color: #a5a5ad; font-size: 11px; white-space: nowrap; }
.status-pill { display: none; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #65656c; }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.card-body { padding: 18px; }
.label {
  display: block;
  color: #a8a8b0;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 7px;
}
.field {
  width: 100%;
  height: 43px;
  border: 1px solid #303036;
  border-radius: 5px;
  outline: none;
  color: var(--text);
  background: #0d0d0f;
  padding: 0 12px;
  font-size: 13px;
  transition: border-color .12s ease;
}
.field:focus { border-color: #565660; }
.field::placeholder { color: #505057; }
.key-field { font-family: Consolas, "Courier New", monospace; letter-spacing: .02em; }

.primary-btn, .secondary-btn, .danger-btn {
  height: 41px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.primary-btn {
  width: 100%;
  margin-top: 10px;
  background: #eeeeef;
  color: #101012;
}
.primary-btn:hover { background: #fff; }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
.secondary-btn {
  padding: 0 14px;
  background: #17171a;
  border-color: #303036;
  color: #d1d1d5;
}
.secondary-btn:hover { background: #1d1d21; border-color: #3a3a42; }
.danger-btn { padding: 0 14px; background: #1c1213; border-color: #402527; color: #e49a9e; }

.form-error { display: none; margin-top: 10px; color: #dc8989; font-size: 11px; line-height: 1.45; }
.form-error.show { display: block; }
.build-panel { display: none; }
.build-panel.show { display: block; }
.license-form.hidden { display: none; }

.build-info {
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 12px;
}
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}
.info-row:last-child { border-bottom: 0; }
.info-row span:first-child { color: var(--muted); }
.info-row span:last-child { color: #d5d5d9; text-align: right; }
.build-id { font-family: Consolas, "Courier New", monospace; }
.button-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.button-row .primary-btn { margin-top: 0; }
.portal-note { margin-top: 14px; color: #66666e; font-size: 10px; line-height: 1.5; }
.footer {
  width: min(920px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0 24px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  color: #55555d;
  font-size: 10px;
}

/* Admin */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(360px, 100%);
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 7px;
  padding: 20px;
}
.login-card .brand { display: inline-block; margin-bottom: 40px; }
.login-heading { margin-bottom: 22px; }
.login-heading h1 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.login-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.admin-app { display: none; }
.admin-app.show { display: grid; }
.login-wrap.hidden { display: none; }

.admin-shell { min-height: 100vh; grid-template-columns: 180px 1fr; }
.sidebar {
  padding: 24px 15px;
  border-right: 1px solid var(--line-soft);
  background: #0d0d0e;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo { display: block; padding: 0 8px 28px; }
.sidebar-nav { display: grid; gap: 3px; }
.nav-item {
  display: block;
  width: 100%;
  padding: 9px 8px;
  border-radius: 4px;
  color: #777780;
  font-size: 11px;
}
.nav-item:hover, .nav-item.active { color: #ececef; background: #151517; }

.admin-main { max-width: 1120px; width: 100%; padding: 34px 36px 70px; }
.admin-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.admin-top h1 { margin: 0; font-size: 24px; letter-spacing: -.035em; }
.admin-top p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  margin-bottom: 16px;
  background: #0f0f11;
}
.summary-strip > div { padding: 14px 15px; border-right: 1px solid var(--line-soft); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 7px; }
.summary-strip strong { font-size: 14px; font-weight: 600; }
.grid-3 { display: none; }

.admin-card {
  border: 1px solid var(--line-soft);
  background: var(--panel);
  border-radius: 6px;
  margin-bottom: 14px;
  overflow: hidden;
}
.admin-card-head {
  min-height: 48px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.admin-card-head h2 { margin: 0; font-size: 12px; font-weight: 700; }
.admin-card-body { padding: 15px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
textarea.field { height: 78px; padding-top: 10px; resize: vertical; }
select.field { appearance: auto; }
.section-action { margin-top: 12px; }
.publish-btn { width: auto; padding: 0 18px; margin-top: 13px; }

.dropzone {
  min-height: 78px;
  border: 1px dashed #35353b;
  border-radius: 5px;
  background: #0d0d0f;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: #595961; background: #101012; }
.dropzone strong { font-size: 12px; font-weight: 600; }
.dropzone span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.file-name { color: #cfd9e8 !important; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 690px; }
th {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  color: #696971;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
}
td { padding: 10px 11px; border-bottom: 1px solid var(--line-soft); color: #c5c5ca; font-size: 11px; }
tr:last-child td { border-bottom: 0; }
.tag {
  display: inline;
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: #777780;
  font-size: 10px;
}
.tag.active { color: #8fd2a2; background: transparent; border: 0; }
.plain-meta { color: var(--muted); font-size: 10px; }
.link-btn { border: 0; background: transparent; color: #b9cae0; cursor: pointer; padding: 0; font-size: 10px; }
.link-btn:hover { color: #fff; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 10px 12px;
  border: 1px solid #34343a;
  background: #151517;
  border-radius: 5px;
  color: #dedee2;
  font-size: 11px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: .15s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.bad { border-color: #4a2d30; color: #e1a0a4; }

@media (max-width: 760px) {
  .portal-page { padding-top: 62px; }
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .admin-main { padding: 24px 18px 55px; }
  .summary-strip { grid-template-columns: 1fr; }
  .summary-strip > div { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .summary-strip > div:last-child { border-bottom: 0; }
}

@media (max-width: 560px) {
  .topbar, .footer, .portal-page { width: calc(100% - 28px); }
  .portal-page { padding-top: 52px; }
  .nav-actions { gap: 16px; }
  .card-head { align-items: flex-start; }
  .service-line { margin-top: 2px; }
  .button-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .admin-top { align-items: center; }
  .admin-top p { max-width: 220px; }
  .footer { flex-direction: column; gap: 5px; }
}

.field-note { margin-top: 6px; color: #66666e; font-size: 10px; line-height: 1.4; }
