/* ==========================================================================
   MSQUARE — admin design system
   One dark workspace: ink background, glass panels, cyan→mint accent.
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg: #080b12;
  --surface: #101725;
  --surface-2: #151f30;
  --surface-3: #1b2740;
  --border: #22304a;
  --border-soft: #1a2436;
  --text: #e9effb;
  --muted: #8ea0bd;
  --muted-2: #6d7f9c;
  --accent: #22d3ee;
  --accent-2: #34d399;
  --accent-ink: #04141a;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 20px 45px rgba(0, 0, 0, .38);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, .22);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 78% -10%, rgba(34, 211, 238, .10), transparent 60%),
    radial-gradient(900px 520px at 8% 0%, rgba(52, 211, 153, .07), transparent 55%),
    var(--bg);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(24px, 2.6vw, 32px); letter-spacing: -.7px; line-height: 1.18; margin-bottom: 8px; }
h2 { font-size: 17px; letter-spacing: -.25px; margin-bottom: 3px; }
h3 { font-size: 13.5px; margin-bottom: 3px; }
p { margin-bottom: 0; }
small { font-size: 11.5px; }
.muted, small { color: var(--muted); }
.block { display: block; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.eyebrow { display: block; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 2px; margin-bottom: 10px; }

/* -- shell ---------------------------------------------------------------- */
.workspace { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 26px 16px 20px; background: linear-gradient(180deg, #0b111c, #080d15);
  border-right: 1px solid var(--border-soft);
}
.sidebar .brand { padding: 0 10px; margin-bottom: 30px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .5px; white-space: nowrap; }
.sidebar-brand img { border-radius: 10px; background: #0a1420; }
.sidebar-brand span { display: flex; flex-direction: column; font-size: 14px; letter-spacing: 1.6px; line-height: 1.2; }
.sidebar-brand small { font-size: 8.5px; letter-spacing: 1.2px; color: var(--muted-2); font-weight: 600; text-transform: uppercase; }
.sidebar-caption { color: var(--muted-2); letter-spacing: 1.8px; font-size: 9px; font-weight: 700; margin: 0 12px 10px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; color: var(--muted);
  padding: 10px 12px; border-radius: 10px; margin-bottom: 4px; font-size: 12.5px;
  font-weight: 500; transition: background .15s ease, color .15s ease;
}
.nav-item > span:first-child { font-size: 15px; opacity: .85; width: 18px; text-align: center; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.nav-item.active {
  color: #d9fbff; background: linear-gradient(90deg, rgba(34, 211, 238, .16), rgba(34, 211, 238, .03));
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item.active > span:first-child { color: var(--accent); opacity: 1; }
.nav-count {
  margin-left: auto; font-size: 9.5px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--border); padding: 1px 6px; border-radius: 999px; background: #0c1420;
}
.sidebar-bottom { margin-top: auto; }
.private-note { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 20px 12px 16px; font-size: 11px; color: var(--muted); }
.private-note small { display: block; width: 100%; color: var(--muted-2); font-size: 9.5px; letter-spacing: .3px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .15); }
.admin-profile { display: flex; align-items: center; gap: 10px; padding: 10px; margin: 0 4px 10px; border: 1px solid var(--border-soft); border-radius: 12px; background: rgba(255, 255, 255, .02); }
.admin-profile strong { display: block; font-size: 12px; }
.admin-profile small { font-size: 10px; color: var(--muted-2); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); font-weight: 800; font-size: 12px; }
.avatar.small { width: 28px; height: 28px; font-size: 10px; border-radius: 8px; }

.main-content { min-width: 0; padding: 0 34px 40px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; height: 64px; margin: 0 -34px 26px;
  padding: 0 34px; background: rgba(8, 11, 18, .78); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft); font-size: 12px; color: var(--muted);
}
.topbar a { color: var(--muted); }
.topbar a:hover { color: var(--text); }
.breadcrumb { color: var(--muted-2); margin: 0 4px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-heading h1 { margin-bottom: 6px; }
.page-heading p { max-width: 62ch; color: var(--muted); font-size: 12.5px; }
.page-heading .button, .page-heading .text-button { flex-shrink: 0; }
.page-footer { display: flex; gap: 8px; justify-content: center; margin-top: 42px; font-size: 10px; letter-spacing: 2px; color: var(--muted-2); text-transform: uppercase; }
.page-footer span { text-transform: none; letter-spacing: .3px; }

/* -- buttons -------------------------------------------------------------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 10px; padding: 9px 16px; font-size: 12.5px; font-weight: 600;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.button:hover { background: var(--surface-3); border-color: #2d3f5f; }
.button:active { transform: translateY(1px); }
.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); border: 0; box-shadow: 0 8px 20px rgba(34, 211, 238, .18);
}
.button.primary:hover { filter: brightness(1.06); }
.button.ghost { background: transparent; }
.button.full { width: 100%; }
.button[disabled] { opacity: .45; cursor: not-allowed; }
.text-button { background: none; border: 0; padding: 2px 4px; color: var(--accent); font-size: 11.5px; font-weight: 600; }
.text-button:hover { text-decoration: underline; }
.text-button.danger { color: var(--danger); }
.text-button.plain { color: var(--muted); }

/* -- badges --------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  border: 1px solid var(--border); color: var(--muted); background: #0d1420; white-space: nowrap;
}
.badge.private, .badge.neutral { color: var(--muted); }
.badge.enabled, .badge.ok, .badge.good { color: #9df3cd; background: rgba(52, 211, 153, .10); border-color: rgba(52, 211, 153, .28); }
.badge.disabled { color: #aebbd0; background: #1a2130; }
.badge.warn { color: #f6d78a; background: rgba(251, 191, 36, .10); border-color: rgba(251, 191, 36, .28); }
.badge.bad { color: #f7a9a9; background: rgba(248, 113, 113, .10); border-color: rgba(248, 113, 113, .28); }
.count-pill { font-size: 10px; font-weight: 700; color: var(--accent); border: 1px solid rgba(34, 211, 238, .3); background: rgba(34, 211, 238, .07); padding: 2px 9px; border-radius: 999px; }

/* -- notices -------------------------------------------------------------- */
.notice { border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 12.5px; border: 1px solid var(--border); background: var(--surface); }
.notice.success { border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .08); color: #bdf5dd; }
.notice.error { border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .08); color: #fbcaca; }
.notice.info { border-color: rgba(34, 211, 238, .3); background: rgba(34, 211, 238, .06); color: #c9f4fb; }

/* -- stats ---------------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  position: relative; padding: 18px 20px; border: 1px solid var(--border-soft);
  border-radius: var(--radius); background: linear-gradient(180deg, var(--surface), #0d1421);
  box-shadow: var(--shadow-soft); overflow: hidden;
}
.stat-card::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(180deg, var(--accent), transparent); opacity: .5; }
.stat-card.accent::after { background: linear-gradient(180deg, var(--accent-2), transparent); opacity: .9; }
.stat-label { display: block; font-size: 9.5px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted-2); margin-bottom: 8px; font-weight: 700; }
.stat-card strong { display: block; font-size: 27px; letter-spacing: -1px; line-height: 1.1; margin-bottom: 4px; }
.stat-card .muted { font-size: 10.5px; }
.small-strong { font-size: 15px !important; letter-spacing: 0 !important; }
.warn-card { border-color: rgba(251, 191, 36, .3); }

/* -- panels --------------------------------------------------------------- */
.panel { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); margin-bottom: 20px; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border-soft); }
.panel-heading p { font-size: 11px; color: var(--muted); margin-top: 2px; }
.panel-heading .eyebrow { margin-bottom: 4px; }
.panel-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 22px; border-top: 1px solid var(--border-soft); background: rgba(255, 255, 255, .015); flex-wrap: wrap; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.bottom-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.bottom-grid.single { grid-template-columns: 1fr; }
.overview-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 22px; }
.health-strip { display: flex; flex-wrap: wrap; gap: 10px; padding: 18px 22px; }
.health-cell { flex: 1 1 120px; padding: 13px 15px; border: 1px solid var(--border-soft); border-radius: 11px; background: var(--surface-2); }
.health-cell span { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: 1.3px; font-weight: 700; }
.health-cell strong { display: block; font-size: 21px; margin-top: 4px; letter-spacing: -.5px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; margin: 22px 0; }
.quick-card { display: flex; flex-direction: column; gap: 3px; padding: 17px 18px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: linear-gradient(180deg, var(--surface), #0d1421); transition: border-color .15s ease, transform .15s ease; }
.quick-card:hover { border-color: rgba(34, 211, 238, .45); transform: translateY(-2px); }
.quick-icon { font-size: 18px; color: var(--accent); margin-bottom: 4px; }
.quick-card strong { font-size: 13px; }
.quick-card small { font-size: 10.5px; line-height: 1.45; }

/* -- tables --------------------------------------------------------------- */
.table-scroll { overflow-x: auto; }
.portal-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.portal-table thead th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-size: 9px; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--muted-2); font-weight: 700; padding: 11px 12px;
  background: #0e1522; border-bottom: 1px solid var(--border);
}
.portal-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.portal-table tbody tr:hover { background: rgba(255, 255, 255, .022); }
.portal-table tbody tr:last-child td { border-bottom: 0; }
.portal-table strong { font-weight: 600; }
.portal-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
td.portal-actions { min-width: 180px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form label { font-size: 10.5px; color: var(--muted); }
.order-input { width: 58px; }

/* -- forms ---------------------------------------------------------------- */
input, select, textarea {
  background: #0b121d; border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 11px; font-size: 12.5px; color: var(--text); width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: rgba(34, 211, 238, .6); box-shadow: 0 0 0 3px rgba(34, 211, 238, .12); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="file"] { padding: 8px; }
label { display: block; font-size: 11.5px; color: var(--muted); }
label > small { display: block; margin-top: 4px; font-size: 10.5px; color: var(--muted-2); }
label > input, label > select, label > textarea { margin-top: 6px; }
.search-label { display: block; padding: 0 22px 14px; }
.search-label input { background: #0b121d; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 22px 14px; }
.filter-bar > label { flex: 1 1 180px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px 22px; }
.filter-row > label { flex: 0 0 auto; }
.filter-row select, .filter-row input { width: auto; min-width: 150px; }
.create-form { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 62px; }
.password-toggle { position: absolute; right: 6px; top: 6px; background: transparent; border: 0; color: var(--accent); font-size: 10px; font-weight: 700; padding: 6px; }
.password-form { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px 22px; border-top: 1px solid var(--border-soft); }
.selection-tools { display: flex; justify-content: space-between; gap: 10px; padding: 0 22px 10px; font-size: 11px; color: var(--muted); }
.selection-tools div { display: flex; gap: 10px; }
.merge-panel { padding: 14px 22px; border-bottom: 1px solid var(--border-soft); background: rgba(255, 255, 255, .015); }
.merge-panel select { max-width: 300px; }
.grant-buttons { display: flex; gap: 14px; align-items: center; justify-content: flex-end; padding: 4px 22px 16px; }
.inline-check { display: inline-flex; gap: 7px; align-items: center; font-size: 11px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }

/* -- accounts ------------------------------------------------------------- */
.account-list { padding: 0 12px 12px; max-height: 420px; overflow-y: auto; }
.account-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1px solid transparent; }
.account-row:hover { background: rgba(255, 255, 255, .03); }
.account-row.selected { border-color: rgba(34, 211, 238, .35); background: rgba(34, 211, 238, .06); }
.account-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-text strong { font-size: 12px; }
.account-text small { font-size: 10px; color: var(--muted-2); }
.account-status { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 22px; border-bottom: 1px solid var(--border-soft); }
.account-status p { font-size: 10.5px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: #232f45; transition: background .15s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #c8d3e5; transition: transform .15s ease; }
.switch input:checked + .switch-track { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: #fff; }
.account-limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border-soft); }
.category-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 22px 6px; }
.category-heading p { font-size: 10.5px; }
.category-list { max-height: 330px; overflow-y: auto; padding: 0 14px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px; }
.category-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 11px; color: var(--text); }
.category-row:hover { background: rgba(255, 255, 255, .03); }
.category-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind-tag { font-size: 8px; letter-spacing: .8px; color: var(--muted-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-weight: 700; }

/* -- sources -------------------------------------------------------------- */
.source-card { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); margin-bottom: 18px; overflow: hidden; min-width: 0; }
.source-card .panel-heading { border-bottom: 1px solid var(--border-soft); }
.add-source { border-top: 1px solid var(--border-soft); background: rgba(255, 255, 255, .012); }
.add-source > summary { list-style: none; display: inline-flex; gap: 8px; align-items: center; padding: 13px 22px; font-size: 11.5px; font-weight: 600; color: var(--accent); cursor: pointer; }
.add-source > summary::-webkit-details-marker { display: none; }
.add-source[open] > summary { color: var(--muted); }
.row-menu { position: relative; }
.row-menu > summary { list-style: none; cursor: pointer; color: var(--accent); font-size: 11.5px; font-weight: 600; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); min-width: 260px; }
.category-filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 22px 14px; }
.category-filters label { flex: 1 1 180px; }
.grant-accounts { padding: 0 22px 8px; display: flex; flex-wrap: wrap; gap: 14px; }
.grant-bar { display: flex; justify-content: space-between; gap: 12px; padding: 12px 22px 16px; }

/* -- player --------------------------------------------------------------- */
.player-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.player-side { display: flex; flex-direction: column; max-height: calc(100vh - 140px); }
.player-main { overflow: hidden; }
.source-picker { padding: 16px 18px 12px; }
.category-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 18px 12px; scrollbar-width: thin; }
.chip { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; font-size: 10.5px; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.chip:hover { color: var(--text); border-color: #31435f; }
.chip.active { color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; font-weight: 700; }
.chip span { opacity: .65; margin-left: 4px; }
.channel-list { overflow-y: auto; padding: 0 10px 8px; flex: 1; min-height: 180px; }
.channel-row { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 7px 9px; color: var(--text); }
.channel-row:hover { background: rgba(255, 255, 255, .035); }
.channel-row.playing { border-color: rgba(34, 211, 238, .45); background: rgba(34, 211, 238, .07); }
.channel-logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #0a121d; overflow: hidden; flex-shrink: 0; font-size: 11px; color: var(--muted-2); border: 1px solid var(--border-soft); }
.channel-logo img { width: 100%; height: 100%; object-fit: contain; }
.channel-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.channel-text strong { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-text small { font-size: 9.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-icon { color: var(--accent); font-size: 10px; opacity: .55; }
.player-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px 12px; }
.player-head .eyebrow { margin-bottom: 2px; }
.video-shell { background: #03060b; aspect-ratio: 16 / 9; display: grid; place-items: center; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.video-shell video { width: 100%; height: 100%; background: #03060b; display: block; }
.player-note { padding: 12px 20px 16px; font-size: 10.5px; }
.load-more { display: flex; justify-content: center; padding: 10px; }

/* -- import --------------------------------------------------------------- */
.tabs { display: flex; gap: 6px; padding: 4px; border: 1px solid var(--border-soft); border-radius: 11px; background: var(--surface-2); align-self: flex-start; }
.tab { padding: 7px 14px; border-radius: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.tab:hover { color: var(--text); }
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); }
.import-form { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px 20px; }
.import-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; min-height: 140px; }
.file-drop { border: 1px dashed var(--border); border-radius: 11px; padding: 14px; background: var(--surface-2); }
.import-options { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.import-note { padding: 0 22px 18px; font-size: 10.5px; line-height: 1.6; }
.footer-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.truncate { display: inline-block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* -- empty / misc --------------------------------------------------------- */
.empty-state { padding: 22px; text-align: center; color: var(--muted-2); font-size: 11.5px; }
.connection-content { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 12px; }
.connection-content dl { display: grid; grid-template-columns: 190px 1fr; gap: 8px 14px; margin: 0; font-size: 12px; }
.connection-content dt { color: var(--muted-2); font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; }
.connection-content dd { margin: 0; }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; padding: 18px 22px; }
.plain-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }

/* -- login ---------------------------------------------------------------- */
.login-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); min-height: 100vh; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 76px); }
.login-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 48px clamp(24px, 5vw, 64px); background: linear-gradient(160deg, rgba(34, 211, 238, .12), rgba(8, 11, 18, .2) 55%), #0a1019; border-left: 1px solid var(--border-soft); overflow: hidden; }
.login-story::before { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; top: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(52, 211, 153, .18), transparent 65%); }
.portal-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.portal-logo { width: 42px; height: 44px; border-radius: 11px; background: #0a1420; }
.portal-wordmark { display: flex; flex-direction: column; font-weight: 800; letter-spacing: 1.8px; }
.portal-wordmark small { font-size: 8.5px; letter-spacing: 1.4px; color: var(--muted-2); text-transform: uppercase; }
.login-card { width: min(420px, 100%); border: 1px solid var(--border-soft); border-radius: 18px; background: linear-gradient(180deg, var(--surface), #0c131f); padding: 30px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 24px; }
.login-emblem { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgba(34, 211, 238, .1); color: var(--accent); font-size: 20px; margin-bottom: 18px; border: 1px solid rgba(34, 211, 238, .25); }
.login-note { margin-top: 18px; font-size: 10px; color: var(--muted-2); display: flex; gap: 8px; align-items: center; }
.login-story h2 { font-size: 26px; letter-spacing: -.8px; max-width: 22ch; line-height: 1.25; }
.story-content { position: relative; display: flex; flex-direction: column; gap: 16px; }
.story-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.story-tags span { border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px; font-size: 10px; color: var(--muted); }
.story-footer { position: relative; font-size: 10.5px; color: var(--muted-2); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.portal-service { font-size: 10.5px; color: var(--muted-2); letter-spacing: 1px; }

/* -- responsive ----------------------------------------------------------- */
@media (max-width: 1180px) {
  .dashboard-grid, .bottom-grid { grid-template-columns: 1fr; }
  .player-layout { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .sidebar .brand { margin: 0 12px 0 0; }
  .sidebar-caption, .sidebar-bottom { display: none; }
  .sidebar nav { display: flex; gap: 4px; flex: 1; }
  .nav-item { margin: 0; white-space: nowrap; }
  .nav-count { display: none; }
  .main-content { padding: 0 16px 32px; }
  .topbar { margin: 0 -16px 18px; padding: 0 16px; height: 54px; }
  .player-layout { grid-template-columns: 1fr; }
  .player-side { max-height: none; }
  .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .category-list { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 560px) {
  .page-heading { flex-direction: column; align-items: flex-start; }
  .panel-heading { flex-direction: column; align-items: flex-start; }
  .connection-content dl { grid-template-columns: 1fr; }
  .filter-row select, .filter-row input { min-width: 0; width: 100%; }
}

/* -- channel watch list --------------------------------------------------- */
.channels-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.category-side { max-height: calc(100vh - 130px); display: flex; flex-direction: column; }
.category-list-2 { overflow-y: auto; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.category-item { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 9px; border: 1px solid transparent; }
.category-item:hover { background: rgba(255, 255, 255, .03); }
.category-item.active { border-color: rgba(34, 211, 238, .35); background: rgba(34, 211, 238, .06); }
.category-item small { font-size: 9.5px; color: var(--muted-2); }
.watched-dot { color: var(--accent-2); }
.channel-table td:first-child { width: 34px; }
.channel-group td { vertical-align: top; }
.link-details { margin-top: 5px; }
.link-details > summary { cursor: pointer; }
.link-list { list-style: none; margin: 8px 0 0; padding: 9px; background: #0b121d; border: 1px solid var(--border-soft); border-radius: 9px; display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.link-row { display: grid; grid-template-columns: 74px 120px minmax(0, 1fr); gap: 8px; font-size: 10.5px; align-items: center; }
.link-source { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-check { color: var(--muted-2); }
.link-url { grid-column: 1 / -1; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 960px) {
  .channels-layout { grid-template-columns: 1fr; }
  .category-side { max-height: none; }
}

/* -- inline player modal -------------------------------------------------- */
.play-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); color: var(--accent); font-size: 9px; line-height: 1; vertical-align: middle; }
.play-btn:hover { background: rgba(34, 211, 238, .15); border-color: rgba(34, 211, 238, .45); }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(3, 6, 11, .82); backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-card { width: min(920px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal .video-shell { border: 0; }
.modal-status { margin: 0; padding: 10px 18px; font-size: 11px; color: var(--muted); }
.link-main { display: flex; flex-direction: column; min-width: 0; }
.link-row { grid-template-columns: 28px 74px 120px minmax(0, 1fr); }
.dedicated-links { display: grid; gap: 10px; padding: 14px 22px; border-bottom: 1px solid var(--border-soft); }
.dedicated-links input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; }
.dedicated-form { padding: 0 22px 18px; }

/* -- provider tools ------------------------------------------------------- */
.heading-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.title-meta { display: block; margin-top: 1px; }
.small-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-all; }
.tool-grid, .preset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; padding: 0 14px 14px; }
.tool-card, .preset-card { border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px; background: #0b121d; display: flex; flex-direction: column; gap: 8px; }
.tool-card header, .preset-card header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.tool-card h3, .preset-card h3 { margin: 0; font-size: 13px; }
.tool-card p, .preset-card p { margin: 0; font-size: 11px; }
.tool-meta { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 2px 8px; margin: 0; font-size: 10.5px; }
.tool-meta dt { color: var(--muted-2); }
.tool-meta dd { margin: 0; overflow: hidden; text-overflow: ellipsis; }
.tool-meta code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; color: var(--muted); }
.tool-notes { font-size: 10.5px; color: #f5b942; margin: 0; }
.tool-form { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border-soft); padding-top: 10px; }
.tool-form label { font-size: 10.5px; display: flex; flex-direction: column; gap: 3px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool-install { white-space: pre-wrap; background: #070d16; border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px; margin: 6px 0 0; font-size: 10px; color: var(--muted); }
.tool-problems { margin: 0; padding: 0 16px 14px 30px; font-size: 11px; color: var(--muted); }

/* -- verified projects on the Tools page ---------------------------------- */
.project-list { border-top: 1px solid var(--border-soft); padding-top: 10px; display: flex; flex-direction: column; gap: 9px; }
.project-list h4 { margin: 0; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); }
.project { border: 1px solid var(--border-soft); border-radius: 9px; padding: 9px 10px; display: flex; flex-direction: column; gap: 4px; background: #070d16; }
.project header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.project header a { font-size: 11.5px; }
.project p { margin: 0; font-size: 10.5px; color: var(--muted); }
.project small { font-size: 9.5px; }
.project .tool-install { margin: 4px 0 0; }

/* -- mobile polish ---------------------------------------------------------- */
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .button, .text-button, .nav-item { min-height: 42px; }
  .nav-item { padding: 10px 12px; font-size: 12px; }
  .table-scroll { -webkit-overflow-scrolling: touch; }
  .modal-card { width: 96vw; }
  .modal .video-shell { aspect-ratio: 16 / 9; }
  .modal-head { padding: 12px 14px; }
  .channels-layout { gap: 10px; }
  .category-item { padding: 10px 12px; }
  .main-content { padding: 0 10px 24px; }
  .topbar { margin: 0 -10px 14px; padding: 0 10px; }
  .selection-tools { flex-direction: column; align-items: flex-start; gap: 8px; }
  .filter-row { align-items: stretch; }
  .heading-actions { flex-direction: column; align-items: stretch; }
  .panel { padding: 12px; }
  .tool-grid, .preset-grid { grid-template-columns: 1fr; padding: 0 10px 12px; }
}

/* -- player-as-user ---------------------------------------------------------- */
.channel-row-wrap { position: relative; }
.channel-row-wrap .channel-row { width: 100%; }
.channel-remove {
  position: absolute; top: 6px; right: 8px; z-index: 2;
  width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border-soft);
  background: #0b121d; color: var(--muted); font-size: 15px; line-height: 1;
  cursor: pointer;
}
.channel-remove:hover { color: #ff7a7a; border-color: rgba(255, 122, 122, .5); }
.removed-bar { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.removed-bar .muted { font-size: 10.5px; }

/* -- playlist editor tools --------------------------------------------------- */
.channel-tools { position: absolute; top: 4px; right: 4px; z-index: 2; display: flex; gap: 4px; }
.channel-tools button {
  width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--border-soft);
  background: #0b121d; color: var(--muted); font-size: 11px; line-height: 1; cursor: pointer;
}
.channel-tools button:hover { color: var(--accent); border-color: rgba(34, 211, 238, .5); }
.channel-row-wrap.replacing { padding: 6px; border: 1px dashed var(--border); border-radius: 10px; }
.channel-row-wrap.replacing input { width: 100%; margin-bottom: 4px; }
.replace-results { display: flex; flex-direction: column; gap: 2px; max-height: 160px; overflow-y: auto; }
.replace-item { background: none; border: 0; color: var(--text); text-align: left; padding: 5px 8px; border-radius: 6px; font-size: 11px; cursor: pointer; }
.replace-item:hover { background: rgba(34, 211, 238, .08); }

/* -- player side: never squeeze the category chips --------------------------- */
.player-filters { display: flex; flex-direction: column; gap: 10px; }
.player-filters .button { align-self: flex-start; }
.category-chips { flex: 0 0 auto; flex-wrap: wrap; max-height: 132px; overflow-y: auto; overflow-x: hidden; }
.channel-list { flex: 1 1 auto; min-height: 260px; }
.channel-logo { position: relative; }
.channel-logo .logo-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-transform: uppercase; }
.channel-logo img { position: relative; z-index: 1; background: #0b121d; }
@media (max-width: 560px) {
  .category-chips { max-height: 160px; }
  .channel-list { min-height: 320px; }
}
