:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --panel: #15151b;
  --panel-2: #1b1b23;
  --border: #2a2a34;
  --text: #f5f5f7;
  --muted: #9b9ba8;
  --accent: #ff5b2e;
  --accent-hover: #ff7048;
  --danger: #ff5d6c;
  --success: #45d19c;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  height: 72px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 11, 15, .94);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand, .top-actions, .page-heading, .panel-heading, .row-actions, .playlist-controls {
  display: flex;
  align-items: center;
}

.brand { gap: 12px; }
.top-actions { gap: 10px; }

.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  font-size: 25px;
  letter-spacing: -2px;
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 16px;
}

.dashboard {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.page-heading {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(27px, 3vw, 38px); letter-spacing: -1.2px; }
h2 { margin-bottom: 5px; font-size: 20px; letter-spacing: -.3px; }
p { color: var(--muted); margin-bottom: 0; line-height: 1.55; }

.button {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-hover); }
.button.secondary { background: var(--panel-2); border-color: var(--border); }
.button.secondary:hover, .button.ghost:hover { border-color: #4a4a58; }
.button.ghost { background: transparent; border-color: var(--border); color: #d1d1d8; }

.status { color: var(--success); font-size: 13px; font-weight: 700; margin-right: 6px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, .85fr) minmax(460px, 1.15fr);
  gap: 20px;
  align-items: start;
}

.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-heading {
  min-height: 88px;
  padding: 20px;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border);
}

.panel-heading p { font-size: 13px; }
.media-list, .playlist-list { padding: 8px; min-height: 280px; }

.media-row, .playlist-row {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255,255,255,.055);
}

.media-row:last-child, .playlist-row:last-child { border-bottom: 0; }

.media-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #23232d;
  color: #a6a6b3;
  font-size: 17px;
}

.media-icon.video { color: var(--accent); background: rgba(255,91,46,.1); }

.media-info { min-width: 0; flex: 1; }
.media-info strong, .media-info span { display: block; }
.media-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.media-info span { margin-top: 5px; color: var(--muted); font-size: 12px; }

.row-actions { gap: 6px; }
.mini-button, .icon-button {
  border: 1px solid var(--border);
  background: #202029;
  color: #dddde4;
  border-radius: 8px;
  cursor: pointer;
}
.mini-button { padding: 7px 9px; font-size: 12px; font-weight: 700; }
.mini-button.add { color: var(--success); }
.danger { color: var(--danger) !important; }
.icon-button { width: 32px; height: 32px; font-weight: 800; }
.mini-button:hover, .icon-button:hover { background: #2a2a35; }

.position {
  width: 34px;
  flex: 0 0 34px;
  color: #666674;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.playlist-controls { gap: 5px; }
.playlist-controls input {
  width: 58px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0f0f14;
  color: var(--text);
  text-align: center;
}
.playlist-controls > span { color: var(--muted); font-size: 12px; margin-right: 5px; }

.list-empty {
  min-height: 260px;
  padding: 32px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.alert {
  padding: 13px 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(69,209,156,.28);
  border-radius: 10px;
  background: rgba(69,209,156,.08);
  color: #80e4be;
}
.alert.error { border-color: rgba(255,93,108,.28); background: rgba(255,93,108,.08); color: #ff949e; }
.hidden { display: none !important; }
.upload-progress { padding: 11px 20px; background: rgba(255,91,46,.08); color: #ff9b7f; font-size: 13px; }

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 38px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0,0,0,.35);
}
.login-card .brand-mark { margin-bottom: 24px; }
.login-card h1 { margin-bottom: 8px; }
.login-card > p { margin-bottom: 28px; }
.stack { display: grid; gap: 18px; }
.stack label { color: #d7d7df; font-weight: 700; font-size: 13px; }
.stack input {
  width: 100%;
  height: 46px;
  margin-top: 8px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #0f0f14;
  color: var(--text);
}
.stack input:focus { border-color: var(--accent); }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .topbar { padding: 0 18px; }
  .dashboard { width: min(100% - 28px, 700px); padding-top: 28px; }
  .status { display: none; }
}

@media (max-width: 560px) {
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .button { width: 100%; }
  .top-actions .button:first-of-type { display: none; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-heading .button { width: 100%; }
  .media-row, .playlist-row { flex-wrap: wrap; }
  .row-actions, .playlist-controls { width: 100%; justify-content: flex-end; padding-left: 46px; }
  .login-card { padding: 28px; }
}
