:root {
  --dashboard-bg: #f3f5fa;
  --dashboard-sidebar: #587bad;
  --dashboard-sidebar-deep: #4b6d9f;
  --dashboard-sidebar-soft: #dce8f8;
  --dashboard-accent: #5b7fb5;
  --dashboard-accent-dark: #3f6195;
  --dashboard-ink: #253249;
  --dashboard-muted: #768399;
  --dashboard-border: #e2e7ef;
  --dashboard-panel: #ffffff;
  --dashboard-panel-soft: #f8fafc;
  --dashboard-success: #3e9b79;
  --dashboard-danger: #c65d66;
  --dashboard-focus: #2f75c8;
  --primary-color: var(--dashboard-accent);
  --primary-hover: var(--dashboard-accent-dark);
}

body.dashboard-page {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--dashboard-bg);
  color: var(--dashboard-ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.dashboard-page * { box-sizing: border-box; }
body.dashboard-page [hidden] { display: none !important; }

.dashboard-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.dashboard-sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  width: 80px;
  min-width: 80px;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  padding: 18px 10px 20px;
  background: linear-gradient(180deg, var(--dashboard-sidebar) 0%, var(--dashboard-sidebar-deep) 100%);
  color: #fff;
  box-shadow: 4px 0 18px rgba(42, 65, 99, 0.1);
}

.sidebar-brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 26px;
  text-align: center;
}

.sidebar-logo {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.08em;
}

.sidebar-brand-label {
  max-width: 62px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.dashboard-nav {
  display: flex;
  width: 100%;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dashboard-nav a {
  display: grid;
  width: 54px;
  min-height: 54px;
  place-items: center;
  gap: 3px;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.dashboard-nav a:hover,
.dashboard-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.dashboard-nav a:hover { transform: translateY(-1px); }

.sidebar-nav-icon {
  font-size: 1.22rem;
  line-height: 1;
}

.sidebar-nav-label {
  font-size: 0.58rem;
  font-weight: 700;
}

.sidebar-footer {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.dashboard-main {
  min-width: 0;
  flex: 1;
  padding: 28px 32px 42px;
}

.dashboard-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  max-width: 1260px;
  margin: 0 auto 24px;
}

body.unit-selection-page .dashboard-page-header { position: relative; }

body.unit-selection-page .dashboard-page-header {
  align-items: flex-start;
}

body.unit-selection-page .dashboard-page-copy {
  min-width: 0;
  padding-right: 260px;
}

body.unit-selection-page .dashboard-header-actions {
  position: absolute;
  top: 0;
  right: 0;
}

.dashboard-page-header h1,
.dashboard-page-header h2,
.dashboard-page-header p { margin-top: 0; }

.dashboard-page-header h1 {
  margin-bottom: 7px;
  color: var(--dashboard-ink);
  font-size: clamp(1.75rem, 3vw, 2.2rem);
  letter-spacing: -0.035em;
}

.dashboard-page-header p {
  margin-bottom: 0;
  color: var(--dashboard-muted);
  line-height: 1.6;
}

.dashboard-kicker,
.section-kicker {
  margin-bottom: 7px !important;
  color: var(--dashboard-accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--dashboard-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.dashboard-site-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dashboard-muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.dashboard-site-select {
  min-height: 40px;
  max-width: 240px;
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--dashboard-border);
  border-radius: 7px;
  outline: 0;
  background: #fff;
  color: var(--dashboard-ink);
  font: inherit;
  font-weight: 700;
}

.dashboard-site-select:focus-visible {
  border-color: var(--dashboard-focus);
  box-shadow: 0 0 0 3px rgba(47, 117, 200, 0.16);
}

.dashboard-profile {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--dashboard-sidebar-soft);
  color: var(--dashboard-accent-dark);
  font-weight: 800;
}

.dashboard-panel {
  min-width: 0;
  border: 1px solid var(--dashboard-border);
  border-radius: 10px;
  background: var(--dashboard-panel);
  box-shadow: 0 5px 18px rgba(49, 70, 101, 0.06);
}

.dashboard-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px 18px;
}

.dashboard-panel-heading h2,
.dashboard-panel-heading h3 {
  margin-bottom: 6px;
  color: var(--dashboard-ink);
  font-size: 1.15rem;
}

.dashboard-panel-heading p:not(.section-kicker) {
  margin-bottom: 0;
  color: var(--dashboard-muted);
  line-height: 1.55;
}

.dashboard-directory-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--dashboard-border);
}

.dashboard-directory-toolbar > .dashboard-unit-search { margin-top: 0; }

.dashboard-directory-toolbar > .status {
  max-width: 340px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--dashboard-border);
  border-radius: 7px;
  background: var(--dashboard-panel-soft);
  font-size: 0.82rem;
  line-height: 1.45;
}

.dashboard-unit-search {
  width: min(100%, 330px);
  min-width: 250px;
  margin-top: 1px;
}

.dashboard-search-field {
  display: flex;
  min-height: 42px;
  align-items: center;
  border: 1px solid var(--dashboard-border);
  border-radius: 7px;
  background: #fff;
  color: var(--dashboard-muted);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.dashboard-search-field:focus-within {
  border-color: var(--dashboard-focus);
  box-shadow: 0 0 0 3px rgba(47, 117, 200, 0.12);
}

.dashboard-search-icon {
  padding-left: 12px;
  color: var(--dashboard-accent);
  font-size: 1.35rem;
  line-height: 1;
}

.dashboard-search-field input {
  min-width: 0;
  flex: 1;
  height: 40px;
  padding: 8px 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--dashboard-ink);
  font: inherit;
}

.dashboard-search-field input::placeholder { color: #a3adbd; }

.dashboard-voice-button {
  display: grid;
  width: 38px;
  height: 38px;
  margin-right: 2px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--dashboard-accent-dark);
  cursor: pointer;
  font-size: 1rem;
}

.dashboard-voice-button:hover,
.dashboard-voice-button:focus-visible,
.dashboard-voice-button.is-listening {
  background: var(--dashboard-sidebar-soft);
}

.dashboard-voice-button.is-listening { color: var(--dashboard-danger); }

.dashboard-voice-button:focus-visible {
  outline: 3px solid rgba(47, 117, 200, 0.25);
  outline-offset: -2px;
}

.dashboard-search-hint {
  min-height: 18px;
  margin: 5px 0 0;
  color: var(--dashboard-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.dashboard-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dashboard-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 0 28px;
  border-bottom: 1px solid var(--dashboard-border);
}

.dashboard-tab {
  position: relative;
  padding: 15px 18px 13px;
  border: 0;
  background: transparent;
  color: var(--dashboard-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
}

.dashboard-tab.is-active {
  color: var(--dashboard-accent-dark);
}

.dashboard-tab.is-active::after {
  position: absolute;
  right: 13px;
  bottom: -1px;
  left: 13px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--dashboard-accent);
  content: "";
}

.dashboard-site-tree {
  min-width: 0;
  border-right: 1px solid var(--dashboard-border);
  background: #f7f9fc;
}

.dashboard-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--dashboard-border);
  color: var(--dashboard-ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.dashboard-tree-badge {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--dashboard-accent);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
}

.dashboard-tree-list {
  padding: 8px 0 16px;
}

.dashboard-tree-item {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-left: 3px solid transparent;
  color: var(--dashboard-muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.dashboard-tree-item.is-active {
  border-left-color: var(--dashboard-accent);
  background: var(--dashboard-sidebar-soft);
  color: var(--dashboard-accent-dark);
  font-weight: 800;
}

.dashboard-tree-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--dashboard-accent);
}

.dashboard-tree-count {
  margin-left: auto;
  color: var(--dashboard-muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.dashboard-empty-tree {
  padding: 16px 18px;
  color: var(--dashboard-muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.dashboard-selection-grid {
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
  width: min(100%, 1260px);
  min-height: 520px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--dashboard-border);
  border-radius: 10px;
  background: var(--dashboard-panel);
  box-shadow: 0 5px 18px rgba(49, 70, 101, 0.06);
}

body.unit-selection-page .dashboard-selection-grid {
  display: block;
  min-height: 0;
}

.dashboard-selection-column {
  min-width: 0;
  padding: 0 0 24px;
}

.dashboard-selection-column > .dashboard-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.dashboard-selection-content {
  padding: 0 28px;
}

.dashboard-selection-content h2 {
  margin: 0 0 7px;
  color: var(--dashboard-ink);
  font-size: 1.2rem;
}

body.dashboard-page .button,
body.dashboard-page .btn,
body.dashboard-page .primary-btn,
body.dashboard-page .secondary-btn {
  border-radius: 7px;
  font: inherit;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

body.dashboard-page .button {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--dashboard-border);
  background: #fff;
  color: var(--dashboard-accent-dark);
}

body.dashboard-page .button:hover,
body.dashboard-page .button:focus-visible {
  border-color: var(--dashboard-accent);
  background: var(--dashboard-sidebar-soft);
}

body.dashboard-page .button:focus-visible,
body.dashboard-page .unit-button:focus-visible,
body.dashboard-page .btn:focus-visible,
body.dashboard-page .primary-btn:focus-visible,
body.dashboard-page .secondary-btn:focus-visible,
body.dashboard-page a:focus-visible,
body.dashboard-page summary:focus-visible {
  outline: 3px solid rgba(47, 117, 200, 0.32);
  outline-offset: 3px;
}

body.dashboard-page .card {
  border: 1px solid var(--dashboard-border);
  border-radius: 10px;
  background: var(--dashboard-panel);
  box-shadow: 0 5px 18px rgba(49, 70, 101, 0.06);
  backdrop-filter: none;
}

body.dashboard-page .status,
body.dashboard-page .status-notice {
  color: var(--dashboard-muted);
}

body.dashboard-page .status.error,
body.dashboard-page .status-notice.error { color: var(--dashboard-danger); }

body.dashboard-page .status-notice {
  border: 1px solid var(--dashboard-border);
  border-radius: 7px;
  background: var(--dashboard-panel-soft);
}

body.dashboard-page .status-notice.success {
  border-color: rgba(62, 155, 121, 0.24);
  background: rgba(62, 155, 121, 0.1);
  color: var(--dashboard-success);
}

body.dashboard-page .status-notice.error {
  border-color: rgba(198, 93, 102, 0.24);
  background: rgba(198, 93, 102, 0.08);
}

body.dashboard-page .unit-list {
  gap: 12px;
}

body.unit-selection-page .unit-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.dashboard-page .unit-button {
  display: grid;
  min-height: 0;
  aspect-ratio: 1 / 1;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  background: #fff;
  color: var(--dashboard-ink);
  box-shadow: 0 2px 7px rgba(49, 70, 101, 0.04);
}

body.dashboard-page .unit-button:hover {
  border-color: var(--dashboard-accent);
  background: #f7faff;
  transform: translateY(-1px);
}

body.dashboard-page .unit-icon,
body.dashboard-page .unit-call-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
}

body.dashboard-page .unit-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--dashboard-sidebar-soft);
  color: var(--dashboard-accent-dark);
}

body.dashboard-page .unit-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

body.dashboard-page .unit-copy {
  min-width: 0;
}

body.dashboard-page .unit-call-icon {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(47, 117, 200, 0.18);
  border-radius: 50%;
  background: rgba(91, 127, 181, 0.1);
  color: var(--dashboard-accent);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

body.dashboard-page .unit-call-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

body.dashboard-page .unit-button:hover .unit-call-icon,
body.dashboard-page .unit-button:focus-visible .unit-call-icon {
  background: var(--dashboard-accent);
  color: #fff;
  transform: scale(1.04);
}

body.dashboard-page .unit-name { color: var(--dashboard-ink); }

body.dashboard-page .log-box {
  max-height: 330px;
  border: 1px solid var(--dashboard-border);
  border-radius: 7px;
  background: #f7f9fc;
  color: #52627a;
}

.dashboard-data-panel {
  margin: 18px 28px 0;
  overflow: hidden;
}

.dashboard-debug-summary {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
}

.dashboard-debug-summary::-webkit-details-marker { display: none; }

.dashboard-debug-summary::after {
  flex: 0 0 auto;
  color: var(--dashboard-accent);
  content: "+";
  font-size: 1.35rem;
  font-weight: 400;
}

.dashboard-data-panel[open] .dashboard-debug-summary::after { content: "−"; }

.dashboard-debug-summary .section-kicker {
  display: block;
  margin-bottom: 4px !important;
}

.dashboard-debug-summary strong {
  display: block;
  color: var(--dashboard-ink);
  font-size: 1rem;
}

.dashboard-debug-toggle {
  margin-left: auto;
  color: var(--dashboard-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.dashboard-debug-content {
  padding: 0 20px 20px;
}

.dashboard-debug-content > p {
  margin: 0 0 12px;
  color: var(--dashboard-muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.dashboard-entry-content {
  width: min(100%, 780px);
  margin: 0 auto;
}

.dashboard-entry-content .card { margin-bottom: 18px; }

body.dashboard-page .form-group label,
body.dashboard-page .form-control,
body.dashboard-page input,
body.dashboard-page select {
  color: var(--dashboard-ink);
}

body.dashboard-page .form-group label {
  font-weight: 700;
}

body.dashboard-page .form-control,
body.dashboard-page input {
  border: 1px solid var(--dashboard-border);
  border-radius: 7px;
  background: #fff;
  color: var(--dashboard-ink);
  font-family: inherit;
  letter-spacing: normal;
  text-align: left;
}

body.dashboard-page .form-control:focus,
body.dashboard-page input:focus {
  border-color: var(--dashboard-focus);
  box-shadow: 0 0 0 3px rgba(47, 117, 200, 0.14);
}

body.dashboard-page .btn-primary,
body.dashboard-page .primary-btn {
  background: var(--dashboard-accent);
  color: #fff;
}

body.dashboard-page .btn-primary:hover,
body.dashboard-page .primary-btn:hover {
  background: var(--dashboard-accent-dark);
}

body.dashboard-page .secondary-btn {
  border: 1px solid var(--dashboard-border);
  background: #fff;
  color: var(--dashboard-accent-dark);
}

body.dashboard-page .secondary-btn:hover {
  border-color: var(--dashboard-accent);
  background: var(--dashboard-sidebar-soft);
  color: var(--dashboard-accent-dark);
}

/* Waiting page: keep the video surface full-screen, but use the dashboard shell while idle. */
body.dashboard-page.waiting-page {
  display: block;
  min-height: 100vh;
  height: auto;
  overflow-y: auto;
}

body.dashboard-page.waiting-page #app.dashboard-shell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  max-width: none;
  min-height: 100vh;
  height: auto;
  padding: 0;
}

body.dashboard-page.waiting-page .waiting-main {
  position: relative;
  min-width: 0;
  flex: 1;
  padding: 28px 32px 42px;
}

body.dashboard-page .status-bar {
  position: static;
  width: fit-content;
  margin: 0 0 10px auto;
  transform: none;
  border: 1px solid var(--dashboard-border);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(49, 70, 101, 0.06);
}

body.dashboard-page .status-indicator { color: var(--dashboard-muted); }
body.dashboard-page .status-dot { background: #aab5c4; }
body.dashboard-page .status-dot.connected { background: var(--dashboard-success); box-shadow: 0 0 8px rgba(62, 155, 121, 0.25); }
body.dashboard-page .status-dot.disconnected { background: var(--dashboard-danger); }

body.dashboard-page #waiting-screen {
  width: min(100%, 720px);
  min-height: 470px;
  margin: 20px auto 0;
  padding: 34px clamp(22px, 5vw, 58px);
  text-align: center;
}

body.dashboard-page #waiting-screen h2 {
  color: var(--dashboard-ink);
}

body.dashboard-page #target-user { color: var(--dashboard-accent-dark) !important; }

body.dashboard-page .pulse-ring {
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
  background: var(--dashboard-accent);
  box-shadow: 0 0 0 0 rgba(91, 127, 181, 0.4);
}

body.dashboard-page .token-display {
  margin: 24px 0 18px;
  border: 1px dashed #c7d2e2;
  border-radius: 9px;
  background: var(--dashboard-panel-soft);
}

body.dashboard-page .token-label { color: var(--dashboard-muted); }
body.dashboard-page #my-token { color: var(--dashboard-accent-dark); }

body.dashboard-page .call-details {
  border-color: var(--dashboard-border);
  border-radius: 8px;
  background: var(--dashboard-panel-soft);
}

body.dashboard-page .call-details summary { color: var(--dashboard-ink); }
body.dashboard-page .call-details-list div { background: #fff; }
body.dashboard-page .call-details-list dt { color: var(--dashboard-muted); }
body.dashboard-page .call-details-list dd { color: var(--dashboard-ink); }

body.dashboard-page.waiting-page .call-debug {
  margin-top: 24px;
}

body.dashboard-page.waiting-page .call-debug .token-display {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 0 16px 16px;
  padding: 18px 12px;
}

body.dashboard-page.waiting-page .call-debug #my-token {
  max-width: 100%;
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

body.dashboard-page .guest-url-row input { min-width: 0; }
body.dashboard-page .copy-btn { border-radius: 7px; background: var(--dashboard-accent); }

@media (max-width: 960px) {
  .dashboard-main,
  body.dashboard-page.waiting-page .waiting-main { padding: 24px 22px 34px; }
  .dashboard-selection-grid { grid-template-columns: minmax(180px, 210px) minmax(0, 1fr); }
  .dashboard-selection-content { padding-inline: 22px; }
  .dashboard-tabs { padding-inline: 22px; }
  .dashboard-data-panel { margin-inline: 22px; }
}

@media (max-width: 760px) {
  /* Match the waiting-page override so its desktop flex row cannot squeeze mobile content. */
  .dashboard-shell,
  body.dashboard-page.waiting-page #app.dashboard-shell { display: block; }
  .dashboard-sidebar {
    position: static;
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: auto;
    flex-direction: row;
    justify-content: space-between;
    padding: 10px 14px;
  }
  .sidebar-brand { display: flex; align-items: center; gap: 9px; margin: 0; }
  .sidebar-logo { width: 34px; height: 34px; border-width: 2px; font-size: 1rem; }
  .sidebar-brand-label { max-width: none; font-size: 0.68rem; }
  .dashboard-nav { flex: 0 1 auto; flex-direction: row; gap: 4px; }
  .dashboard-nav a { width: 42px; min-height: 42px; border-radius: 10px; }
  .sidebar-nav-label { display: none; }
  .sidebar-nav-icon { font-size: 1.05rem; }
  .sidebar-footer { display: none; }
  .dashboard-main,
  body.dashboard-page.waiting-page .waiting-main { padding: 22px 14px 30px; }
  .dashboard-page-header { flex-wrap: wrap; margin-bottom: 18px; }
  .dashboard-header-actions { width: 100%; justify-content: space-between; }
  .dashboard-selection-grid { display: block; min-height: 0; }
  .dashboard-site-tree { border-right: 0; border-bottom: 1px solid var(--dashboard-border); }
  .dashboard-tree-list { display: flex; max-width: 100%; gap: 8px; overflow-x: auto; padding: 8px 12px 12px; }
  .dashboard-tree-item { min-width: 170px; min-height: 44px; border-left: 0; border-bottom: 3px solid transparent; border-radius: 7px; background: #fff; }
  .dashboard-tree-item.is-active { border-bottom-color: var(--dashboard-accent); border-left: 0; }
  .dashboard-selection-content { padding-inline: 14px; }
  .dashboard-tabs { padding-inline: 14px; overflow-x: auto; }
  .dashboard-tab { white-space: nowrap; }
  .dashboard-panel-heading { padding-inline: 18px; }
  .dashboard-data-panel { margin-inline: 14px; }
  body.dashboard-page .unit-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.unit-selection-page .unit-button {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    padding: clamp(8px, 2vw, 12px);
  }
  body.unit-selection-page .unit-icon {
    width: clamp(28px, 8vw, 34px);
    height: clamp(28px, 8vw, 34px);
  }
  body.unit-selection-page .unit-copy {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: center;
    text-align: center;
  }
  body.unit-selection-page .unit-call-icon {
    grid-column: 2;
    grid-row: 1;
    width: clamp(32px, 9vw, 38px);
    height: clamp(32px, 9vw, 38px);
    justify-self: end;
  }
  body.unit-selection-page .unit-name {
    font-size: clamp(0.88rem, 3.8vw, 1rem);
    overflow-wrap: anywhere;
  }
  body.unit-selection-page .dashboard-sidebar { display: none; }
  body.unit-selection-page .dashboard-main { padding-top: 24px; }
  body.unit-selection-page .dashboard-page-header { padding-top: 0; }
  body.unit-selection-page .dashboard-page-copy { padding-right: 0; }
  body.unit-selection-page .dashboard-page-header.has-site-selector {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(145px, 42%);
    align-items: start;
    gap: 16px;
  }
  body.unit-selection-page .dashboard-header-actions {
    top: 0;
    right: 0;
    width: 100%;
    justify-content: flex-end;
  }
  body.unit-selection-page .dashboard-page-header.has-site-selector .dashboard-header-actions {
    position: static;
  }
  body.unit-selection-page .dashboard-page-header.has-site-selector .dashboard-site-selector {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }
  body.unit-selection-page .dashboard-panel-heading { flex-direction: column; }
  body.unit-selection-page .dashboard-directory-toolbar {
    flex-direction: column;
    gap: 4px;
    padding: 18px;
  }
  body.unit-selection-page .dashboard-unit-search {
    width: 100%;
    min-width: 0;
  }
  body.unit-selection-page .dashboard-directory-toolbar > .status {
    width: 100%;
    max-width: none;
  }
  body.unit-selection-page .dashboard-selection-content { padding-inline: 18px; }
  body.unit-selection-page .dashboard-tabs { padding-inline: 18px; }
  body.unit-selection-page .dashboard-data-panel { margin-inline: 0; }
}

@media (orientation: landscape) {
  body.unit-selection-page .unit-list {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media (max-width: 460px) {
  .dashboard-page-header h1 { font-size: 1.55rem; }
  .dashboard-page-header p { font-size: 0.88rem; }
  body.dashboard-page #waiting-screen { min-height: 0; padding: 28px 16px; }
  body.dashboard-page .call-details-list { grid-template-columns: 1fr; }
  body.dashboard-page .guest-url-row { flex-direction: column; }
  body.dashboard-page .guest-url-row button { width: 100%; }
  body.unit-selection-page .dashboard-header-actions { justify-content: flex-end; }
  body.unit-selection-page .dashboard-site-selector { min-width: 0; flex: 1; }
  body.unit-selection-page .dashboard-site-select { width: 100%; max-width: none; }
  body.unit-selection-page .dashboard-profile { display: none; }
  body.unit-selection-page .dashboard-directory-toolbar { padding: 16px; }
  body.unit-selection-page .dashboard-debug-summary { padding-inline: 16px; }
  body.unit-selection-page .dashboard-debug-content { padding-inline: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-nav a,
  body.dashboard-page .button,
  body.dashboard-page .btn,
  body.dashboard-page .primary-btn,
  body.dashboard-page .secondary-btn,
  body.dashboard-page .unit-button { transition: none; }
  body.dashboard-page .pulse-ring,
  body.dashboard-page .pulse-ring::before,
  body.dashboard-page .pulse-ring::after { animation: none; }
}
