/* NearMyDesk — design system (see docs/DESIGN_SYSTEM.md). */

:root {
  /* Surfaces */
  --bg-0: #0a0b0d;
  --bg-1: #121316;
  --bg-2: #181a1e;
  --bg-3: #22252a;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Text */
  --fg: #ececef;
  --fg-dim: #9a9da3;
  --fg-mute: #8b8f96; /* 4.5:1 minimum on the dark surfaces */
  --fg-faint: #4a4d52;

  /* Accent — orange, rare and precious */
  --orange: #ff8a3d;
  --orange-hover: #ff9a55;
  --orange-strong: #ff7a1f;
  --orange-08: rgba(255, 138, 61, 0.08);
  --orange-12: rgba(255, 138, 61, 0.12);
  --orange-16: rgba(255, 138, 61, 0.16);
  --orange-24: rgba(255, 138, 61, 0.24);
  --orange-40: rgba(255, 138, 61, 0.4);
  --orange-60: rgba(255, 138, 61, 0.6);

  /* Status */
  --green: #3ddc84;
  --yellow: #f5a623;
  --red: #ff5a5a;
  --red-strong: #ff3b3b;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 11px;
  --radius-xl: 14px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-pop: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-toolbar: 0 12px 40px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);

  /* Type */
  --font-ui: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'Cascadia Code', monospace;

  /* Compatibility alias used by the fullscreen frame indicator */
  --accent: var(--orange);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  background: var(--bg-0);
  color: var(--fg);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
}

::selection { background: var(--orange-24); color: var(--fg); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg-0);
}
::-webkit-scrollbar-thumb:hover { background: #2e323a; }

.view { height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }
.muted { color: var(--fg-dim); }
.error { color: var(--red); min-height: 1.2em; font-size: 12px; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
code { font-family: var(--font-mono); }

/* --- Login ------------------------------------------------------------ */
#view-login { align-items: center; justify-content: center; }
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card h1 { text-align: center; margin-bottom: 4px; }

/* Login hero — mark stacked above the wordmark with a subtle orange glow
   in the background. Matches the kit's logo-demo.html "login mock". */
.login-hero { align-items: center; position: relative; overflow: hidden; }
.login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 300px at 50% 35%, rgba(255, 138, 61, 0.06), transparent 60%);
  pointer-events: none;
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero-mark { display: block; }
.login-hero-sub {
  font-size: 12px;
  color: var(--fg-dim);
  text-align: center;
  margin-bottom: 4px;
}
.login-hero input,
.login-hero button { width: 100%; }

/* Second login step (mfa.js). */
.mfa-title { font-size: 16px; font-weight: 600; color: var(--fg); }
.mfa-qr { background: #fff; border-radius: 8px; padding: 6px; }
.mfa-secret {
  font: 500 13px var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--fg);
  user-select: all;
  text-align: center;
  word-spacing: 0.2em;
}
.mfa-code { text-align: center; font: 500 20px var(--font-mono); letter-spacing: 0.3em; }

.security-dialog {
  margin: auto;
  width: min(460px, calc(100vw - 32px));
  color: var(--fg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.security-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.passkey-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.passkey-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.passkey-empty { color: var(--fg-dim); font-size: 13px; justify-content: center !important; }
.security-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Admin pill displayed inside the topbar lockup, next to the wordmark. */
.admin-pill {
  font: 500 10px var(--font-mono);
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  margin-left: 8px;
}

/* --- Inputs & selects ------------------------------------------------- */
input[type='text'],
input[type='password'],
input[type='search'],
select {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: var(--fg);
  font: 400 13px var(--font-ui);
}
input::placeholder { color: var(--fg-mute); }
input:focus,
select:focus {
  outline: 0;
  border-color: var(--orange-60);
  background: var(--bg-2);
  box-shadow: 0 0 0 3px var(--orange-12);
}
select { cursor: pointer; }
select:disabled { opacity: 0.5; cursor: not-allowed; }
.bar-select { max-width: 190px; }

/* --- Buttons ---------------------------------------------------------- */
button {
  appearance: none;
  background: var(--orange);
  color: #1a0f06;
  border: 1px solid var(--orange);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font: 600 13px var(--font-ui);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover { background: var(--orange-hover); border-color: var(--orange-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:disabled:hover { background: var(--orange); border-color: var(--orange); }

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-weight: 500;
}
button.ghost:hover {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}

.danger {
  background: transparent;
  border: 1px solid rgba(255, 90, 90, 0.3);
  color: var(--red);
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
}
.danger:hover { background: rgba(255, 90, 90, 0.08); border-color: var(--red); }

/* --- Top bar ---------------------------------------------------------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
}
.bar h1 { font-size: 16px; }
.bar-right { display: flex; align-items: center; gap: 12px; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-dim); }
.btn-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font: 500 13px var(--font-ui);
}
.btn-link:hover { color: var(--fg); border-color: var(--border-strong); }

/* --- Agent list ------------------------------------------------------- */
.agent-list { list-style: none; padding: 20px; overflow-y: auto; }
.agent-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 10px;
}
.agent-name { font-weight: 600; display: flex; align-items: center; }
.agent-meta { font-size: 12px; color: var(--fg-dim); font-family: var(--font-mono); margin-top: 3px; }
.agent-busy { font-size: 12px; color: var(--orange); margin-top: 3px; }
.agent-actions { display: flex; align-items: center; gap: 14px; }
.agent-adapt { white-space: nowrap; cursor: pointer; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; }
.dot.online { background: var(--green); box-shadow: 0 0 6px rgba(61, 220, 132, 0.7); }
.dot.offline { background: var(--fg-faint); }

/* --- Tabs ------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; }
.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-dim);
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font: 500 13px var(--font-ui);
}
.tab:hover { background: rgba(255, 255, 255, 0.04); color: var(--fg); border-color: transparent; }
.tab.active {
  background: var(--orange-12);
  border-color: var(--orange-40);
  color: var(--orange);
}

/* --- Admin layout ----------------------------------------------------- */
.admin-body { padding: 20px; overflow-y: auto; }
.panel { max-width: 1000px; }

.inline-form { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.inline-form input { flex: 1; min-width: 160px; }

.banner {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--fg-dim);
  overflow-wrap: anywhere;
}
.banner b { color: var(--fg); }
.banner code {
  color: var(--orange);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* --- Tables ----------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
th {
  background: var(--bg-2);
  color: var(--fg-mute);
  font: 500 11.5px var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
td .ghost, td .danger { white-space: nowrap; }
.empty-row { color: var(--fg-mute); }

/* --- Filter bar ------------------------------------------------------- */
.filter-bar { display: flex; align-items: center; gap: 8px; margin: 16px 0; }
.filter-bar input[type='search'] { min-width: 240px; }
.filter-bar .muted { margin-left: auto; font-size: 12px; font-family: var(--font-mono); }

/* --- Access / role boxes --------------------------------------------- */
.access-box {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
}
.access-box h3 { margin: 0 0 4px; }
.access-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 16px;
}
.access-item { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* --- Custom checkboxes ------------------------------------------------ */
input[type='checkbox'] {
  appearance: none;
  width: 16px;
  height: 16px;
  flex: none;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  border-radius: var(--radius-xs);
  cursor: pointer;
  position: relative;
}
input[type='checkbox']:checked { background: var(--orange); border-color: var(--orange); }
input[type='checkbox']:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 1.75px solid #1a0f06;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
}

/* --- Floating overlay toolbar (client) ------------------------------- */
.overlay {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  user-select: none;
  font-size: 13px;
  opacity: 1;
  transition: opacity 0.15s ease;
}
.overlay.idle { opacity: 0.32; transition: opacity 0.6s ease; }

.overlay-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: rgba(18, 19, 22, 0.78);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-toolbar);
}

.ov-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--fg-dim);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.ov-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--fg); border-color: transparent; }
.ov-btn svg { display: block; }
.ov-move { cursor: move; color: var(--fg-mute); }
.ov-danger { color: var(--red); }
.ov-danger:hover { background: rgba(255, 90, 90, 0.1); color: var(--red); }

.overlay-tools { display: flex; align-items: center; gap: 4px; }
.overlay-screens { display: flex; align-items: center; gap: 4px; }

.ov-tool.active,
.ov-screen.active {
  background: var(--orange-12);
  border-color: var(--orange-40);
  color: var(--orange);
}
.ov-tool.active:hover,
.ov-screen.active:hover {
  background: var(--orange-16);
  border-color: var(--orange-60);
  color: var(--orange);
}

#btn-fullscreen .fs-exit { display: none; }
#btn-fullscreen.is-fs .fs-enter { display: none; }
#btn-fullscreen.is-fs .fs-exit { display: block; }

.ov-toggle svg { transition: transform 0.18s ease; }
.ov-toggle.expanded svg { transform: rotate(180deg); }

.ov-status {
  padding: 0 8px;
  color: var(--fg-dim);
  font-size: 12px;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Latency badge — mono value + status dot */
.latency-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: 34px;
  white-space: nowrap;
}
.latency-badge-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-faint);
  flex: none;
}
.stat-dot.good { background: var(--green); box-shadow: 0 0 6px rgba(61, 220, 132, 0.7); }
.stat-dot.fair { background: var(--yellow); box-shadow: 0 0 6px rgba(245, 166, 35, 0.7); }
.stat-dot.poor { background: var(--red); box-shadow: 0 0 6px rgba(255, 90, 90, 0.7); }

/* --- Overlay dropdown menu ------------------------------------------- */
.overlay-menu {
  margin-top: 8px;
  width: 264px;
  background: rgba(20, 22, 26, 0.96);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}

.menu-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-dim);
  border-bottom: 1px solid var(--border);
}
.menu-back {
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.menu-item,
.menu-opt {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--fg);
  font: 400 13px var(--font-ui);
  text-align: left;
  cursor: pointer;
}
.menu-list { padding: 6px; }
.menu-page .menu-list { padding: 6px; }
.menu-item:hover,
.menu-opt:hover { background: rgba(255, 255, 255, 0.04); }
.menu-opt.active { background: var(--orange-12); color: var(--orange); }
.menu-danger { color: var(--red); }
.menu-opt .opt-sub { color: var(--fg-mute); font-size: 11.5px; }
.menu-opt.active .opt-sub { color: var(--orange); opacity: 0.7; }
.chev { color: var(--fg-mute); }

/* --- Remote session --------------------------------------------------- */
.status { font-size: 13px; color: var(--fg-dim); }
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  position: relative;
}
#remote-video {
  /* Fill the window both ways: a small or downscaled stream is enlarged
     too. contain keeps the ratio; input.js maps clicks to the real image. */
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: default;
  touch-action: none;
}
#input-surface {
  position: absolute;
  inset: 0;
  cursor: default;
  touch-action: none;
}
#input-surface.cursor-hidden { cursor: none !important; }
.stage:fullscreen { width: 100vw; height: 100vh; }

#remote-frame {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  display: none;
}
.stage:fullscreen #remote-frame {
  display: block;
  box-shadow: inset 0 0 0 3px var(--frame-color, var(--orange));
}
#remote-frame.off { display: none !important; }

/* --- Stream-stall overlay --------------------------------------------- */
/* Shown by app.js when the watchdog detects no decoded video frames for a
   few seconds — typical of an agent capture/encoder freeze. */
.stall-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.stall-overlay.hidden { display: none; }
.stall-card {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 18px 24px;
  text-align: center;
  min-width: 240px;
}
.stall-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--orange);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.stall-sub {
  font-size: 12px;
  color: var(--fg-dim);
  font-family: var(--font-mono);
}
.stall-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--fg);
}
.stall-hint.hidden { display: none; }
.session-notice {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  pointer-events: auto;
  cursor: pointer;
  user-select: text;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 10px 16px;
  font-size: 12px;
  color: var(--fg);
}
.session-notice.hidden { display: none; }

/* --- Border-colour swatch picker ------------------------------------- */
.color-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
.color-grid.disabled { opacity: 0.4; pointer-events: none; }
.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background-clip: padding-box;
  transition: transform 0.12s ease;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active {
  border-color: var(--fg);
  box-shadow: 0 0 0 2px var(--bg-0);
}

/* Version footer and agent update badges */
.version-footer { font-size: 11px; color: var(--fg-dim); font-family: var(--font-mono); margin: 16px 20px; }
.update-badge { display: inline-block; font-size: 11px; font-family: var(--font-ui); padding: 1px 6px; border-radius: 4px; margin-left: 4px; border: 1px solid currentColor; }
.update-badge.ok { color: var(--green); }
.update-badge.stale { color: var(--orange); }
.update-badge.unknown { color: var(--fg-dim); }
.admin-body .version-footer { margin: 0 0 12px; }

/* --- Connection overlay (until the first frame, and on link loss) ----- */
.session-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 11, 13, 0.82);
  z-index: 55;
}
.session-overlay.hidden { display: none; }
.session-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 24px 32px;
  min-width: 280px;
  max-width: min(440px, 90vw);
  text-align: center;
}
#session-overlay-text { font-size: 14px; color: var(--fg); line-height: 1.4; }
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--orange-16);
  border-top-color: var(--orange);
  animation: rf-spin 0.9s linear infinite;
}
@keyframes rf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.5s; }
}

/* --- Message on the machine list (why the last session ended) -------- */
.message-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 20px 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 90, 90, 0.4);
  background: rgba(255, 90, 90, 0.08);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.45;
}
.message-banner.info { border-color: var(--border-strong); background: var(--bg-2); }
.message-banner > span { flex: 1; }
.message-banner > button { padding: 2px 8px; min-width: 32px; min-height: 32px; }

/* --- Accessibility ------------------------------------------------------ */
/* Keyboard focus is always visible (mouse clicks do not show it). */
button:focus-visible,
a:focus-visible,
input[type='checkbox']:focus-visible,
input[type='range']:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}
/* Comfortable click targets, also on touch screens. */
button, .btn-link { min-height: 32px; }
.danger { min-height: 32px; }
input[type='checkbox'] { width: 16px; height: 16px; accent-color: var(--orange); cursor: pointer; }
.toggle, .access-item { min-height: 32px; }
.dot.offline { background: var(--fg-mute); }

/* --- Narrow screens (phone, half-width window) ------------------------- */
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .bar-right { flex-wrap: wrap; gap: 8px; }
  .tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tab { flex: none; }
  .admin-body { padding: 14px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar input[type='search'] { min-width: 0; flex: 1 1 100%; }
  .filter-bar .muted { margin-left: 0; }
  .inline-form input, .inline-form select { flex: 1 1 100%; }
  /* Wide tables scroll sideways instead of squeezing every column. */
  table { display: block; overflow-x: auto; white-space: nowrap; }
  th, td { padding: 10px 12px; }
  .agent-list { padding: 14px; }
  .agent-list li { flex-direction: column; align-items: stretch; gap: 12px; }
  .agent-actions { justify-content: space-between; }
  .message-banner { margin: 14px 14px 0; }
}

/* --- Language switch -------------------------------------------------- */
.lang-switch { font: 600 12px var(--font-mono); letter-spacing: 0.04em; padding: 6px 10px; }
.lang-switch-row { display: flex; justify-content: center; width: 100%; }
.login-hero .lang-switch-row button { width: auto; }
