/* =============================================================
 * AlbZone TV — Admin SPA styles
 * Minimal, dense, no framework. Designed for desk use, not phone.
 * ============================================================= */
:root {
  color-scheme: dark;
  --bg: #0b0d13;
  --bg-elev: #14181f;
  --bg-card: #1a1f29;
  --bg-card-hover: #232838;
  --border: #262b3a;
  --border-strong: #3a4154;
  --text: #e7e9ee;
  --text-dim: #8a93a6;
  --text-faint: #5d6478;
  --accent: #4f8cff;
  --accent-hover: #6ba0ff;
  --ok: #6cdf8d;
  --warn: #ffc23c;
  --err: #ff7a7a;
  --max-width: 96vw;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
}

code, kbd {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px; background: rgba(255,255,255,0.05);
  padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border);
}
kbd { background: var(--bg-card); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============== Topbar ============== */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #c33);
  box-shadow: 0 0 12px rgba(79, 140, 255, 0.5);
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.api-base {
  font-family: ui-monospace, Menlo, monospace; font-size: 11px;
  color: var(--text-faint); padding: 3px 8px;
  background: var(--bg-card); border-radius: 4px; border: 1px solid var(--border);
}
.auth-state { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-dim); }

/* ============== Main layout ============== */
main {
  max-width: var(--max-width); margin: 20px auto 60px;
  padding: 0 20px;
}

/* ============== Cards ============== */
.card, .tab {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 22px;
  margin-bottom: 18px;
}
.card h2, .card h3, .tab h2, .tab h3 { margin: 0 0 12px; font-weight: 600; letter-spacing: -0.01em; }
.tab > .card { background: var(--bg-card); }
.tab h2 { font-size: 18px; }
h3.section-h { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); margin: 24px 0 10px; }
.muted { color: var(--text-dim); }
.center { text-align: center; }

.msg { min-height: 18px; font-size: 13px; margin: 10px 0 0; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }

/* ============== Gate ============== */
#gate { max-width: 480px; margin: 60px auto; }
#gate-form { display: flex; gap: 8px; margin-top: 12px; }
#gate-form input { flex: 1; }

/* ============== Tabs ============== */
.tabs {
  display: flex; gap: 6px; margin-bottom: 16px;
  padding: 6px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.tabs button {
  background: transparent; border: none; color: var(--text-dim);
  padding: 9px 16px; border-radius: 6px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.tabs button:hover { background: var(--bg-card); color: var(--text); }
.tabs button.active {
  background: var(--accent); color: white; font-weight: 600;
}
.count-pill {
  display: inline-block; min-width: 22px; padding: 1px 8px;
  background: rgba(255,255,255,0.15); border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.tabs button.active .count-pill { background: rgba(255,255,255,0.25); }

/* ============== Tab head ============== */
.tab-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.tab-head h2, .tab-head h3 { margin: 0; }
.tab-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-head-actions input { min-width: 240px; }

/* ============== Inputs / buttons ============== */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 12px; outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea {
  width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px;
  background: #07090d; line-height: 1.45;
}

button {
  font: inherit; cursor: pointer;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 14px; transition: background 0.15s, border-color 0.15s;
}
button:hover { background: var(--bg-card-hover); }
button.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
button.primary:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============== Form grid ============== */
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; align-items: end;
}
.form-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--text-dim);
}
.form-grid button { align-self: end; padding: 9px 18px; font-weight: 600; }

/* ============== Stats row ============== */
.stats-row {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.stat-pill {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px;
  display: flex; flex-direction: column; gap: 2px; min-width: 110px;
}
.stat-pill .stat-label { font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.05em; }
.stat-pill .stat-value { font-size: 19px; font-weight: 700; }

/* ============== Tables ============== */
.tablewrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow-x: auto;
  max-height: 70vh; overflow-y: auto;
}
.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 1100px;
}
.data-table thead { position: sticky; top: 0; z-index: 2; }
.data-table th {
  background: #1f2330; color: var(--text-dim);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle; white-space: nowrap;
}
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: rgba(79, 140, 255, 0.06); }
.data-table tbody tr:last-child td { border-bottom: none; }
.col-actions { text-align: right; width: 1%; }
.data-table td.col-actions { text-align: right; }

/* Identity cells — monospace, click-to-copy. */
td.code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
td.copyable { cursor: copy; }
td.copyable:hover { background: rgba(108, 223, 141, 0.08); }

/* ============== Tier pills ============== */
.tier-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.tier-free    { background: #2a2f40; color: var(--text-dim); }
.tier-premium { background: linear-gradient(135deg, #ffc23c, #ff8a3c); color: #1b1300; }
.tier-paid    { background: linear-gradient(135deg, #6cdf8d, #3cb371); color: #0a2a14; }

/* ============== Mini buttons ============== */
.mini-btn {
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); padding: 5px 10px;
  font-size: 12px; border-radius: 5px; cursor: pointer;
  margin-left: 4px;
  transition: background 0.1s, border-color 0.1s;
}
.mini-btn:first-child { margin-left: 0; }
.mini-btn:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.mini-btn.danger { color: var(--err); border-color: #4a1f1f; }
.mini-btn.danger:hover { background: #3a1818; border-color: var(--err); }

/* ============== System tab ============== */
.url-cell {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  max-width: 460px; overflow: hidden; text-overflow: ellipsis;
}
.method-pill {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; font-family: ui-monospace, Menlo, monospace;
}
.method-GET    { background: rgba(108, 223, 141, 0.15); color: var(--ok); }
.method-POST   { background: rgba(79, 140, 255, 0.15); color: var(--accent); }
.method-PUT    { background: rgba(255, 194, 60, 0.15); color: var(--warn); }
.method-DELETE { background: rgba(255, 122, 122, 0.15); color: var(--err); }

.status-pill {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; font-family: ui-monospace, Menlo, monospace;
}
.status-2xx { background: rgba(108, 223, 141, 0.15); color: var(--ok); }
.status-3xx { background: rgba(79, 140, 255, 0.15); color: var(--accent); }
.status-4xx { background: rgba(255, 194, 60, 0.15); color: var(--warn); }
.status-5xx { background: rgba(255, 122, 122, 0.15); color: var(--err); }
.status-pending { color: var(--text-faint); }

.kv-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.kv-tile {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.kv-tile h4 { margin: 0 0 8px; font-size: 13px;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.kv-tile .kv-row { display: flex; justify-content: space-between;
  font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.kv-tile .kv-row:last-child { border-bottom: none; }
.kv-tile .kv-row .k { color: var(--text-dim); }
.kv-tile .kv-row .v { font-family: ui-monospace, Menlo, monospace; }
