:root {
  --bg: #081018;
  --surface: #0e1924;
  --surface-2: #132231;
  --surface-3: #172a3a;
  --line: #213548;
  --line-soft: #192b3c;
  --text: #edf6fb;
  --muted: #8fa6b8;
  --muted-2: #6f8799;
  --primary: #4fe3b2;
  --primary-dark: #071b16;
  --blue: #56a9ff;
  --violet: #aa8cff;
  --amber: #ffbd66;
  --danger: #ff6f7d;
  --radius: 16px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 80% 0%, rgba(79, 227, 178, 0.07), transparent 30rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 18px;
  border-right: 1px solid var(--line-soft);
  background: rgba(7, 15, 23, 0.92);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand strong { display: block; font-size: 17px; letter-spacing: -0.02em; }
.brand small { display: block; color: var(--muted-2); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.brand-identity { flex-direction: column; align-items: flex-start; gap: 10px; }
.brand-art {
  position: relative;
  display: block;
  width: 180px;
  height: 37.54px;
  overflow: hidden;
  border-radius: 5px;
  background: #fff;
}
.brand-art img {
  position: absolute;
  width: 157.04%;
  max-width: none;
  left: 0;
  top: 0;
  transform: translate(-18.16%, -41.7%);
}
.brand-copy { display: block; }

.sidebar nav { display: grid; gap: 6px; margin-top: 34px; }
.nav-link {
  position: relative;
  padding: 11px 13px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  transition: color .16s ease, background .16s ease;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.035); }
.nav-link.is-active { color: var(--primary); background: rgba(79, 227, 178, 0.09); }
.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 2px;
  background: var(--primary);
}
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 13px;
  color: var(--muted-2);
  font-size: 12px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(79, 227, 178, .08);
}

.main { min-width: 0; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  border-bottom: 1px solid var(--line-soft);
}
.topbar form { display: flex; align-items: center; gap: 12px; }
.admin-name { color: var(--muted); }
.mobile-brand { display: none; font-weight: 800; }
.content { width: min(1500px, 100%); margin: 0 auto; padding: 38px 40px 56px; }
footer { padding: 24px 40px 36px; color: var(--muted-2); font-size: 12px; text-align: center; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}
.page-heading h1 { margin: 4px 0 0; font-size: clamp(28px, 3vw, 40px); line-height: 1.12; letter-spacing: -.045em; }
.page-heading p { max-width: 660px; margin: 8px 0 0; color: var(--muted); }
.heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.eyebrow { display: block; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric {
  position: relative;
  overflow: hidden;
  min-height: 145px;
  padding: 21px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(155deg, var(--surface-2), var(--surface));
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
}
.metric::after {
  content: "";
  position: absolute;
  width: 100px;
  height: 100px;
  right: -32px;
  top: -32px;
  border-radius: 50%;
  background: currentColor;
  opacity: .06;
}
.metric > span { color: var(--muted); }
.metric strong { display: block; margin: 12px 0 5px; color: var(--text); font-size: 34px; line-height: 1; letter-spacing: -.04em; }
.metric small { color: var(--muted-2); }
.metric-green { color: var(--primary); }
.metric-blue { color: var(--blue); }
.metric-violet { color: var(--violet); }
.metric-amber { color: var(--amber); }

.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(19,34,49,.94), rgba(11,22,32,.96));
  box-shadow: var(--shadow);
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-heading h2, .form-panel h2, .context-panel h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.panel-heading p, .context-panel p { margin: 5px 0 0; color: var(--muted); }
.panel-heading a { color: var(--primary); text-decoration: none; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted-2); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
td { color: #d6e3eb; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.cell-sub { display: block; max-width: 220px; margin-top: 3px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; }
.empty-cell { padding: 50px; color: var(--muted); text-align: center; }
.actions { text-align: right; }
.actions form { display: inline-flex; }
.row-actions { display: inline-flex; align-items: center; gap: 8px; }
.ua-cell { display: inline-block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.bulk-channel-form { overflow: hidden; }
.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255,255,255,.018);
}
.bulk-toolbar > div:first-child { display: grid; gap: 3px; }
.bulk-toolbar small { color: var(--muted-2); }
.bulk-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.select-cell { width: 58px; text-align: center; }
.channel-checkbox {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.badge, .delivery {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}
.badge-active, .badge-allowed { color: var(--primary); border-color: rgba(79,227,178,.25); background: rgba(79,227,178,.08); }
.badge-disabled, .badge-denied { color: var(--danger); border-color: rgba(255,111,125,.25); background: rgba(255,111,125,.08); }
.delivery { color: var(--blue); border-color: rgba(86,169,255,.24); background: rgba(86,169,255,.08); }
code {
  color: #a8c8dc;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}
.compact-code { display: inline-block; max-width: 265px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 750;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: var(--primary-dark); background: var(--primary); box-shadow: 0 10px 28px rgba(79,227,178,.14); }
.btn-primary:hover { background: #67ebbd; }
.btn-ghost { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.025); }
.btn-ghost:hover { border-color: #35516a; background: rgba(255,255,255,.05); }
.btn-danger { color: #ffe9ec; border-color: rgba(255,111,125,.3); background: rgba(255,111,125,.12); }
.btn-danger:hover { border-color: rgba(255,111,125,.55); background: rgba(255,111,125,.2); }
.btn-danger-strong { border-color: rgba(255,111,125,.5); background: rgba(255,111,125,.22); }
.btn-warning { color: #ffe0ac; border-color: rgba(255,189,102,.34); background: rgba(255,189,102,.1); }
.btn-warning:hover { border-color: rgba(255,189,102,.58); background: rgba(255,189,102,.17); }
.btn-small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }

.form-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 18px; }
.form-panel { display: grid; gap: 18px; padding: 26px; }
.wide-form { max-width: 1050px; }
.import-layout { grid-template-columns: minmax(0, 1.65fr) minmax(280px, .35fr); }
.playlist-paste { min-height: 430px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px; line-height: 1.6; }
.feature-list { display: grid; gap: 10px; margin: 20px 0 0; padding-left: 20px; color: var(--muted); }
.feature-list li::marker { color: var(--primary); }
.subsection { display: grid; gap: 18px; margin-top: 4px; padding-top: 22px; border-top: 1px solid var(--line); }
.subsection h2 { margin: 5px 0 0; font-size: 19px; }
.subsection p { margin: 5px 0 0; color: var(--muted); font-weight: 450; }
.context-panel { align-self: start; padding: 26px; }
.context-panel h2 { margin-top: 7px; font-size: 22px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
label { display: grid; gap: 7px; color: #cfe0e9; font-weight: 700; }
label small { color: var(--muted-2); font-weight: 450; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--text);
  background: #0a151f;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input, select { height: 44px; padding: 0 12px; }
textarea { min-height: 100px; padding: 11px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(79,227,178,.65); box-shadow: 0 0 0 3px rgba(79,227,178,.08); }
.form-actions { display: flex; justify-content: flex-end; padding-top: 4px; }
.split-actions { justify-content: space-between; gap: 12px; }
.single-panel { max-width: 880px; }
.bulk-delete-panel { gap: 20px; }
.delete-summary h2 { margin: 6px 0 18px; font-size: 25px; }
.delete-summary dl { display: grid; gap: 12px; margin: 0; }
.delete-summary dl div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.delete-summary dt { color: var(--muted-2); font-weight: 700; }
.delete-summary dd { min-width: 0; margin: 0; color: var(--text); overflow-wrap: anywhere; }
.bulk-delete-list {
  display: grid;
  max-height: 390px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  list-style: none;
  overflow: auto;
}
.bulk-delete-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.bulk-delete-list li:last-child { border-bottom: 0; }
.bulk-delete-list span { color: var(--muted-2); font-size: 12px; }
.bulk-delete-list .bulk-delete-more { display: block; color: var(--muted); text-align: center; }
.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input { width: 17px; height: 17px; }
.danger-zone { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.danger-zone strong { color: var(--danger); }

.alert {
  margin-bottom: 20px;
  padding: 15px 17px;
  border: 1px solid;
  border-radius: 12px;
}
.alert p { margin: 3px 0 0; color: #c6d5df; }
.alert-success { border-color: rgba(79,227,178,.28); background: rgba(79,227,178,.08); }
.alert-info { border-color: rgba(86,169,255,.28); background: rgba(86,169,255,.08); }
.alert-warning { border-color: rgba(255,189,102,.28); background: rgba(255,189,102,.08); }
.alert-danger { border-color: rgba(255,111,125,.28); background: rgba(255,111,125,.08); }
.secret-box { margin-top: 13px; padding: 13px; border: 1px dashed rgba(79,227,178,.28); border-radius: 10px; background: rgba(0,0,0,.16); }
.secret-box .secret-input { margin-top: 9px; color: var(--primary); border-color: rgba(79,227,178,.32); font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.secret-box small { display: block; margin-top: 7px; color: var(--muted-2); }

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(86,169,255,.1), transparent 28rem),
    radial-gradient(circle at 85% 75%, rgba(79,227,178,.1), transparent 30rem),
    var(--bg);
}
.login-card {
  width: min(480px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(13,25,36,.9);
  box-shadow: 0 30px 100px rgba(0,0,0,.45);
}
.login-brand { margin-bottom: 44px; }
.login-brand .brand-art { width: 220px; height: 45.88px; }
.login-brand .brand-copy strong { font-size: 19px; }
.login-copy h1 { margin: 8px 0 10px; font-size: 32px; line-height: 1.12; letter-spacing: -.04em; }
.login-copy p { margin: 0 0 28px; color: var(--muted); }
.form-stack { display: grid; gap: 16px; }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .sidebar .brand, .sidebar-footer { display: none; }
  .sidebar nav { grid-auto-flow: column; grid-auto-columns: max-content; gap: 5px; margin: 0; overflow-x: auto; }
  .nav-link { padding: 9px 11px; font-size: 12px; }
  .nav-link.is-active::before { display: none; }
  .topbar { height: 60px; padding: 0 18px; }
  .mobile-brand { display: block; }
  .admin-name { display: none; }
  .content { padding: 26px 18px 40px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; }
  .page-heading .btn { width: 100%; }
  .bulk-toolbar { align-items: stretch; flex-direction: column; }
  .bulk-toolbar-actions { display: grid; grid-template-columns: 1fr; }
  .bulk-toolbar-actions .btn { width: 100%; }
  .metrics-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .split-actions { flex-direction: column-reverse; }
  .split-actions .btn { width: 100%; }
  footer { padding: 20px; }
}
