:root {
  --bg: #0f1115; --panel: #151820; --card: #181b22; --line: #2a2f3a; --fg: #e6e8ee; --dim: #8a93a6;
  --ok: #3ecf8e; --warn: #f5a524; --bad: #f31260; --link: #7aa2f7; --accent: #2b3a67; --sidebar: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 12.5px; background: #11141a; padding: 1px 5px; border-radius: 4px; }

/* Permanent left sidebar */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; }
.brand { display: flex; flex-direction: column; color: var(--fg); padding: 0 8px 20px; }
.brand:hover { text-decoration: none; }
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: .2px; line-height: 1.1; }
.brand-sub { font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.brand.big .brand-name { font-size: 30px; }
.brand.big .brand-sub { font-size: 14px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { padding: 8px 10px; border-radius: 7px; color: var(--dim); }
.side-nav a:hover { background: #1c2029; color: var(--fg); text-decoration: none; }
.side-nav a.active { background: var(--accent); color: var(--fg); }
.side-group { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 8px 10px; padding-left: 10px; border-left: 1px solid var(--line); }
.side-group-label { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--dim); padding: 6px 0 4px; }
.side-nav a.sub { padding: 6px 10px; font-size: 13.5px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.who { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 7px; color: var(--fg); }
.who:hover, .who.active { background: #1c2029; text-decoration: none; }
.who-name { font-weight: 600; }
.who-email { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; }

.content { margin-left: var(--sidebar); padding: 28px 32px; max-width: calc(var(--sidebar) + 1200px); }
h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 15px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 18px; }
.card.narrow { max-width: 560px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 0; }
dt { color: var(--dim); } dd { margin: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; } ul.plain li { padding: 3px 0; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 8px 14px; color: var(--dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--fg); border-bottom-color: var(--link); }
.tabs a:hover { color: var(--fg); text-decoration: none; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }

table.grid-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px; }
table.grid-table th { text-align: left; color: var(--dim); font-weight: 500; border-bottom: 1px solid var(--line); padding: 6px 8px; }
table.grid-table td { border-bottom: 1px solid var(--line); padding: 7px 8px; vertical-align: top; }
td.details { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--dim); word-break: break-all; }
td.nowrap { white-space: nowrap; }

.chip { display: inline-block; padding: 1px 8px; margin: 1px 4px 1px 0; border-radius: 999px; background: var(--accent); font-size: 12px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 7px; background: var(--dim); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.status-active { color: var(--ok); } .status-invited { color: var(--warn); } .status-disabled { color: var(--bad); }

input, select, button, .button { font: inherit; color: var(--fg); background: #11141a; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
input:focus, select:focus { outline: 2px solid var(--link); outline-offset: -1px; }
button, .button { background: var(--accent); border-color: #3a4c85; cursor: pointer; display: inline-block; }
button:hover, .button:hover { filter: brightness(1.15); text-decoration: none; }
button.ghost { background: transparent; }
button.danger { background: #5b1d2a; border-color: #7a2638; }
button.small { padding: 3px 9px; font-size: 12px; }
.button.primary { background: #3553b5; border-color: #4a68c9; font-weight: 600; text-align: center; }
.button.wide { display: block; width: 100%; padding: 10px; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline label { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12px; }
form.stack { display: grid; gap: 12px; }
form.stack label { display: grid; gap: 4px; color: var(--dim); font-size: 12px; }
.card button + button { margin-left: 8px; }

.flash { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: #1b2130; margin-bottom: 16px; }
.flash.ok { border-color: var(--ok); } .flash.error { border-color: var(--bad); background: #2a1720; }
.result { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #11141a; word-break: break-all; }

/* Sign-in page (no sidebar) */
body.signin { display: grid; place-items: center; min-height: 100vh; }
.signin-card { width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 14px; }
.signin-card .brand { padding: 0 0 6px; }

/* Phones: the sidebar stacks above the page instead of covering it; wide tables scroll inside their card (Rabbit chat
   admin). Before the Usage block on purpose: at 720px and below the Usage phone rules that follow keep precedence. */
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px; }
  .content { margin-left: 0; padding: 16px 12px; }
  table.grid-table { display: block; overflow-x: auto; }
  .tabs { overflow-x: auto; }
}

/* Usage snapshots: local CSS and native SVG only; no inline styles or chart scripts. */
.usage-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.usage-filters label { display: grid; gap: 4px; }
.usage-filters input, .usage-filters select { width: 100%; min-width: 0; }
.usage-filters .links { align-items: end; }
.usage-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 12px; margin-bottom: 18px; }
.usage-stat { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.usage-stat strong { display: block; font-size: 22px; overflow-wrap: anywhere; }
.usage-table-wrap { max-width: 100%; overflow-x: auto; }
.usage-table-wrap:focus-visible, summary:focus-visible { outline: 2px solid var(--link); }
.usage-table { min-width: 700px; }
.usage-table caption { text-align: left; padding: 8px 0; color: var(--dim); }
.usage-table td { overflow-wrap: anywhere; max-width: 340px; }
.usage-table th[scope="row"] { color: var(--fg); }
.usage-details { margin: 12px 0; }
.usage-details summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
.usage-details dl { grid-template-columns: minmax(90px, 150px) minmax(0, 1fr); }
.usage-details dd { overflow-wrap: anywhere; }
.usage-windows { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.usage-window { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.usage-window meter { width: 100%; }
.usage-chart { width: 100%; height: auto; max-height: 220px; color: var(--link); }
.usage-chart .axis { stroke: var(--dim); }
.usage-chart rect, .usage-chart circle { fill: currentColor; }
.usage-chart text { fill: var(--dim); font-size: 11px; }
.usage-stale { color: var(--warn); }
.usage-refresh-expired { visibility: hidden; animation: usage-expire 0s 120s forwards; }
@keyframes usage-expire { to { visibility: visible; } }
.usage-snapshot { overflow-wrap: anywhere; }
.usage-snapshot h2 { margin-top: 22px; }
.usage-snapshot h3 { font-size: 14px; }
.usage-snapshot dl { grid-template-columns: minmax(90px, 45%) minmax(0, 1fr); }
.usage-snapshot figure { margin-inline: 0; }
@media (max-width: 720px) {
  .sidebar { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .brand { padding-bottom: 10px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-group { flex-basis: 100%; }
  .side-foot { margin-top: 12px; }
  .content { margin-left: 0; padding: 18px 12px; max-width: 100%; min-width: 0; }
  .usage-windows { grid-template-columns: 1fr; }
}
/* Admin person panel: switches (Meet rights; the same rules as rabbit-web's chat capability switches) */
ul.switches { list-style: none; padding: 0; margin: 8px 0 16px; display: grid; gap: 10px; }
ul.switches li { display: grid; gap: 2px; }
button.switch { display: inline-flex; align-items: center; gap: 10px; background: transparent; border-color: transparent; padding: 4px 6px; justify-self: start; }
button.switch:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
button.switch[disabled] { opacity: .5; cursor: not-allowed; }
.switch-track { width: 34px; height: 18px; border-radius: 999px; background: var(--line); position: relative; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--fg); transition: left .12s; }
button.switch.on .switch-track { background: var(--ok); }
button.switch.on .switch-track::after { left: 18px; }
.warn { color: var(--warn); margin: 2px 0 0; }
.check-passed { color: var(--ok); } .check-failed { color: var(--bad); } .check-pending { color: var(--warn); }
details.chat-options { margin-bottom: 6px; }
button.switch .switch-label { text-align: left; }
