/* HY300 admin panel — vanilla CSS, no external assets */
:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-soft: #f8f9fb;
  --ink: #151922;
  --ink-2: #394052;
  --muted: #6d7587;
  --faint: #98a0b1;
  --line: #e3e7ee;
  --line-strong: #d3d9e4;
  --accent: #4f5bd5;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --ok: #0c8a68;
  --ok-soft: #e6f7f1;
  --warn: #a16207;
  --warn-soft: #fdf6e3;
  --bad: #b42318;
  --bad-soft: #fdeceb;
  --sidebar: #111521;
  --sidebar-ink: #eef1f8;
  --sidebar-muted: #8f97ac;
  --sidebar-line: rgba(255, 255, 255, .08);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 12px 30px -18px rgba(17, 24, 39, .25);
  --shadow-lg: 0 24px 60px -24px rgba(17, 24, 39, .38);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.mono { font-family: var(--mono); font-size: .86em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px;
  padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- boot / login ---------- */
.boot-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: var(--bg); color: var(--muted);
}
.boot-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 28px 18px;
  background:
    radial-gradient(700px 420px at 15% 0%, rgba(79, 91, 213, .13), transparent 65%),
    radial-gradient(600px 380px at 100% 100%, rgba(12, 138, 104, .08), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 408px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 20px; padding: 30px 30px 24px;
  box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand-mark {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 11px; background: linear-gradient(145deg, #5b68e8, #414cc4); color: #fff;
  box-shadow: 0 8px 18px -8px rgba(79, 91, 213, .8);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark-lg { width: 42px; height: 42px; border-radius: 12px; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.brand-sub { color: var(--muted); font-size: 12px; }
.login-title { font-size: 23px; font-weight: 680; letter-spacing: -.02em; }
.login-desc { color: var(--muted); font-size: 13px; margin-top: 8px; }
.login-form { display: grid; gap: 14px; margin-top: 22px; }
.login-foot {
  display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
  color: var(--faint); font-size: 12px;
}
.login-origin { color: var(--muted); word-break: break-all; }
.login-note { color: var(--faint); font-size: 11.5px; margin-top: 8px; line-height: 1.45; }
.login-note .mono { font-size: 10.5px; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--sidebar); color: var(--sidebar-ink);
  padding: 22px 14px 18px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.sidebar .brand-name { color: #fff; }
.sidebar .brand-sub { color: var(--sidebar-muted); }
.nav { display: grid; gap: 3px; }
.nav-btn {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 11px; border: 0; border-radius: 9px;
  background: transparent; color: var(--sidebar-muted); text-align: left; font-size: 13.5px;
  transition: background-color .15s ease, color .15s ease;
}
.nav-btn:hover { background: rgba(255, 255, 255, .055); color: var(--sidebar-ink); }
.nav-btn.is-active { background: rgba(255, 255, 255, .1); color: #fff; font-weight: 600; }
.nav-ic { display: inline-flex; width: 18px; height: 18px; flex: none; }
.nav-ic .icon, .btn-ic .icon, .icon-btn .icon { width: 17px; height: 17px; }
.nav-label { flex: 1; }
.nav-count {
  min-width: 20px; text-align: center; font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 20px; background: rgba(255, 255, 255, .09); color: var(--sidebar-muted);
}
.nav-btn.is-active .nav-count { background: rgba(255, 255, 255, .16); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 22px 8px 0; display: grid; gap: 8px; }
.server-mini { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--sidebar-muted); }
.side-note { font-size: 11px; color: #5f677b; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--faint); }
.dot-ok { background: #37d5a4; box-shadow: 0 0 0 3px rgba(55, 213, 164, .16); }
.dot-bad { background: #ff7a6e; box-shadow: 0 0 0 3px rgba(255, 122, 110, .15); }
.dot-idle { background: #6b7387; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 62px; padding: 10px 30px;
  background: rgba(243, 245, 248, .86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-meta { min-width: 0; }
.updated { color: var(--muted); font-size: 12px; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.view { padding: 28px 30px 54px; max-width: 1320px; width: 100%; margin: 0 auto; }

/* ---------- generic controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink-2);
  font-size: 13px; font-weight: 560; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:hover { background: var(--panel-soft); border-color: #c3cad7; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-btn:focus-visible, .input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn:disabled { opacity: .65; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #4450c2; border-color: #4450c2; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(21, 25, 34, .05); border-color: transparent; color: var(--ink); }
.btn-danger-ghost { color: var(--bad); background: transparent; border-color: transparent; }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; min-height: 40px; }
.btn-ic { display: inline-flex; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: rgba(21, 25, 34, .05); color: var(--ink); }
.icon-btn:disabled { opacity: .55; cursor: default; }
.btn.is-busy .btn-ic, .icon-btn.is-busy svg { animation: spin .8s linear infinite; }

.input, select.input, textarea.input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font-size: 13.5px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:hover { border-color: #c3cad7; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 91, 213, .14); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236d7587' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 620; color: var(--ink-2); letter-spacing: .01em; }
.form { display: grid; gap: 16px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error {
  border: 1px solid #f3c4c0; background: var(--bad-soft); color: var(--bad);
  padding: 8px 11px; border-radius: 8px; font-size: 12.5px; line-height: 1.45;
}
.form-ok {
  border: 1px solid #bfe8da; background: var(--ok-soft); color: var(--ok);
  padding: 8px 11px; border-radius: 8px; font-size: 12.5px;
}
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- page ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 25px; font-weight: 690; letter-spacing: -.025em; line-height: 1.2; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 5px; max-width: 680px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .035em; text-transform: uppercase; }
.stat-value { font-size: 24px; font-weight: 680; letter-spacing: -.02em; margin-top: 4px; line-height: 1.2; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat-note { color: var(--faint); font-size: 11.5px; margin-top: 2px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-title { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; min-width: 680px; }
.table th {
  text-align: left; padding: 10px 18px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .045em; text-transform: uppercase;
  white-space: nowrap; background: var(--panel-soft);
}
.table td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table .cell-main { font-weight: 600; color: var(--ink); }
.table .cell-sub { color: var(--faint); font-size: 11.5px; margin-top: 2px; }
.table .cell-actions { text-align: right; white-space: nowrap; }
.table .cell-nowrap { white-space: nowrap; }
.table .cell-mono { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ---------- badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 620; line-height: 1.6; white-space: nowrap;
  background: #eef1f6; color: var(--muted);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 7px;
  background: var(--panel-soft); border: 1px solid var(--line); color: var(--muted); font-size: 11.5px;
}
.subline { color: var(--muted); font-size: 12px; margin-top: 2px; }
.overridden { color: var(--accent); font-size: 11px; font-weight: 600; }

/* ---------- empty state ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 6px; padding: 44px 22px; border: 1px dashed var(--line-strong); border-radius: 12px;
  background: var(--panel-soft); margin: 18px;
}
.card-body > .empty:first-child { margin: 0; }
.empty-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #eef1f6; color: var(--muted); margin-bottom: 4px; }
.empty-icon .icon { width: 20px; height: 20px; }
.empty h3 { font-size: 14px; font-weight: 650; }
.empty p { color: var(--muted); font-size: 12.5px; max-width: 380px; }
.empty .btn { margin-top: 8px; }

/* ---------- dropzone / upload ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 24px 18px; border: 1.5px dashed var(--line-strong); border-radius: 12px;
  background: var(--panel-soft); text-align: center; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dropzone .dz-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 1px solid var(--line); color: var(--accent); margin-bottom: 4px; }
.dropzone .dz-icon .icon { width: 18px; height: 18px; }
.dz-title { font-weight: 600; font-size: 13.5px; }
.dz-sub { color: var(--muted); font-size: 12px; }
.upload-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-top: 12px; flex-wrap: wrap; }
.file-name { font-size: 12.5px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 7px; border-radius: 99px; background: #edf0f5; overflow: hidden; margin-top: 12px; }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #5b68e8, #7b86f0); border-radius: inherit; transition: width .2s ease; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 6px; }

/* ---------- toolbar / filter ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { position: relative; min-width: 210px; }
.search .input { padding-left: 32px; }
.search::before {
  content: ""; position: absolute; left: 11px; top: 50%; width: 13px; height: 13px; transform: translateY(-50%);
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a0b1' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ---------- playlists ---------- */
.playlist-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.playlist-card { margin: 0 !important; display: flex; flex-direction: column; }
.playlist-card .card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 13px; flex: 1; }
.pl-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.pl-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: var(--panel-soft); font-size: 12.5px; }
.pl-item + .pl-item { border-top: 1px solid var(--line); }
.pl-num { width: 18px; color: var(--faint); font-size: 11px; text-align: right; flex: none; }
.pl-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-more { color: var(--muted); font-size: 11.5px; padding: 6px 10px; background: #fff; border-top: 1px solid var(--line); }
.pl-assign { color: var(--muted); font-size: 11.5px; margin-top: auto; padding-top: 2px; }
.pl-actions { display: flex; justify-content: flex-end; }

/* ---------- editor (playlist modal) ---------- */
.schedule-box { border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; background: var(--panel-soft); display: grid; gap: 12px; }
.check-line { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.check-line input { width: 15px; height: 15px; accent-color: var(--accent); }
.schedule-fields { display: grid; gap: 12px; }
.schedule-fields.is-off { opacity: .55; }
.weekdays { display: flex; flex-wrap: wrap; gap: 6px; }
.weekday {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px 5px 7px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
  font-size: 11.5px; color: var(--muted); cursor: pointer; user-select: none;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}
.weekday input { width: 13px; height: 13px; margin: 0; accent-color: var(--accent); }
.weekday.is-on { border-color: #b9befa; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.editor-section { display: grid; gap: 10px; }
.editor-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.editor-title { font-size: 12px; font-weight: 650; color: var(--ink-2); }
.editor-count { color: var(--faint); font-size: 11.5px; }
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.editor-list { display: grid; gap: 5px; max-height: 250px; overflow-y: auto; padding-right: 2px; }
.editor-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.editor-num { width: 20px; text-align: right; color: var(--faint); font-size: 11px; flex: none; }
.editor-item-main { flex: 1; min-width: 0; }
.editor-item-title { font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-item-sub { color: var(--faint); font-size: 10.5px; }
.editor-item-actions { display: flex; gap: 2px; flex: none; }
.editor-item-actions .icon-btn { width: 26px; height: 26px; border-radius: 6px; }
.editor-item-actions .icon-btn .icon { width: 14px; height: 14px; }
.editor-empty { padding: 16px; border: 1px dashed var(--line-strong); border-radius: 8px; text-align: center; color: var(--muted); font-size: 12px; background: var(--panel-soft); }

/* ---------- events ---------- */
.events-list { display: flex; flex-direction: column; }
.event-row { display: grid; grid-template-columns: 118px 150px minmax(0, 1fr); gap: 14px; align-items: start; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.event-row:last-child { border-bottom: 0; }
.event-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.event-time small { display: block; color: var(--faint); font-size: 10.5px; }
.event-detail { color: var(--ink-2); font-size: 12.5px; overflow-wrap: anywhere; }
.event-detail .mono { color: var(--muted); font-size: 11px; }

/* ---------- code display ---------- */
.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid #c9cdf7; background: var(--accent-soft); border-radius: 11px; padding: 15px 16px;
}
.code-value { font-family: var(--mono); font-size: 21px; font-weight: 650; letter-spacing: .09em; color: #333da8; word-break: break-all; }
.code-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.divider { height: 1px; background: var(--line); margin: 2px 0; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(13, 17, 27, .52); backdrop-filter: blur(2px);
  animation: fade-in .13s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 540px; max-height: min(88vh, 820px);
  display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  animation: modal-in .16s ease;
}
.modal-wide { max-width: 720px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 17px; font-weight: 670; letter-spacing: -.015em; }
.modal-sub { color: var(--muted); font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--panel-soft); border-radius: 0 0 16px 16px; flex-wrap: wrap; }
.modal-foot .form-error { margin-right: auto; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px;
  background: #171c29; color: #f4f6fb; border-radius: 10px; font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 18px 38px -16px rgba(13, 17, 27, .55);
  animation: toast-in .18s ease;
}
.toast .toast-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex: none; background: #8f97ac; }
.toast-success .toast-dot { background: #37d5a4; }
.toast-error .toast-dot { background: #ff7a6e; }
@keyframes toast-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---------- misc ---------- */
.loading-block { display: grid; gap: 12px; }
.skeleton { background: linear-gradient(90deg, #e9edf3 25%, #f2f4f8 37%, #e9edf3 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; border-radius: 10px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.noscript { padding: 30px; text-align: center; }
.foot-note { color: var(--faint); font-size: 11.5px; margin-top: 18px; }
.error-panel { border: 1px solid #f3c4c0; background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 14px 16px; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.error-panel p { font-size: 12.5px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .playlist-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px 14px 10px; }
  .sidebar .brand { padding: 0 4px 12px; }
  .nav { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-btn { width: auto; flex: none; padding: 8px 12px; }
  .nav-count { display: none; }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 4px 0; gap: 10px; }
  .topbar { padding: 9px 16px; }
  .view { padding: 20px 16px 44px; }
  .page-title { font-size: 22px; }
  .row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar-actions .btn-ghost span:not(.btn-ic) { display: none; }
  .topbar-actions .btn-ghost { padding: 8px 9px; }
  .topbar { gap: 8px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 20px; }
  .table th, .table td { padding-left: 13px; padding-right: 13px; }
  .event-row { grid-template-columns: 1fr; gap: 3px; padding: 11px 14px; }
  .event-time small { display: inline; margin-left: 6px; }
  .modal-foot { padding: 12px 14px; }
  .modal-body { padding: 16px 14px; }
  .modal-head { padding: 15px 14px 12px; }
  .code-box { flex-direction: column; align-items: flex-start; }
  .login-card { padding: 24px 20px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
