:root {
  --bg: #0d1117;
  --panel: rgba(20, 24, 31, 0.94);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f6fb;
  --muted: #9aa5b5;
  --accent: #ff8a00;
  --success: #24b26b;
  --danger: #ff5e7d;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { color: var(--text); background: var(--bg); }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin-top: 0; }
code { font-family: "Cascadia Code", Consolas, monospace; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lead,
.muted {
  color: var(--muted);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(255, 138, 0, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(79, 140, 255, 0.16), transparent 20%),
    linear-gradient(180deg, #0d1117 0%, #090c11 100%);
}

.login-shell {
  width: min(1120px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: stretch;
}

.login-hero,
.login-panel,
.panel,
.template-card,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-hero {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 620px;
}

.login-hero h1 {
  margin-bottom: 14px;
  font-size: 42px;
  line-height: 1.1;
}

.login-highlights,
.chip-row,
.template-card__meta,
.template-card__actions,
.topbar__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.login-panel,
.panel {
  padding: 24px;
}

.panel-head {
  margin-bottom: 20px;
}

.panel-head h2 {
  margin-bottom: 8px;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.panel-head--row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.stack-form {
  display: grid;
  gap: 16px;
}

.stack-form--wide {
  max-width: 720px;
}

.stack-form label,
.form-grid label {
  display: grid;
  gap: 8px;
}

.stack-form span,
.form-grid span {
  font-size: 14px;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0f141c;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: rgba(79, 140, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.16);
}

textarea {
  resize: vertical;
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
}

.captcha-image {
  width: 160px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #1d2430;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.button--primary {
  background: linear-gradient(135deg, var(--accent) 0%, #ff6b00 100%);
  color: #fff;
}

.button--ghost {
  background: transparent;
  border-color: var(--line-strong);
}

.button--block {
  width: 100%;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid;
}

.alert--success {
  color: #d9ffeb;
  background: rgba(36, 178, 107, 0.12);
  border-color: rgba(36, 178, 107, 0.28);
}

.alert--error {
  color: #ffdce4;
  background: rgba(255, 94, 125, 0.12);
  border-color: rgba(255, 94, 125, 0.28);
}

.login-footnote {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.login-footnote p {
  margin-bottom: 6px;
}

.admin-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 138, 0, 0.12), transparent 22%),
    linear-gradient(180deg, #0f1319 0%, #0b0f14 100%);
}

.admin-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(12, 16, 22, 0.88);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.4;
}

.sidebar__nav {
  display: grid;
  gap: 8px;
}

.sidebar__nav a,
.sidebar__logout {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  color: var(--muted);
  border-radius: 8px;
}

.sidebar__nav a.is-active,
.sidebar__nav a:hover,
.sidebar__logout:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar__logout {
  margin-top: auto;
  border: 1px solid var(--line);
}

.admin-main {
  padding: 28px;
}

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

.topbar h1 {
  margin-bottom: 8px;
  font-size: 28px;
}

.topbar p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.stat-card {
  padding: 22px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
}

.stat-card__label {
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
}

.table-empty {
  color: var(--muted);
  text-align: center !important;
  padding: 24px 0 !important;
}

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

.meta-list {
  display: grid;
  gap: 12px;
}

.meta-list div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.meta-list dt {
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.template-card {
  overflow: hidden;
}

.template-card__cover,
.template-card__empty {
  aspect-ratio: 3 / 4;
  width: 100%;
  background: #0d0e11;
}

.template-card__cover {
  object-fit: cover;
}

.template-card__empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.template-card__body {
  padding: 18px;
}

.template-card h2 {
  margin-bottom: 0;
  font-size: 18px;
}

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

.form-grid__full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.code-area {
  min-height: 520px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}

.component-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.component-list__item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.component-list__item span {
  color: var(--muted);
}

.preview-body {
  margin: 0;
}

.kaboss-page {
  min-height: 100vh;
}

.kaboss-stage {
  width: min(100%, 750px);
  margin: 0 auto;
  position: relative;
}

.kaboss-block {
  position: relative;
}

.kaboss-image img,
.floating-entry img {
  width: 100%;
}

.floating-entry {
  position: fixed;
  z-index: 30;
}

.kaboss-ticker {
  overflow: hidden;
  display: flex;
  align-items: center;
}

.kaboss-ticker__track {
  display: flex;
  gap: 36px;
  white-space: nowrap;
  animation: ticker 18s linear infinite;
  padding: 0 12px;
}

.kaboss-form {
  padding: 0 15px;
}

.kaboss-form__box {
  padding: 14px;
}

.kaboss-form__row {
  margin-bottom: 12px;
}

.kaboss-form__row--split {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.kaboss-form__row input,
.kaboss-form__row button {
  min-height: 52px;
  border-radius: 999px;
  border: 0;
}

.kaboss-form__row button {
  padding: 0 18px;
}

.kaboss-form__tip {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.kaboss-form__gesture {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.kaboss-agreement {
  padding: 0 15px 15px;
}

.kaboss-agreement__main {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.kaboss-agreement__links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.kaboss-link,
.kaboss-richtext__toggle,
.kaboss-dialog__close {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.kaboss-richtext {
  padding: 0 15px 16px;
}

.kaboss-richtext__content {
  overflow: hidden;
}

.kaboss-richtext.is-collapsed .kaboss-richtext__content {
  max-height: 240px;
  position: relative;
}

.kaboss-richtext.is-collapsed .kaboss-richtext__content::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 80px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(13, 17, 23, 0.92));
}

.kaboss-richtext__toggle {
  display: inline-flex;
  margin-top: 12px;
  padding: 0;
  color: #7fb3ff;
}

.kaboss-dialog {
  width: min(92vw, 720px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #10141b;
  color: var(--text);
}

.kaboss-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.kaboss-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.kaboss-dialog__head h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.kaboss-dialog__body {
  padding: 20px;
  max-height: 70vh;
  overflow: auto;
}

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (max-width: 960px) {
  .login-shell,
  .admin-layout,
  .form-split,
  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .captcha-row {
    grid-template-columns: 1fr;
  }
}
