/* Styles of the gabrielepunk_77 panel: light theme by default, grayscale dark theme
   (automatic from the system, or forced with <html data-theme="light|dark">). */

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #e9e9ec;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #8b8b94;
  --primary: #18181b;
  --primary-hover: #2e2e33;
  --on-primary: #fafafa;
  --ring: rgba(24, 24, 27, .14);
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --blue: #2563eb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 30px -14px rgba(0, 0, 0, .16);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .3);
  --console-bg: #111113;
  --console-text: #e4e4e7;
  --console-dim: #8b8b94;
  --scroll-thumb: #cdcdd2;
  --scroll-thumb-hover: #a8a8b0;
  --radius: 14px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.3, 1.4, .5, 1);
  --radius-sm: 9px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --surface: #121212;
    --surface-2: #191919;
    --surface-3: #232323;
    --border: #242424;
    --border-strong: #333333;
    --text: #ededed;
    --text-2: #a1a1a1;
    --text-3: #6b6b6b;
    --primary: #ededed;
    --primary-hover: #ffffff;
    --on-primary: #0a0a0a;
    --ring: rgba(237, 237, 237, .16);
    --green: #22c55e;
    --amber: #f59e0b;
    --red: #ef4444;
    --blue: #60a5fa;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .8);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .9);
    --console-bg: #070707;
    --console-text: #d4d4d4;
    --console-dim: #6b6b6b;
    --scroll-thumb: #3a3a3a;
    --scroll-thumb-hover: #525252;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #121212;
  --surface-2: #191919;
  --surface-3: #232323;
  --border: #242424;
  --border-strong: #333333;
  --text: #ededed;
  --text-2: #a1a1a1;
  --text-3: #6b6b6b;
  --primary: #ededed;
  --primary-hover: #ffffff;
  --on-primary: #0a0a0a;
  --ring: rgba(237, 237, 237, .16);
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #60a5fa;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .8);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .9);
  --console-bg: #070707;
  --console-text: #d4d4d4;
  --console-dim: #6b6b6b;
  --scroll-thumb: #3a3a3a;
  --scroll-thumb-hover: #525252;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

/* Scrollbars drawn like the rest of the panel (thin, rounded, theme colours) instead of the browser's own:
   scrollbar-color/-width for Firefox and current Chrome, ::-webkit-scrollbar for Safari and older Chrome. */
:root { scrollbar-color: var(--scroll-thumb) transparent; }
* { scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 99px; background: var(--scroll-thumb) padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } /* no font inflation on phones in landscape */
button, a, .nav-item { -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--ring); }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; row-gap: 6px; }
.stack { display: grid; gap: 6px; align-content: center; } /* title line + text line under it */
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

svg.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 15px !important; height: 15px !important; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-weight: 500; white-space: nowrap; cursor: pointer; text-decoration: none; /* also for <a class="btn"> */
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, color .15s, opacity .15s, transform .15s var(--spring);
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:focus-visible, .input:focus-visible, .nav-item:focus-visible, .icon-btn:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--ring);
}
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 9%, var(--surface)); border-color: color-mix(in srgb, var(--red) 35%, var(--border)); }
.btn-solid-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-solid-danger:hover { background: color-mix(in srgb, var(--red) 85%, #000); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn.loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-3) var(--text-3) var(--text-3) transparent;
  animation: spin .7s linear infinite;
}
.btn-primary.loading::after { border-color: var(--on-primary) var(--on-primary) var(--on-primary) transparent; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: 0; border-radius: 9px; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }

/* ------------------------------------------------------------------ form controls */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: var(--border-strong); }
.input:focus { border-color: var(--text-3); }
input[type="number"].input { appearance: textfield; -moz-appearance: textfield; }
input[type="number"].input::-webkit-inner-spin-button, input[type="number"].input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
select.input { padding-right: 32px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon > .input { padding-left: 36px; }
.input-icon > .icon-btn { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); }
.input-icon > .input:has(+ .icon-btn) { padding-right: 38px; } /* the text never goes under the eye button */

.switch { position: relative; display: inline-flex; flex: none; width: 38px; height: 22px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3);
  border: 1px solid var(--border-strong); transition: background .2s, border-color .2s;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .3s var(--spring), background .2s;
}
.switch input:checked + span { background: var(--primary); border-color: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--on-primary); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.switch input:disabled + span { opacity: .4; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; }
.check > input[type="checkbox"] {
  appearance: none; position: relative; flex: none; width: 18px; height: 18px; margin: 0; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface);
  transition: background .15s, border-color .15s;
}
.check > input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
.check > input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 5px; top: 1.5px; width: 5px; height: 10px;
  border: solid var(--on-primary); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.check > input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.check > input[type="checkbox"]:disabled { cursor: default; opacity: .5; }
.check:has(> input:disabled) { cursor: default; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text-2); cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background .2s, color .15s, box-shadow .2s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ cards, badges, bars */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-header { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h2 { flex: 1; }
.card-note { padding: 12px 20px 0; } /* a short note right under a card header */
.card-body { padding: 20px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge .icon { width: 12px; height: 12px; }
.badge.green { color: var(--green); background: color-mix(in srgb, var(--green) 10%, transparent); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.badge.amber { color: var(--amber); background: color-mix(in srgb, var(--amber) 10%, transparent); border-color: color-mix(in srgb, var(--amber) 25%, transparent); }
.badge.red { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.badge.blue { color: var(--blue); background: color-mix(in srgb, var(--blue) 10%, transparent); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.badge.solid { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--text); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar.warn > span { background: var(--amber); }
.bar.danger > span { background: var(--red); }

.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 13px;
}
.notice .icon { margin-top: 1px; }
.notice.amber { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 30%, transparent); background: color-mix(in srgb, var(--amber) 8%, transparent); }
.notice.red { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); background: color-mix(in srgb, var(--red) 8%, transparent); }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  overflow: hidden; background: var(--surface-3); color: var(--text-2); font-weight: 600; font-size: 13px;
  text-transform: uppercase; user-select: none; box-shadow: inset 0 0 0 1px var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.square { border-radius: 8px; image-rendering: pixelated; }
.avatar.xl { width: 96px; height: 96px; font-size: 34px; }

.empty { display: grid; place-items: center; gap: 10px; padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty .icon { width: 32px; height: 32px; stroke-width: 1.5; }

.skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }

/* ------------------------------------------------------------------ status */
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; }
.dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: currentColor; opacity: 0; }
[data-state="online"] .dot { background: var(--green); color: var(--green); }
[data-state="starting"] .dot, [data-state="stopping"] .dot { background: var(--amber); color: var(--amber); }
[data-state="offline"] .dot { background: var(--red); color: var(--red); }
[data-state="online"] .dot::after, [data-state="starting"] .dot::after, [data-state="stopping"] .dot::after { animation: pulse 2s ease-out infinite; }
.status-pill { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ app layout */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 6px;
  padding: 16px 12px; border-right: 1px solid var(--border); background: var(--surface);
}
.brand { /* a link to the Home page */
  display: flex; align-items: center; gap: 11px; padding: 6px 8px; margin-bottom: 10px; border-radius: 12px;
  color: inherit; text-decoration: none; transition: background .15s;
}
.brand:hover { background: var(--surface-2); }
.brand:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.brand img { width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 0 0 1px var(--border); }
.brand strong { display: block; font-size: 14px; letter-spacing: -.01em; }
.brand small { display: block; font-size: 12px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-label { padding: 14px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.nav-item {
  display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: 9px;
  color: var(--text-2); text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav-item.active .icon { color: var(--text); }
.me {
  display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 6px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2);
}
.me .who { flex: 1; min-width: 0; }
.me .who strong { display: block; font-size: 13px; }
.me .who small { display: block; font-size: 12px; color: var(--text-3); }
.me a { text-decoration: none; display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.nav-badge { /* requests waiting for a decision */
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--primary); color: var(--on-primary); font: 700 10.5px/18px var(--font); text-align: center;
  animation: pop .25s var(--spring);
}

/* ------------------------------------------------------------------ home */
.home-hero { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; gap: 28px; padding: 32px; }
.home-hero-art { /* soft light in two corners and a slow sheen passing over the card */
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(620px 260px at 0% 0%, color-mix(in srgb, var(--text) 7%, transparent), transparent 70%),
    radial-gradient(520px 280px at 100% 100%, color-mix(in srgb, var(--text) 5%, transparent), transparent 70%);
}
.home-hero-art::after {
  content: ""; position: absolute; inset: 0; background-size: 260% 100%;
  background-image: linear-gradient(115deg, transparent 42%, color-mix(in srgb, var(--text) 6%, transparent) 50%, transparent 58%);
  animation: sheen 10s ease-in-out infinite;
}
.home-icon {
  width: 112px; height: 112px; flex: none; border-radius: 24px;
  box-shadow: 0 0 0 1px var(--border), var(--shadow-lg); animation: float 6s ease-in-out infinite;
}
.home-hero-text { display: grid; gap: 10px; min-width: 0; }
.home-greeting { color: var(--text-2); font-weight: 500; }
.home-title { font-size: clamp(26px, 4.2vw, 38px); line-height: 1.1; letter-spacing: -.03em; }
.home-chips { gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 500;
}
.home-actions { margin-top: 6px; }
.home-actions .btn .icon-sm { transition: transform .25s var(--spring); }
.home-actions .btn:hover .icon-sm { transform: translateX(3px); }

.home-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.home-tile {
  display: grid; grid-template-rows: auto 1fr auto; gap: 14px; padding: 18px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); color: inherit; font: inherit;
  text-align: left; text-decoration: none; cursor: pointer; animation: rise .45s var(--ease-out) backwards;
  transition: transform .25s var(--spring), border-color .2s, box-shadow .25s;
}
.home-tile:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.home-tile:active { transform: translateY(-1px) scale(.99); }
.home-tile:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.home-tile-icon {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); transition: transform .3s var(--spring), background .2s;
}
.home-tile:hover .home-tile-icon { transform: scale(1.08) rotate(-4deg); background: var(--surface-3); }
.home-tile-text { display: grid; gap: 4px; align-content: start; }
.home-tile-text strong { font-size: 15px; }
.home-tile-text span { color: var(--text-2); font-size: 13px; line-height: 1.45; }
.home-tile-foot { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.home-tile-info { flex: 1; color: var(--text-3); font-size: 12px; font-weight: 500; }
.home-tile-arrow { color: var(--text-3); transition: transform .25s var(--spring), color .2s; }
.home-tile:hover .home-tile-arrow { transform: translateX(4px); color: var(--text); }
.home-grid > :nth-child(2) { animation-delay: 40ms; }
.home-grid > :nth-child(3) { animation-delay: 80ms; }
.home-grid > :nth-child(4) { animation-delay: 120ms; }
.home-grid > :nth-child(5) { animation-delay: 160ms; }
.home-grid > :nth-child(6) { animation-delay: 200ms; }
.home-grid > :nth-child(7) { animation-delay: 240ms; }
.home-grid > :nth-child(8) { animation-delay: 280ms; }
.home-grid > :nth-child(9) { animation-delay: 320ms; }
.home-grid > :nth-child(n+10) { animation-delay: 360ms; }
@container (max-width: 620px) {
  .home-hero { flex-direction: column; align-items: flex-start; gap: 18px; padding: 22px; }
  .home-icon { width: 84px; height: 84px; border-radius: 18px; }
}

/* ------------------------------------------------------------------ requests and devices */
.request { display: grid; gap: 12px; padding: 18px; }
.request-reason {
  margin: 0; padding: 8px 12px; border-left: 3px solid var(--border-strong); border-radius: 0 8px 8px 0;
  background: var(--surface-2); color: var(--text-2); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.request-row, .session-row { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.session-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.request-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.request-head:hover { background: var(--surface-3); }
.request-head:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ring); }
.request-head .chevron { flex: none; color: var(--text-3); transition: transform .2s var(--ease-out); }
.request-row.open .request-head .chevron { transform: rotate(90deg); }
.request-details { display: grid; gap: 8px; padding: 2px 12px 12px 36px; font-size: 13px; } /* slides open (slide() in app.js) */
.grid.cards { align-items: start; } /* a short card (e.g. the admin's) is not stretched to its neighbour's height */
.session-row > .icon { color: var(--text-3); flex: none; }
.session-row strong { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-width: 0; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  height: calc(64px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 28px 0; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px);
}
.topbar h1 { font-size: 17px; flex: 1; }
.menu-btn { display: none; }
.page {
  width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px; display: grid; gap: 20px; align-content: start;
  grid-template-columns: minmax(0, 1fr); /* never wider than the window, whatever is inside */
  container-type: inline-size; /* the grids below follow the page width (with or without the side menu) */
}
.page > div:empty { display: none; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head > .grow { flex: 1 1 260px; }
.page-head > .input-icon, .row > .input-icon { width: 260px; }
.page-head .grow p { color: var(--text-2); margin-top: 4px; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ------------------------------------------------------------------ dashboard */
.hero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 20px; padding: 24px; flex-wrap: wrap; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: radial-gradient(600px 200px at 0% 0%, var(--surface-2), transparent 70%);
}
.hero > * { position: relative; }
.hero-icon { width: 64px; height: 64px; border-radius: 14px; box-shadow: 0 0 0 1px var(--border), var(--shadow); }
.hero-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-title h2 { font-size: 20px; }
.motd { margin-top: 6px; font-family: var(--mono); font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stat { padding: 18px 20px; display: grid; gap: 4px; position: relative; overflow: hidden; }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-left: 4px; }
.stat-sub { font-size: 12px; color: var(--text-3); }
.spark { width: 100%; height: 38px; margin-top: 6px; display: block; overflow: visible; }
.spark path.line { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark path.area { fill: var(--text); opacity: .07; stroke: none; }
.spark path.guide { fill: none; stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }

.resource { display: grid; gap: 8px; }
.resource + .resource { margin-top: 18px; }
.resource-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.resource-head span:first-of-type { flex: 1; color: var(--text-2); font-weight: 500; }
.resource-head b { font-weight: 600; font-variant-numeric: tabular-nums; }

.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.player-tile {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
}
.player-tile .avatar { width: 40px; height: 40px; border-radius: 8px; box-shadow: 0 0 0 1px var(--border-strong); }
.player-tile .stack { gap: 2px; min-width: 0; }
.player-tile strong { font-size: 14px; font-weight: 600; }
.player-tile small { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.player-tile .dot { width: 6px; height: 6px; background: var(--green); }
button.player-tile { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.player-tile.clickable {
  transition: border-color .2s, background .2s, transform .25s var(--spring), box-shadow .25s;
}
.player-tile.clickable:hover { border-color: var(--border-strong); background: var(--surface-3); transform: translateY(-2px); box-shadow: var(--shadow); }
.player-tile.clickable:active { transform: scale(.98); }
.player-tile.clickable:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.player-tile.loading { opacity: .6; cursor: progress; }
.tile-arrow { margin-left: auto; color: var(--text-3); transition: transform .25s var(--spring), color .2s; }
.player-tile.clickable:hover .tile-arrow { transform: translateX(3px); color: var(--text); }
.player-tile .stack { flex: 1; }
.empty.compact { padding: 22px 12px; gap: 8px; font-size: 13px; }
.empty.compact .icon { width: 26px; height: 26px; }

/* ------------------------------------------------------------------ console */
.console-card { display: flex; flex-direction: column; height: calc(100vh - 120px); height: calc(100dvh - 120px); min-height: 420px; overflow: hidden; }
.console {
  flex: 1; overflow: auto; padding: 14px 16px; margin: 0;
  background: var(--console-bg); color: var(--console-text);
  font: 12.5px/1.65 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.console { --scroll-thumb: #3f3f46; --scroll-thumb-hover: #52525b; scrollbar-color: var(--scroll-thumb) transparent; } /* always dark */
.console .line { display: block; }
.console .ts { color: var(--console-dim); }
.console .warn { color: #fbbf24; }
.console .error { color: #f87171; }
.console .sent { color: #a5b4fc; }
.console-input { display: flex; align-items: center; gap: 8px; padding: 10px; background: var(--console-bg); border-top: 1px solid #222; }
.console-input .prompt { color: var(--console-dim); font-family: var(--mono); padding-left: 8px; }
.console-input input {
  flex: 1; height: 36px; border: 0; outline: 0; background: transparent; color: var(--console-text); font: 13px var(--mono);
}
.console-input input::placeholder { color: #555; }
.console-input .btn { background: #1d1d1f; border-color: #2c2c2e; color: #e4e4e7; box-shadow: none; }
.console-input .btn:hover { background: #2a2a2d; }
.console-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); }

/* ------------------------------------------------------------------ tables and lists */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.card-header ~ .table-wrap { border-radius: 0 0 var(--radius) var(--radius); } /* under a header: square top corners */
.card-header ~ .table-wrap .table th { border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td:first-child { width: 100%; max-width: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.table .clickable { cursor: pointer; }
.table .when { white-space: nowrap; color: var(--text-2); }
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name-cell .icon { color: var(--text-3); }
.name-cell.dir .icon { color: var(--text); }

.breadcrumb { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 13.5px; }
.breadcrumb button { border: 0; background: none; padding: 4px 8px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 500; }
.breadcrumb button:hover { background: var(--surface-2); color: var(--text); }
.breadcrumb button:last-child { color: var(--text); }
.breadcrumb .icon { width: 14px; height: 14px; color: var(--text-3); }

.dropzone { position: relative; }
.dropzone.dragging::after {
  content: attr(data-label); position: absolute; inset: 8px; display: grid; place-items: center; z-index: 5;
  border: 2px dashed var(--text-3); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 88%, transparent);
  font-weight: 600; color: var(--text-2);
}

/* ------------------------------------------------------------------ plugins, users */
.plugin { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.plugin-head { display: flex; align-items: flex-start; gap: 12px; }
.plugin-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
.plugin-desc { color: var(--text-2); font-size: 13px; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.plugin-foot { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.plugin.disabled .plugin-head, .plugin.disabled .plugin-desc { opacity: .5; }

.user-card { display: grid; gap: 16px; padding: 18px; }

.temp-password-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.temp-password {
  flex: 1; min-width: 0; padding: 10px 14px; border-radius: 10px; border: 1px dashed var(--border-strong);
  background: var(--surface-2); color: var(--text); font: 600 17px var(--mono); letter-spacing: .04em; user-select: all; word-break: break-all;
}
.rights-editor { display: grid; gap: 12px; }
/* permissions: one collapsible box per area (rightsEditor() and the request dialog in app.js) */
.perm-areas { display: grid; gap: 6px; }
.perm-area { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.perm-area > summary {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 500; color: var(--text-2); user-select: none; transition: background .15s, color .15s;
}
.perm-area > summary::-webkit-details-marker { display: none; }
.perm-area > summary:hover { background: var(--surface-2); color: var(--text); }
.perm-area > summary:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ring); }
.perm-area .chevron { color: var(--text-3); transition: transform .2s var(--ease-out); }
.perm-area[open]:not(.closing) .chevron { transform: rotate(90deg); }
.perm-area { transition: border-color .2s; }
.perm-area[open]:not(.closing) { border-color: var(--border-strong); }
.perm-area[open] > summary { border-bottom: 1px solid var(--border); }
.perm-list { display: grid; gap: 2px; padding: 6px; } /* slides open (smoothDetails() in app.js) */
.check.perm { display: flex; gap: 10px; padding: 6px 8px; border-radius: 7px; }
.check.perm:hover { background: var(--surface-2); }
.check.perm.locked { color: var(--text-3); }
.check.perm.locked:hover { background: none; }
.check.perm > .icon { color: var(--text-3); flex: none; }
.perm-tools { display: flex; justify-content: flex-end; padding: 4px 2px 0; }
.rules-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.rules { display: grid; gap: 6px; }
.rule { display: flex; align-items: center; gap: 8px; }
.rule .icon { color: var(--text-3); }
.rule .input { height: 32px; }
.rule input.input { flex: 1; min-width: 0; }
.rule .select-btn { width: auto; flex: none; min-width: 150px; }
.rule.inherited { padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.prop-row { display: flex; align-items: center; gap: 16px; min-height: 58px; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.prop-row:last-child { border-bottom: 0; }
.prop-key { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; }
.prop-row .input { width: min(340px, 50%); height: 34px; }
.prop-row.changed .prop-key::after { content: " •"; color: var(--amber); }
.save-bar {
  position: sticky; bottom: 20px; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 18px;
  border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  box-shadow: var(--shadow-lg); animation: rise .2s ease-out;
}
.save-bar > .icon { color: var(--amber); }
.save-bar .btn { box-shadow: none; }

.log-tools .input-icon { min-width: 180px; }
.log-tools .select-btn { width: auto; min-width: 210px; max-width: 100%; }
.log-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.log-list { max-height: calc(100vh - 180px); overflow-y: auto; padding: 6px; }
.log-item { display: grid; gap: 2px; width: 100%; padding: 9px 12px; border: 0; border-radius: 9px; background: none; text-align: left; cursor: pointer; transition: background .15s, box-shadow .15s, transform .2s var(--spring); }
.log-item:active { transform: scale(.98); }
.log-item:hover { background: var(--surface-2); }
.log-item.active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.log-item strong { font-size: 13px; font-weight: 500; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-item small { color: var(--text-3); font-size: 12px; }
.log-view { height: calc(100vh - 180px); min-height: 360px; border-radius: var(--radius); }


.profile-avatar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ player sheet (inventory like in the game) */
.player-sheet { display: grid; gap: 18px; color: var(--text); --slot: 44px; }
.sheet-head { display: flex; align-items: center; gap: 14px; }
.sheet-avatar { width: 56px !important; height: 56px !important; border-radius: 12px !important; }
.stat-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.stat-chip b { font-size: 15px; font-variant-numeric: tabular-nums; }
.loc-card { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); min-width: 0; }
.loc-head { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.loc-head .icon-btn { margin: -6px -6px -6px 0; }
.loc-coords { font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.inv-section { display: grid; gap: 10px; }
.inv-section h3 { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.inventory { display: flex; flex-wrap: wrap; gap: 14px; }
.equipment { display: grid; grid-template-columns: var(--slot); gap: 4px; align-content: start; }
.equipment .offhand { margin-top: 8px; }
.inv-main { display: grid; gap: 10px; align-content: start; }
.slot-grid { display: grid; grid-template-columns: repeat(9, var(--slot)); gap: 4px; }
.slot {
  position: relative; display: grid; place-items: center; width: var(--slot); height: var(--slot);
  border-radius: 6px; background: var(--surface-3); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25);
  outline: none; transition: background .12s;
}
.slot[tabindex]:hover, .slot[tabindex]:focus-visible { background: var(--border-strong); }
.slot.selected { box-shadow: inset 0 0 0 2px var(--text-2); }
.slot.armor:empty::before, .slot.offhand:empty::before { content: ""; width: 40%; height: 40%; border-radius: 4px; border: 2px dashed var(--border-strong); }
.slot-icon { position: relative; width: 76%; height: 76%; }
.slot-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; image-rendering: pixelated; }
.slot-icon.foliage img:first-child { filter: sepia(1) saturate(3.2) hue-rotate(50deg) brightness(.82); }
.slot-head { width: 70% !important; height: 70% !important; border-radius: 3px !important; box-shadow: none !important; }
.slot-svg { width: 62% !important; height: 62% !important; color: var(--text-2); stroke-width: 1.8; }
.slot-fallback { font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; }
.slot-count {
  position: absolute; right: 3px; bottom: 1px; font: 700 12px/1 var(--mono); color: #fff;
  text-shadow: 1px 1px 0 #3f3f3f, -1px 0 0 rgba(0, 0, 0, .4); pointer-events: none;
}
.slot-durability { position: absolute; left: 12%; right: 12%; bottom: 3px; height: 3px; background: #000; border-radius: 1px; pointer-events: none; }
.slot-durability > span { display: block; height: 100%; border-radius: 1px; }
.slot.glint .slot-icon::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; border-radius: 2px;
  background: linear-gradient(115deg, transparent 30%, rgba(168, 85, 247, .55) 45%, transparent 60%) 0 0 / 250% 250%;
  animation: glint 3s linear infinite;
}
.item-tip {
  position: fixed; z-index: 300; display: grid; gap: 2px; max-width: 280px; padding: 8px 10px; pointer-events: none;
  border-radius: 8px; background: #160b22f2; border: 2px solid #2b0f5c; color: #f4f4f5; font-size: 13px; box-shadow: var(--shadow-lg);
}
.item-tip .custom { font-style: italic; color: #7dd3fc; }
.item-tip .ench { color: #c4b5fd; }
.item-tip .faint { color: #a1a1aa; }
.item-tip .tip-title { margin-top: 4px; color: #d4d4d8; font-weight: 600; }
.item-tip .tip-id { margin-top: 2px; color: #71717a; font: 11px var(--mono); }
.modal.large { width: min(920px, 100%); }
@keyframes glint { to { background-position: -250% -250%; } }

/* ------------------------------------------------------------------ quick messages (chat drawer) */
.chat-btn { position: relative; }
.chat-badge {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px;
  background: var(--primary); color: var(--on-primary); font: 700 10px/16px var(--font); text-align: center;
  box-shadow: 0 0 0 2px var(--bg); animation: pop .2s var(--spring);
}
.chat {
  position: fixed; z-index: 90; display: flex; flex-direction: column;
  background: var(--surface); box-shadow: var(--shadow-lg);
}
@media (min-width: 641px) { /* floating box under the top bar button (top/right set by chat.js) */
  .chat {
    top: 70px; right: 16px; width: 380px; height: min(560px, calc(100vh - 96px)); height: min(560px, calc(100dvh - 96px));
    border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
    transform-origin: top right; animation: chat-pop .18s var(--ease-out);
  }
}
@media (max-width: 640px) { /* phones: the whole screen, more room to read and type */
  .chat {
    left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-height, 100dvh); /* stays above the keyboard */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    animation: chat-up .25s var(--ease-out);
  }
  html:has(body > .chat:not([hidden])) { overflow: hidden; } /* nor the page behind the full-screen chat */
}
.chat-head { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--border); flex: none; }
.chat-head h2 { font-size: 15px; }
.chat-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.chat-person {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 12px;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .15s;
}
.chat-person:hover { background: var(--surface-2); }
.chat-person .stack { gap: 2px; min-width: 0; }
.chat-person strong { font-size: 14px; }
.chat-person .faint { font-size: 12.5px; }
.chat-meta { display: grid; justify-items: end; gap: 4px; flex: none; }
.chat-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--primary); color: var(--on-primary); font: 700 11px/20px var(--font); text-align: center; }
.chat-empty, .chat-note { margin: auto 0; text-align: center; color: var(--text-3); font-size: 13px; padding: 16px; }
.chat-note { margin: 8px 0 0; font-size: 12px; padding: 8px; }
.bubble {
  display: grid; gap: 2px; max-width: 80%; padding: 8px 12px; border-radius: 14px; font-size: 14px;
  white-space: pre-wrap; word-break: break-word; animation: rise .2s var(--ease-out);
}
.bubble small { font-size: 10.5px; opacity: .6; justify-self: end; }
.bubble.mine { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: var(--surface-3); color: var(--text); border-bottom-left-radius: 4px; }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--border); flex: none; }
.bubble[role="button"] { cursor: pointer; transition: filter .15s, transform .15s var(--spring); }
.bubble[role="button"]:hover { filter: brightness(1.08); }
.bubble[role="button"]:active { transform: scale(.98); }
.bubble[role="button"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.bubble.deleted { font-style: italic; opacity: .6; }
.bubble.deleted .icon { vertical-align: -2px; }
.chat-editbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0 16px; color: var(--text-2); font-size: 13px; flex: none; animation: rise .2s var(--ease-out); }
.chat-form .input { flex: 1; }
.chat-form .btn { flex: none; height: 38px; } /* as tall as a one-line text box, stays at the bottom when it grows */
.chat-input { min-height: 38px; max-height: 160px; padding: 8px 12px; line-height: 1.45; resize: none; overflow-y: auto; }
.chat-person.board-row { border: 1px dashed var(--border-strong); margin-bottom: 4px; }
.bubble-tag { font-size: 11.5px; font-style: normal; font-weight: 600; opacity: .75; }
/* Announcements: the picture at the bottom of the bubble, on its left (others) or on its right (your own),
   and the less rounded corner of the bubble towards it. */
.bubble-row { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; align-self: flex-start; }
.bubble-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble-row .bubble { max-width: none; min-width: 0; }
.bubble-row.theirs .bubble { border-radius: 14px 14px 14px 4px; }
.bubble-row.mine .bubble { border-radius: 14px 14px 4px 14px; }
.chat-avatar { width: 28px; height: 28px; font-size: 12px; flex: none; animation: rise .2s var(--ease-out); }
.bubble-row.more .chat-avatar { visibility: hidden; } /* only the last message of a run shows it; the space keeps them aligned */
.bubble-row.cont .bubble-tag { display: none; }
.bubble-row.theirs.cont .bubble { border-top-left-radius: 4px; }
.bubble-row.mine.cont .bubble { border-top-right-radius: 4px; }
.chat-body > .cont { margin-top: -3px; } /* a run reads as one block */
.chat-readonly { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 14px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 13px; flex: none; }
@keyframes chat-pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
@keyframes chat-up { from { opacity: 0; transform: translateY(16px); } }

/* ------------------------------------------------------------------ guided tour (tour.js) */
.tour { position: fixed; inset: 0; z-index: 400; animation: fade .25s ease-out; }
.tour.closing { animation: fade-out .2s ease forwards; }
.tour-spot { /* the highlighted element: a hole in the dimmed page, sliding from step to step */
  position: absolute; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 2px var(--primary), 0 0 0 9999px rgba(0, 0, 0, .6);
  transition: top .35s var(--ease-out), left .35s var(--ease-out), width .35s var(--ease-out), height .35s var(--ease-out);
}
.tour-card {
  position: absolute; width: min(340px, calc(100vw - 24px)); display: grid; gap: 8px; padding: 18px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transition: top .35s var(--ease-out), left .35s var(--ease-out);
}
.tour-card.in > * { animation: rise .3s var(--ease-out) backwards; }
.tour-card h2 { font-size: 16px; }
.tour-card p { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.tour-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.tour-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { /* phones: the card sits at the bottom, the highlight stays visible above it */
  .tour-card { left: 12px !important; right: 12px; top: auto !important; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; }
  .tour-card.top { top: calc(12px + env(safe-area-inset-top)) !important; bottom: auto; }
}

/* ------------------------------------------------------------------ overlays */
.modal-backdrop {
  position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-height, 100dvh); /* above the keyboard */
  z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .45); backdrop-filter: blur(3px); animation: fade .15s ease-out;
}
.modal {
  width: min(460px, 100%); max-height: calc(100vh - 32px); max-height: calc(var(--vv-height, 100dvh) - 32px); display: flex; flex-direction: column;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.wide { width: min(1100px, 100%); height: calc(100vh - 32px); height: calc(var(--vv-height, 100dvh) - 32px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 0; }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-body { padding: 14px 20px 4px; display: grid; gap: 14px; overflow: auto; overscroll-behavior: contain; color: var(--text-2); }
.modal.wide .modal-body { flex: 1; padding-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 18px; }
.editor {
  width: 100%; height: 100%; min-height: 300px; resize: none; border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  background: var(--console-bg); color: var(--console-text); font: 12.5px/1.6 var(--mono); tab-size: 4; outline: none;
}

.dropdown { position: relative; }

/* drop-down lists drawn like the menus (selectMenu() in core.js), instead of the browser's own */
.select-btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.select-btn > .icon { flex: none; color: var(--text-3); transition: transform .2s var(--ease-out); }
.select-btn[aria-expanded="true"] { border-color: var(--text-3); }
.select-btn[aria-expanded="true"] > .icon { transform: rotate(180deg); }
.select-btn:disabled { cursor: default; opacity: .6; }
.menu {
  position: fixed; z-index: 150; min-width: 200px; padding: 5px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: pop .12s ease-out; max-height: min(60vh, 440px); overflow-y: auto;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px;
  border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left; font-size: 13.5px; color: var(--text);
}
.menu button:hover:not(:disabled) { background: var(--surface-2); }
.menu button:disabled { opacity: .45; cursor: not-allowed; }
.menu-note {
  display: flex; align-items: flex-start; gap: 8px; max-width: 260px; margin: 0 0 5px; padding: 8px 10px;
  border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; line-height: 1.4;
}
.menu-note .icon { flex: none; margin-top: 1px; }
.menu button.danger { color: var(--red); }
.menu button.active::after { content: "✓"; margin-left: auto; color: var(--text-2); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: slide .25s cubic-bezier(.2, .9, .3, 1.1);
}
.toast .icon { margin-top: 1px; }
.toast.success .icon { color: var(--green); }
.toast.error .icon { color: var(--red); }
.toast p { flex: 1; word-break: break-word; }
.toast small { display: block; color: var(--text-3); font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; margin-top: 2px; }
.toast { cursor: pointer; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .2s; }

/* ------------------------------------------------------------------ login */
.login-body {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; position: relative;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  overflow-x: hidden; /* vertical scrolling stays: with the keyboard open the form may not fit */
}
.login-body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 500px at 50% -10%, var(--surface-3), transparent 70%),
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
  opacity: .7;
}
.login-corner { position: fixed; top: calc(16px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); display: flex; gap: 6px; }
.login-card { width: min(400px, 100%); padding: 32px; border-radius: 20px; box-shadow: var(--shadow); animation: rise .35s ease-out; }
.login-logo { display: grid; justify-items: center; gap: 14px; margin-bottom: 26px; text-align: center; }
.login-logo img { width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 0 0 1px var(--border), var(--shadow); }
.login-logo h1 { font-size: 21px; }
.login-logo p { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.login-form { display: grid; gap: 14px; }
.form-error { min-height: 0; color: var(--red); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.form-error:empty { display: none; }
.login-foot { margin-top: 22px; text-align: center; color: var(--text-3); font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.login-foot.login-notice { margin-top: 6px; }
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.strength span { height: 4px; border-radius: 99px; background: var(--surface-3); transition: background .2s; }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--red); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--amber); }
.strength[data-score="3"] span:nth-child(-n+3) { background: var(--green); }
.strength[data-score="4"] span { background: var(--green); }

/* ------------------------------------------------------------------ Minecraft text colors (MOTD) */
.mc-0 { color: #000; } .mc-1 { color: #0000aa; } .mc-2 { color: #00aa00; } .mc-3 { color: #00aaaa; }
.mc-4 { color: #aa0000; } .mc-5 { color: #aa00aa; } .mc-6 { color: #ffaa00; } .mc-7 { color: #aaaaaa; }
.mc-8 { color: #555; } .mc-9 { color: #5555ff; } .mc-a { color: #55ff55; } .mc-b { color: #29b6c6; }
.mc-c { color: #ff5555; } .mc-d { color: #ff55ff; } .mc-e { color: #d9a400; } .mc-f { color: var(--text); }
.mc-l { font-weight: 700; } .mc-o { font-style: italic; } .mc-n { text-decoration: underline; } .mc-m { text-decoration: line-through; }
.mc-k { font-family: var(--mono); } /* random letters (app.js): same width for each */

/* ------------------------------------------------------------------ motion (subtle; off with "reduce motion") */
/* Page sections, and data replacing a loading placeholder (see clear() in core.js), come in one after another.
   "backwards": the animation does not keep overriding the element (hover effects) once it has ended. */
.page > *, .reveal, .reveal > .grid > *, .reveal.grid > *, .reveal tbody > tr { animation: rise .4s var(--ease-out) backwards; }
.page > :nth-child(2), .reveal:nth-child(2), .reveal > .grid > :nth-child(2), .reveal.grid > :nth-child(2), .reveal tbody > tr:nth-child(2) { animation-delay: 35ms; }
.page > :nth-child(3), .reveal:nth-child(3), .reveal > .grid > :nth-child(3), .reveal.grid > :nth-child(3), .reveal tbody > tr:nth-child(3) { animation-delay: 70ms; }
.page > :nth-child(4), .reveal:nth-child(4), .reveal > .grid > :nth-child(4), .reveal.grid > :nth-child(4), .reveal tbody > tr:nth-child(4) { animation-delay: 105ms; }
.page > :nth-child(5), .reveal:nth-child(5), .reveal > .grid > :nth-child(5), .reveal.grid > :nth-child(5), .reveal tbody > tr:nth-child(5) { animation-delay: 140ms; }
.page > :nth-child(6), .reveal:nth-child(6), .reveal > .grid > :nth-child(6), .reveal.grid > :nth-child(6), .reveal tbody > tr:nth-child(6) { animation-delay: 175ms; }
.page > :nth-child(7), .reveal:nth-child(7), .reveal > .grid > :nth-child(7), .reveal.grid > :nth-child(7), .reveal tbody > tr:nth-child(7) { animation-delay: 210ms; }
.page > :nth-child(8), .reveal:nth-child(8), .reveal > .grid > :nth-child(8), .reveal.grid > :nth-child(8), .reveal tbody > tr:nth-child(8) { animation-delay: 245ms; }
.page > :nth-child(9), .reveal:nth-child(9), .reveal > .grid > :nth-child(9), .reveal.grid > :nth-child(9), .reveal tbody > tr:nth-child(9) { animation-delay: 280ms; }
.page > :nth-child(10), .reveal:nth-child(10), .reveal > .grid > :nth-child(10), .reveal.grid > :nth-child(10), .reveal tbody > tr:nth-child(10) { animation-delay: 315ms; }
.page > :nth-child(11), .reveal:nth-child(11), .reveal > .grid > :nth-child(11), .reveal.grid > :nth-child(11), .reveal tbody > tr:nth-child(11) { animation-delay: 350ms; }
.page > :nth-child(12), .reveal:nth-child(12), .reveal > .grid > :nth-child(12), .reveal.grid > :nth-child(12), .reveal tbody > tr:nth-child(12) { animation-delay: 385ms; }
.page > :nth-child(n+13), .reveal tbody > tr:nth-child(n+13) { animation-delay: 420ms; }
.notice, .player-tile { animation: rise .3s var(--ease-out) backwards; }
.login-form:not([hidden]) { animation: rise .35s var(--ease-out) backwards; }
.login-logo img { animation: pop .5s var(--spring) backwards; }
.console .line.new { animation: line-in .35s var(--ease-out); }
.item-tip { animation: pop .12s ease-out; }
.menu { transform-origin: top right; }
.request, .request-row, .session-row { animation: rise .3s var(--ease-out) backwards; }
.page.no-anim *, .page.no-anim { animation: none !important; } /* the same page rebuilt after a change of rights */
.request-row:nth-child(2), .session-row:nth-child(2) { animation-delay: 40ms; }
.request-row:nth-child(3), .session-row:nth-child(3) { animation-delay: 80ms; }
.request-row:nth-child(4), .session-row:nth-child(4) { animation-delay: 120ms; }
.request-row:nth-child(n+5), .session-row:nth-child(n+5) { animation-delay: 160ms; }
.removing { animation: fade-out .2s ease forwards; pointer-events: none; }
.check.perm { transition: background .15s, color .15s; }
.log-view { transition: opacity .2s; }
.log-view.loading { opacity: .45; }
.menu button { transition: background .12s; }
.select-btn:hover { border-color: var(--border-strong); }
.request-head:active, .chat-person:active { transform: scale(.99); }
.request-head, .chat-person { transition: background .15s, transform .2s var(--spring); }
.temp-password-box, .request-reason { animation: rise .3s var(--ease-out) backwards; }
.app.nav-open::after { animation: fade .2s ease-out; }
.modal-backdrop.closing { animation: fade-out .16s ease forwards; pointer-events: none; }
.modal-backdrop.closing .modal { animation: pop-out .16s ease forwards; }

/* Small feedback on things you touch. */
.icon-btn { transition: background .15s, color .15s, transform .2s var(--spring); }
.icon-btn:active { transform: scale(.9); }
.nav-item { position: relative; }
.nav-item::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--text); transform: scaleY(0); transition: transform .3s var(--spring);
}
.nav-item.active::before { transform: scaleY(1); }
.nav-item .icon { transition: transform .25s var(--spring); }
.nav-item:hover .icon { transform: scale(1.1); }
.check > input[type="checkbox"]:checked::after { animation: check-pop .25s var(--spring); }
.stat, .plugin, .user-card, .loc-card { transition: border-color .25s; }
.stat:hover, .plugin:hover, .user-card:hover, .request:hover, .page > .grid > .card:hover { border-color: var(--border-strong); }
.request, .page > .grid > .card { transition: border-color .25s; }
.chip { transition: background-color .3s, color .3s, border-color .3s; }
.slot { transition: background .12s, transform .2s var(--spring); }
.slot[tabindex]:hover { transform: translateY(-2px); }
.hero-icon { transition: transform .4s var(--spring); }
.hero:hover .hero-icon { transform: rotate(-4deg) scale(1.05); }
.dot, .badge, .status-pill { transition: background-color .3s, color .3s, border-color .3s; }
.sheet-skeleton { height: 64px; }
.sheet-skeleton:last-child { height: 180px; }

/* Messages box: closing, view changes, list rows, edited and deleted bubbles, unread badge. */
.chat.closing { animation: chat-out .15s ease forwards; pointer-events: none; }
.chat-body.view-in > * { animation: rise .3s var(--ease-out) backwards; }
.chat-body.view-in > :nth-child(2) { animation-delay: 30ms; }
.chat-body.view-in > :nth-child(3) { animation-delay: 60ms; }
.chat-body.view-in > :nth-child(4) { animation-delay: 90ms; }
.chat-body.view-in > :nth-child(5) { animation-delay: 120ms; }
.chat-body.view-in > :nth-child(n+6) { animation-delay: 150ms; }
.bubble.changed, .bubble-row.changed .bubble { animation: flash .6s ease-out; }
.bubble.removing, .bubble-row.removing { animation: bubble-out .22s ease forwards; }
.chat-badge.bump { animation: pop .3s var(--spring); }
/* Login: shake on a wrong password. Dashboard: values that just changed. Plugins: enabling fades in. */
.login-card.shake { animation: shake .35s ease; }
.tick { animation: tick .45s var(--ease-out); }
.plugin .plugin-head, .plugin .plugin-desc { transition: opacity .3s; }
.chat-head > * { animation: fade .2s ease-out; }

/* Theme switch: colors cross-fade for a moment (class set by setTheme in core.js). */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
  transition: background-color .35s ease, border-color .35s ease, color .35s ease, fill .35s ease, box-shadow .35s ease !important;
}

/* ------------------------------------------------------------------ animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { transform: scale(.6); opacity: .5; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes sheen { 0% { background-position: 130% 0; } 60%, 100% { background-position: -130% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
@keyframes slide { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-out { to { opacity: 0; transform: scale(.97); } }
@keyframes line-in { from { opacity: 0; transform: translateX(-4px); } }
@keyframes check-pop { from { transform: rotate(45deg) scale(.4); opacity: 0; } }
@keyframes chat-out { to { opacity: 0; transform: translateY(-6px) scale(.98); } }
@keyframes bubble-out { to { opacity: 0; transform: scale(.9); max-height: 0; margin: 0; padding-top: 0; padding-bottom: 0; } }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--ring); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes tick { from { opacity: .35; transform: translateY(3px); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ responsive */
/* Grids by the width of the page itself: a narrow window with the side menu open counts as narrow. */
@container (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 820px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@container (max-width: 520px) { .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; width: min(280px, 85vw);
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
    overflow-y: auto; overscroll-behavior: contain; /* scrolls as a whole only if it really does not fit */
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  }
  .sidebar.dragging { transition: none; } /* follows the finger (see menuGestures in app.js) */
  html:has(.app.nav-open) { overflow: hidden; } /* the page behind the open menu does not scroll */
  .sidebar .nav { flex: none; overflow: visible; }
  .sidebar .me { margin-top: auto; }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .4); }
  .sidebar { height: 100vh; height: 100dvh; }
  .menu-btn { display: inline-grid; margin-left: -6px; }
  .topbar { padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); gap: 6px; }
  .topbar h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page {
    padding: 20px max(16px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    gap: 16px;
  }
  .input, .console-input input, .editor { font-size: 16px; } /* smaller text makes iOS zoom in on focus */
  .icon-btn.sm { width: 34px; height: 34px; }
  .card-header, .card-body, .card-pad { padding: 16px; }
  .table th, .table td { padding: 10px 12px; }
  .page-head > .input-icon, .row > .input-icon { width: 100%; }
  .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented button { flex: none; }
  .hero { padding: 18px; gap: 16px; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; }
  .console-card { height: calc(100vh - 104px); height: calc(100dvh - 104px - env(safe-area-inset-top)); min-height: 360px; }
  .log-view { height: 65vh; height: 65dvh; min-height: 300px; }
  .prop-row { padding: 10px 16px; }
  .save-bar { bottom: calc(12px + env(safe-area-inset-bottom)); padding: 10px 10px 10px 14px; gap: 8px; }
  .save-bar > .icon { display: none; }
  .toasts { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: auto; }
  .modal-head { padding: 16px 16px 0; }
  .player-sheet { --slot: min(44px, calc((100vw - 96px) / 9)); }  /* 9 slots fit the dialog width */
  .inventory { flex-direction: column; }
  .equipment { grid-template-columns: repeat(5, var(--slot)); }
  .equipment .offhand { margin: 0 0 0 8px; }
  .modal-body { padding: 12px 16px 4px; }
  .modal-foot { padding: 14px 16px 16px; }
  .grid-2, .log-layout { grid-template-columns: minmax(0, 1fr); }
  .log-list { max-height: 260px; }
  .hide-mobile { display: none !important; }
}
@media (max-width: 560px) {
  .grid-4, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .prop-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .prop-row .input { width: 100%; }
  .prop-row:has(> .switch) { flex-direction: row; align-items: center; } /* switches stay on the right */
  .login-corner { top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
  .hero-icon { width: 52px; height: 52px; }
  .login-card { padding: 24px; }
  .status-pill .label { display: none; }
}
@media (max-width: 360px) { /* very narrow phones */
  .topbar h1 { font-size: 15px; }
  .topbar { gap: 2px; }
  .page { gap: 14px; }
}
@media (max-height: 760px) { /* short screens: the whole menu fits without scrolling */
  .brand { padding: 2px 8px; margin-bottom: 6px; }
  .brand img { width: 32px; height: 32px; }
  .nav-label { padding: 10px 10px 4px; }
  .nav-item { height: 33px; }
  .me { padding: 8px; }
}
@media (max-height: 560px) { /* phones in landscape */
  .console-card { min-height: 240px; }
  .log-view { min-height: 200px; }
  .chat-head { height: 52px; }
  .nav-label { padding: 6px 10px 2px; }
  .nav-item { height: 30px; }
}
