:root {
  --bg: #07090d;
  --bg-elev: #0e131b;
  --panel: rgba(16, 22, 32, 0.82);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f1ea;
  --muted: #9aa3b2;
  --accent: #ff7a18;
  --accent-2: #2ec4b6;
  --danger: #ff4d6d;
  --ok: #3ddc84;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --font-display: "Syne", sans-serif;
  --font-body: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(255, 122, 24, 0.28), transparent 55%),
    radial-gradient(700px 480px at 100% 0%, rgba(46, 196, 182, 0.18), transparent 50%),
    radial-gradient(600px 400px at 70% 100%, rgba(255, 77, 109, 0.1), transparent 55%),
    linear-gradient(180deg, #0a0d13 0%, #07090d 100%);
  z-index: 0;
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: rgba(8, 11, 16, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #ffb347);
  color: #111;
  box-shadow: 0 12px 30px rgba(255, 122, 24, 0.35);
}
.brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.brand span {
  color: var(--muted);
  font-size: 0.82rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav a {
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: 0.2s ease;
}
.nav a:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.nav a.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(255,122,24,0.18), rgba(46,196,182,0.08));
  border-color: rgba(255,122,24,0.25);
}

.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }
.user-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.main {
  padding: 28px 36px 48px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 28px;
}
.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent-2);
}
.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  transition: 0.2s ease;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #ff9b45);
  color: #111;
  box-shadow: 0 10px 28px rgba(255,122,24,0.28);
}
.btn.primary:hover { transform: translateY(-1px); }
.btn.soft {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  color: var(--text);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.btn.danger {
  background: rgba(255,77,109,0.12);
  border: 1px solid rgba(255,77,109,0.35);
  color: #ff8da3;
}
.btn.block { width: 100%; }
.btn.small { padding: 8px 12px; font-size: 0.85rem; }

.grid {
  display: grid;
  gap: 18px;
}
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1.2fr 0.8fr; }
.grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.card h2, .card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}
.card p.lead {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.stat {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stat .label { color: var(--muted); font-size: 0.92rem; }
.stat .value {
  font-family: var(--font-display);
  font-size: 2.4rem;
  letter-spacing: -0.05em;
}
.stat .hint { color: var(--accent-2); font-size: 0.85rem; }

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.flash.ok { background: rgba(61,220,132,0.1); border-color: rgba(61,220,132,0.3); }
.flash.error { background: rgba(255,77,109,0.1); border-color: rgba(255,77,109,0.3); }

.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; gap: 8px; }
.form-row.inline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
label {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}
input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.28);
  padding: 13px 14px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(255,122,24,0.55);
  box-shadow: 0 0 0 3px rgba(255,122,24,0.15);
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  margin-top: 28px;
}

.table-wrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
td code {
  font-size: 0.85rem;
  color: var(--accent-2);
}
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge.on { background: rgba(61,220,132,0.15); color: var(--ok); }
.badge.off { background: rgba(255,255,255,0.06); color: var(--muted); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.preview {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a0e14;
  min-height: 180px;
  position: relative;
}
.preview img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.preview.logo img {
  object-fit: contain;
  background: radial-gradient(circle at center, #151b26, #0a0e14);
  padding: 24px;
}
.preview .caption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  font-size: 0.78rem;
}
.preview.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.asset-block {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  display: grid;
  gap: 12px;
}
.asset-block h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.asset-current {
  color: var(--muted);
  word-break: break-all;
}
.asset-current a {
  color: var(--accent-2);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.login-card {
  width: min(460px, 100%);
  padding: 36px 32px;
  border-radius: 28px;
  background: rgba(14, 19, 27, 0.88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.login-card h1 {
  margin: 8px 0 8px;
  font-family: var(--font-display);
  font-size: 2.2rem;
  letter-spacing: -0.04em;
}
.login-card p { color: var(--muted); margin: 0 0 24px; line-height: 1.5; }
.login-card .brand-mark { margin-bottom: 8px; }

.api-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  padding: 14px;
  border-radius: 14px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--line);
  color: var(--accent-2);
  word-break: break-all;
}

.nav-toggle { display: none; }

@media (max-width: 1100px) {
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .grid.cards, .preview-grid, .form-row.inline { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 30;
  }
  .sidebar.open { transform: translateX(0); }
  .nav-toggle { display: inline-flex; }
  .main { padding: 20px 16px 40px; }
  .topbar { flex-direction: column; }
}
