:root {
  color-scheme: dark;
  --bg: #1e2124;
  --surface: #282b30;
  --surface-raised: #2e3136;
  --surface-soft: #36393e;
  --border: #3f434a;
  --text: #f2f3f5;
  --muted: #9aa0a8;
  --green: #8a94a3;
  --green-strong: #aab4c4;
  --green-soft: rgba(170, 180, 196, 0.14);
  --red: #ff6b6b;
  --amber: #ffbf5f;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: rgba(13, 18, 15, 0.97);
  backdrop-filter: blur(20px);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #071006;
  background: var(--green);
  font-weight: 900;
  font-size: 21px;
  box-shadow: 0 0 32px rgba(83, 252, 24, 0.2);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -0.02em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 12px; }
nav { display: grid; gap: 6px; }
.nav-link { padding: 11px 13px; color: var(--muted); border-radius: 10px; font-size: 14px; font-weight: 600; }
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface-soft); }
.nav-link.active { box-shadow: inset 3px 0 var(--green); }
.sidebar-footer { margin-top: auto; display: grid; gap: 10px; padding: 16px 8px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

.main-content { margin-left: 248px; padding: 34px clamp(24px, 4vw, 64px) 90px; max-width: 1600px; }
.topbar, .section-heading, .panel-header, .dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar { margin-bottom: 34px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(27px, 3vw, 38px); letter-spacing: -0.04em; }
h2 { margin-bottom: 0; font-size: 25px; letter-spacing: -0.03em; }
h3 { margin-bottom: 6px; font-size: 17px; }
.eyebrow, .panel-kicker { margin-bottom: 6px; color: var(--green); text-transform: uppercase; letter-spacing: 0.13em; font-size: 11px; font-weight: 800; }
.section-block { padding-top: 24px; margin-bottom: 62px; scroll-margin-top: 20px; }
.section-heading { margin-bottom: 18px; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card, .panel {
  border: 1px solid var(--border);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(25, 34, 28, 0.9), rgba(15, 21, 17, 0.95));
  box-shadow: var(--shadow);
}
.metric-card { min-height: 155px; padding: 20px; }
.metric-card p { margin: 22px 0 5px; color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; font-size: 18px; }
.metric-card small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.4; }
.status-dot { display: block; width: 11px; height: 11px; border-radius: 50%; background: #566158; box-shadow: 0 0 0 5px rgba(86, 97, 88, 0.12); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.status-dot.warning { background: var(--amber); box-shadow: 0 0 0 5px rgba(255, 191, 95, 0.12); }
.metric-number { display: block; font-size: 31px; font-weight: 800; color: var(--green); line-height: 1; }
.panel { padding: 22px; }
.connection-panel { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.connection-panel p:last-child { margin: 0; color: var(--muted); }
.button-row, .heading-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  font-size: 13px;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: 0.55; transform: none; }
.button-primary { color: #071006; background: var(--green); }
.button-primary:hover { background: #6cff37; }
.button-secondary { color: var(--text); background: var(--surface-raised); border-color: var(--border); }
.button-secondary:hover { border-color: #405246; }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--border); }
.button-danger { color: #ffb2b2; background: rgba(255, 107, 107, 0.08); border-color: rgba(255, 107, 107, 0.22); }
.button-small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button-large { width: 100%; min-height: 48px; font-size: 14px; }

.master-toggle, .compact-toggle, .setting-row { position: relative; display: flex; align-items: center; gap: 11px; }
.master-toggle, .compact-toggle { color: var(--muted); font-size: 13px; font-weight: 700; }
.master-toggle input, .compact-toggle input, .setting-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; flex: 0 0 auto; width: 43px; height: 24px; border-radius: 99px; background: #334038; border: 1px solid #46544b; transition: 160ms ease; cursor: pointer; }
.switch::after { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; border-radius: 50%; background: #abb5ae; transition: 160ms ease; }
input:checked + .switch { background: var(--green); border-color: var(--green); }
input:checked + .switch::after { transform: translateX(19px); background: #071006; }
input:focus-visible + .switch { outline: 2px solid var(--green); outline-offset: 2px; }

.two-column { display: grid; grid-template-columns: minmax(300px, 0.8fr) minmax(420px, 1.2fr); gap: 14px; }
.settings-panel h3 { margin-bottom: 10px; }
.setting-row, .select-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child, .select-row:last-child { border-bottom: 0; }
.setting-row > span:first-child, .select-row > span:first-child { flex: 1; }
.setting-row strong, .select-row strong { display: block; font-size: 14px; }
.setting-row small, .select-row small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.35; }
.select-row { display: flex; align-items: center; gap: 14px; }
select, input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: #0e1410;
  padding: 9px 11px;
  outline: none;
}
select:focus, input:focus { border-color: var(--green-strong); box-shadow: 0 0 0 3px var(--green-soft); }
.select-row select { width: auto; min-width: 175px; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin: 17px 0; }
.form-grid { display: grid; align-items: end; gap: 11px; margin-bottom: 20px; }
.command-form { grid-template-columns: minmax(110px, 0.6fr) minmax(240px, 2fr) minmax(145px, 0.7fr) auto; }
.timer-form { grid-template-columns: minmax(280px, 1fr) 170px auto; }
.form-grid label, .dialog-fields label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.form-hint { margin: -8px 0 18px; color: var(--muted); font-size: 12px; }

.item-list, .data-table, .activity-list { display: grid; gap: 8px; }
.list-row, .table-row, .activity-row { display: flex; align-items: center; gap: 12px; padding: 12px 13px; border: 1px solid var(--border); border-radius: 11px; background: rgba(7, 11, 8, 0.35); }
.row-content { min-width: 0; flex: 1; }
.row-content strong, .row-content span { display: block; overflow-wrap: anywhere; }
.row-content small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.4; }
.row-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.pill { display: inline-flex; width: fit-content; padding: 3px 7px; border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.pill.off { color: var(--muted); background: rgba(150, 163, 154, 0.1); }
.activity-row { align-items: flex-start; }
.activity-icon { flex: 0 0 auto; width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--green); }
.activity-icon.warning { background: var(--amber); }
.activity-icon.error { background: var(--red); }
.empty-state { padding: 26px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 11px; }

.alert { margin-bottom: 18px; padding: 12px 15px; border-radius: 10px; }
.alert-error { color: #ffd3d3; background: rgba(255, 107, 107, 0.1); border: 1px solid rgba(255, 107, 107, 0.25); }
.alert-success { color: #caffb8; background: var(--green-soft); border: 1px solid rgba(83, 252, 24, 0.25); }
.hidden { display: none !important; }
.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; }

.editor-dialog { width: min(520px, calc(100vw - 28px)); padding: 0; border: 1px solid var(--border); border-radius: 17px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.editor-dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px); }
.editor-dialog form { padding: 22px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 22px; }
.dialog-fields { display: grid; gap: 14px; margin: 20px 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
.checkbox-field { display: flex !important; grid-template-columns: auto 1fr; align-items: center; }
.checkbox-field input { width: 18px; min-height: 18px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 380px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: #1b261f; box-shadow: var(--shadow); font-size: 13px; }

.login-page { min-height: 100vh; background: radial-gradient(circle at 50% 15%, rgba(83, 252, 24, 0.12), transparent 34%), var(--bg); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 38px; border: 1px solid var(--border); border-radius: 22px; text-align: center; background: rgba(17, 23, 19, 0.94); box-shadow: var(--shadow); }
.login-card .brand-mark { margin: 0 auto 24px; }
.login-card h1 { margin-bottom: 14px; }
.login-copy { color: var(--muted); line-height: 1.65; }
.security-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; }
.public-login-card { width: min(420px, 100%); }
.signed-in-view { display: grid; justify-items: center; gap: 8px; margin-top: 22px; }
.signed-in-view .status-dot { margin-bottom: 8px; }
.signed-in-view p { margin: 0; color: var(--muted); font-size: 13px; }
.signed-in-view strong { margin-bottom: 16px; font-size: 20px; }
.public-site-shell { min-height: 100vh; padding: 24px; }
.public-login-card { margin: max(5vh, 28px) auto; }
.public-global-alert { width: min(1180px, 100%); margin: 0 auto 18px; }
.public-dashboard { width: min(1180px, 100%); margin: 0 auto; }
.public-dashboard-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.public-dashboard-brand { padding: 0; }
.public-account { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.public-account strong { color: var(--text); }
.public-channel-summary { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 14px; }
.public-channel-summary .channel-stats { justify-content: flex-end; margin: 0; }
.public-setup-callout { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; border-color: rgba(255, 191, 95, 0.3); background: rgba(255, 191, 95, 0.06); }
.public-setup-callout .status-dot { margin-top: 6px; flex: 0 0 auto; }
.public-setup-callout h2 { margin-bottom: 7px; font-size: 20px; }
.public-setup-callout p:last-child { margin: 0; color: var(--muted); line-height: 1.55; }
.public-config-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.public-behavior-panel { grid-column: 1 / -1; }
.public-behavior-panel .feature-grid { margin: 18px 0; }
.public-config-panel { min-width: 0; }
.public-add-form { margin-bottom: 20px; }
.public-list-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 0 0 13px; color: var(--muted); font-size: 12px; }
.public-list-toolbar > label { display: grid; gap: 5px; width: min(230px, 55%); font-weight: 700; }
.public-word-selection { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 13px; }
.public-select-all { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-weight: 700; cursor: pointer; }
.public-select-all input, .public-word-checkbox input { width: 18px; min-height: 18px; accent-color: var(--green); cursor: pointer; }
.public-select-all:has(input:disabled) { color: var(--muted); cursor: default; }
.public-bulk-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; margin: -4px 0 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); background: rgba(7, 11, 8, 0.28); font-size: 12px; }
.public-config-list { max-height: 520px; overflow-y: auto; }
.public-config-list .table-row { align-items: flex-start; }
.public-config-list .public-word-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
.public-word-checkbox { display: flex; padding-top: 2px; }
.public-command-form { padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.public-command-form > .button { width: fit-content; }
.public-command-fields { display: grid; grid-template-columns: 1fr 180px; gap: 10px; }
.public-timer-panel { grid-column: 1 / -1; }
.public-timer-form { margin-top: 18px; padding-bottom: 4px; }
.public-timer-fields { display: grid; grid-template-columns: minmax(240px, 1fr) 170px auto; align-items: end; gap: 10px; }
.public-timer-fields label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.public-timer-list { max-height: 420px; overflow-y: auto; }
.public-feature-notice { margin-top: 16px; padding: 11px 13px; border: 1px solid rgba(255, 191, 95, 0.3); border-radius: 10px; color: #ffd597; background: rgba(255, 191, 95, 0.07); font-size: 13px; }
.public-inline-editor { width: 100%; display: grid; grid-template-columns: minmax(90px, .55fr) minmax(180px, 1.5fr) 105px; gap: 9px; }
.public-inline-editor label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.public-inline-editor .row-actions { grid-column: 1 / -1; }
.public-timer-inline-editor { grid-template-columns: minmax(220px, 1fr) 150px; }

@media (max-width: 900px) {
  .public-config-grid { grid-template-columns: 1fr; }
  .public-channel-summary { align-items: flex-start; flex-direction: column; }
  .public-channel-summary .channel-stats { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .public-site-shell { padding: 14px; }
  .public-dashboard-header { align-items: flex-start; flex-direction: column; }
  .public-account { width: 100%; justify-content: space-between; }
  .public-channel-summary .channel-title-row { gap: 8px; }
  .public-list-toolbar { align-items: stretch; flex-direction: column; }
  .public-list-toolbar > label { width: 100%; }
  .public-config-list .public-word-row { grid-template-columns: auto minmax(0, 1fr); }
  .public-word-row .row-actions { grid-column: 2; }
  .public-command-fields, .public-timer-fields, .public-inline-editor { grid-template-columns: 1fr; }
  .public-inline-editor .row-actions { grid-column: auto; }
}

.admin-page { min-height: 100vh; background: radial-gradient(circle at 12% 0%, rgba(83, 252, 24, 0.09), transparent 28%), var(--bg); }
.stacked-form { display: grid; gap: 14px; margin-top: 22px; text-align: left; }
.stacked-form label, .admin-create-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.stacked-form label small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.admin-shell { min-height: 100vh; }
.admin-topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 82px; padding: 14px clamp(18px, 4vw, 58px); border-bottom: 1px solid var(--border); background: rgba(9, 13, 11, 0.93); backdrop-filter: blur(18px); }
.compact-brand { padding: 0; }
.compact-brand .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; }
.admin-content { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 90px; }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-card { padding: 25px; }
.admin-card-wide { grid-column: 1 / -1; }
.admin-form-hint { margin: 0; }
.security-callout { margin-bottom: 16px; border-color: rgba(255, 191, 95, 0.45); background: rgba(255, 191, 95, 0.07); }
.security-callout p:last-child { margin: 10px 0 0; color: var(--muted); }
.endpoint-box { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 11px; background: rgba(5, 9, 6, 0.45); }
.endpoint-box strong { margin-top: 6px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.endpoint-box code { color: var(--green); overflow-wrap: anywhere; font-size: 12px; }
.admin-user-list { margin: 20px 0; }
.admin-create-form { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; align-items: end; gap: 11px; padding-top: 20px; border-top: 1px solid var(--border); }
.channel-add-form { display: grid; grid-template-columns: minmax(260px, 1fr) auto; align-items: end; gap: 11px; margin: 20px 0 12px; }
.channel-add-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.channel-list { display: grid; gap: 12px; margin-top: 22px; }
.channel-search { display: block; max-width: 420px; margin-top: 18px; }
.channel-card { padding: 18px; border: 1px solid var(--border); border-radius: 13px; background: rgba(7, 11, 8, 0.42); }
.channel-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.channel-card-heading a { display: block; color: var(--text); font-size: 18px; font-weight: 800; }
.channel-card-heading small { display: block; margin-top: 4px; color: var(--muted); }
.connection-detail { margin: 12px 0; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(135px, 1fr)); gap: 8px; margin: 14px 0; }
.feature-toggle { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); font-size: 12px; font-weight: 700; background: rgba(14, 20, 16, 0.75); }
.feature-toggle input { width: 17px; min-height: 17px; accent-color: var(--green); }
.feature-toggle:has(input:checked) { color: var(--text); border-color: rgba(83, 252, 24, 0.3); background: var(--green-soft); }
.channel-actions { margin-top: 14px; }
.success-text { color: var(--green) !important; }
.danger-text { color: var(--red) !important; }
.confirm-dialog { width: min(480px, calc(100vw - 28px)); padding: 24px; border: 1px solid var(--border); border-radius: 17px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px); }
.confirm-dialog p:not(.panel-kicker) { color: var(--muted); line-height: 1.55; }
.channel-config-dialog { width: min(940px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 24px; border: 1px solid var(--border); border-radius: 17px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.channel-config-dialog::backdrop { background: rgba(0, 0, 0, 0.76); backdrop-filter: blur(4px); }
.channel-config-dialog .dialog-header { margin-bottom: 18px; }
.config-section { display: grid; gap: 14px; padding: 20px 0; border-top: 1px solid var(--border); }
.config-section h3 { margin-bottom: 5px; }
.channel-rule-form, .channel-import-form, .channel-timer-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 10px; }
.channel-import-form { grid-template-columns: minmax(220px, 1fr) minmax(170px, auto) auto; }
.channel-timer-form { grid-template-columns: minmax(260px, 1fr) 160px auto; }
.channel-rule-form label, .channel-import-form > label:first-child, .channel-timer-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.import-toggle { margin: 0; }
.config-search { margin-top: 0; }
.config-list { max-height: 330px; overflow: auto; }
.config-list .table-row { padding: 10px 0; }
.config-list .row-content { min-width: 0; }
.config-list .row-content strong { overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; }
  .command-form { grid-template-columns: 1fr 2fr; }
  .timer-form { grid-template-columns: 1fr 170px; }
  .command-form .button, .timer-form .button { width: fit-content; }
  .admin-create-form { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, minmax(135px, 1fr)); }
}

@media (max-width: 760px) {
  .sidebar { position: static; width: auto; padding: 15px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar nav { display: flex; overflow-x: auto; }
  .nav-link { white-space: nowrap; }
  .sidebar-footer { display: none; }
  .brand { padding-bottom: 15px; }
  .main-content { margin-left: 0; padding: 24px 15px 70px; }
  .topbar, .section-heading, .connection-panel { align-items: flex-start; flex-direction: column; }
  .metrics-grid { grid-template-columns: 1fr; }
  .command-form, .timer-form { grid-template-columns: 1fr; }
  .button-row { width: 100%; }
  .button-row .button { flex: 1; }
  .list-row, .table-row { align-items: flex-start; flex-direction: column; }
  .row-actions { width: 100%; }
  .select-row { align-items: flex-start; flex-direction: column; }
  .select-row select { width: 100%; }
  .admin-topbar, .admin-heading { align-items: flex-start; flex-direction: column; }
  .admin-topbar .button-row { width: auto; }
  .admin-content { width: min(100% - 24px, 1180px); padding-top: 28px; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-card-wide { grid-column: auto; }
  .admin-create-form { grid-template-columns: 1fr; }
  .channel-add-form, .feature-grid { grid-template-columns: 1fr; }
  .channel-rule-form, .channel-import-form, .channel-timer-form { grid-template-columns: 1fr; }
}

/* Routed administration control center */
.admin-control-center { min-height: 100vh; }
.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 260px;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: rgba(12, 17, 14, 0.97);
  backdrop-filter: blur(20px);
}
.admin-brand { padding: 0 8px 28px; }
.admin-nav { display: grid; gap: 5px; }
.admin-nav .nav-disabled { opacity: 0.35; cursor: not-allowed; }
.admin-sidebar-footer { margin-top: auto; display: grid; gap: 9px; padding: 18px 8px 0; border-top: 1px solid var(--border); }
.admin-sidebar-footer > span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.admin-workspace { min-height: 100vh; margin-left: 260px; padding: 34px clamp(22px, 4vw, 62px) 90px; }
.admin-workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 1320px; margin: 0 auto 28px; }
.admin-workspace > .alert, .admin-workspace > .security-callout, .admin-view { max-width: 1320px; margin-left: auto; margin-right: auto; }
.admin-view { display: none; }
.admin-view.active { display: block; }
.admin-page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-page-grid-wide { margin-top: 16px; grid-template-columns: minmax(300px, 0.82fr) minmax(420px, 1.18fr); }
.admin-page-grid + .panel, .channel-tab > .panel + .panel { margin-top: 16px; }
.panel-copy { margin: 9px 0 0; color: var(--muted); line-height: 1.55; font-size: 13px; }
.status-list { display: grid; gap: 0; margin: 14px 0 20px; }
.status-row { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.status-row:last-child { border-bottom: 0; }
.status-row strong { color: var(--text); text-align: right; overflow-wrap: anywhere; }
.channel-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.channel-stats span { padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); font-size: 12px; }
.channel-stats strong { color: var(--text); }
.channel-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.back-link, .subtle-link { display: inline-flex; margin-bottom: 10px; color: var(--muted); font-size: 13px; font-weight: 650; }
.back-link:hover, .subtle-link:hover { color: var(--green); }
.channel-title-row { display: flex; align-items: center; gap: 12px; }
.channel-title-row h2 { font-size: clamp(25px, 3vw, 34px); }
.channel-tabs { display: flex; gap: 5px; margin-bottom: 18px; padding: 5px; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: rgba(12, 17, 14, 0.76); }
.channel-tabs a { flex: 0 0 auto; padding: 10px 13px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.channel-tabs a:hover, .channel-tabs a.active { color: var(--text); background: var(--surface-soft); }
.channel-tabs a.active { box-shadow: inset 0 -2px var(--green); }
.channel-tab { display: none; }
.channel-tab.active { display: block; }
.feature-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
.feature-toggle { align-items: flex-start; min-height: 68px; }
.feature-toggle input { margin-top: 2px; flex: 0 0 auto; }
.feature-toggle span, .feature-toggle strong, .feature-toggle small { display: block; }
.feature-toggle small { margin-top: 4px; color: var(--muted); line-height: 1.35; font-weight: 500; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 16px; border-color: rgba(255, 107, 107, 0.24); }
.compact-form { margin-top: 16px; }
.compact-form .button { width: fit-content; }
.compact-search { display: grid; gap: 6px; min-width: min(260px, 45vw); color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-row { display: grid; grid-template-columns: 200px 230px minmax(240px, 1fr); gap: 11px; margin: 20px 0; }
.filter-row label, .inline-editor label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.inline-editor { width: 100%; display: grid; grid-template-columns: minmax(110px, .55fr) minmax(260px, 2fr) 130px auto; align-items: end; gap: 10px; }
.inline-editor.timer-editor { grid-template-columns: minmax(260px, 2fr) 130px auto; }
textarea {
  width: 100%; min-height: 110px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); background: #0e1410; outline: none; resize: vertical; font: inherit;
}
textarea:focus { border-color: var(--green-strong); box-shadow: 0 0 0 3px var(--green-soft); }

@media (max-width: 1050px) {
  .admin-page-grid, .admin-page-grid-wide { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row label:last-child { grid-column: 1 / -1; }
  .inline-editor { grid-template-columns: 1fr 1fr; }
  .inline-editor.timer-editor { grid-template-columns: 1fr 150px; }
}

@media (max-width: 760px) {
  .admin-sidebar { position: static; width: auto; padding: 15px; border-right: 0; border-bottom: 1px solid var(--border); }
  .admin-brand { padding-bottom: 14px; }
  .admin-nav { display: flex; overflow-x: auto; }
  .admin-nav .nav-link { flex: 0 0 auto; white-space: nowrap; }
  .admin-sidebar-footer { display: none; }
  .admin-workspace { margin-left: 0; padding: 25px 14px 70px; }
  .admin-workspace-header, .panel-header, .channel-page-header, .danger-zone { align-items: flex-start; flex-direction: column; }
  .feature-grid, .filter-row, .inline-editor, .inline-editor.timer-editor { grid-template-columns: 1fr; }
  .filter-row label:last-child { grid-column: auto; }
  .compact-search { min-width: 100%; width: 100%; }
  .channel-title-row { align-items: flex-start; flex-direction: column; }
  .command-form, .timer-form { grid-template-columns: 1fr; }
}

/* Memory and live feed views */
.scroll-panel { max-height: 460px; overflow-y: auto; padding-right: 6px; }
.feed-log .feed-row { border-left: 2px solid var(--border); }
.feed-user-id { color: var(--muted); font-weight: 500; font-size: 12px; }
.subsection-title { margin: 22px 0 10px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.inline-toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.memory-user-row { cursor: default; }
