/* pstars – "Editorial classic" look with three themes.
   Layout: fixed-width sidebar (search, menu, theme, footer) + main column
   with a red-ruled top bar. Below 1100px the sidebar becomes a drawer.
   Themes: <html data-theme="light|lightdark|dark">. lightdark = light page,
   dark sidebar. */

:root,
:root[data-theme="light"],
:root[data-theme="lightdark"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f6f7;
  --ink: #3d4449;
  --ink-strong: #2b3034;
  --soft: #7f888f;
  --line: rgba(210, 215, 217, 0.75);
  --line-strong: rgba(61, 68, 73, 0.3);
  --accent: #f56a6a;
  --accent-strong: #e2504f;
  --accent-soft: rgba(245, 106, 106, 0.08);
  --on-accent: #ffffff;
  --input-bg: #ffffff;
  --ok: #3a9d5d;
  --warn: #c98a00;
  --danger: #d64545;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  --scrim: rgba(20, 22, 25, 0.4);

  --side-bg: #f5f6f7;
  --side-ink: #3d4449;
  --side-soft: #7f888f;
  --side-line: rgba(210, 215, 217, 0.75);
  --side-input-bg: #ffffff;
  --side-seg-on: #3d4449;
  --side-seg-on-ink: #ffffff;

  --font: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --radius: 4px;
  --side-w: 280px;
  color-scheme: light;
}

/* light page, dark sidebar */
:root[data-theme="lightdark"] {
  --side-bg: #23272c;
  --side-ink: #d4d8dc;
  --side-soft: #8c949b;
  --side-line: rgba(255, 255, 255, 0.09);
  --side-input-bg: #1b1e22;
  --side-seg-on: #f56a6a;
  --side-seg-on-ink: #ffffff;
}

:root[data-theme="dark"] {
  --bg: #1b1e22;
  --surface: #22262b;
  --surface-2: #262a30;
  --ink: #c9ced3;
  --ink-strong: #eceff1;
  --soft: #8a929a;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.26);
  --accent: #f27c7c;
  --accent-strong: #f59393;
  --accent-soft: rgba(242, 124, 124, 0.12);
  --on-accent: #1b1e22;
  --input-bg: #16191c;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --scrim: rgba(0, 0, 0, 0.55);

  --side-bg: #15171a;
  --side-ink: #c4c9ce;
  --side-soft: #7b838b;
  --side-line: rgba(255, 255, 255, 0.07);
  --side-input-bg: #1f2327;
  --side-seg-on: #f27c7c;
  --side-seg-on-ink: #15171a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 300 15px/1.7 var(--font);
}
body.modal-open { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
b, strong { font-weight: 500; }
h1, h2, h3 { color: var(--ink-strong); font-weight: 400; line-height: 1.3; text-wrap: balance; }
.muted { color: var(--soft); }
.center { text-align: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================================================================ layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  flex: 0 0 var(--side-w); width: var(--side-w);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side-bg); color: var(--side-ink);
  transition: margin-left 0.3s ease, transform 0.3s ease;
}
.side-collapsed .sidebar { margin-left: calc(-1 * var(--side-w)); }
.sidebar-inner { min-height: 100%; padding: 30px 30px 26px; display: flex; flex-direction: column; gap: 40px; }

.side-search { position: relative; }
.side-search input, .main-search input {
  width: 100%; height: 44px; padding: 0 40px 0 14px; border-radius: var(--radius);
  font: 300 15px var(--font);
}
.side-search input { background: var(--side-input-bg); color: var(--side-ink); border: 1px solid var(--side-line); }
.side-search .fa, .main-search .fa { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--soft); pointer-events: none; }
.side-search .fa { color: var(--side-soft); }

.menu-title {
  display: inline-block; margin: 0 0 20px; padding-bottom: 12px;
  color: var(--side-ink); font-size: 1.35rem; font-weight: 400;
  border-bottom: 3px solid var(--accent);
}
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu li + li { border-top: 1px solid var(--side-line); }
.menu a {
  display: flex; align-items: center; gap: 10px; padding: 13px 0;
  color: var(--side-ink); font-size: 0.76rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.menu a .fa { color: var(--side-soft); }
.menu a:hover, .menu a.on, .menu a.on .fa { color: var(--accent); }

.theme-label { display: block; margin-bottom: 10px; color: var(--side-soft); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; }
.theme-seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--side-line); border-radius: var(--radius); overflow: hidden; }
.theme-seg button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px;
  border: 0; background: transparent; color: var(--side-soft); cursor: pointer;
  font: 500 0.62rem var(--font); letter-spacing: 0.06em;
}
.theme-seg button + button { border-left: 1px solid var(--side-line); }
.theme-seg button .fa { font-size: 0.95rem; }
.theme-seg button:hover { color: var(--side-ink); }
.theme-seg button[aria-pressed="true"] { background: var(--side-seg-on); color: var(--side-seg-on-ink); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; color: var(--side-soft); font-size: 0.78rem; }

.main { flex: 1; min-width: 0; }
.main-inner { max-width: 1280px; margin: 0 auto; padding: 0 60px 70px; }

.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 36px 0 16px; border-bottom: 4px solid var(--accent);
}
.burger {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  margin-left: -6px; border: 0; border-radius: var(--radius); background: transparent;
  color: var(--accent); font-size: 1.35rem; cursor: pointer;
}
.burger:hover { background: var(--accent-soft); }
.logo { color: var(--ink-strong); font-size: 1.1rem; font-weight: 500; letter-spacing: 0.01em; white-space: nowrap; }
.logo:hover { color: var(--accent); }
.top-icons { list-style: none; display: flex; gap: 22px; margin: 0 0 0 auto; padding: 0; }
.top-icons a { display: inline-flex; align-items: center; gap: 7px; color: var(--soft); font-size: 0.92rem; font-weight: 300; white-space: nowrap; }
.top-icons a:hover { color: var(--accent); }

.content { padding-top: 46px; }

/* ================================================================ page head */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 26px; }
.page-title { margin: 0 auto 0 0; font-size: 2.4rem; font-weight: 300; letter-spacing: -0.01em; color: var(--ink-strong); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.main-search { position: relative; display: none; margin-bottom: 22px; }
.main-search input { background: var(--input-bg); color: var(--ink); border: 1px solid var(--line); }
.side-collapsed .main-search { display: block; }

.notice { margin: 0 0 26px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface-2); color: var(--soft); font-size: 0.9rem; }
.notice-accent { background: var(--accent-soft); color: var(--ink); }
.autohide { overflow: hidden; transition: opacity 0.5s ease, max-height 0.5s ease, margin 0.5s ease, padding 0.5s ease; }
.autohide-out { opacity: 0; max-height: 0 !important; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }

.seg { display: inline-flex; border-radius: var(--radius); box-shadow: inset 0 0 0 1.5px var(--line-strong); overflow: hidden; }
.seg-btn { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; color: var(--ink); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.seg-btn:hover { color: var(--accent); }
.seg-btn.on { background: var(--accent); color: var(--on-accent); }

/* ================================================================ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 24px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong);
  font: 500 0.72rem var(--font); letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap; transition: box-shadow 0.15s, color 0.15s, background 0.15s;
}
.btn:hover { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary, .btn.on { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.btn-primary:hover, .btn.on:hover { background: var(--accent-strong); color: var(--on-accent); box-shadow: none; }
.btn-small { min-height: 34px; padding: 0 14px; font-size: 0.66rem; }
.btn-block { width: 100%; }
.btn-quiet { color: var(--soft); box-shadow: inset 0 0 0 1px var(--line); }
.btn-danger { color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.btn-danger:hover { color: var(--on-accent); background: var(--danger); box-shadow: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: var(--radius); background: transparent;
  color: var(--soft); cursor: pointer; font-size: 0.85rem;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--ink-strong); }
.icon-btn.danger:hover { color: var(--danger); }

/* ================================================================ bookmarks */
.bm-root { display: flex; flex-direction: column; gap: 36px; }
.cat { min-width: 0; }
.cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.cat-title { margin: 0; font-size: 1.22rem; font-weight: 400; }
.cat-count { color: var(--soft); font-size: 0.72rem; }
.cat-actions { margin-left: auto; gap: 2px; }
.bm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 14px; }
.bm {
  display: inline-flex; align-items: stretch; max-width: 100%; border-radius: var(--radius);
  box-shadow: inset 0 0 0 1.5px var(--line-strong); transition: box-shadow 0.15s;
}
.bm:hover { box-shadow: inset 0 0 0 1.5px var(--accent); }
.bm-link {
  display: inline-flex; align-items: center; min-height: 40px; max-width: 100%; padding: 0 20px;
  color: var(--ink); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
}
.bm-link:hover { color: var(--accent); }
.bm-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drag-handle { display: none; color: var(--soft); cursor: grab; padding: 4px; }
.edit-only { display: none; }
.bm-add {
  display: none; align-items: center; gap: 6px; min-height: 40px; margin-top: 12px; padding: 0 18px;
  border: 1.5px dashed var(--accent); border-radius: var(--radius); background: transparent;
  color: var(--accent); cursor: pointer; font: 500 0.68rem var(--font); letter-spacing: 0.12em; text-transform: uppercase;
}

.edit-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 30px;
  padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); font-size: 0.86rem;
}
.edit-bar .spacer { flex: 1; }

.editing .edit-only { display: inline-flex; align-items: center; }
.editing .bm-add { display: inline-flex; }
.editing .drag-handle { display: inline-block; }
.editing .bm { cursor: grab; }
.editing .bm-link { pointer-events: none; padding-right: 12px; }
.editing .bm-actions { padding: 0 4px; border-left: 1px solid var(--line); }
.editing .bm-actions .icon-btn { width: 28px; height: 28px; }
.sortable-ghost { opacity: 0.35; }
.sortable-chosen { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* ================================================================ forms & cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; }
.card h3 { margin-top: 0; font-size: 1.15rem; }
.card.narrow { max-width: 440px; }
.card .page-title { display: block; margin-bottom: 22px; font-size: 1.9rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 20px; }
.kv dt { color: var(--soft); }
.kv dd { margin: 0; word-break: break-all; }
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { color: var(--ink-strong); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search] {
  width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--input-bg); color: var(--ink); font: 300 16px var(--font);
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
input::placeholder { color: var(--soft); }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.form-error { margin: 0; color: var(--danger); font-size: 0.88rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ================================================================ flash */
.flash-area {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60;
  width: min(560px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px;
}
.flash {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); border-left: 3px solid var(--soft);
  transition: opacity 0.25s, transform 0.25s; animation: flash-in 0.25s ease-out;
}
.flash span { flex: 1; word-break: break-all; }
.flash.hide { opacity: 0; transform: translateY(8px); }
.flash-success { border-color: var(--ok); }
.flash-info { border-color: #4a90d9; }
.flash-warning { border-color: var(--warn); }
.flash-danger { border-color: var(--danger); }
.flash-close { background: none; border: 0; font-size: 1.3rem; color: var(--soft); cursor: pointer; }
@keyframes flash-in { from { opacity: 0; transform: translateY(8px); } }

/* ================================================================ modal */
.modal {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px; background: var(--scrim);
}
.modal-box { width: 100%; max-width: 440px; background: var(--surface); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.modal-box h3 { margin: 0 0 18px; font-size: 1.2rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ================================================================ wake up page */
.access-log { max-width: 1180px; margin-top: 24px; }
.access-table { overflow-x: auto; }
.access-table table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.access-table th { text-align: left; font-weight: 600; color: var(--soft); font-size: 0.75rem;
  letter-spacing: .06em; text-transform: uppercase; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
.access-table td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.access-table .nowrap { white-space: nowrap; }
.access-hint { margin: 12px 0 0; font-size: 0.85rem; }
.ip-tag { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: 0.7rem; line-height: 1.6; }
.ip-local { background: var(--line); color: var(--soft); }
.ip-remote { background: #c0392b; color: #fff; }
.access-log .wake-head { flex-wrap: wrap; gap: 4px 12px; }
@media (max-width: 640px) {      /* phone: one record = a small block of lines */
  .access-table thead { display: none; }
  .access-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .access-table td { display: inline; padding: 0 6px 0 0; border: 0; }
  .access-table td.c-when { font-weight: 600; }
  .access-table td.c-kind::before, .access-table td.c-user::before { content: "· "; color: var(--soft); }
  .access-table td.c-dev, .access-table td.c-ip { display: block; color: var(--soft); margin-top: 2px; }
}
.wake { max-width: 560px; }
.live { max-width: 560px; margin-bottom: 24px; }
/* Wide screens: Live and Wake Up SON! side by side; narrow: stacked */
.wake-grid {
  display: grid; gap: 24px; align-items: start; max-width: 1180px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
}
.wake-grid > .card { max-width: none; margin-bottom: 0; min-width: 0; }
@media (max-width: 1099px) {   /* stacked layout keeps the comfortable card width */
  .wake-grid { grid-template-columns: minmax(0, 560px); }
}
.live .wake-head { margin-bottom: 14px; flex-wrap: wrap; gap: 8px 14px; }
.live-viewers { margin-left: auto; font-size: 0.8rem; color: var(--soft); white-space: nowrap; }
.live-viewers b { color: var(--ink); font-weight: 600; }
.live-viewers.many b { color: var(--accent); }
.live-view {
  position: relative; aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden;
  border-radius: var(--radius); background: #15171a;
}
.live-view live-video, .live-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.live-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 16px; text-align: center; color: #c4c9ce;
}
.live-placeholder .fa { font-size: 2rem; color: #6f777f; }
.live-placeholder p { margin: 4px 0 0; color: #eceff1; }
.live-placeholder small { color: #8a929a; }
.live-placeholder .btn { margin-top: 10px; color: #c4c9ce; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25); }
.live-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; color: var(--soft); font-size: 0.85rem; }
.live-camera { flex: 1 0 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; }
.live-tools { margin-left: auto; display: inline-flex; gap: 6px; }
.live-icon { min-width: 36px; padding: 0 10px; }
.live-view:fullscreen { aspect-ratio: auto; border-radius: 0; background: #000; }
.live-view:-webkit-full-screen { aspect-ratio: auto; border-radius: 0; background: #000; }
.live-sound { min-height: 44px; padding: 0 18px; }
.live-sound .fa { font-size: 1.1rem; }
.live-sound.on { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.live-orient[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.live-ctl { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.ctl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 30px; margin-top: 14px; }
.ctl-head:first-child { margin-top: 0; }
.ctl-label { font-size: 0.8rem; font-weight: 600; color: var(--soft); white-space: nowrap; }
.ctl-af { padding: 0 10px; min-height: 30px; }
/* - | slider | + | value */
.ctl-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px 44px;
  align-items: center; column-gap: 10px; margin-top: 6px; }
.ctl-range { grid-column: 2; width: 100%; min-width: 0; accent-color: var(--accent); }
.ctl-range:disabled { opacity: .35; }
.live-ctl .ctl-step { width: 34px; height: 34px; min-width: 34px; min-height: 34px; padding: 0; font-size: 0.75rem; }
.ctl-step:disabled { opacity: .4; }
.ctl-value { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.85rem; white-space: nowrap; }
.ctl-scale { grid-column: 2; grid-row: 2; display: flex; justify-content: space-between;
  font-size: 0.7rem; color: var(--soft); }
.ctl-check { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; font-size: 0.85rem; }
.ctl-check small { display: block; font-size: 0.75rem; }
.ctl-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 0.75rem; }
.live-orient[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }
/* Orientation is applied in the browser (no extra CPU on the Pi) */
.live-view live-video { transition: transform .2s ease; }
.live-view.is-flip live-video { transform: scaleX(-1); }
.live-view.is-rot live-video { transform: rotate(180deg); }
.live-view.is-flip.is-rot live-video { transform: scaleY(-1); }
.live-sound.on:hover { background: var(--accent-strong); color: var(--on-accent); }

.talk { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.talk-btn {
  width: 96px; height: 96px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--accent); color: var(--on-accent);
  font: 500 0.66rem var(--font); letter-spacing: 0.12em; text-transform: uppercase;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 0 0 0 var(--accent-soft); transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
}
.talk-btn .fa { font-size: 1.9rem; }
.talk-btn:disabled { opacity: 0.45; cursor: default; }
.talk-btn.pressed { transform: scale(0.96); }
.talk-btn.on { background: var(--accent-strong); box-shadow: 0 0 0 10px var(--accent-soft); animation: talk-pulse 1.2s ease-in-out infinite; }
@keyframes talk-pulse { 50% { box-shadow: 0 0 0 16px var(--accent-soft); } }
.talk-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.talk-state { color: var(--ink-strong); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.talk-state[data-state="talking"] { color: var(--accent); }
.talk-state[data-state="offline"] { color: var(--danger); }
.talk-level { height: 6px; }
.talk-side small { font-size: 0.78rem; line-height: 1.5; }
.wake-head { display: flex; align-items: center; gap: 14px; }
.wake-head h3 { margin: 0; }
.wake-status {
  display: inline-flex; align-items: center; gap: 7px; padding: 2px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--soft); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.wake-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.wake-status[data-state="playing"] { background: var(--accent-soft); color: var(--accent); }
.wake-status[data-state="playing"]::before { animation: wake-pulse 1.2s ease-in-out infinite; }
@keyframes wake-pulse { 50% { opacity: 0.25; } }
.wake-desc { margin: 10px 0 18px; }
.wake-actions { display: flex; gap: 12px; }
.wake-actions .btn { flex: 1; min-height: 56px; font-size: 0.8rem; }
.wake-actions .btn .fa { font-size: 1rem; }
.wake-list { margin: 22px 0 0; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.wake-list-title { float: left; width: 100%; padding: 0; margin-bottom: 10px; color: var(--ink-strong); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.wake-list-title .fa { color: var(--soft); margin-right: 4px; }
.wake-list-title .muted { letter-spacing: 0; }
.wake-files { clear: both; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); }
.wake-file {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 14px;
  cursor: pointer; color: var(--ink); font-size: 0.95rem; min-width: 0;
}
.wake-file + .wake-file { border-top: 1px solid var(--line); }
.wake-file:hover { background: var(--surface-2); }
.wake-file input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); cursor: pointer; }
.wake-file span { overflow-wrap: anywhere; }
.wake-file:has(input:checked) { color: var(--ink-strong); background: var(--accent-soft); }
.wake-list-actions { display: flex; gap: 8px; margin-top: 10px; }
.wake-queue { margin: 16px 0 0; padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); font-size: 0.88rem; overflow-wrap: anywhere; }
.wake-volume {
  display: grid; grid-template-columns: auto 56px 1fr 56px; align-items: center; gap: 12px;
  margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line);
}
.wake-vol-label { color: var(--ink-strong); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.wake-vol-label .fa { color: var(--soft); margin-right: 4px; }
.vol-btn { min-height: 48px; padding: 0; font-size: 1rem; }
.vol-meter { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.vol-value { color: var(--ink-strong); font-size: 1.6rem; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.vol-bar { width: 100%; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.vol-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease; }
@media (max-width: 420px) {
  .wake-volume { grid-template-columns: 56px 1fr 56px; }
  .wake-vol-label { grid-column: 1 / -1; }
}
.wake-problems { margin: 14px 0 0; padding-left: 18px; }

/* ================================================================ tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--ink-strong); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.table tr.inactive td { opacity: 0.55; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.74rem; background: var(--surface-2); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-ok { color: var(--ok); }
.tag-off { color: var(--danger); }

/* ================================================================ responsive */
@media (max-width: 1099px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50; margin-left: 0 !important;
    transform: translateX(-100%); box-shadow: none;
  }
  .drawer-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .scrim { position: fixed; inset: 0; z-index: 45; background: var(--scrim); }
  .main-inner { padding: 0 36px 56px; }
  .main-search { display: block; }
}
@media (max-width: 760px) {
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; }
  .table.responsive td { display: flex; gap: 12px; border: 0; padding: 5px 0; }
  .table.responsive td::before { content: attr(data-label); min-width: 84px; color: var(--soft); font-size: 0.78rem; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .main-inner { padding: 0 18px 44px; }
  .topbar { gap: 12px; padding: 16px 0 12px; border-bottom-width: 3px; }
  .top-icons { gap: 14px; }
  .top-icons a { font-size: 0.85rem; }
  .content { padding-top: 26px; }
  .page-title { font-size: 1.8rem; }
  .page-head { margin-bottom: 18px; }
  .bm-root { gap: 28px; }
  .cat-head { margin-bottom: 12px; }
  .bm-list { gap: 8px 8px; }
  .bm-link { min-height: 40px; padding: 0 14px; font-size: 0.68rem; letter-spacing: 0.1em; }
  .card { padding: 22px; }
}
@media (max-width: 400px) {
  .top-icons span { display: none; }
  .top-icons a .fa { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
