/* ============ Moose Gate Portal — control-room theme ============ */
:root {
  --accent: #2f6fe6;
  --ok: #2e9c6d; --warn: #d39524; --bad: #e0555b;
  --r: 12px; --r-sm: 9px; --r-lg: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.18), 0 8px 28px -12px rgba(0,0,0,.5);
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
:root[data-theme="dark"] {
  --bg: #0b0e13; --bg-2: #0f131a; --panel: #111620;
  --surface: #161b25; --surface-2: #1c222e; --surface-3: #232b39;
  --border: rgba(255,255,255,.075); --border-2: rgba(255,255,255,.13);
  --text: #e9edf3; --text-2: #9aa6b6; --text-3: #647082;
  --ok: #36c285; --warn: #e3b14d; --bad: #ef6b71;
  --accent-soft: color-mix(in oklab, var(--accent) 16%, transparent);
  --accent-line: color-mix(in oklab, var(--accent) 36%, transparent);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 34px -14px rgba(0,0,0,.7);
}
:root[data-theme="light"] {
  --bg: #eef1f6; --bg-2: #e9edf3; --panel: #f4f6fa;
  --surface: #ffffff; --surface-2: #f5f7fb; --surface-3: #eef1f6;
  --border: rgba(18,28,45,.10); --border-2: rgba(18,28,45,.17);
  --text: #18202e; --text-2: #5a6779; --text-3: #8b96a6;
  --accent-soft: color-mix(in oklab, var(--accent) 14%, white);
  --accent-line: color-mix(in oklab, var(--accent) 40%, transparent);
  --shadow: 0 1px 2px rgba(18,28,45,.05), 0 10px 26px -16px rgba(18,28,45,.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.45;
}
#root { height: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13.5px; }
a { color: inherit; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.muted-sm { color: var(--text-3); font-size: 12.5px; }
.muted-bad { color: var(--bad); }
.tone-ok { color: var(--ok); } .tone-warn { color: var(--warn); } .tone-bad { color: var(--bad); }
.ta-r { text-align: right; } .nowrap { white-space: nowrap; }
.num { font-family: var(--mono); font-weight: 600; }
.empty { color: var(--text-3); font-size: 13px; padding: 14px 2px; text-align: center; }
.empty.pad { padding: 34px; }
.full { width: 100%; }
.mt8 { margin-top: 8px; }

/* ============ layout ============ */
.app { display: grid; grid-template-columns: 244px 1fr; height: 100%; background: var(--bg); }
.main { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.content { flex: 1; overflow-y: auto; padding: 22px 26px 60px; }
.content::-webkit-scrollbar { width: 11px; }
.content::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 3px solid var(--bg); }

/* ============ sidebar ============ */
.sidebar { background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 6px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 16px; }
.brand-logo { width: 40px; height: 40px; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px var(--border-2); border-radius: 11px;
  --is-empty-bg: var(--surface-2); }
.brand-plate { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 11px;
  display: grid; place-items: center; background: #fff;
  box-shadow: inset 0 0 0 1px var(--border-2), 0 1px 3px rgba(12,20,35,.12); }
.brand-logo-img { width: 34px; height: 34px; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.02em; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }
.nav-group { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border: none; background: transparent; color: var(--text-2);
  border-radius: 10px; font-size: 13.5px; font-weight: 540; text-align: left; transition: .14s; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.on { background: var(--accent-soft); color: var(--text); }
.nav-item.on .nav-ic { color: var(--accent); }
.nav-ic { display: grid; place-items: center; color: var(--text-3); transition: .14s; }
.nav-label { flex: 1; }
.nav-badge { font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 9px; font-family: var(--mono); }
.nav-rail { position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; }
.sidebar-foot { margin-top: auto; padding-top: 12px; }
.su-card { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border); }
.su-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.su-name { font-size: 13px; font-weight: 600; }
.su-mail { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-out { background: transparent; border: none; color: var(--text-3); padding: 5px; border-radius: 8px; display: grid; place-items: center; }
.su-out:hover { background: var(--surface-2); color: var(--bad); }

/* ============ topbar ============ */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 26px; border-bottom: 1px solid var(--border); background: var(--bg-2);
  position: sticky; top: 0; z-index: 5; }
.tb-title h1 { margin: 0; font-size: 19px; font-weight: 680; letter-spacing: -.025em; }
.tb-title p { margin: 2px 0 0; color: var(--text-3); font-size: 12.5px; }
.tb-right { display: flex; align-items: center; gap: 9px; }
.lodge-pill { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 11px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; margin-right: 4px; }
.lp-dot { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 3px var(--accent-soft); }
.lp-name { font-size: 12.5px; font-weight: 600; }
.tb-btn { position: relative; width: 36px; height: 36px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text-2); transition: .14s; }
.tb-btn:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }
.tb-bell-dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg-2); }

/* ============ cards ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 17px; border-bottom: 1px solid var(--border); }
.card-title { margin: 0; font-size: 13.5px; font-weight: 650; letter-spacing: -.01em; }
.card-body { padding: 16px 17px; }
.card-note { color: var(--text-3); font-size: 12px; margin: 0 0 12px; line-height: 1.5; }

/* ============ badges / pills ============ */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; line-height: 1.3; }
.badge svg { margin: 0 -1px; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: color-mix(in oklab, var(--ok) 14%, transparent); border-color: color-mix(in oklab, var(--ok) 26%, transparent); }
.badge-warn { color: var(--warn); background: color-mix(in oklab, var(--warn) 14%, transparent); border-color: color-mix(in oklab, var(--warn) 26%, transparent); }
.badge-bad { color: var(--bad); background: color-mix(in oklab, var(--bad) 14%, transparent); border-color: color-mix(in oklab, var(--bad) 26%, transparent); }
.badge-neutral { color: var(--text-2); background: var(--surface-3); border-color: var(--border); }
.badge-accent { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }

/* ============ buttons ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text); transition: .14s; white-space: nowrap; }
.btn:hover { border-color: var(--text-3); }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn-ghost { background: var(--surface-2); }
.btn-primary { border: 1px solid transparent; box-shadow: 0 1px 0 rgba(0,0,0,.12); font-weight: 650; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-danger { color: var(--bad); background: color-mix(in oklab, var(--bad) 12%, transparent); border-color: color-mix(in oklab, var(--bad) 30%, transparent); }
.btn-danger:hover { background: color-mix(in oklab, var(--bad) 20%, transparent); border-color: var(--bad); }
.btn.danger-text { color: var(--bad); }
.btn.full { width: 100%; }

/* ============ avatar ============ */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700;
  border: 1px solid; flex: 0 0 auto; letter-spacing: -.02em; }

/* ============ forms ============ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field > label { font-size: 11.5px; font-weight: 600; color: var(--text-2); letter-spacing: .01em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
input, select, textarea { background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 9px; padding: 9px 11px; outline: none; transition: .14s; width: 100%; }
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea { background: #fff; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
select { 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='%23889' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text); cursor: pointer; }
.check input, .radio input { width: 16px; height: 16px; accent-color: var(--accent); flex: 0 0 auto; }
.radio { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 7px 9px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--bg-2); }
.radio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.seg { display: inline-flex; gap: 4px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { border: 1px solid transparent; background: transparent; color: var(--text-2); padding: 6px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; transition: .12s; }
.seg button:hover { color: var(--text); }
.seg.sm button { padding: 5px 10px; font-size: 12px; }
.inline-search { display: flex; gap: 8px; }
.inline-search input { flex: 1; }

/* search box */
.search { display: flex; align-items: center; gap: 9px; background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 0 12px; color: var(--text-3); min-width: 220px; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: none; background: transparent; padding: 9px 0; box-shadow: none !important; }
.search.sm { min-width: 150px; padding: 0 10px; }
.search.sm input { padding: 7px 0; }

/* chips */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; transition: .12s; }
.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip-count { font-family: var(--mono); font-size: 11px; opacity: .7; }
.chip-on .chip-count { opacity: .8; }

/* ============ tables ============ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th { text-align: left; font-size: 10.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-3); padding: 11px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg-2); position: sticky; top: 0; }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text-2); }
.sort-caret { margin-left: 4px; color: var(--accent); }
.data-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr { transition: .1s; cursor: pointer; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr.no-link { cursor: default; }
.data-table tbody tr.no-link:hover { background: transparent; }
.data-table tbody tr:last-child td { border-bottom: none; }
.cell-member { display: flex; align-items: center; gap: 10px; }
.cm-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.cm-id { display: block; font-size: 11px; color: var(--text-3); }
.officer-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.officer-tag { font-size: 10.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft);
  padding: 2px 7px; border-radius: 5px; border: 1px solid var(--accent-line); }
.susp-count { font-family: var(--mono); font-weight: 600; color: var(--warn); }

/* ============ DASHBOARD ============ */
.stat-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-tile { text-align: left; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 15px 15px 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); transition: .14s; }
.stat-tile.is-link { cursor: pointer; }
.stat-tile.is-link:hover { border-color: var(--border-2); transform: translateY(-2px); }
.stat-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent-soft); margin-bottom: 8px; }
.stat-value { font-size: 27px; font-weight: 700; letter-spacing: -.03em; font-family: var(--mono); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-2); font-weight: 550; }
.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }

.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px;
  grid-template-areas: "chart expiring" "recent expiring" "recent top" "devices top"; }
.ga-chart { grid-area: chart; } .ga-expiring { grid-area: expiring; }
.ga-recent { grid-area: recent; } .ga-top { grid-area: top; } .ga-devices { grid-area: devices; }

.legend { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--text-2); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.lg-dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.lg-denied { background: var(--bad); }
.legend-sep { width: 1px; height: 13px; background: var(--border-2); }
.chart-summary { display: flex; gap: 26px; padding: 4px 2px 16px; }
.chart-summary div { display: flex; flex-direction: column; }
.chart-summary b { font-size: 22px; font-weight: 700; font-family: var(--mono); letter-spacing: -.02em; }
.chart-summary span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }

.chart { padding-bottom: 4px; }
.chart-bars { display: flex; align-items: flex-end; gap: 3px; }
.chart-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart-stack { width: 62%; max-width: 13px; height: 100%; display: flex; flex-direction: column-reverse; align-items: stretch; }
.bar { width: 100%; border-radius: 2px; min-height: 2px; }
.bar-granted { background: var(--accent); }
.bar-denied { background: var(--bad); margin-bottom: 2px; border-radius: 2px; }
.chart-xlabel { position: absolute; bottom: -17px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; color: var(--text-3); white-space: nowrap; font-family: var(--mono); }
.chart-bars { margin-bottom: 18px; }
.chart-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 10px;
  display: flex; flex-direction: column; gap: 1px; font-size: 11px; white-space: nowrap; z-index: 4; box-shadow: var(--shadow); }
.chart-tip strong { font-size: 11.5px; margin-bottom: 2px; }

/* lite list (expiring) */
.lite-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lite-row { display: flex; align-items: center; gap: 11px; padding: 9px 4px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 8px; transition: .1s; }
.lite-row:hover { background: var(--surface-2); }
.lite-row:last-child { border-bottom: none; }
.lite-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lite-name { font-weight: 600; font-size: 13px; }
.lite-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lite-until { font-size: 11px; color: var(--warn); }
.expiry-pill { font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 8px;
  background: var(--surface-3); color: var(--text-2); }
.expiry-pill[data-soon="true"] { color: var(--warn); background: color-mix(in oklab, var(--warn) 13%, transparent); }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-row { display: flex; align-items: center; gap: 11px; padding: 8px 4px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 8px; transition: .1s; }
.feed-row:hover { background: var(--surface-2); }
.feed-row:last-child { border-bottom: none; }
.feed-ic { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: 0 0 auto; }
.feed-ic.ok { color: var(--ok); background: color-mix(in oklab, var(--ok) 14%, transparent); }
.feed-ic.bad { color: var(--bad); background: color-mix(in oklab, var(--bad) 14%, transparent); }
.feed-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.feed-name { font-weight: 600; font-size: 13px; }
.feed-sub { font-size: 11.5px; color: var(--text-3); }
.feed-time { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); white-space: nowrap; }

/* rank */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-row { display: flex; align-items: center; gap: 11px; padding: 8px 4px; cursor: pointer; border-radius: 8px; }
.rank-row:hover { background: var(--surface-2); }
.rank-no { font-family: var(--mono); font-size: 12px; color: var(--text-3); width: 14px; font-weight: 600; }
.rank-main { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rank-count { font-family: var(--mono); font-weight: 700; font-size: 15px; display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.rank-count small { font-size: 9.5px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.meter { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 3px; }

/* device mini */
.dev-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dev-mini { border: 1px solid var(--border); border-radius: var(--r); padding: 13px; cursor: pointer; transition: .12s; background: var(--bg-2); }
.dev-mini:hover { border-color: var(--border-2); }
.dev-mini-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.dev-mini-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); }
.dev-mini-name { font-weight: 650; font-size: 13.5px; }
.dev-mini-loc { font-size: 11.5px; color: var(--text-3); margin-bottom: 11px; }
.dev-mini-stats { display: flex; flex-wrap: wrap; gap: 5px 12px; font-size: 11.5px; color: var(--text-2); font-family: var(--mono); }
.dev-mini-stats span { display: inline-flex; align-items: center; gap: 4px; }
.dev-mini-stats svg { color: var(--text-3); }

/* ============ ACTIVITY ============ */
.activity-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.activity-side { display: flex; flex-direction: column; gap: 16px; }
.log-head { align-items: flex-start; }
.log-sub { margin: 3px 0 0; font-size: 12px; color: var(--text-3); }
.log-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.log-controls select { width: auto; }
.log-scroll { max-height: calc(100vh - 230px); overflow-y: auto; }
.log-table thead th { top: 0; }
.log-time { font-weight: 600; font-family: var(--mono); font-size: 12.5px; display: block; }
.log-date { font-size: 11px; color: var(--text-3); }
.log-more { padding: 12px; text-align: center; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--border); }
.susp-active-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.susp-active-row:last-child { border-bottom: none; }
.susp-active-row .lite-main { cursor: pointer; }
.qs-none { font-size: 12.5px; color: var(--text-3); padding: 4px 0; }
.qs-card { margin-top: 12px; padding: 13px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--bg-2); }
.qs-member { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

/* ============ MEMBER DRAWER ============ */
.drawer-scrim { position: fixed; inset: 0; background: rgba(4,7,12,.55); backdrop-filter: blur(3px);
  z-index: 50; display: flex; justify-content: flex-end; }
.drawer { width: 440px; max-width: 92vw; height: 100%; background: var(--panel); border-left: 1px solid var(--border-2);
  overflow-y: auto; padding: 26px 24px 40px; position: relative; animation: slidein .26s cubic-bezier(.2,.8,.2,1) both; box-shadow: -20px 0 60px -20px rgba(0,0,0,.6); }
@keyframes slidein { from { transform: translateX(40px); } to { transform: none; } }
.drawer-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; }
.drawer-close:hover { color: var(--text); border-color: var(--border-2); }
.prof-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-right: 30px; }
.prof-id h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.prof-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--text-3); }
.prof-status { margin-left: auto; align-self: flex-start; }
.prof-actions { display: flex; gap: 9px; margin-bottom: 18px; }
.active-susp { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: var(--r);
  background: color-mix(in oklab, var(--bad) 11%, transparent); border: 1px solid color-mix(in oklab, var(--bad) 26%, transparent);
  color: var(--bad); margin-bottom: 16px; }
.active-susp > svg { flex: 0 0 auto; }
.active-susp div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.active-susp strong { font-size: 13px; }
.active-susp span { font-size: 11.5px; color: var(--text-2); }
.suspend-form { padding: 14px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--bg-2); margin-bottom: 16px; }
.suspend-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.prof-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin-bottom: 22px; }
.kv { background: var(--surface); padding: 12px 13px; display: flex; flex-direction: column; gap: 3px; }
.kv-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.kv-value { font-size: 16px; font-weight: 650; font-family: var(--mono); letter-spacing: -.02em; }
.kv-sub { font-size: 11px; color: var(--text-3); }
.prof-section { margin-bottom: 22px; }
.prof-section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 11px; }
.prof-section-head h4 { margin: 0; font-size: 13px; font-weight: 650; }
.cadence-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; display: grid; place-items: center; }
.spark { display: block; width: 100%; }
.susp-list { list-style: none; margin: 0; padding: 0; }
.susp-row { display: flex; align-items: flex-start; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.susp-row:last-child { border-bottom: none; }
.susp-marker { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); margin-top: 5px; flex: 0 0 auto; }
.susp-marker.active { background: var(--bad); box-shadow: 0 0 0 4px color-mix(in oklab, var(--bad) 20%, transparent); }
.susp-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.susp-reason { font-size: 13px; font-weight: 550; }
.susp-dates { font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.mini-access { list-style: none; margin: 0; padding: 0; }
.mini-access li { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.mini-access li:last-child { border-bottom: none; }
.ma-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.ma-dot.ok { background: var(--ok); } .ma-dot.bad { background: var(--bad); }
.ma-device { font-weight: 550; }
.ma-reason { color: var(--bad); font-size: 11.5px; }
.mini-access time { margin-left: auto; color: var(--text-3); font-family: var(--mono); font-size: 11px; }

/* ============ DEVICES ============ */
.dev-summary-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.dev-sumtile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 3px; min-width: 110px; box-shadow: var(--shadow); }
.dev-sumtile.grow { flex: 1; }
.dev-sumtile span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.dev-sumtile b { font-size: 17px; font-weight: 680; letter-spacing: -.02em; }
.device-list { display: flex; flex-direction: column; gap: 14px; }
.device-card { box-shadow: var(--shadow); }
.dev-head { display: flex; align-items: center; gap: 14px; padding: 15px 18px; cursor: pointer; }
.dev-glyph { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); flex: 0 0 auto; }
.dev-headmain { flex: 1; min-width: 0; }
.dev-titlerow { display: flex; align-items: center; gap: 10px; }
.dev-titlerow h3 { margin: 0; font-size: 15px; font-weight: 650; white-space: nowrap; }
.dev-subrow { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.dev-quick { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); font-family: var(--mono); }
.dev-quick span { display: inline-flex; align-items: center; gap: 5px; }
.dev-quick svg { color: var(--text-3); }
.dev-report { color: var(--text-3); }
.dev-caret { color: var(--text-3); transition: transform .2s; display: grid; place-items: center; }
.dev-caret.open { transform: rotate(180deg); }
.dev-expand { border-top: 1px solid var(--border); padding: 16px 18px 18px; background: var(--bg-2); }
.dev-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.dev-tabs button { background: transparent; border: none; border-bottom: 2px solid transparent; padding: 7px 13px;
  font-size: 12.5px; font-weight: 600; color: var(--text-3); margin-bottom: -1px; }
.dev-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; }
.detail-col.span2 { grid-column: 1 / -1; }
.detail-col h5 { margin: 0 0 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
.drow { display: grid; grid-template-columns: minmax(78px, auto) 1fr; gap: 6px 18px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.drow:last-child { border-bottom: none; }
.dk { color: var(--text-3); white-space: nowrap; }
.dv { color: var(--text); text-align: right; overflow-wrap: anywhere; min-width: 0; }
.dv.link { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); text-decoration: none; }
.dv.link svg { flex: 0 0 auto; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; }
.settings-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 4px; border-top: 1px solid var(--border); }
.settings-foot .card-note { margin: 0; flex: 1; }
.rename-row { grid-column: 1 / -1; display: flex; align-items: flex-end; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.rename-row .field { flex: 1; margin: 0; }
.settings-pending { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-2); background: color-mix(in oklch, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent) 35%, transparent); border-radius: 9px; padding: 9px 12px; }
.settings-pending .span2 { grid-column: 1 / -1; }

/* ============ REQUESTS / ACCOUNT ============ */
.view { animation: rise .24s ease both; }
@keyframes rise { from { transform: translateY(7px); } to { transform: none; } }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-card .card-body { display: flex; flex-direction: column; }
.account-cols { align-items: start; }
.acc-left, .acc-right { display: flex; flex-direction: column; gap: 16px; }
.plan-box { padding: 2px 0 6px; }
.plan-name { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.plan-name b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.plan-name span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.plan-meta { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px; }
.plan-meta div { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }
.plan-meta span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.plan-meta b { font-size: 14px; }
.cancel-link { display: block; width: 100%; margin-top: 10px; background: none; border: none; color: var(--text-3); font-size: 12px; text-align: center; cursor: pointer; text-decoration: underline; }
.cancel-link:hover { color: var(--bad, #e5484d); }
.cancel-scheduled { margin-top: 12px; display: flex; align-items: flex-start; gap: 6px; color: var(--text-2); background: color-mix(in oklch, var(--accent) 10%, transparent); border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent); border-radius: 9px; padding: 9px 11px; }
.cancel-confirm { margin-top: 12px; border: 1px solid color-mix(in oklch, var(--bad, #e5484d) 40%, transparent); border-radius: 10px; padding: 12px 14px; background: color-mix(in oklch, var(--bad, #e5484d) 8%, transparent); }
.cancel-confirm p { margin: 0 0 8px; font-weight: 600; font-size: 13px; }
.cancel-confirm ul { margin: 0 0 12px; padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.cancel-actions { display: flex; gap: 10px; justify-content: flex-end; }
.user-list { list-style: none; margin: 0 0 14px; padding: 0; }
.user-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.user-list li:last-child { border-bottom: none; }
.user-email { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.user-manage { display: flex; gap: 8px; align-items: center; padding-top: 12px; border-top: 1px solid var(--border); }
.user-manage select { flex: 1; }

/* density */
.app[data-density="compact"] .content { padding: 16px 20px 50px; }
.app[data-density="compact"] .card-body { padding: 13px 14px; }
.app[data-density="compact"] .data-table tbody td { padding: 8px 12px; }
.app[data-density="compact"] .stat-row { gap: 9px; }

/* ============ notifications dropdown (ported from design) ============ */
.notif { position: relative; }
.tb-bell.active { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }
.tb-bell-badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 9px; font-size: 10.5px; font-weight: 700; font-family: var(--mono);
  box-shadow: 0 0 0 2px var(--bg-2); line-height: 1; user-select: none; -webkit-user-select: none; pointer-events: none; }
.notif-pop { position: absolute; top: calc(100% + 9px); right: 0; width: 348px; max-width: 92vw; z-index: 40;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden; animation: notifIn .17s cubic-bezier(.2,.8,.2,1) both; transform-origin: top right; }
@keyframes notifIn { from { transform: translateY(-7px) scale(.98); } to { transform: none; } }
.notif-head { display: flex; align-items: center; gap: 9px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.notif-title { font-size: 13.5px; font-weight: 700; }
.notif-count { font-size: 11px; font-weight: 700; font-family: var(--mono); color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 1px 8px; border-radius: 999px; user-select: none; -webkit-user-select: none; }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.notif-item { position: relative; display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.notif-item:hover { background: var(--surface-2); }
.notif-item:last-child { border-bottom: none; }
.notif-dot { position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; }
.notif-dot.bad { background: var(--bad); } .notif-dot.warn { background: var(--warn); }
.notif-ic { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; margin-top: 1px; }
.notif-ic.bad { color: var(--bad); background: color-mix(in oklab, var(--bad) 13%, transparent); }
.notif-ic.warn { color: var(--warn); background: color-mix(in oklab, var(--warn) 14%, transparent); }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-it { font-size: 13px; font-weight: 600; line-height: 1.3; }
.notif-is { font-size: 11.5px; color: var(--text-3); line-height: 1.35; }
.notif-x { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px; border: none; background: transparent;
  color: var(--text-3); display: grid; place-items: center; opacity: 0; transition: .12s; }
.notif-item:hover .notif-x { opacity: 1; }
.notif-x:hover { background: var(--surface-3); color: var(--text); }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 20px 32px; text-align: center; }
.notif-empty-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 5px;
  color: var(--ok); background: color-mix(in oklab, var(--ok) 13%, transparent); }
.notif-empty-t { font-size: 13.5px; font-weight: 650; }
.notif-empty-s { font-size: 12px; color: var(--text-3); }
.notif-clear { width: 100%; border: none; border-top: 1px solid var(--border); background: var(--bg-2);
  color: var(--text-2); font-size: 12.5px; font-weight: 600; padding: 12px; transition: .12s; cursor: pointer; }
.notif-clear:hover { background: var(--surface-2); color: var(--bad); }
/* the .notif-x ✕ should still be tappable on mobile (no hover) */
@media (max-width: 760px) { .notif-x { opacity: 1; } }

/* Mobile-only controls + card lists (hidden on desktop, shown on phones) */
.tb-burger { display: none; }
.tb-logo { display: none; align-items: center; background: transparent; border: none; padding: 0; margin-right: 2px; cursor: pointer; }
.tb-logo-plate { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #fff;
  box-shadow: inset 0 0 0 1px var(--border-2); flex: 0 0 auto; transition: box-shadow .14s; }
.tb-logo:active .tb-logo-plate { box-shadow: inset 0 0 0 1px var(--border-2), 0 0 0 3px var(--accent-soft); }
.tb-logo-plate img { width: 30px; height: 30px; object-fit: contain; display: block; }
.nav-close { display: none; }
.mob-only { display: none; }

/* ===== mobile card lists (shown < 720px in place of tables; ported from design) ===== */
.acard-list, .mcard-list { list-style: none; margin: 0; padding: 0; }
.acard { position: relative; display: flex; align-items: center; gap: 12px; padding: 13px 16px 13px 19px;
  border-bottom: 1px solid var(--border); cursor: pointer; }
.acard:last-child { border-bottom: none; }
.acard.no-link { cursor: default; }
.acard-rail { position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; }
.acard-rail.granted { background: var(--ok); }
.acard-rail.denied { background: var(--bad); }
.acard-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acard-name { font-weight: 650; font-size: 14px; }
.acard-meta { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acard-reason { font-size: 11.5px; color: var(--bad); font-weight: 500; }
.acard-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; }
.acard-time { font-size: 10.5px; color: var(--text-3); font-family: var(--mono); white-space: nowrap; }
.mcard { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.mcard:last-child { border-bottom: none; }
.mcard-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mcard-name { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.mcard-id { font-size: 11.5px; color: var(--text-3); }
.mcard-tags { display: flex; align-items: center; gap: 9px; margin-top: 4px; }
.mcard-visits { font-size: 11px; color: var(--text-2); font-weight: 600; }
.mcard-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; text-align: right; }
.mcard-renew { font-size: 12.5px; font-weight: 650; }
.mcard-seen { font-size: 10.5px; color: var(--text-3); }

/* responsive (mobile-first system ported from design) */
@media (max-width: 1180px) {
  .stat-row { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { grid-template-columns: 1fr; grid-template-areas: "chart" "expiring" "recent" "top" "devices"; }
  .activity-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  html, body { overflow-x: hidden; }
  /* single column — sidebar becomes a full-viewport off-canvas drawer */
  .app { display: block; grid-template-columns: none; }
  .sidebar { position: fixed; inset: 0; width: 100vw; max-width: 100vw; z-index: 70;
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
    padding: 14px 16px; overflow-y: auto; will-change: transform; }
  .app.nav-open .sidebar { transform: translateX(0); }
  .nav-scrim { position: fixed; inset: 0; background: rgba(4,7,12,.5); z-index: 65; backdrop-filter: blur(2px); }
  /* logo plate is the menu button in the topbar; close (×) inside the drawer */
  .tb-logo { display: flex; }
  .nav-ic svg { width: 21px; height: 21px; }
  .nav-rail { left: -16px; }
  .nav-close { display: grid; place-items: center; margin-left: auto; width: 38px; height: 38px;
    border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
  /* restore full labels inside the drawer */
  .brand { justify-content: flex-start; padding: 6px 6px 18px; }
  .brand-text, .nav-label, .su-text, .nav-badge { display: flex; }
  .brand-text { flex-direction: column; }
  .nav-item { justify-content: flex-start; padding: 13px 13px; font-size: 15px; border-radius: 12px; }
  .su-card { justify-content: flex-start; }
  /* topbar */
  .topbar { padding: 12px 16px; gap: 10px; }
  .tb-title h1 { font-size: 17px; }
  .tb-title p { display: none; }
  .lodge-pill { display: none; }
  /* grids */
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .field-row, .detail-grid, .settings-grid, .dev-mini-grid, .two-col, .account-cols { grid-template-columns: 1fr; }
  .card, .activity-main, .activity-side { min-width: 0; }
}
@media (max-width: 720px) {
  /* swap tables for cards */
  .tbl-only { display: none; }
  .mob-only { display: block; }
  .content { padding: 16px 14px 64px; }
  .card-body { padding: 14px; }
  /* dashboard tiles: tighter 2-up */
  .stat-row { gap: 10px; margin-bottom: 14px; }
  .stat-tile { padding: 13px 13px 12px; }
  .stat-icon { width: 28px; height: 28px; margin-bottom: 7px; }
  .stat-value { font-size: 23px; }
  /* activity log header controls go full width, stacked */
  .log-head { flex-direction: column; align-items: stretch; gap: 11px; }
  .log-controls { flex-direction: column; align-items: stretch; gap: 9px; }
  .log-controls .search.sm, .log-controls select { width: 100%; min-width: 0; }
  .log-controls .seg.sm { width: 100%; }
  .log-controls .seg.sm button { flex: 1; }
  /* device header: stop the meta row crushing the title into vertical text */
  .dev-head { flex-wrap: wrap; row-gap: 11px; padding: 14px 16px; }
  .dev-headmain { order: 1; flex: 1 1 auto; min-width: 0; }
  .dev-caret { order: 2; }
  .dev-quick { order: 3; flex-basis: 100%; gap: 8px 16px; flex-wrap: wrap; font-size: 11.5px; }
  .dev-subrow { white-space: normal; word-break: break-word; }
  .dev-summary-row { gap: 9px; }
  .dev-sumtile { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .dev-sumtile.grow { flex-basis: 100%; }
  /* member profile drawer: 2-up stats */
  .prof-stats { grid-template-columns: 1fr 1fr; }
  .prof-actions { flex-wrap: wrap; }
  .prof-actions .btn { flex: 1; }
  /* members toolbar full-width */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search { min-width: 0; }
  /* requests / account / roster forms */
  .field-row, .roster-link-form .field-row { grid-template-columns: 1fr; }
  .search, .search.sm { min-width: 0; width: 100%; }
  .drawer { width: 100vw; max-width: 100vw; padding: 22px 16px 32px; }
}

/* ===== Additions for live portal: auth, toast, loading, invoices ===== */
.login-screen { min-height: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 30px 28px 26px; display: flex; flex-direction: column; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.login-brandtext { display: flex; flex-direction: column; }
.login-title { font-size: 21px; font-weight: 700; margin: 6px 0 0; }
.login-sub { font-size: 13px; color: var(--text-2); margin: 0 0 6px; }
.login-btn { width: 100%; justify-content: center; margin-top: 4px; }
.login-err { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad);
  border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); border-radius: var(--r-sm);
  padding: 8px 11px; font-size: 12.5px; }
.login-forgot { text-align: center; font-size: 12.5px; color: var(--text-2); text-decoration: none; margin-top: 2px; }
.login-forgot:hover { color: var(--accent); }

.app-loading { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: var(--bg); color: var(--text-2); font-size: 14px; }
.app-loading .btn { margin-top: 4px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border-2);
  border-top-color: var(--accent); animation: mg-spin .8s linear infinite; }
@keyframes mg-spin { to { transform: rotate(360deg); } }
.tb-btn.spinning svg { animation: mg-spin .8s linear infinite; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; background: var(--panel); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 999px; padding: 9px 16px 9px 13px;
  box-shadow: var(--shadow); font-size: 13px; font-weight: 600; z-index: 9000;
  animation: mg-toast-in .22s ease; }
.toast svg { flex: none; }
.toast-ok svg { color: var(--ok); }
.toast-bad svg { color: var(--bad); }
@keyframes mg-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.invoice-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.invoice-list li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.invoice-list .inv-num { font-family: var(--mono); }
.invoice-list .inv-amt { margin-left: auto; font-weight: 600; }
.invoice-list a { color: var(--accent); text-decoration: none; }

input:disabled, select:disabled, textarea:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }

/* Brand logo (real <img>, replaces the design's drag-drop slot).
   No chip/background — the theme-appropriate logo is shown per mode (white on dark,
   full-color on light) so it stays crisp and visible either way. */
img.brand-logo { width: 56px; height: 56px; object-fit: contain; flex: none;
  background: none; box-shadow: none; border-radius: 0; padding: 0; }
img.login-logo { width: 84px; height: 84px; padding: 0; border-radius: 0; }
:root[data-theme="light"] .logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }

/* Member roster panel (Members tab) — link LCL.WEB / import a file. */
.roster-card { margin-bottom: 14px; }
.roster-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; }
.roster-head-left { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13px;
  color: var(--text); min-width: 0; flex-wrap: wrap; }
.roster-head-left > svg { color: var(--accent); flex: none; }
.roster-sum { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 12.5px;
  color: var(--text-2); }
.roster-sum b { color: var(--text); }
.roster-body { padding: 4px 14px 14px; border-top: 1px solid var(--border); }
.roster-linked .card-note, .roster-link-form .card-note, .roster-import-form .card-note { margin-top: 12px; }
.roster-meta { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12.5px; margin: 6px 0 12px; }
.roster-meta .muted { margin-right: 5px; }
.roster-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.roster-choose { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 12px; }
.roster-link-form .field-row { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) { .roster-link-form .field-row { grid-template-columns: 1fr; } }

/* Request conversation thread (customer portal request detail drawer). */
.req-thread { display: flex; flex-direction: column; gap: 10px; }
.req-msg { border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; max-width: 92%; }
.req-msg-customer { align-self: flex-end; background: var(--accent-soft); border-color: var(--accent-line); }
.req-msg-staff { align-self: flex-start; background: var(--surface-2, var(--bg-2)); }
.req-msg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 3px; }
.req-msg-head b { font-size: 12.5px; }
.req-msg-head time, .req-msg-system time { font-size: 11px; color: var(--text-3); }
.req-msg-body { white-space: pre-wrap; font-size: 13px; line-height: 1.5; color: var(--text); }
.req-msg-system { align-self: center; display: flex; gap: 8px; align-items: baseline;
  font-size: 11.5px; color: var(--text-3); font-style: italic; padding: 2px 0; }
.req-reply { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.req-reply textarea { width: 100%; resize: vertical; }
.req-reply-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
