:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11,11,11,0.10);
  --input-border: rgba(11,11,11,0.18);
  --accent: #2a78d6;
  --accent-hover: #256abf;
  --series-1: #2a78d6;
  --series-1-wash: rgba(42,120,214,0.10);
  --up: #006300;
  --down: #d03b3b;
  --error-bg: rgba(208,59,59,0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255,255,255,0.10);
    --input-border: rgba(255,255,255,0.20);
    --accent: #3987e5;
    --accent-hover: #5598e7;
    --series-1: #3987e5;
    --series-1-wash: rgba(57,135,229,0.16);
    --up: #0ca30c;
    --down: #e66767;
    --error-bg: rgba(230,103,103,0.12);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255,255,255,0.10);
  --input-border: rgba(255,255,255,0.20);
  --accent: #3987e5;
  --accent-hover: #5598e7;
  --series-1: #3987e5;
  --series-1-wash: rgba(57,135,229,0.16);
  --up: #0ca30c;
  --down: #e66767;
  --error-bg: rgba(230,103,103,0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
.sub { color: var(--text-secondary); margin: 0; }
.muted { color: var(--text-secondary); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
input, select {
  width: 100%;
  font: inherit;
  color: var(--text-primary);
  background: var(--page);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 9px 11px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field textarea { width: 100%; font: inherit; color: var(--text-primary); background: var(--page); border: 1px solid var(--input-border); border-radius: 8px; padding: 9px 11px; resize: vertical; }
.field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.btn {
  font: inherit; font-weight: 500;
  border: 1px solid transparent; border-radius: 8px;
  padding: 9px 14px; cursor: pointer;
  background: var(--accent); color: #fff;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--text-primary); border-color: var(--input-border); }
.btn.ghost:hover { background: var(--border); }

.error {
  display: none;
  background: var(--error-bg); color: var(--down);
  border-radius: 8px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px;
}
.error.show { display: block; }

/* ---------- Auth pages ---------- */
.auth {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 24px 16px;
}
.auth .card { width: 100%; max-width: 380px; padding: 28px 24px; }
.auth .brand { font-weight: 700; font-size: 18px; margin-bottom: 20px; }
.auth h1 { margin-bottom: 6px; }
.auth .sub { margin-bottom: 22px; }
.auth .switch { text-align: center; margin: 18px 0 0; color: var(--text-secondary); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 60px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--text-secondary);
  font: inherit; font-size: 12px; cursor: pointer; padding: 4px 6px;
}

/* ---------- Brand ---------- */
.by, .site-footer { color: var(--text-muted); font-size: 12px; text-align: center; margin: 0; }
.site-footer { padding: 0 16px 32px; }
.by a, .site-footer a { color: var(--text-secondary); }

/* ---------- Shared ---------- */
[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;
}
a.btn { display: inline-block; text-align: center; text-decoration: none; }
.btn.block + .btn.block { margin-top: 10px; }
.btn:focus-visible, .choice:focus-visible, .link-btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.hint { font-size: 12px; color: var(--text-muted); margin: 0 0 14px; }
h1:focus { outline: none; }

.message {
  display: none;
  background: var(--series-1-wash); color: var(--text-primary);
  border-radius: 8px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px;
}
.message.show { display: block; }

/* ---------- Auth pages ---------- */
.auth .brand { display: block; color: var(--text-primary); text-decoration: none; }
.welcome h1 { font-size: 24px; line-height: 1.25; margin-bottom: 10px; }

.choices { display: grid; gap: 10px; }
.choice {
  display: block; width: 100%; text-align: left; cursor: pointer;
  font: inherit; color: var(--text-primary);
  background: var(--page); border: 1px solid var(--input-border); border-radius: 10px;
  padding: 12px 14px;
}
.choice:hover { border-color: var(--accent); }
.choice strong { display: block; font-weight: 600; }
.choice span { display: block; color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

.rules { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; color: var(--text-muted); }
.rules li { padding-left: 18px; position: relative; margin-top: 2px; }
.rules li::before { content: "○"; position: absolute; left: 0; }
.rules li.ok { color: var(--up); }
.rules li.ok::before { content: "✓"; }

.divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 14px; color: var(--text-muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--grid); }

/* ---------- Home ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .inner {
  max-width: 880px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar .brand { font-weight: 700; font-size: 17px; color: var(--text-primary); text-decoration: none; }
.topbar .who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .who span { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .btn { padding: 6px 12px; flex-shrink: 0; }

.home { max-width: 880px; margin: 0 auto; padding: 24px 16px 40px; display: grid; gap: 12px; }
.stack > * + * { margin-top: 10px; }
.stack h1, .stack h2, .stack p { margin-bottom: 0; }
.org-head { padding: 4px 2px 0; }
.org-head p { margin: 4px 0 0; }

.banner {
  background: var(--series-1-wash); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; font-size: 13px;
}

.list { list-style: none; margin: 0; padding: 0; }
.list > li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--grid);
}
.list > li:last-child { border-bottom: 0; }

.link-btn {
  background: none; border: 0; padding: 6px 4px; font: inherit; font-size: 13px;
  color: var(--accent); cursor: pointer; border-radius: 6px;
}
.link-btn.danger { color: var(--down); }

.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }

.invite-form { display: grid; gap: 10px; }
.invite-form .field { margin: 0; }

.people { list-style: none; margin: 4px 0 0; padding: 0; }
.people li { padding: 12px 0; border-top: 1px solid var(--grid); display: grid; gap: 8px; }
.people .who { min-width: 0; overflow-wrap: anywhere; }
.people .controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.people .controls select { width: auto; flex: 1 1 120px; padding: 6px 8px; }

@media (min-width: 640px) {
  .invite-form { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; }
  .people li { grid-template-columns: 1fr auto; align-items: center; }
  .people .controls { flex-wrap: nowrap; }
}
.forgot { margin: 8px 0 0; font-size: 13px; text-align: right; }

/* ---------- Registration ---------- */
.auth .card.wide-card { max-width: 440px; }
.plan-chip {
  display: inline-block; font-size: 12px; color: var(--text-secondary);
  background: var(--page); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; margin-bottom: 14px;
}
.plan-chip a { margin-left: 4px; }
.progress { font-size: 12px; color: var(--text-muted); margin: 0 0 6px; font-weight: 500; }
.code-input { font-size: 24px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.optional { color: var(--text-muted); font-weight: 400; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; font-weight: 400; margin: 0 0 12px; color: var(--text-secondary); }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.check + .btn { margin-top: 6px; }

/* ---------- Dashboard setup ---------- */
.banner a { color: var(--accent); }
.banner.good { background: rgba(12, 163, 12, .08); }
.banner.warn { background: var(--error-bg); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head h2 { white-space: nowrap; }
.section-head h2 { margin: 0; }

.setup { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.setup li { display: flex; gap: 12px; align-items: flex-start; }
.setup li a { font-weight: 600; color: var(--text-primary); text-decoration: none; }
.setup li a:hover { color: var(--accent); }
.setup li span:not(.tick) { display: block; font-size: 13px; color: var(--text-secondary); }
.setup .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--input-border); flex-shrink: 0; margin-top: 1px; position: relative; }
.setup li.done .tick { background: var(--up); border-color: var(--up); }
.setup li.done .tick::after { content: ""; position: absolute; left: 6px; top: 3px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.setup li.done a { color: var(--text-secondary); }

.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--page); border: 1px solid var(--border); color: var(--text-secondary); margin-left: 6px; }
.pill.ok { background: rgba(12, 163, 12, .1); border-color: transparent; color: var(--up); }
.domains .domain-item { display: block; }
.domain-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.dns-steps { margin-top: 12px; padding: 14px 16px; background: var(--page); border: 1px solid var(--border); border-radius: 10px; }
.dns-steps ol { margin: 0; padding-left: 20px; }
.dns-steps li { display: list-item; margin-bottom: 14px; }
.dns-steps li:last-child { margin-bottom: 0; }
.dns-steps p { margin: 0 0 8px; color: var(--text-secondary); font-size: 13px; }
.record { display: grid; grid-template-columns: 82px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--grid); }
.record-label { font-size: 12px; color: var(--text-muted); }
.record code { font-size: 12px; overflow-wrap: anywhere; background: var(--surface); padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border); }
.check-result { display: block; margin-top: 8px; font-size: 13px; color: var(--text-secondary); }

.locked { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--page); border: 1px dashed var(--input-border); color: var(--text-secondary); font-size: 13px; }
.lock { width: 12px; height: 9px; border: 2px solid currentColor; border-radius: 2px; position: relative; flex-shrink: 0; margin-top: 5px; }
.lock::before { content: ""; position: absolute; left: 1px; top: -8px; width: 6px; height: 6px; border: 2px solid currentColor; border-bottom: 0; border-radius: 5px 5px 0 0; }
select:disabled { opacity: .6; }
.home .fine { font-size: 12px; color: var(--text-muted); margin: 0; }
.auto-check { display: block; margin-top: 8px !important; }
.one-click { margin-top: 12px; display: grid; gap: 6px; justify-items: start; }

/* ---------- Sign-in ---------- */
.org-results { list-style: none; margin: -6px 0 14px; padding: 0; display: grid; gap: 6px; }
.org-results:empty { display: none; }
.org-option {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  font: inherit; color: var(--text-primary); background: var(--page);
  border: 1px solid var(--input-border); border-radius: 10px; padding: 10px 12px;
}
.org-option:hover, .org-option:focus-visible { border-color: var(--accent); outline: none; }
.org-option span { display: block; font-size: 12px; color: var(--text-secondary); }
.logo-box {
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0; object-fit: contain;
  background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; font-weight: 700; color: var(--accent); font-size: 16px;
}
.org-head-auth { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--page); }
.org-head-auth img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; }
.org-head-auth strong { display: block; }
.org-head-auth .link-btn { padding: 0; font-size: 12px; }
.username-wrap { display: flex; align-items: stretch; border: 1px solid var(--input-border); border-radius: 8px; background: var(--page); overflow: hidden; }
.username-wrap:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.username-wrap input { border: 0; border-radius: 0; min-width: 0; flex: 1; outline: none; }
.username-wrap input:focus { outline: none; }
.at-domain { display: flex; align-items: center; padding: 0 11px; color: var(--text-secondary); background: var(--surface); border-left: 1px solid var(--border); font-size: 14px; white-space: nowrap; }
.at-domain:empty { display: none; }
.username-wrap select { width: auto; border: 0; border-left: 1px solid var(--border); border-radius: 0; background: var(--surface); }
.signing-as { font-size: 13px; color: var(--text-secondary); margin: 0 0 12px; }
.signing-as .link-btn { padding: 0 2px; font-size: 13px; }

/* ---------- Dashboard: logo, people, settings, staff ---------- */
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
label.btn { cursor: pointer; }
.org-head.with-logo { display: flex; gap: 14px; align-items: center; }
.logo-box.big { width: 56px; height: 56px; font-size: 22px; border-radius: 12px; }
img.logo-box { padding: 4px; }
.logo-prompt { border: 1px dashed var(--accent); }

.bulk textarea { width: 100%; font: inherit; font-size: 14px; color: var(--text-primary); background: var(--page); border: 1px solid var(--input-border); border-radius: 8px; padding: 9px 11px; resize: vertical; }
.bulk textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.bulk .hint code, .preview code { font-size: 12px; }
.file-link { padding: 0 0 0 4px; font-size: 12px; }
.bulk-defaults { display: grid; gap: 10px; }
.bulk-defaults .field { margin: 0; }
@media (min-width: 640px) { .bulk-defaults { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; } }
.preview, .result-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--page); display: grid; gap: 10px; }
.preview p, .result-box p { margin: 0; }
.bad { color: var(--down); }
.table-wrap { overflow-x: auto; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.preview-table th, .preview-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.preview-table th { color: var(--text-muted); font-weight: 500; font-size: 12px; }
.preview-table tr.bad td { color: var(--down); }
.method { border: 0; padding: 0; margin: 0; }
.method legend { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.pending-actions { font-size: 12px; margin-top: 4px; }
.pending-actions .link-btn { padding: 2px 0; font-size: 12px; }
.people .pill { margin-left: 4px; }

.team-actions { display: flex; align-items: center; gap: 10px; }
.check.inline { margin: 0; font-size: 12px; align-items: center; }
.setting { padding-top: 14px; border-top: 1px solid var(--grid); }
.setting:first-of-type { border-top: 0; padding-top: 0; }
.setting h3 { font-size: 14px; margin: 0 0 8px; }
.setting .check { margin-bottom: 8px; }
.setting .record { margin-bottom: 8px; }

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.toggle-btn { font: inherit; font-size: 14px; font-weight: 500; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 7px 16px; cursor: pointer; }
.toggle-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.facts { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts a { color: var(--accent); }

/* ---------- Account menu and profile ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--grid); }
.avatar.sm { width: 32px; height: 32px; }
.avatar.md { width: 44px; height: 44px; }
.avatar.lg { width: 96px; height: 96px; }

.account { position: relative; min-width: 0; display: flex; align-items: center; gap: 8px; }
.account-btn {
  display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 260px;
  padding: 4px 10px 4px 4px; border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--text-primary); font: inherit; font-size: 14px; cursor: pointer;
}
.account-btn:hover { background: var(--border); }
.account-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); flex-shrink: 0; }
.account-btn[aria-expanded="true"] .chevron { transform: rotate(225deg) translateY(-2px); }
@media (max-width: 480px) { .account-name { display: none; } }

.account-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(300px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 8px;
}
.account-head { display: flex; gap: 12px; align-items: center; padding: 8px 8px 12px; border-bottom: 1px solid var(--grid); margin-bottom: 6px; }
.account-head div { min-width: 0; display: grid; }
.account-head span { font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-head .muted { color: var(--text-muted); }
.account-panel nav { display: grid; }
.account-panel nav a, .account-panel nav button {
  display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: 0;
  background: transparent; color: var(--text-primary); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer;
}
.account-panel nav a:hover, .account-panel nav button:hover { background: var(--border); }
.account-panel nav a[aria-current="page"] { font-weight: 600; }
.account-panel nav .signout { color: var(--down); border-top: 1px solid var(--grid); border-radius: 0 0 8px 8px; margin-top: 4px; }

.profile-teaser { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.profile-teaser p { flex: 1; min-width: 160px; margin: 0; }
.photo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.photo-row .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.links-grid { display: grid; gap: 10px; margin-bottom: 14px; }
@media (min-width: 640px) { .links-grid { grid-template-columns: 1fr 1fr; } }
.links-grid .field { margin: 0; }
.readonly-value { padding: 9px 0; color: var(--text-secondary); }
.member-links { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; margin-top: 2px; }
.member-links a { color: var(--accent); }
.person-line { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.person-line .avatar { margin-top: 2px; }
.field > .label { display: block; font-size: 13px; font-weight: 500; }
#security .setting { margin-top: 18px; }

/* ---------- Admin area ---------- */
.admin-layout { max-width: 1080px; margin: 0 auto; padding: 24px 16px 40px; display: grid; gap: 16px; }
@media (min-width: 860px) { .admin-layout { grid-template-columns: 190px 1fr; align-items: start; } }
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (min-width: 860px) { .admin-tabs { flex-direction: column; position: sticky; top: 16px; } }
.admin-tabs a {
  padding: 8px 12px; border-radius: 8px; color: var(--text-secondary); text-decoration: none; white-space: nowrap; font-size: 14px;
}
.admin-tabs a:hover { background: var(--border); color: var(--text-primary); }
.admin-tabs a[aria-current="page"] { background: var(--series-1-wash); color: var(--accent); font-weight: 600; }
.admin-main { display: grid; gap: 12px; min-width: 0; }
.admin-main h1 { font-size: 20px; margin: 0; }
.small { font-size: 12px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.small-select { width: auto; padding: 3px 6px; font-size: 12px; }

.roles { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.role-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--page); }
.role-card.locked-role { opacity: .85; }
.role-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.role-actions { display: flex; gap: 4px 10px; flex-wrap: wrap; }
.perm-grid { display: grid; gap: 4px 16px; margin-top: 10px; }
@media (min-width: 640px) { .perm-grid { grid-template-columns: 1fr 1fr; } }
.perm-grid .check { margin: 0; font-size: 13px; }

.unit-tree { list-style: none; padding: 0; margin: 0; }
.unit-tree li, .sessions li {
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--grid);
}
.unit-tree li:first-child { border-top: 0; }
.unit-tree .depth-2 { padding-left: 22px; }
.unit-tree .depth-3 { padding-left: 44px; }
.unit-tree .depth-2 > span:first-child::before, .unit-tree .depth-3 > span:first-child::before { content: "└ "; color: var(--text-muted); }
.unit-actions { display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: center; }
.unit-picker { font-size: 13px; }
.unit-picker summary { cursor: pointer; color: var(--accent); }
.unit-checks { display: grid; gap: 2px; margin: 6px 0; max-height: 220px; overflow: auto; }
.unit-checks .depth-2 { padding-left: 16px; }
.unit-checks .depth-3 { padding-left: 32px; }
.session-form { display: grid; gap: 10px; align-items: end; width: 100%; }
@media (min-width: 640px) { .session-form { grid-template-columns: 2fr 1fr 1fr auto; } }
.session-form .field { margin: 0; }
.words-grid { display: grid; gap: 4px 16px; }
@media (min-width: 640px) { .words-grid { grid-template-columns: 1fr 1fr; } .words-grid .btn, .words-grid .error, .words-grid .message { grid-column: 1 / -1; justify-self: start; } }
.admin-layout { grid-template-columns: minmax(0, 1fr); }
.admin-layout > * { min-width: 0; }
@media (min-width: 860px) { .admin-layout { grid-template-columns: 190px minmax(0, 1fr); } }
.unit-actions select.small-select { width: auto; max-width: 100%; }
.unit-tree li > *, .sessions li > * { min-width: 0; max-width: 100%; }
.admin-main { grid-template-columns: minmax(0, 1fr); }

/* ---------- Pictures: avatar, frames ---------- */
.av { --av: 44px; position: relative; display: inline-block; flex-shrink: 0; width: var(--av); height: var(--av); vertical-align: middle; }
.av-xs { --av: 24px; }
.av-sm { --av: 32px; }
.av-md { --av: 44px; }
.av-lg { --av: 96px; }
.av-photo { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; background: var(--grid); }
.av-still { display: block; width: 100%; height: 100%; object-fit: cover; }
.av-anim { position: absolute; max-width: none; }
/* Frames are a quarter bigger than the photo, centred on it. */
.av-frame { position: absolute; left: -12.5%; top: -12.5%; width: 125%; height: 125%; pointer-events: none; }
.av-still-frame { display: none; }
.av-badge {
  position: absolute; left: 50%; bottom: -16%; transform: translateX(-50%); z-index: 1;
  max-width: 160%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10px; font-weight: 700; line-height: 1.5; letter-spacing: .02em;
  padding: 0 7px; border-radius: 999px; color: #fff; background: #2a78d6; border: 2px solid var(--surface);
}
.av-lg .av-badge { font-size: 12px; padding: 1px 10px; bottom: -10%; }
.av-badge.gold { background: #b8860b; }
@media (prefers-reduced-motion: reduce) {
  .av-anim, .av-moving { display: none; }
  .av-still-frame { display: block; }
}
.account-btn .av { margin: 2px; }

/* ---------- Cropper ---------- */
.cropper {
  border: 0; padding: 0; border-radius: 16px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  background: var(--surface); color: var(--text-primary); box-shadow: 0 24px 64px rgba(0,0,0,.35);
}
.cropper::backdrop { background: rgba(10, 14, 22, .62); backdrop-filter: blur(3px); }
.crop-form { padding: 16px 18px 18px; display: grid; gap: 12px; }
.crop-head { display: flex; justify-content: space-between; align-items: center; }
.crop-head h2 { margin: 0; font-size: 17px; }
.crop-close { border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--text-secondary); cursor: pointer; padding: 2px 8px; border-radius: 8px; }
.crop-close:hover { background: var(--border); }
.crop-note { margin: 0; font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--series-1-wash); }
.crop-body { display: grid; gap: 14px; }
@media (min-width: 560px) { .crop-body { grid-template-columns: minmax(0, 1fr) 140px; align-items: start; } }
/* Cover pictures: a wide crop area with the preview underneath. */
@media (min-width: 560px) { .crop-body.wide { grid-template-columns: minmax(0, 1fr); } }
.crop-stage.wide { max-width: none; }
.crop-stage {
  position: relative; width: 100%; max-width: 380px; aspect-ratio: 1; margin: 0 auto; overflow: hidden;
  border-radius: 12px; background: repeating-conic-gradient(#d9d9d9 0% 25%, #f4f4f4 0% 50%) 50% / 16px 16px;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
.crop-stage.dragging { cursor: grabbing; }
.crop-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.crop-img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: center; will-change: transform; pointer-events: none; }
/* The crop area itself is the whole stage; the shade dims what falls outside the round guide. */
.crop-shade { position: absolute; inset: 0; pointer-events: none; border-radius: 12px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.9); }
.crop-stage.round .crop-shade { border-radius: 50%; box-shadow: 0 0 0 999px rgba(10, 14, 22, .5), inset 0 0 0 2px rgba(255,255,255,.9); }
.crop-grid { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .15s; }
.crop-stage.dragging .crop-grid, .crop-stage:focus-visible .crop-grid { opacity: 1; }
.crop-grid span { position: absolute; background: rgba(255,255,255,.55); }
.crop-grid span:nth-child(1) { left: 33.333%; top: 0; bottom: 0; width: 1px; }
.crop-grid span:nth-child(2) { left: 66.666%; top: 0; bottom: 0; width: 1px; }
.crop-grid span:nth-child(3) { top: 33.333%; left: 0; right: 0; height: 1px; }
.crop-grid span:nth-child(4) { top: 66.666%; left: 0; right: 0; height: 1px; }
.crop-side { display: grid; gap: 6px; justify-items: center; }
.crop-label { margin: 0; font-size: 12px; color: var(--text-muted); }
.crop-previews { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.crop-previews canvas { border-radius: 8px; background: var(--grid); }
.crop-previews canvas.round { border-radius: 50%; }
.crop-size { margin: 0; font-size: 11px; color: var(--text-muted); text-align: center; }
.crop-controls { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; justify-content: center; }
.crop-zoom-row { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; max-width: 360px; }
.crop-tools { display: flex; align-items: center; gap: 8px; }
.crop-zoom { flex: 1; min-width: 0; padding: 0; accent-color: var(--accent); }
.crop-icon {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--input-border); background: var(--page);
  color: var(--text-primary); font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
}
.crop-icon:hover { background: var(--border); }
.crop-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.crop-form .hint { margin: 0; text-align: center; }
.crop-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Frame picker ---------- */
.frame-group h3 { font-size: 13px; margin: 6px 0; color: var(--text-secondary); }
.frame-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.frame-option {
  display: grid; justify-items: center; gap: 8px; padding: 14px 6px 8px; border-radius: 12px; cursor: pointer;
  border: 2px solid transparent; background: var(--page); color: var(--text-primary); font: inherit; font-size: 12px;
}
.frame-option:hover { border-color: var(--border); }
.frame-option[aria-pressed="true"] { border-color: var(--accent); background: var(--series-1-wash); }
.frame-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.frame-option .av { margin: 6px 0 4px; }
.own-frames { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.own-frames li { display: grid; justify-items: center; gap: 6px; font-size: 12px; }
.own-frames img { width: 64px; height: 64px; }

/* ---------- Plan ---------- */
.plan-now { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.plan-now > div { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--page); }
.plan-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plan-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--page); }
.plan-card.current { border: 2px solid var(--accent); }
.plan-card h2 { margin: 0; font-size: 16px; }
.plan-card p { margin: 0; }
.plan-price { font-size: 20px; font-weight: 700; }
.plan-card ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-secondary); flex: 1; }
.plan-action { margin-top: 8px; }
.plan-switch { display: grid; gap: 8px; }
.banner .link-btn { padding: 0 0 0 4px; }

/* ---------- Frame preview ---------- */
.frame-preview { display: flex; align-items: center; gap: 20px; padding: 14px 16px; border-radius: 12px; background: var(--page); border: 1px solid var(--border); }
.frame-preview .av { margin: 14px; }
.frame-preview p { margin: 0; }
.frame-preview .previewing { color: var(--accent); font-weight: 600; }

/* ---------- People search and profile cards ---------- */
.topbar-search {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--page); color: var(--text-secondary); font: inherit; font-size: 14px;
}
.topbar-search:hover { background: var(--border); }
.topbar-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-icon { width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 50%; position: relative; flex-shrink: 0; }
.search-icon::after { content: ""; position: absolute; width: 2px; height: 7px; background: currentColor; right: -4px; bottom: -6px; transform: rotate(-45deg); border-radius: 1px; }
@media (max-width: 560px) { .topbar-search-text { display: none; } .topbar-search { padding: 9px; } }

.sheet {
  border: 0; padding: 0; border-radius: 16px; width: min(480px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 32px));
  background: var(--surface); color: var(--text-primary); box-shadow: 0 24px 64px rgba(0,0,0,.35);
}
.sheet::backdrop { background: rgba(10, 14, 22, .55); backdrop-filter: blur(2px); }
.sheet-close { border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--text-secondary); cursor: pointer; padding: 4px 10px; border-radius: 8px; }
.sheet-close:hover { background: var(--border); }
.people-search { margin-top: min(12vh, 96px); }
.people-search-bar { display: flex; gap: 6px; align-items: center; padding: 12px; border-bottom: 1px solid var(--grid); }
.people-search-bar input { border-radius: 999px; }
.people-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; max-height: 460px; }
.people-results .empty { padding: 16px; text-align: center; }
.person-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text-primary); font: inherit; cursor: pointer;
}
.person-row:hover, .person-row:focus-visible { background: var(--series-1-wash); outline: none; }
.person-row-text { display: grid; min-width: 0; }
.person-row-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-online { display: inline-block; width: 9px; height: 9px; margin-left: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px var(--surface); vertical-align: middle; }
.person-card { padding: 16px 20px 22px; }
.person-card .sheet-close { float: right; margin: -6px -10px 0 0; }
.person-card-head { display: grid; justify-items: center; text-align: center; gap: 4px; padding-top: 10px; }
.person-card-head .av { margin: 14px 0 16px; }
.person-card-head h2 { margin: 0; font-size: 20px; }
.person-card-head p { margin: 0; }
.presence { font-size: 13px; color: var(--text-muted); }
.presence.online { color: #16a34a; }
.presence .dot-online { margin: 0 6px 0 0; }
.person-card-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--grid); font-size: 14px; }
.person-card-facts dt { color: var(--text-muted); }
.person-card-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Active now ---------- */
.active-list { list-style: none; padding: 0; margin: 0; }
.active-list li { border-top: 1px solid var(--grid); }
.active-list li:first-child { border-top: 0; }
.active-list .person-row { padding: 10px 4px; }
.active-list .when { margin-left: auto; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.active-list .when.online { color: #16a34a; font-weight: 600; }
.name-line { display: flex; align-items: center; min-width: 0; } .name-line strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Portfolio profiles ---------- */
.av-xl { --av: 152px; }
.av-xl .av-badge { font-size: 13px; padding: 2px 12px; bottom: -8%; }
.home.profile-page { max-width: 1080px; }
.stack-12 { display: grid; gap: 12px; }
.profile-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grid); }
.profile-tabs [role="tab"] {
  border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--text-secondary); cursor: pointer;
  padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.profile-tabs [role="tab"]:hover { color: var(--text-primary); }
.profile-tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.profile-tabs [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.pf-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 960px) { .pf-layout { grid-template-columns: minmax(0, 1fr) 300px; } .pf-layout aside { position: sticky; top: 16px; } }
.pf { display: grid; gap: 12px; min-width: 0; }
.pf-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; min-width: 0; }
.pf-card h2 { font-size: 18px; margin: 0; }
.pf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.pf-top { padding: 0; overflow: hidden; }
.pf-banner { position: relative; aspect-ratio: 4 / 1; background: linear-gradient(120deg, var(--series-1-wash), var(--grid)); }
.pf-banner img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pf-banner-edit { position: absolute; top: 10px; right: 10px; background: var(--surface) !important; }
.pf-head { position: relative; display: flow-root; padding: 0 20px 18px; }
.pf-photo { margin-top: calc(-1 * clamp(48px, 9vw, 84px)); margin-bottom: 10px; }
.pf-photo .av { box-shadow: 0 0 0 4px var(--surface); border-radius: 50%; }
.pf-photo .av.has-frame { box-shadow: none; }
@media (max-width: 560px) { .pf-photo .av-xl { --av: 104px; } }
.pf-head-edit { position: absolute; top: 10px; right: 14px; }
.pf-head h1 { font-size: 24px; margin: 0; }
.pf-pronouns { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.pf-headline { font-size: 16px; margin: 2px 0 6px; }
.pf-facts { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; }
.pf-org { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-primary); }
.pf-org img { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; }
.pf-links { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pf-links a { display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--input-border); text-decoration: none; }
.pf-links a:hover { background: var(--border); }
.pf-actions:not(:empty) { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.pf-icon {
  border: 1px solid transparent; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 17px; line-height: 1;
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
}
.pf-icon:hover:not(:disabled) { background: var(--border); color: var(--text-primary); }
.pf-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pf-icon:disabled { opacity: .3; cursor: default; }
.pf-icon.small { width: 30px; height: 30px; font-size: 14px; }
.pf-text { white-space: pre-line; margin: 6px 0 0; overflow-wrap: anywhere; }
.pf-items { list-style: none; padding: 0; margin: 0; display: grid; }
.pf-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--grid); align-items: flex-start; }
.pf-item:first-child { border-top: 0; padding-top: 2px; }
.pf-item-body { flex: 1; min-width: 0; }
.pf-item-body h3 { font-size: 15px; margin: 0; }
.pf-item-body p { margin: 2px 0 0; font-size: 14px; }
.pf-item-body p.muted { font-size: 13px; }
.pf-item-tools, .pf-sec-tools { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.pf-thumb { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--grid); display: grid; place-items: center; color: var(--text-muted); font-weight: 600; }
.pf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--page); border: 1px dashed var(--axis); color: var(--text-secondary); white-space: nowrap; }
.pf-sub { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 6px 0; }
.pf-chips { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.pf-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; padding: 4px 6px 4px 12px; border-radius: 999px; border: 1px solid var(--input-border); background: var(--page); }
.pf-chips.top .pf-chip { border-color: var(--accent); background: var(--series-1-wash); }
.pf-chip:not(:has(button)) { padding-right: 12px; }
.pf-chip.hidden-public { border-style: dashed; }
.pf-chip .pf-icon { width: 26px; height: 26px; font-size: 13px; }
.pf-chip-btn { border: 0; background: transparent; cursor: pointer; color: var(--text-muted); width: 24px; height: 24px; border-radius: 50%; }
.pf-chip-btn:hover:not(:disabled) { background: var(--border); }
.pf-chip-btn:disabled { opacity: .25; cursor: default; }
.pf-add h2 { font-size: 15px; margin-bottom: 10px; }
.pf-add-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-link { font-size: 13px; font-weight: 600; }
.pf-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.pf-form { display: grid; gap: 0; max-height: calc(100vh - 24px); }
.pf-dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--grid); }
.pf-dialog-head h2 { margin: 0; font-size: 17px; }
.pf-dialog-body { padding: 16px 18px 4px; overflow-y: auto; }
.pf-dialog-body textarea { width: 100%; font: inherit; font-size: 14px; color: var(--text-primary); background: var(--page); border: 1px solid var(--input-border); border-radius: 8px; padding: 9px 11px; resize: vertical; }
.pf-dialog-body textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.pf-form > .error { margin: 0 18px; }
.pf-dialog-actions { display: flex; align-items: center; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--grid); }
.pf-dialog-actions .spacer { flex: 1; }
.pf-count { text-align: right; margin-top: 2px; }
.pf-dates { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.pf-image-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pf-image-row .pf-thumb { width: 64px; height: 64px; }
.pf-visibility h2 { font-size: 16px; }
.pf-vis-options { border: 0; padding: 0; margin: 0; }
.pf-handle-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.pf-handle-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pf-handle-prefix { font-size: 12px; color: var(--text-muted); }
.pf-handle-row input { flex: 1 1 120px; min-width: 0; width: auto; }
.person-card-head .btn { margin-top: 8px; }

/* ---------- Messages ---------- */
.topbar-msgs {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--page); color: var(--text-secondary); font-size: 14px; text-decoration: none;
}
.topbar-msgs:hover, .topbar-msgs[aria-current="page"] { background: var(--border); color: var(--text-primary); }
.topbar-msgs:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.msgs-icon { width: 16px; height: 13px; border: 2px solid currentColor; border-radius: 5px; position: relative; flex-shrink: 0; }
.msgs-icon::after { content: ""; position: absolute; left: 2px; bottom: -5px; border: 3px solid transparent; border-top-color: currentColor; border-left-color: currentColor; }
.msg-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--up); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
@media (max-width: 560px) { .topbar-msgs-text { display: none; } .topbar-msgs { padding: 9px; } .msg-badge { position: absolute; top: -4px; right: -6px; } }
.person-card-actions { justify-content: center; align-items: center; margin-top: 8px; }
.danger-btn { background: var(--down); }
.danger-btn:hover { background: var(--down); filter: brightness(.92); }
.reports { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.report { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--page); display: grid; gap: 6px; }
.report.done { opacity: .7; }
.report blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--down); background: var(--surface); border-radius: 6px; white-space: pre-line; overflow-wrap: anywhere; }
.report p { margin: 0; }

body.chat-body { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.chat-app {
  flex: 1; min-height: 0; width: 100%; max-width: 1400px; margin: 0 auto; display: grid;
  grid-template-columns: minmax(0, 1fr); border-left: 1px solid var(--border); border-right: 1px solid var(--border);
}
@media (min-width: 760px) { .chat-app { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); } }
.chat-side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.chat-side-head h1 { font-size: 20px; margin: 0; }
.chat-side-actions { display: flex; gap: 4px; }
.chat-icon {
  border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 18px; line-height: 1;
  width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
}
.chat-icon:hover { background: var(--border); color: var(--text-primary); }
.chat-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat-search { padding: 0 12px 8px; }
.chat-search input { border-radius: 10px; padding: 8px 12px; }
.chat-filters { display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: none; }
.chat-filters button {
  border: 1px solid var(--border); background: var(--page); color: var(--text-secondary); border-radius: 999px; padding: 4px 12px;
  font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chat-filters button[aria-pressed="true"] { background: var(--series-1-wash); color: var(--accent); border-color: transparent; font-weight: 600; }
.chat-list { flex: 1; overflow-y: auto; }
.chat-list ul { list-style: none; margin: 0; padding: 0; }
.chat-list-head { font-size: 13px; color: var(--accent); margin: 10px 16px 4px; font-weight: 600; }
.chat-empty { padding: 24px 16px; text-align: center; }
.chat-row, .chat-result {
  width: 100%; display: flex; gap: 12px; align-items: center; padding: 10px 14px; border: 0; background: transparent; text-align: left;
  font: inherit; color: var(--text-primary); cursor: pointer; border-bottom: 1px solid var(--grid);
}
.chat-result { display: grid; gap: 2px; }
.chat-row:hover, .chat-result:hover { background: var(--page); }
.chat-row.active { background: var(--series-1-wash); }
.chat-row:focus-visible, .chat-result:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chat-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-row-top, .chat-row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.chat-row-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chat-time { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.chat-time.unread { color: var(--up); font-weight: 600; }
.chat-preview { font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-flags { display: flex; align-items: center; gap: 4px; font-size: 12px; flex-shrink: 0; }
.chat-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--up); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.chat-badge.muted { background: var(--axis); }
.chat-group-av { width: var(--av); height: var(--av); border-radius: 50%; background: var(--grid); display: inline-grid; place-items: center; font-size: calc(var(--av) * .45); flex-shrink: 0; }
.typing { color: var(--up); font-style: normal; }
.ticks { font-size: 12px; letter-spacing: -3px; margin-left: 4px; color: var(--text-muted); }
.ticks.read { color: #34b7f1; }

.chat-pane { display: none; flex-direction: column; min-height: 0; min-width: 0; position: relative;
  background-color: var(--page);
  background-image: radial-gradient(var(--grid) 1px, transparent 1px); background-size: 18px 18px; }
@media (min-width: 760px) { .chat-pane { display: flex; } }
@media (max-width: 759px) { .chat-app.show-pane .chat-side { display: none; } .chat-app.show-pane .chat-pane { display: flex; } }
.chat-welcome { margin: auto; text-align: center; max-width: 360px; padding: 24px; }
.chat-welcome h2 { margin: 0 0 6px; }
.chat-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--surface); border-bottom: 1px solid var(--border); }
.chat-back { display: inline-grid; }
@media (min-width: 760px) { .chat-back { display: none; } }
.chat-head-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; padding: 4px; border-radius: 8px; }
.chat-head-who:hover { background: var(--page); }
.chat-head-who > span:last-child { display: grid; min-width: 0; }
.chat-head-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px clamp(10px, 4vw, 48px) 16px; display: flex; flex-direction: column; gap: 2px; }
.chat-log:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chat-more { text-align: center; margin: 4px 0 8px; }
.chat-private { align-self: center; max-width: 440px; text-align: center; font-size: 12px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin: 4px 0 10px; }
.chat-day { text-align: center; margin: 10px 0 6px; }
.chat-day span, .chat-system span { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); }
.chat-system { text-align: center; margin: 6px 0; }
.chat-msg { display: flex; flex-direction: column; align-items: flex-start; margin-top: 6px; }
.chat-msg.continued { margin-top: 1px; }
.chat-msg.mine { align-items: flex-end; }
.chat-bubble {
  position: relative; max-width: min(78%, 560px); padding: 6px 9px 6px 10px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: 0 1px 1px rgba(0,0,0,.04); min-width: 72px;
}
.chat-msg.mine .chat-bubble { background: #d9fdd3; border-color: #c5ebbf; color: #0b0b0b; }
:root[data-theme="dark"] .chat-msg.mine .chat-bubble { background: #144d37; border-color: #1d5c43; color: #e9edef; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chat-msg.mine .chat-bubble { background: #144d37; border-color: #1d5c43; color: #e9edef; } }
.chat-msg:not(.continued):not(.mine) .chat-bubble { border-top-left-radius: 2px; }
.chat-msg.mine:not(.continued) .chat-bubble { border-top-right-radius: 2px; }
.chat-bubble.flash { animation: chat-flash 1.6s ease; }
@keyframes chat-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 1px 1px rgba(0,0,0,.04); } }
.chat-sender { display: block; font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 1px; }
.chat-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.4; }
.chat-text a { color: #027eb5; }
.chat-text.deleted { color: var(--text-muted); }
/* Floats at the end of the text: on the last line when there's room, otherwise just below (like WhatsApp). */
.chat-meta { float: right; margin: 6px -2px -4px 12px; font-size: 11px; line-height: 1; color: var(--text-muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.chat-msg.mine .chat-meta { color: #667781; }
.chat-msg-menu {
  position: absolute; top: 2px; right: 2px; width: 24px; height: 22px; border: 0; border-radius: 6px; cursor: pointer;
  background: inherit; box-shadow: -8px 0 8px -2px var(--bubble, var(--surface)); color: var(--text-muted); font-size: 14px; opacity: 0; transition: opacity .12s;
}
.chat-bubble:hover .chat-msg-menu, .chat-msg-menu:focus-visible, .chat-msg-menu[aria-expanded="true"] { opacity: 1; }
@media (pointer: coarse) { .chat-msg-menu { opacity: .6; } }
.chat-msg-menu:focus-visible { outline: 2px solid var(--accent); }
.chat-quote {
  display: grid; gap: 1px; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--accent); border-radius: 6px;
  background: rgba(0,0,0,.05); padding: 4px 8px; margin: 2px 0 4px; font: inherit; font-size: 12.5px; color: inherit; cursor: pointer;
}
.chat-quote strong { color: var(--accent); font-size: 12px; }
.chat-quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.chat-msg.mine .chat-quote span { color: #3b4a54; }
.chat-reactions { display: flex; gap: 4px; margin: -4px 8px 0; position: relative; z-index: 1; flex-wrap: wrap; }
.chat-reaction { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 1px 7px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text-primary); }
.chat-reaction.mine { border-color: var(--accent); background: var(--series-1-wash); }
.chat-jump { position: absolute; right: 18px; bottom: 84px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.15); cursor: pointer; font-size: 18px; }
.chat-composer { background: var(--surface); border-top: 1px solid var(--border); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.chat-composer.locked { text-align: center; }
.chat-composer.locked p { margin: 6px; }
.chat-compose-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-compose-row textarea {
  flex: 1; resize: none; font: inherit; font-size: 15px; line-height: 1.4; padding: 9px 14px; border-radius: 20px; max-height: 160px;
  border: 1px solid var(--input-border); background: var(--page); color: var(--text-primary);
}
.chat-compose-row textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.chat-send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--up); color: #fff; font-size: 17px; cursor: pointer; flex-shrink: 0; }
.chat-send:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat-replybar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 6px 6px 6px 10px; border-left: 3px solid var(--accent); background: var(--page); border-radius: 6px; }
.chat-replybar > span { flex: 1; min-width: 0; display: grid; font-size: 13px; }
.chat-replybar strong { color: var(--accent); font-size: 12px; }
.chat-replybar span span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.chat-menu {
  position: fixed; z-index: 50; min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.2); padding: 6px; display: grid;
}
.chat-menu > button { border: 0; background: transparent; text-align: left; padding: 8px 12px; border-radius: 6px; font: inherit; font-size: 14px; color: var(--text-primary); cursor: pointer; }
.chat-menu > button:hover, .chat-menu > button:focus-visible { background: var(--page); outline: none; }
.chat-menu > button.danger { color: var(--down); }
.chat-quick { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--grid); margin-bottom: 4px; }
.chat-quick button { border: 0; background: transparent; font-size: 20px; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; }
.chat-quick button:hover, .chat-quick button:focus-visible { background: var(--page); outline: none; transform: scale(1.15); }
.chat-sheet { width: min(460px, calc(100vw - 24px)); }
.chat-sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--grid); }
.chat-sheet-head h2 { margin: 0; font-size: 17px; }
.chat-sheet-body { padding: 12px 16px; overflow-y: auto; max-height: calc(min(640px, 100vh - 32px) - 130px); }
.chat-sheet-body .people-results { max-height: 340px; padding: 6px 0; }
.chat-sheet-foot { padding: 10px 16px 14px; border-top: 1px solid var(--grid); display: flex; justify-content: flex-end; }
.chat-chosen { font-size: 13px; color: var(--text-secondary); margin: 8px 0 0; }
.pick-check { margin-left: auto; color: var(--up); font-weight: 700; width: 20px; }
.person-row[aria-pressed="true"] { background: var(--series-1-wash); }
.chat-members { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.chat-members li { display: flex; align-items: center; gap: 10px; }
.chat-member-text { flex: 1; min-width: 0; }
.chat-bubble.wide { width: min(78%, 340px); }
.chat-text.empty { min-height: 0; }
.chat-text.empty .chat-meta { margin-top: 4px; }
.chat-photos { display: grid; gap: 3px; margin: 2px -5px 2px -6px; border-radius: 8px; overflow: hidden; }
.chat-photos.n2, .chat-photos.n3, .chat-photos.n4 { grid-template-columns: 1fr 1fr; }
.chat-photo { border: 0; padding: 0; background: var(--grid); cursor: zoom-in; display: block; aspect-ratio: 1; overflow: hidden; }
.chat-photo.single { aspect-ratio: auto; max-height: 360px; }
.chat-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chat-photo.single img { height: auto; max-height: 360px; }
.chat-photo:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
/* The 24-pixel copy, blurred, sits under the photo until it loads. */
.chat-photo { position: relative; }
.chat-photo img:not(.chat-photo-blur) { position: relative; }
.chat-photo .chat-photo-blur { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(12px); transform: scale(1.15); }
.chat-video { display: block; width: calc(100% + 11px); margin: 2px -5px 2px -6px; max-height: 360px; border-radius: 8px; background: #000; }
.chat-voice { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.chat-voice audio { width: 100%; min-width: 0; height: 40px; }
.chat-file { display: flex; gap: 10px; align-items: center; padding: 8px; margin: 2px 0 4px; border-radius: 8px; background: rgba(0,0,0,.05); text-decoration: none; color: inherit; }
.chat-file > span:last-child { display: grid; min-width: 0; }
.chat-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.chat-file-icon { width: 40px; height: 46px; flex-shrink: 0; border-radius: 6px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.chat-poll, .chat-event { display: grid; gap: 6px; margin: 2px 0 2px; }
.chat-poll p, .chat-event p { margin: 0; }
.chat-poll-q { font-size: 15px; }
.chat-poll-opt {
  position: relative; display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; text-align: left; padding: 8px 6px 12px;
  border: 0; background: transparent; font: inherit; font-size: 14px; color: inherit; cursor: pointer; border-radius: 6px;
}
.chat-poll-opt:hover:not(:disabled) { background: rgba(0,0,0,.04); }
.chat-poll-opt:focus-visible { outline: 2px solid var(--accent); }
.chat-poll-box { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--axis); display: grid; place-items: center; font-size: 12px; color: #fff; }
.chat-poll-opt.mine .chat-poll-box { background: var(--up); border-color: var(--up); }
.chat-poll-n { font-size: 13px; color: var(--text-secondary); }
.chat-poll-bar { position: absolute; left: 36px; bottom: 4px; height: 4px; border-radius: 2px; background: var(--up); width: 0; transition: width .3s; }
.chat-poll-opt::after { content: ""; position: absolute; left: 36px; right: 6px; bottom: 4px; height: 4px; border-radius: 2px; background: rgba(0,0,0,.08); z-index: -1; }
.chat-poll-opt { isolation: isolate; }
.chat-event-top { display: flex; gap: 10px; align-items: flex-start; }
.chat-event-top > span:last-child { display: grid; gap: 2px; min-width: 0; }
.chat-event-title { font-size: 15px; }
.chat-event-date { width: 46px; flex-shrink: 0; border-radius: 8px; overflow: hidden; text-align: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-primary); }
.chat-event-date span { display: block; background: var(--down); color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 1px 0; }
.chat-event-date strong { display: block; font-size: 18px; padding: 2px 0; }
.chat-event-desc { white-space: pre-line; font-size: 14px; }
.chat-rsvps { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-rsvp { border: 1px solid var(--input-border); background: var(--surface); color: var(--text-primary); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chat-rsvp span { color: var(--text-muted); margin-left: 2px; }
.chat-rsvp.mine { background: var(--up); border-color: var(--up); color: #fff; }
.chat-rsvp.mine span { color: rgba(255,255,255,.85); }
.chat-uploading { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.chat-uploading progress { flex: 1; accent-color: var(--up); }
.chat-compose-row > .chat-icon { align-self: center; }
.chat-compose-row.recording { align-items: center; }
.chat-rec { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text-secondary); }
.chat-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--down); animation: chat-pulse 1s infinite alternate; }
@keyframes chat-pulse { to { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .chat-rec-dot { animation: none; } .chat-poll-bar { transition: none; } }
.chat-lightbox { border: 0; padding: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: rgba(0,0,0,.92); color: #fff; }
.chat-lightbox::backdrop { background: rgba(0,0,0,.8); }
.chat-lightbox-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.chat-lightbox-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-lightbox-bar .chat-icon { color: #fff; text-decoration: none; }
.chat-lightbox img { display: block; max-width: 100%; max-height: 100%; margin: auto; position: absolute; inset: 0; object-fit: contain; }
.chat-preview-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; max-height: 260px; overflow-y: auto; }
.chat-preview-list li { display: flex; align-items: center; gap: 10px; }
.chat-preview-list img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.chat-preview-list li > span:last-child { display: grid; min-width: 0; }
.chat-preview-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-poll-fields { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.chat-poll-fields legend { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.chat-ev-row { display: grid; gap: 0 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.chat-extra-form textarea { width: 100%; font: inherit; font-size: 14px; color: var(--text-primary); background: var(--page); border: 1px solid var(--input-border); border-radius: 8px; padding: 9px 11px; resize: vertical; }
.chat-extra-form .chat-sheet-foot { gap: 8px; }
.chat-event .link-btn { justify-self: start; padding-left: 0; }
.report-photo { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* ---------- Spaces ---------- */
.space-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.space-cards.one { grid-template-columns: minmax(0, 1fr); }
.space-card {
  display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--page); color: inherit; text-decoration: none; min-width: 0; height: 100%;
}
a.space-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
a.space-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.space-card-pic { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--grid); }
.space-card-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.space-card-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-card-text .pill { justify-self: start; margin: 2px 0 0; }
.space-code { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--accent); text-transform: uppercase; }
.space-group-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 12px 0 6px; }
.space-archived summary { cursor: pointer; color: var(--text-secondary); font-size: 14px; margin: 6px 0; }
.space-page { max-width: 1080px; }
.space-head { display: flex; gap: 16px; align-items: center; padding: 4px 2px; }
.space-head h1 { margin: 2px 0; font-size: 24px; }
.space-head p { margin: 2px 0 0; }
.space-head-pic { width: 84px; height: 84px; border-radius: 16px; object-fit: cover; flex-shrink: 0; background: var(--grid); }
.space-desc { white-space: pre-line; }
.channels-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 820px) { .channels-layout { grid-template-columns: 280px minmax(0, 1fr); } }
.channel-list ul { list-style: none; margin: 8px -8px 0; padding: 0; display: grid; gap: 2px; }
.channel-row { width: 100%; display: flex; gap: 8px; align-items: flex-start; text-align: left; padding: 8px; border: 0; border-radius: 8px; background: transparent; font: inherit; color: inherit; cursor: pointer; }
.channel-row > span:last-child { display: grid; min-width: 0; }
.channel-row:hover { background: var(--page); }
.channel-row[aria-current="true"] { background: var(--series-1-wash); }
.channel-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.channel-hash { color: var(--text-muted); font-weight: 700; }
.add-ways { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); align-items: start; }
.add-ways h3 { margin: 0; font-size: 14px; }
.add-ways textarea, .chat-sheet-body textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--text-primary); background: var(--page); border: 1px solid var(--input-border); border-radius: 8px; padding: 9px 11px; resize: vertical;
}
.join-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 26px; font-weight: 700; letter-spacing: .18em; margin: 0; color: var(--accent); }
.unit-links { list-style: none; padding: 0; margin: 4px 0 0; font-size: 13px; display: grid; gap: 4px; }
.space-people { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.space-people li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.space-person { display: grid; flex: 1; min-width: 160px; }
.space-groups { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.space-groups li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--page); }
.group-people { display: grid; gap: 2px; max-height: 300px; overflow-y: auto; }
.group-picks { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-left: 26px; }
fieldset.plain { border: 0; padding: 0; margin: 0; }
fieldset.plain legend { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.space-pic-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------- People you can click ---------- */
.person-link { cursor: pointer; border-radius: 3px; text-decoration: underline transparent; text-underline-offset: 2px; transition: text-decoration-color .12s, color .12s; }
.person-link:hover, .person-link:focus-visible { color: var(--accent); text-decoration-color: currentColor; }
.person-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.person-photo { display: inline-flex; cursor: pointer; border-radius: 50%; transition: box-shadow .12s, transform .12s; flex-shrink: 0; }
.person-photo:hover { box-shadow: 0 0 0 3px var(--series-1-wash), 0 0 0 4px var(--accent); transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) { .person-photo:hover { transform: none; } }
.friend-pill { color: var(--up); border-color: currentColor; }
.person-card-actions { flex-wrap: wrap; }

/* ---------- Bell ---------- */
.bell { position: relative; }
.bell-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--page);
  color: var(--text-secondary); cursor: pointer; display: grid; place-items: center;
}
.bell-btn:hover, .bell-btn[aria-expanded="true"] { background: var(--border); color: var(--text-primary); }
.bell-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bell-btn .msg-badge { position: absolute; top: -4px; right: -6px; }
.bell-icon { width: 14px; height: 13px; border: 2px solid currentColor; border-bottom-width: 2px; border-radius: 7px 7px 2px 2px; position: relative; margin-top: -2px; }
.bell-icon::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 6px; height: 3px; margin-left: -3px; border-radius: 0 0 3px 3px; background: currentColor; }
.bell-btn.ring .bell-icon { animation: bell-ring .6s ease; }
@keyframes bell-ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { .bell-btn.ring .bell-icon { animation: none; } }
.bell-panel {
  position: absolute; right: -60px; top: calc(100% + 8px); z-index: 40; width: min(380px, calc(100vw - 24px)); max-height: min(520px, calc(100vh - 90px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.18);
}
@media (max-width: 560px) { .bell-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 8px; }
.bell-head h2 { margin: 0; font-size: 16px; }
.bell-list { list-style: none; margin: 0; padding: 0 6px; overflow-y: auto; flex: 1; }
.bell-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 8px; text-decoration: none; color: inherit; }
.bell-item:hover, .bell-item:focus-visible { background: var(--page); outline: none; }
.bell-item.unread { background: var(--series-1-wash); }
.bell-item > span:nth-child(2) { flex: 1; display: grid; gap: 2px; font-size: 14px; min-width: 0; }
.bell-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.bell-kontour { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.bell-empty { padding: 18px 8px; text-align: center; }
.bell-more { display: block; margin: 6px auto; }
.bell-settings { padding: 8px 14px 12px; border-top: 1px solid var(--grid); }

/* ---------- Chat: menu, pins, forwarding, selecting ---------- */
.chat-menu-sep { border: 0; border-top: 1px solid var(--grid); margin: 4px 0; }
.chat-menu > button { display: flex; align-items: center; gap: 10px; }
.chat-menu-icon { width: 18px; text-align: center; opacity: .75; }
.chat-pins { display: flex; flex-direction: column; gap: 1px; background: var(--surface); border-bottom: 1px solid var(--border); }
.chat-pin { display: flex; gap: 8px; align-items: center; text-align: left; border: 0; background: transparent; font: inherit; font-size: 13px; color: inherit; padding: 6px 14px; cursor: pointer; }
.chat-pin:hover { background: var(--page); }
.chat-pin > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-forwarded { display: block; font-size: 12px; font-style: italic; color: var(--text-muted); margin-bottom: 2px; }
.chat-msg.selecting { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.chat-msg.selecting.mine { flex-direction: row; justify-content: flex-end; }
.chat-msg.selecting .chat-reactions { display: none; }
.chat-msg.picked { background: var(--series-1-wash); border-radius: 8px; }
.chat-pick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--axis); background: var(--surface); flex-shrink: 0; cursor: pointer; order: -1; }
.chat-msg.picked .chat-pick { background: var(--up); border-color: var(--up); }
.chat-msg.picked .chat-pick::after { content: "✓"; color: #fff; font-size: 13px; line-height: 18px; display: block; text-align: center; }
.chat-selectbar { display: flex; align-items: center; gap: 4px; }
.chat-select-count { flex: 1; font-weight: 600; }
.fwd-row { align-items: center; margin: 0; padding: 6px 4px; }
.fwd-row .av, .fwd-row .chat-group-av { flex-shrink: 0; }

/* ---------- Friends page ---------- */
.friend-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.friend-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.friend-text { display: grid; flex: 1; min-width: 160px; }

/* ---------- Home: feed beside your courses ---------- */
.home.home-wide { max-width: 1080px; }
.home-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 320px; }
  .home-side { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; }
}
/* On phones your courses come first, then the feed; the profile and units cards stay out of the way. */
@media (max-width: 899px) {
  .home-side { order: -1; }
  .home-side .home-me, .home-side > section:last-child { display: none; }
}
.home-main { display: grid; gap: 12px; min-width: 0; }
.home-me { display: flex; gap: 12px; align-items: center; }
.home-me > div { display: grid; gap: 2px; min-width: 0; }
.home-me .small { overflow: hidden; text-overflow: ellipsis; }
.home-admin p { margin: 6px 0 0; }
.home-side h2 { font-size: 16px; }
.home-side .space-cards { grid-template-columns: minmax(0, 1fr); }
.home-side .space-card-pic { width: 40px; height: 40px; }

/* ---------- Posts ---------- */
.feed-root { display: grid; gap: 12px; min-width: 0; }
.feed-list { display: grid; gap: 12px; }
.feed-tabs { display: flex; gap: 6px; }
.feed-tabs button { border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.feed-tabs button[aria-selected="true"] { background: var(--series-1-wash); color: var(--accent); border-color: transparent; font-weight: 600; }
.feed-empty { text-align: center; padding: 28px 18px; margin: 0; }
.feed-more { justify-self: center; }

.post-composer { display: grid; gap: 10px; }
.post-composer-row { display: flex; gap: 10px; align-items: flex-start; }
.post-composer textarea { flex: 1; min-height: 44px; resize: vertical; border: 1px solid var(--input-border); border-radius: 12px; padding: 10px 12px; font: inherit; background: var(--page); color: inherit; }
.post-composer-files { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.post-composer-files:empty { display: none; }
.post-composer-files li { position: relative; }
.post-composer-files img, .post-composer-files .chat-file-icon { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; display: grid; }
.post-file-remove { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--text-primary); color: var(--surface); cursor: pointer; line-height: 1; }
.post-composer-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.post-composer-end { display: flex; gap: 8px; align-items: center; margin-left: auto; min-width: 0; }
.post-to { max-width: 240px; min-width: 0; font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--input-border); background: var(--surface); color: inherit; }

.post { display: grid; gap: 10px; padding-bottom: 6px; }
.post-head { display: flex; gap: 10px; align-items: flex-start; }
.post-meta { display: grid; gap: 1px; flex: 1; min-width: 0; }
.post-meta .small a { color: inherit; }
.post-more { border: 0; background: none; color: var(--text-secondary); font-size: 20px; line-height: 1; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; flex-shrink: 0; }
.post-more:hover, .post-more:focus-visible { background: var(--page); }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.post-body a, .post-comment-bubble a { color: var(--accent); }
.post-body + .link-btn { justify-self: start; padding: 0; margin-top: -6px; }
.post-ghost { display: inline-block; width: 44px; height: 44px; }
.post-files { margin: 0 -18px; }
.post-files .chat-photos { margin: 0; border-radius: 0; }
.post-files .chat-photo.single, .post-files .chat-photo.single img { max-height: 520px; }
.post-files .chat-video { width: 100%; margin: 0; border-radius: 0; }
.post-files .chat-file { margin: 4px 18px; }
.post-counts { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.post-counts .link-btn { padding: 0; color: var(--text-secondary); }
.post-actions { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); padding-top: 4px; }
.post-actions button { border: 0; background: none; color: var(--text-secondary); font: inherit; font-weight: 600; font-size: 14px; padding: 8px 4px; border-radius: 8px; cursor: pointer; }
.post-actions button:hover, .post-actions button:focus-visible { background: var(--page); }
.post-actions button[aria-pressed="true"] { color: var(--accent); }
.post-comments { display: grid; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.post-comments > .link-btn { justify-self: start; padding: 0; }
.post-comments ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.post-comment { display: flex; gap: 8px; align-items: flex-start; }
.post-comment > div { min-width: 0; }
.post-comment-bubble { display: grid; gap: 1px; background: var(--page); border-radius: 14px; padding: 7px 12px; overflow-wrap: anywhere; white-space: pre-wrap; }
.post-comment-bubble strong { font-size: 13px; white-space: normal; }
.post-comment .small { margin-left: 12px; }
.post-comment .link-btn { padding: 0; font-size: 12px; }
.post-comment-form { display: flex; gap: 8px; align-items: center; }
.post-comment-form input { flex: 1; min-width: 0; border: 1px solid var(--input-border); border-radius: 999px; padding: 8px 14px; font: inherit; background: var(--page); color: inherit; }
.post-edit textarea { width: 100%; border: 1px solid var(--input-border); border-radius: 10px; padding: 10px; font: inherit; background: var(--page); color: inherit; resize: vertical; }
.post-dialog .post { border: 0; padding: 0; }
.likers-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.channel-main { min-width: 0; }

/* A post shared into a chat. */
.chat-post { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px; margin: 2px 0 4px; border-radius: 8px; background: rgba(0,0,0,.05); text-decoration: none; color: inherit; min-width: 220px; }
.chat-post img { width: 64px; height: 64px; border-radius: 6px; object-fit: cover; }
.chat-post:not(:has(img)) { grid-template-columns: minmax(0, 1fr); }
.chat-post-text { display: grid; gap: 2px; min-width: 0; }
.chat-post-body { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; }
.chat-post.gone { display: block; }

/* ---------- Organization profile and org chart ---------- */
.org-profile-logo { width: clamp(96px, 18vw, 168px); height: clamp(96px, 18vw, 168px); border-radius: 18px; object-fit: cover; background: var(--surface); box-shadow: 0 0 0 4px var(--surface); display: block; }
.org-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 10px 0 0; }
.org-details dt { color: var(--text-muted); font-size: 14px; }
.org-details dd { margin: 0; overflow-wrap: anywhere; }
.chart-people { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.chart-person { display: flex; gap: 10px; align-items: center; padding: 8px 12px 8px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--page); min-width: 0; max-width: 100%; }
.chart-person-text { display: grid; min-width: 0; }
.chart-leaders { margin-bottom: 14px; }
.chart-units { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.chart-units .chart-units { margin: 10px 0 0 18px; padding-left: 14px; border-left: 2px solid var(--grid); }
.chart-unit { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.chart-unit-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.admin-banner { border-radius: 10px; overflow: hidden; max-width: 640px; }
.chart-edit { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.chart-edit li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; }
.chart-add { border-top: 1px solid var(--grid); padding-top: 12px; }
.chart-add h3 { margin: 0; font-size: 15px; }

/* ---------- Stickers and GIFs ---------- */
.chat-bubble.sticker { background: transparent !important; border-color: transparent !important; box-shadow: none !important; padding: 0; }
.chat-bubble.sticker .chat-text.empty { position: static; justify-content: flex-end; }
.chat-sticker { display: block; width: 150px; height: 150px; object-fit: contain; }
.chat-sticker[src^="/gifs/"] { width: 220px; height: auto; max-height: 260px; border-radius: 10px; object-fit: cover; }
.chat-sticker-gone { margin: 4px 8px; }
.chat-composer { position: relative; }
.sticker-panel { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); max-width: 420px; height: min(380px, 55vh); display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 28px rgba(0,0,0,.16); z-index: 20; }
.sticker-tabs { display: flex; gap: 6px; align-items: center; }
.sticker-tabs [role="tab"] { border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.sticker-tabs [role="tab"][aria-selected="true"] { background: var(--series-1-wash); color: var(--accent); border-color: transparent; font-weight: 600; }
.sticker-tabs .sheet-close { margin-left: auto; }
.sticker-body { overflow-y: auto; min-height: 0; }
.sticker-sub { font-size: 12px; color: var(--text-muted); margin: 4px 0; }
.sticker-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.sticker-grid.gifs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.sticker-pick { border: 0; background: none; padding: 4px; border-radius: 10px; cursor: pointer; width: 100%; aspect-ratio: 1; }
.sticker-pick:hover, .sticker-pick:focus-visible { background: var(--page); }
.sticker-pick img { width: 100%; height: 100%; object-fit: contain; }
.gifs .sticker-pick img { object-fit: cover; border-radius: 8px; }
.sticker-credit { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--text-muted); text-align: right; }
.admin-stickers { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 10px; }
.admin-stickers li { display: grid; justify-items: center; gap: 2px; width: 96px; font-size: 13px; text-align: center; }
.admin-stickers img { width: 72px; height: 72px; object-fit: contain; }
.sticker-name { max-width: 260px; }

/* ---------- Loading placeholders ---------- */
.skeleton-line, .skeleton-block, .skeleton-circle { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--grid) 25%, var(--page) 50%, var(--grid) 75%); background-size: 200% 100%; animation: skeleton 1.2s ease-in-out infinite; }
.skeleton-line { height: 12px; width: 60%; margin: 6px 0; }
.skeleton-line.short { width: 35%; }
.skeleton-line.wide { width: 90%; }
.skeleton-block { height: 140px; width: 100%; margin-top: 8px; border-radius: 10px; }
.skeleton-circle { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.skeleton-post { display: grid; gap: 4px; }
.skeleton-head, .skeleton-row { display: flex; gap: 10px; align-items: center; }
.skeleton-lines { flex: 1; }
.skeleton-row { list-style: none; padding: 10px 14px; }
@keyframes skeleton { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton-line, .skeleton-block, .skeleton-circle { animation: none; } }
.friends-count { margin: 2px 0 0; font-size: 14px; color: var(--text-secondary); }
.friends-count strong { color: var(--text-primary); }
.friends-count a { color: inherit; text-decoration: none; }
.friends-count a:hover { text-decoration: underline; }

/* ---------- Calendar ---------- */
.topbar-cal { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); }
.topbar-cal:hover, .topbar-cal[aria-current="page"] { background: var(--border); color: var(--text-primary); }
.topbar-cal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-icon { width: 16px; height: 15px; border: 2px solid currentColor; border-top-width: 4px; border-radius: 3px; position: relative; }
.cal-icon::before, .cal-icon::after { content: ""; position: absolute; top: -7px; width: 2px; height: 5px; background: currentColor; border-radius: 1px; }
.cal-icon::before { left: 2px; } .cal-icon::after { right: 2px; }

/* Calendar */
.cal-app { width: 100%; max-width: 1400px; margin: 0 auto; padding: 16px; }
.cal-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .cal-layout { grid-template-columns: 240px minmax(0, 1fr); align-items: start; } .cal-side { position: sticky; top: 16px; } }
.cal-side { display: grid; gap: 10px; align-content: start; }
.cal-side h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 8px 0 0; }
.cal-side .link-btn { justify-self: start; }
.cal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cal-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-list .check { margin: 0; align-items: center; flex: 1; min-width: 0; }
.cal-list .check span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-dot { --cal: var(--accent); display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--cal); }
.cal-dot.big { width: 26px; height: 26px; }
.cal-swatch { cursor: pointer; }
.cal-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.cal-swatch input:checked + .cal-dot { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.cal-swatch input:focus-visible + .cal-dot { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-mini { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.cal-mini-head { font-size: 13px; margin-bottom: 6px; }
.cal-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 12px; }
.cal-mini-grid button { border: 0; background: none; color: var(--text-primary); font: inherit; padding: 4px 0; border-radius: 50%; cursor: pointer; aspect-ratio: 1; }
.cal-mini-grid button:hover { background: var(--grid); }
.cal-mini-grid button.other { color: var(--text-muted); }
.cal-mini-grid button.today { color: var(--accent); font-weight: 700; }
.cal-mini-grid button.picked { background: var(--accent); color: #fff; }
@media (max-width: 899px) { .cal-mini { display: none; } }

.cal-main { min-width: 0; display: grid; gap: 12px; }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cal-title { font-size: 20px; margin: 0 auto 0 4px; }
.icon-round { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); font-size: 20px; line-height: 1; cursor: pointer; }
.icon-round:hover { background: var(--grid); }
.cal-views { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface); }
.cal-views button { border: 0; background: none; color: var(--text-secondary); font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.cal-views button[aria-selected="true"] { background: var(--accent); color: #fff; }

.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.cal-head { font-size: 12px; color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: center; }
.cal-cell { min-height: 108px; padding: 4px; border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: var(--page); }
.cal-cell.other .cal-date { color: var(--text-muted); }
.cal-date { align-self: flex-start; border: 0; background: none; font: inherit; font-size: 12px; color: var(--text-primary); width: 24px; height: 24px; border-radius: 50%; cursor: pointer; }
.cal-date:hover { background: var(--grid); }
.cal-cell.today .cal-date { background: var(--accent); color: #fff; font-weight: 700; }
.cal-chip { --cal: var(--accent); display: flex; gap: 4px; align-items: baseline; width: 100%; min-width: 0; text-align: left; border: 0; border-left: 3px solid var(--cal); background: color-mix(in srgb, var(--cal) 12%, transparent); color: var(--text-primary); font: inherit; font-size: 12px; padding: 2px 4px; border-radius: 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.all-day { background: var(--cal); color: #fff; }
.cal-chip-time { color: var(--text-muted); font-size: 11px; flex: none; }
.cal-more { font-size: 12px; align-self: flex-start; }
@media (max-width: 640px) {
  .cal-cell { min-height: 64px; padding: 2px; }
  .cal-chip { font-size: 0; padding: 0; height: 6px; border-left: 0; background: var(--cal); }
  .cal-chip-time { display: none; }
  .cal-more { font-size: 11px; }
}

.cal-week { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); --cols: 7; }
.cal-week[data-days="1"] { --cols: 1; }
.cal-week-head, .cal-allday, .cal-grid { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); }
.cal-week-head { border-bottom: 1px solid var(--border); }
.cal-week-day { border: 0; background: none; font: inherit; color: var(--text-secondary); padding: 6px 0; display: grid; justify-items: center; cursor: pointer; }
.cal-week-day span { font-size: 12px; }
.cal-week-day strong { font-size: 18px; width: 32px; height: 32px; line-height: 32px; border-radius: 50%; color: var(--text-primary); }
.cal-week-day.today strong { background: var(--accent); color: #fff; }
.cal-allday { border-bottom: 1px solid var(--border); min-height: 28px; }
.cal-allday > span { padding: 6px 4px; text-align: right; }
.cal-allday > div { padding: 2px; display: grid; gap: 2px; border-left: 1px solid var(--grid); align-content: start; }
.cal-scroll { max-height: calc(100vh - 260px); min-height: 360px; overflow-y: auto; }
.cal-grid { position: relative; }
.cal-hours { display: grid; grid-auto-rows: 44px; }
.cal-hour { font-size: 11px; color: var(--text-muted); text-align: right; padding-right: 6px; transform: translateY(-7px); }
.cal-col { position: relative; border-left: 1px solid var(--grid); background-image: linear-gradient(var(--grid) 1px, transparent 1px); background-size: 100% 44px; cursor: pointer; }
.cal-col.today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.cal-block { --cal: var(--accent); position: absolute; padding: 2px 6px; border: 0; border-left: 3px solid var(--cal); border-radius: 6px; background: color-mix(in srgb, var(--cal) 18%, var(--surface)); color: var(--text-primary); font: inherit; font-size: 12px; text-align: left; overflow: hidden; display: flex; flex-direction: column; cursor: pointer; box-shadow: 0 0 0 1px var(--surface); }
.cal-block strong, .cal-block span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-block span { color: var(--text-secondary); font-size: 11px; }

.cal-agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.cal-agenda h3 { font-size: 13px; color: var(--text-muted); margin: 0 0 6px; }
.cal-agenda ul { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cal-agenda ul li + li { border-top: 1px solid var(--grid); }
.cal-agenda-row { width: 100%; display: grid; grid-template-columns: 10px 76px minmax(0, 1fr); gap: 10px; align-items: center; border: 0; background: none; font: inherit; color: var(--text-primary); text-align: left; padding: 10px 14px; cursor: pointer; }
.cal-agenda-row:hover { background: var(--page); }
.cal-agenda-time { font-size: 13px; color: var(--text-secondary); }
.cal-empty { text-align: center; padding: 32px 16px; }

.cal-when { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.cal-when[hidden], .ev-time[hidden] { display: none; }
.ev-days .row { flex-wrap: wrap; gap: 6px; }
.day-check { margin: 0; }
.day-check input { position: absolute; opacity: 0; pointer-events: none; }
.day-check span { display: inline-block; min-width: 40px; text-align: center; padding: 6px 8px; border: 1px solid var(--input-border); border-radius: 999px; font-size: 12px; cursor: pointer; }
.day-check input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-item-cal { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; margin: 0; }
.cal-item-desc { white-space: pre-line; overflow-wrap: anywhere; }
.cal-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cal-members li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-members .check { margin: 0; }
.feed-url { user-select: all; }
.space-cal-actions { gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.space-cal-actions .link-btn { margin-left: auto; }
.home-upcoming ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.home-upcoming a { display: grid; gap: 1px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; color: var(--text-primary); text-decoration: none; }
.home-upcoming a:hover { background: var(--page); }
.home-upcoming strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 899px) {
  .cal-main { order: -1; }
  .cal-side > .btn[data-act="new"] { position: fixed; right: 16px; bottom: 16px; z-index: 20; border-radius: 999px; padding: 12px 18px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
  .cal-app { padding-bottom: 80px; }
}

/* Website builder (/website) */
.wb-app { width: 100%; max-width: 1600px; margin: 0 auto; padding: 12px 16px 24px; }
.wb-create { max-width: 760px; margin: 16px auto; }
.wb-templates { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.wb-template { display: block; cursor: pointer; }
.wb-template input { position: absolute; opacity: 0; pointer-events: none; }
.wb-template > span { display: grid; gap: 4px; height: 100%; padding: 14px; border: 1px solid var(--input-border); border-radius: 12px; background: var(--surface); }
.wb-template input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.wb-template input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.wb-address { display: flex; align-items: center; gap: 4px; }
.wb-address input { flex: 1; min-width: 0; }
.wb-address .muted { white-space: nowrap; font-size: 13px; }

.wb { display: grid; gap: 8px; }
.wb-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.wb-top select { max-width: 220px; }
.wb-status { margin-left: auto; }
.wb-status.bad { color: var(--down); }
.wb-state { margin: 0; color: var(--text-secondary); }
.wb-device { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface); }
.wb-device button { border: 0; background: none; color: var(--text-secondary); font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.wb-device button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.wb-main { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .wb-main { grid-template-columns: 360px minmax(0, 1fr); align-items: start; } .wb-panel { position: sticky; top: 8px; } }
.wb-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 150px); min-height: 320px; }
.wb-tabs { display: flex; border-bottom: 1px solid var(--border); overflow-x: auto; }
.wb-tabs button { flex: 1; border: 0; background: none; font: inherit; font-size: 13px; color: var(--text-secondary); padding: 10px 8px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.wb-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.wb-panel-body { padding: 14px; overflow-y: auto; }
.wb-fields { display: grid; gap: 12px; min-width: 0; }
.wb-fields .field { margin: 0; }
.wb-h { font-size: 15px; margin: 6px 0 0; }
.wb-sections, .wb-pages, .wb-nav, .wb-versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wb-sections li { display: flex; gap: 6px; align-items: center; }
.wb-section { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--border); background: var(--page); color: var(--text-primary); font: inherit; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.wb-section:hover { border-color: var(--accent); }
.wb-section > span:last-child { display: grid; min-width: 0; }
.wb-section .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-icon { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: 15px; }
.wb-row-actions { display: flex; gap: 2px; }
.wb-row-actions .icon-round, .wb-item-head .icon-round { width: 28px; height: 28px; font-size: 14px; }
.icon-round:disabled { opacity: .35; cursor: default; }
.wb-form { display: grid; gap: 14px; }
.wb-form .field label, .wb-form .field .label { margin-bottom: 4px; }
.wb-form-actions { justify-content: space-between; margin-top: 8px; }
.wb-more summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.wb-more[open] { display: grid; gap: 10px; }
.wb-list { display: grid; gap: 8px; }
.wb-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: grid; gap: 8px; background: var(--page); }
.wb-item-head { display: flex; gap: 6px; align-items: center; }
.wb-item-head .link-btn { margin-left: auto; }
.wb-sub { list-style: none; margin: 0 0 0 12px; padding: 0; display: grid; gap: 6px; }
.wb-nav-fields { display: grid; gap: 6px; }
.wb-image { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wb-image img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.wb-pages li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 10px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.wb-pages li.current { border-color: var(--accent); }
.wb-pages li > div:first-child { display: grid; min-width: 0; }
.wb-pages .row { gap: 6px 10px; flex-wrap: wrap; }
.wb-versions li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.wb-versions li > div { display: grid; }
.wb-colors { display: flex; gap: 16px; }
.wb-color { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.wb-color input { width: 44px; height: 32px; padding: 0; border: 1px solid var(--input-border); border-radius: 8px; background: none; cursor: pointer; }
.wb-fonts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wb-font input { position: absolute; opacity: 0; pointer-events: none; }
.wb-font span { display: block; padding: 10px; border: 1px solid var(--input-border); border-radius: 8px; text-align: center; font-size: 17px; cursor: pointer; }
.wb-font input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.wb-font input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.wb-fields fieldset.plain .check { margin-bottom: 6px; }
.wb-stage { background: var(--grid); border-radius: 12px; padding: 0; overflow: hidden; display: flex; justify-content: center; }
.wb-stage iframe { width: 100%; height: calc(100vh - 150px); min-height: 480px; border: 0; background: #fff; transition: width .2s; }
.wb-stage.phone { padding: 16px 0; }
.wb-stage.phone iframe { width: 390px; max-width: 100%; height: min(844px, calc(100vh - 182px)); border-radius: 24px; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
@media (max-width: 979px) { .wb-panel { max-height: none; } .wb-stage iframe { height: 70vh; } .wb-status { margin-left: 0; } }
.wb-picker { display: grid; gap: 8px; }
.wb-pick { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 1px solid var(--border); background: var(--page); color: var(--text-primary); font: inherit; padding: 10px; border-radius: 10px; cursor: pointer; }
.wb-pick:hover, .wb-pick:focus-visible { border-color: var(--accent); }
.wb-pick > span:last-child { display: grid; gap: 2px; }
.wb-library { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.wb-library li { display: grid; gap: 2px; justify-items: start; }
.wb-thumb { padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; width: 100%; }
.wb-thumb:hover, .wb-thumb:focus-visible { border-color: var(--accent); }
.wb-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.btn.danger { color: var(--down); }
/* The organization's own website, by its name, in everyone's top bar. */
.topbar-site-text { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.globe-icon { display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-radius: 50%; position: relative; flex-shrink: 0; }
.globe-icon::before { content: ""; position: absolute; inset: -2px 3px; border: 2px solid currentColor; border-radius: 50%; }
.globe-icon::after { content: ""; position: absolute; left: -2px; right: -2px; top: 4.5px; height: 2px; background: currentColor; }
.btn-icon { display: inline-flex; align-items: center; gap: 7px; }
.btn-icon .globe-icon { width: 13px; height: 13px; margin-right: 7px; vertical-align: -2px; }
.btn-icon .globe-icon::after { top: 3.5px; }
.wb-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wb-docs li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.wb-doc-ext { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; }
.wb-doc-name { flex: 1; min-width: 0; display: grid; }
.wb-doc-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-inbox { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.site-inbox li { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; }
.site-inbox li.unread { border-left: 4px solid var(--accent); }
.site-inbox p { margin: 0; }
.site-inbox-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.site-inbox-text { white-space: pre-line; overflow-wrap: anywhere; }

/* Classwork (Space page) */
.tab-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: 2px; }
.cw { display: grid; gap: 18px; }
.cw-bar { display: flex; justify-content: flex-end; }
.cw-empty { text-align: center; padding: 28px 16px; }
.cw-topic { display: grid; gap: 8px; }
.cw-topic-head { display: flex; align-items: center; gap: 8px; border-bottom: 2px solid var(--accent); padding-bottom: 6px; }
.cw-topic-head h2 { font-size: 18px; margin: 0 auto 0 0; }
.cw-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cw-row { display: flex; align-items: center; gap: 6px; }
.cw-item { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-primary); font: inherit; cursor: pointer; }
.cw-item:hover { border-color: var(--accent); }
.cw-icon { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, transparent); font-size: 17px; }
.cw-text { display: grid; min-width: 0; }
.cw-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-new { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-left: auto; }
.cw-move { display: flex; gap: 2px; }
.cw-move .icon-round { width: 28px; height: 28px; font-size: 14px; }
.cw-badge { display: inline-block; padding: 0 6px; border-radius: 999px; background: var(--grid); color: var(--text-secondary); font-size: 12px; }
.cw-view { gap: 14px; }
.cw-rich p, .cw-rich ul, .cw-rich ol { margin: 0 0 10px; }
.cw-rich h3 { font-size: 16px; margin: 12px 0 6px; }
.cw-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cw-files img, .cw-files video { width: 100%; max-height: 420px; object-fit: contain; border-radius: 10px; background: var(--grid); margin-bottom: 6px; }
.cw-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cw-file .cw-text { flex: 1; }
.cw-video { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.cw-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cw-url { overflow-wrap: anywhere; }
.cw-who { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.cw-who h3 { font-size: 14px; margin: 0 0 6px; }
.cw-who ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.cw-upload-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.cw-upload-list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; }
.cw-actions { flex-wrap: wrap; gap: 8px; }
.cw-when[hidden] { display: none; }
.cw, .cw-items > li, .cw-topic { min-width: 0; }
@media (max-width: 560px) { .cw-item { padding: 8px 10px; gap: 10px; } .cw-icon { width: 30px; height: 30px; font-size: 15px; } .cw-row .cw-move { flex-direction: column; } .cw-row .cw-move .icon-round { width: 26px; height: 22px; font-size: 12px; } }
.home > *, .stack-12 > *, .cw-items, .cw-item { min-width: 0; }
.profile-tabs { overflow-x: auto; scrollbar-width: none; } .profile-tabs::-webkit-scrollbar { display: none; } .profile-tabs [role="tab"] { flex: none; white-space: nowrap; }

/* Channel Files */
.cf-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface); justify-self: start; }
.cf-switch button { border: 0; background: none; font: inherit; font-size: 14px; color: var(--text-secondary); padding: 6px 16px; border-radius: 999px; cursor: pointer; }
.cf-switch button[aria-selected="true"] { background: var(--accent); color: #fff; }
.cf { display: grid; gap: 10px; min-width: 0; }
.cf-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cf-bar input[type="search"] { flex: 1 1 180px; min-width: 0; }
.cf-bar select { width: auto; }
.cf-path { font-size: 14px; }
.cf-list, .cf-uploading { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cf-uploading li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border: 1px dashed var(--border); border-radius: 8px; }
.cf-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cf-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-primary); text-decoration: none; font: inherit; text-align: left; cursor: pointer; }
.cf-name:hover { border-color: var(--accent); }
.cf-icon { flex: none; font-size: 20px; }
.cf-text { display: grid; min-width: 0; }
.cf-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-dl { display: grid; place-items: center; text-decoration: none; }
.cf-empty { padding: 16px; text-align: center; }

/* ---------- Gatehier staff console ---------- */
.qr-box { display: flex; justify-content: center; margin: 8px 0 12px; }
.qr-box svg { max-width: 100%; height: auto; border-radius: 8px; }
.qr-manual { margin-bottom: 16px; font-size: 14px; }
.qr-manual summary { cursor: pointer; color: var(--accent); }
.qr-manual .secret { font-size: 15px; letter-spacing: .05em; overflow-wrap: anywhere; }
.pill.warn { background: var(--error-bg); border-color: transparent; color: var(--down); }
.btn.ghost.danger { color: var(--down); }
.staff-accounts { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.staff-accounts h2 { font-size: 16px; margin: 0; }
.staff-access { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 0; margin: 0; }
.staff-access legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.staff-log { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; font-size: 14px; }
.staff-log li { display: grid; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--grid); min-width: 0; overflow-wrap: anywhere; }
.staff-log li:last-child { border-bottom: 0; }
.staff-log time { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
@media (min-width: 640px) { .staff-log li { grid-template-columns: 170px 1fr; } }
#log-filter input { flex: 1; min-width: 0; max-width: 260px; }
.staff-powers { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 0; display: grid; gap: 8px; }
.staff-powers legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.check-row { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check-row input { width: auto; margin-top: 3px; flex-shrink: 0; }
.check-row > span { min-width: 0; }
.check-row:has(input:disabled) { opacity: .6; }
/* Developers Console notices */
.notice-form { display: grid; gap: 6px; padding: 0 14px 10px; border-bottom: 1px solid var(--grid); }
.notice-form textarea { width: 100%; font: inherit; font-size: 14px; color: var(--text-primary); background: var(--page); border: 1px solid var(--input-border); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.notice-form .row { justify-content: space-between; }
.notice-item { padding: 10px 8px; border-bottom: 1px solid var(--grid); display: grid; gap: 4px; font-size: 14px; }
.notice-meta { display: flex; gap: 8px; align-items: baseline; }
.notice-meta .link-btn, .notice-meta .sheet-close { margin-left: auto; }
.notice-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice-item a, .notice-toast a { color: var(--accent); }
.notice-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.notice-toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 12px; box-shadow: 0 12px 30px rgba(0,0,0,.18); display: grid; gap: 4px; font-size: 14px; }
.notice-toast .sheet-close { font-size: 20px; padding: 0 6px; }
.topbar .who .bell { flex-shrink: 0; }

/* Developers Console shell: a side nav pinned to the left that opens while the cursor (or keyboard focus)
   is on it, over the page rather than pushing it. Touch screens and phones get a row of tabs instead. */
.console-top .inner { max-width: none; padding-left: 16px; padding-right: 16px; }
.console-shell { display: flex; min-height: calc(100vh - 61px); }
.console-rail { width: 60px; flex-shrink: 0; position: relative; z-index: 30; }
.console-nav {
  position: sticky; top: 0; height: calc(100vh - 61px); width: 60px; overflow: hidden; background: var(--surface);
  border-right: 1px solid var(--border); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; transition: width .16s ease, box-shadow .16s ease;
}
.console-nav:hover, .console-nav:focus-within { width: 232px; box-shadow: 8px 0 30px rgba(0,0,0,.12); }
.console-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--text-secondary); text-decoration: none; white-space: nowrap; font-size: 14px; }
.console-nav a:hover { background: var(--border); color: var(--text-primary); }
.console-nav a[aria-current="page"] { background: var(--series-1-wash); color: var(--accent); font-weight: 600; }
.console-nav .nav-icon { width: 24px; flex-shrink: 0; text-align: center; font-size: 17px; line-height: 1; }
.console-nav .nav-label { opacity: 0; transition: opacity .12s ease; }
.console-nav:hover .nav-label, .console-nav:focus-within .nav-label { opacity: 1; }
.console-main { flex: 1; min-width: 0; padding: 24px clamp(16px, 3vw, 40px) 40px; max-width: 1180px; align-self: flex-start; align-content: start; }
@media (prefers-reduced-motion: reduce) { .console-nav, .console-nav .nav-label { transition: none; } }
@media (hover: none), (max-width: 760px) {
  .console-shell { display: block; }
  .console-rail { width: auto; }
  .console-nav, .console-nav:hover, .console-nav:focus-within {
    position: static; height: auto; width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); box-shadow: none;
  }
  .console-nav .nav-label { opacity: 1; }
  .console-nav .nav-icon { display: none; }
  .console-main { padding: 16px; }
}
/* The Emulator: the "Viewing as" bar under the top bar, and Kontour below it in a frame. */
.console-main.emu-mode { max-width: none; padding: 0; display: flex; flex-direction: column; height: calc(100vh - 61px); align-self: stretch; position: sticky; top: 0; }
.emu-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.emu-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.emu-bar select { width: auto; max-width: 100%; padding: 6px 10px; font-size: 14px; }
.emu-manage { margin-left: auto; }
.emu-frame { flex: 1; width: 100%; border: 0; background: var(--page); }
@media (hover: none), (max-width: 760px) { .console-main.emu-mode { height: calc(100vh - 110px); } .emu-manage { margin-left: 0; } }
