:root {
  --bg: #0d1117;
  --bg-muted: #121826;
  --surface: rgba(16, 22, 34, 0.86);
  --surface-strong: rgba(18, 24, 39, 0.96);
  --surface-muted: #141b29;
  --surface-dark: #090c12;
  --surface-dark-soft: #171d2b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #edf2f8;
  --text-muted: #aab5c7;
  --text-soft: #7f8aa3;
  --heading: #ffffff;
  --primary: #ff7a45;
  --primary-strong: #ff9b73;
  --accent: #34d399;
  --accent-soft: rgba(52, 211, 153, 0.14);
  --success-bg: #e8f7ef;
  --success-text: #1d7a47;
  --warning-bg: #fff1cc;
  --warning-text: #9a6700;
  --info-bg: #e7f4f2;
  --info-text: #0d6b57;
  --danger-bg: #fdecec;
  --danger-text: #b42318;
  --neutral-bg: rgba(255, 255, 255, 0.08);
  --neutral-text: #d7dfef;
  --shadow-lg: 0 34px 90px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 22px 52px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 12px 28px rgba(0, 0, 0, 0.24);
  --radius-2xl: 32px;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
  min-height: 100%;
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--text);
  font-family: "Aptos", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 69, 0.18), transparent 18%),
    radial-gradient(circle at top right, rgba(52, 211, 153, 0.12), transparent 16%),
    radial-gradient(circle at 50% 120%, rgba(59, 130, 246, 0.12), transparent 28%),
    linear-gradient(180deg, #090b10 0%, #0d1117 42%, #121826 100%);
}

body::-webkit-scrollbar,
.table-shell::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

body::-webkit-scrollbar-track,
.table-shell::-webkit-scrollbar-track {
  background: transparent;
}

body::-webkit-scrollbar-thumb,
.table-shell::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(184, 198, 219, 0.22);
  background-clip: content-box;
}

body::-webkit-scrollbar-thumb:hover,
.table-shell::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 122, 69, 0.44);
  background-clip: content-box;
}

button,
input,
select {
  font: inherit;
}

.shell-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 12, 18, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand h1 {
  margin: 0;
  color: var(--heading);
  font-size: 1.5rem;
  line-height: 1.15;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger-text);
  font-weight: 700;
}

.login-panel .button {
  width: 100%;
}

.backdrop-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(88px);
  opacity: 0.34;
}

.backdrop-orb-left {
  width: 320px;
  height: 320px;
  top: -90px;
  left: -80px;
  background: rgba(255, 122, 69, 0.22);
}

.backdrop-orb-right {
  width: 360px;
  height: 360px;
  top: 120px;
  right: -120px;
  background: rgba(52, 211, 153, 0.18);
}

.backdrop-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent 58%);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1640px;
  margin: 0 auto;
  padding: 24px 26px 40px;
}

.app-frame {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.shell-nav {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid var(--border);
  background: rgba(9, 12, 18, 0.9);
  box-shadow: var(--shadow-lg);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-brand strong {
  display: block;
  color: #fff;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.version-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ff8a57, #e05a28);
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.05em;
  box-shadow: 0 14px 28px rgba(255, 122, 69, 0.3);
}

.nav-stack {
  display: grid;
  gap: 12px;
}

.nav-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.nav-card-primary {
  background:
    radial-gradient(circle at top right, rgba(52, 211, 153, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(31, 41, 55, 0.96), rgba(17, 24, 39, 0.96));
}

.nav-card strong,
.nav-card p,
.nav-label,
.nav-pill {
  color: #fff;
}

.nav-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.45;
}

.nav-label {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
}

.nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.nav-pill.is-active {
  background: linear-gradient(180deg, #ff8a57, #e05a28);
  color: #fff;
}

.dashboard-workspace {
  display: none;
}

.dashboard-workspace.is-active {
  display: block;
}

.nav-actions {
  display: grid;
  gap: 10px;
}

.shell-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 3vw, 3.8rem);
  line-height: 0.96;
  color: var(--heading);
  letter-spacing: -0.045em;
  font-weight: 750;
  font-family: Georgia, "Times New Roman", serif;
}

h2 {
  color: var(--heading);
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.hero,
.toolbar,
.panel,
.stat-card,
.device-card {
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-md);
}

.hero {
  border-radius: var(--radius-2xl);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(226, 110, 57, 0.18), transparent 24%),
    radial-gradient(circle at bottom left, rgba(15, 118, 110, 0.16), transparent 24%),
    linear-gradient(135deg, #1b1d22 0%, #20242c 55%, #181a1f 100%);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 40px 90px rgba(17, 19, 23, 0.24);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), rgba(226, 110, 57, 0.65), transparent);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 120px;
  background:
    linear-gradient(135deg, rgba(202, 98, 53, 0.12), transparent 55%),
    linear-gradient(225deg, rgba(20, 96, 90, 0.08), transparent 52%);
  pointer-events: none;
}

.hero-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  align-items: stretch;
  gap: 24px;
  margin-bottom: 14px;
  padding: 28px 28px 26px;
}

.hero-copy {
  max-width: 900px;
  display: grid;
  gap: 16px;
}

.eyebrow {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 800;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-status-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-narrative {
  max-width: 70ch;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.subtitle,
.panel-copy {
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 72ch;
  overflow-wrap: anywhere;
}

.panel-copy-tight {
  margin-bottom: 12px;
}

.hero .subtitle {
  color: rgba(255, 255, 255, 0.74);
  font-size: 1.02rem;
  max-width: 60ch;
}

.hero h1,
.hero h2,
.hero strong,
.hero .build-chip,
.hero .count-pill,
.hero .user-pill {
  color: #fff;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.hero-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hero-insight {
  display: grid;
  gap: 8px;
  min-height: 148px;
  padding: 20px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.hero-insight-primary {
  grid-column: 1 / -1;
  background:
    radial-gradient(circle at top right, rgba(226, 110, 57, 0.18), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06)),
    var(--surface);
}

.hero-insight-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
}

.hero-insight-value {
  color: #fff;
  font-size: clamp(1.6rem, 2.5vw, 2.7rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.hero-insight-note {
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.45;
}

.build-chip,
.count-pill,
.badge,
.user-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.count-pill-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.count-pill-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.build-chip,
.count-pill,
.user-pill,
.badge-neutral,
.badge-idle {
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.build-chip {
  border: 1px solid rgba(202, 98, 53, 0.16);
  background: rgba(202, 98, 53, 0.09);
  color: var(--primary-strong);
}

.hero .build-chip,
.hero .count-pill,
.hero .user-pill {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.badge-online,
.badge-ready {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-queued {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-preparing {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-failed,
.badge-offline {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.rack-overview-panel {
  margin-bottom: 14px;
}

.rack-overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.rack-overview-card {
  display: grid;
  gap: 10px;
  min-height: 146px;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(24, 31, 46, 0.96), rgba(14, 19, 29, 0.94)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.rack-overview-card.tone-success {
  border-color: rgba(52, 211, 153, 0.22);
  background:
    linear-gradient(180deg, rgba(19, 52, 44, 0.96), rgba(14, 19, 29, 0.94)),
    var(--surface);
}

.rack-overview-card.tone-warning {
  border-color: rgba(245, 158, 11, 0.24);
  background:
    linear-gradient(180deg, rgba(58, 39, 11, 0.94), rgba(14, 19, 29, 0.94)),
    var(--surface);
}

.rack-overview-card.tone-danger {
  border-color: rgba(248, 113, 113, 0.24);
  background:
    linear-gradient(180deg, rgba(62, 23, 31, 0.94), rgba(14, 19, 29, 0.94)),
    var(--surface);
}

.rack-overview-card.tone-info {
  border-color: rgba(59, 130, 246, 0.22);
  background:
    linear-gradient(180deg, rgba(20, 34, 58, 0.94), rgba(14, 19, 29, 0.94)),
    var(--surface);
}

.rack-overview-label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 700;
}

.rack-overview-value {
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: var(--heading);
}

.rack-overview-note {
  color: var(--text-muted);
  line-height: 1.45;
}

.stat-card {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 18px 18px 20px;
  border-radius: 26px;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.3);
}

.stat-card span {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.stat-card strong {
  color: var(--heading);
  font-size: 2.15rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.tone-success {
  background: linear-gradient(180deg, rgba(20, 54, 46, 0.96), rgba(17, 24, 39, 0.96));
}

.tone-warning {
  background: linear-gradient(180deg, rgba(62, 41, 11, 0.96), rgba(17, 24, 39, 0.96));
}

.tone-info {
  background: linear-gradient(180deg, rgba(18, 39, 68, 0.96), rgba(17, 24, 39, 0.96));
}

.tone-danger {
  background: linear-gradient(180deg, rgba(68, 24, 32, 0.96), rgba(17, 24, 39, 0.96));
}

.tone-neutral {
  background: linear-gradient(180deg, rgba(25, 31, 45, 0.96), rgba(17, 24, 39, 0.96));
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 26px;
  position: sticky;
  top: 12px;
  z-index: 24;
  background: rgba(15, 20, 31, 0.84);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

.context-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 24px;
  background: rgba(15, 20, 31, 0.84);
}

.mission-bar {
  position: relative;
  overflow: hidden;
}

.mission-bar::after {
  content: "";
  position: absolute;
  inset: auto -80px -80px auto;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(20, 96, 90, 0.1), transparent 68%);
  pointer-events: none;
}

.context-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.context-label {
  color: var(--text-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
}

.context-copy strong {
  color: var(--heading);
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  min-width: 0;
  overflow-wrap: anywhere;
}

.context-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.context-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.quick-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 24px;
  background: rgba(15, 20, 31, 0.84);
}

.quick-actions-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.quick-actions-copy strong {
  color: var(--heading);
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  min-width: 0;
  overflow-wrap: anywhere;
}

.quick-actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.quick-action-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  max-width: 100%;
  white-space: normal;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.search-field,
.select-field {
  display: grid;
  gap: 8px;
}

.field-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 700;
}

.search-field input,
.select-field select,
.select-field input {
  min-width: 192px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.search-field input:focus,
.select-field select:focus,
.select-field input:focus {
  outline: none;
  border-color: rgba(202, 98, 53, 0.32);
  box-shadow: 0 0 0 4px rgba(202, 98, 53, 0.10);
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 600;
}

.view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.view-toggle-button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
}

.view-toggle-button.is-active {
  background: linear-gradient(180deg, #ff8a57, #e05a28);
  color: #fff;
  box-shadow: 0 12px 24px rgba(255, 122, 69, 0.28);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(340px, 0.78fr);
  gap: 18px;
  align-items: start;
}

.shell.table-mode .dashboard-layout {
  grid-template-columns: 1fr;
}

.shell.table-mode .main-column {
  order: 1;
}

.shell.table-mode .side-column {
  order: 2;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.main-column,
.side-column {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.panel {
  padding: 20px;
  border-radius: 26px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-header > div {
  min-width: 0;
}

.button {
  min-height: 44px;
  padding: 0 15px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.54;
  cursor: not-allowed;
}

.button-primary {
  color: #fff;
  background: linear-gradient(180deg, #ff8a57, #e05a28);
  box-shadow: 0 14px 28px rgba(255, 122, 69, 0.28);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: var(--border);
}

.button-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.44);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow-lg);
}

.editor-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.editor-form input,
.editor-form select {
  min-width: 0;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

.editor-form input:focus,
.editor-form select:focus {
  outline: none;
  border-color: rgba(202, 98, 53, 0.32);
  box-shadow: 0 0 0 4px rgba(202, 98, 53, 0.10);
}

.editor-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.queue-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.queue-overview-card,
.queue-item,
.activity-item,
.empty-state {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
}

.queue-overview-card {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.queue-overview-card span,
.queue-overview-card small,
.queue-item small,
.activity-item small {
  color: var(--text-muted);
}

.queue-overview-card strong {
  color: var(--heading);
  font-size: 1.05rem;
}

.queue-progress,
.prep-progress {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.18);
}

.queue-progress {
  margin-top: 6px;
}

.prep-progress {
  margin-top: 8px;
}

.prep-progress-compact {
  height: 7px;
  margin-top: 6px;
}

.queue-progress-bar,
.prep-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ca6235 0%, #d78649 44%, #f0c17c 100%);
  box-shadow: 0 0 18px rgba(202, 98, 53, 0.22);
  transition: width 220ms ease;
}

.device-card.is-preparing .prep-progress-bar,
.table-row.prep-preparing .prep-progress-bar,
.queue-progress-bar {
  animation: prepBarShift 1.5s linear infinite;
}

.routing-paths {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.route-chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.route-chip-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.queue-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.queue-item,
.activity-item,
.empty-state {
  padding: 13px 14px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.activity-item strong,
.queue-item strong {
  display: block;
  color: var(--heading);
  margin-bottom: 4px;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.device-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 24%),
    radial-gradient(circle at bottom left, rgba(255, 122, 69, 0.1), transparent 22%),
    linear-gradient(180deg, rgba(18, 24, 39, 0.98), rgba(13, 17, 23, 0.98));
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  min-width: 0;
  overflow: visible;
}

.device-card::before {
  content: "";
  display: block;
  height: 2px;
  margin: -18px -18px 2px;
  background: linear-gradient(90deg, rgba(202, 98, 53, 0.24), rgba(202, 98, 53, 0.76), rgba(20, 96, 90, 0.22));
}

.device-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.3);
}

.device-card.is-preparing {
  border-color: rgba(202, 98, 53, 0.24);
  box-shadow: 0 0 0 1px rgba(202, 98, 53, 0.08), var(--shadow-md);
}

.device-card.is-preparing::after {
  content: "";
  display: block;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(202, 98, 53, 0.20), rgba(202, 98, 53, 0.95), rgba(202, 98, 53, 0.20));
  animation: cardPulse 1.7s linear infinite;
}

.device-card.is-failed {
  border-color: rgba(180, 35, 24, 0.22);
}

.device-card.is-failed::before {
  background: linear-gradient(90deg, rgba(180, 35, 24, 0.18), rgba(180, 35, 24, 0.62), rgba(180, 35, 24, 0.12));
}

@keyframes cardPulse {
  0% {
    opacity: 0.4;
    transform: scaleX(0.86);
  }

  50% {
    opacity: 1;
    transform: scaleX(1);
  }

  100% {
    opacity: 0.4;
    transform: scaleX(0.86);
  }
}

@keyframes prepBarShift {
  0% {
    filter: saturate(0.95) brightness(0.98);
  }

  50% {
    filter: saturate(1.1) brightness(1.04);
  }

  100% {
    filter: saturate(0.95) brightness(0.98);
  }
}

.device-card-header,
.card-badges,
.device-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.device-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  align-items: flex-start;
  gap: 10px;
}

.device-card-header > div {
  min-width: 0;
}

.device-kicker {
  color: var(--text-soft);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
  margin-bottom: 6px;
}

.device-name {
  color: var(--heading);
  font-size: 1.12rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.device-serial {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-family: "Cascadia Code", "Consolas", monospace;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.meta-cell {
  display: grid;
  gap: 5px;
  min-height: 76px;
  padding: 12px 13px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  min-width: 0;
}

.meta-cell span {
  color: var(--text-soft);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.meta-cell strong {
  color: var(--heading);
  font-size: 0.92rem;
  line-height: 1.3;
  word-break: break-word;
}

.meta-cell-secondary {
  display: none;
}

.device-state-strip {
  display: grid;
  gap: 8px;
}

.state-pill {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.86rem;
  display: flex;
  align-items: flex-start;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.state-pill-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(180, 35, 24, 0.18);
  font-weight: 700;
}

.state-pill-secondary {
  display: none;
}


.device-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.device-actions .action-airplane,
.device-actions .action-recover,
.device-actions .action-stop {
  display: none;
}

.device-actions .button {
  width: 100%;
  min-width: 0;
}

.table-shell {
  overflow-x: auto;
  overflow-y: visible;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.92);
  min-height: 0;
  max-height: none;
}

.device-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.device-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px 16px;
  background: rgba(13, 17, 23, 0.98);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.73rem;
  font-weight: 800;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.device-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  vertical-align: top;
  color: var(--text);
  background: rgba(17, 24, 39, 0.7);
}

.table-row {
  transition: background 140ms ease, box-shadow 140ms ease;
}

.table-row:hover td {
  background: rgba(25, 34, 52, 0.96);
}

.table-device-cell {
  display: grid;
  gap: 4px;
}

.table-stack {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.table-code {
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.8rem;
  letter-spacing: -0.03em;
}

.table-device-cell strong {
  color: var(--heading);
  font-size: 0.94rem;
  line-height: 1.2;
}

.table-device-cell small {
  color: var(--text-muted);
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.76rem;
}

.table-row.prep-preparing td {
  background: rgba(235, 242, 255, 0.78);
}

.table-row.prep-ready td {
  background: rgba(237, 250, 243, 0.78);
}

.table-row.prep-failed td {
  background: rgba(255, 243, 243, 0.82);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 300px;
}

.table-subline {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.table-subline-strong {
  color: var(--heading);
  font-weight: 700;
  margin-top: 2px;
}

.table-warning {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.table-warning strong {
  color: var(--heading);
  font-size: 0.84rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.table-warning .table-subline,
.table-stack strong,
.table-stack span,
.table-device-cell strong,
.table-device-cell small {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-warning-active strong {
  color: var(--danger-text);
}

.table-action {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.table-action-primary {
  border-color: transparent;
  background: linear-gradient(180deg, #ff8a57, #e05a28);
  color: #fff;
}

.table-action:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.table-empty {
  text-align: center;
  color: var(--text-muted);
}

.router-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.router-card {
  display: grid;
  gap: 12px;
  padding: 20px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(18, 24, 39, 0.98), rgba(13, 17, 23, 0.96));
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
  position: relative;
  overflow: hidden;
}

.router-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, rgba(202, 98, 53, 0.95), rgba(20, 96, 90, 0.75));
}

.router-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.router-card h3,
.router-card p,
.router-card strong,
.router-card span {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.router-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.router-meta span {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.router-meta strong.badge-ready,
.router-meta strong.badge-failed,
.router-meta strong.badge-neutral,
.router-meta strong.badge-queued {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
}

.router-alert {
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid rgba(248, 113, 113, 0.18);
  background: linear-gradient(180deg, rgba(68, 24, 32, 0.95), rgba(42, 17, 21, 0.94));
  color: var(--danger-text);
  font-size: 0.84rem;
  line-height: 1.45;
}

.router-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 1240px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .shell-nav {
    position: static;
  }

  .stats-grid,
  .rack-overview-grid,
  .router-grid,
  .device-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-cell-secondary,
  .state-pill-secondary {
    display: grid;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .queue-overview {
    grid-template-columns: 1fr 1fr;
  }

  .shell.table-mode .side-column {
    grid-template-columns: 1fr;
  }

  .table-shell {
    max-height: none;
  }
}

@media (max-width: 980px) {
  .shell {
    padding: 18px;
  }

  .app-frame {
    gap: 16px;
  }

  .hero-topbar,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .toolbar-left,
  .toolbar-right {
    width: 100%;
    justify-content: flex-start;
  }

  .context-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .context-chips {
    justify-content: flex-start;
  }

  .quick-actions-row {
    justify-content: flex-start;
  }

  .hero-insight-grid {
    grid-template-columns: 1fr;
  }

  .hero-insight-primary {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 14px;
  }

  .stats-grid,
  .rack-overview-grid,
  .router-grid,
  .device-grid,
  .queue-overview,
  .device-actions,
  .device-meta-grid {
    grid-template-columns: 1fr;
  }

  .device-actions .action-airplane,
  .device-actions .action-recover,
  .device-actions .action-stop {
    display: inline-flex;
  }

  .meta-cell-secondary,
  .state-pill-secondary {
    display: grid;
  }

  .panel,
  .hero-topbar {
    padding: 18px;
  }

  .toolbar {
    top: 8px;
    padding: 12px;
  }
}

@media (max-width: 560px) {
  body {
    min-width: 320px;
  }

  .login-overlay {
    align-items: stretch;
    padding: 14px;
  }

  .login-panel {
    align-self: center;
    padding: 18px;
    gap: 14px;
  }

  .login-brand .nav-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .shell {
    width: 100%;
    padding: 10px 10px 24px;
  }

  .app-frame,
  .shell-main {
    gap: 12px;
  }

  .shell-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 10px;
    padding: 10px;
    border-radius: 0 0 18px 18px;
    margin: -10px -10px 0;
    background: rgba(9, 12, 18, 0.96);
  }

  .nav-brand {
    gap: 10px;
  }

  .nav-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .nav-stack {
    gap: 8px;
  }

  .nav-card {
    padding: 10px;
    border-radius: 14px;
  }

  .nav-card-primary {
    display: none;
  }

  .nav-pills {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-pill {
    min-height: 42px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 0.76rem;
  }

  .nav-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .nav-actions .button {
    min-height: 42px;
    padding: 0 10px;
  }

  .hero-topbar,
  .panel,
  .toolbar,
  .router-card,
  .device-card {
    border-radius: 16px;
  }

  .hero-topbar {
    gap: 14px;
    margin-bottom: 0;
    padding: 16px;
  }

  .hero-copy {
    gap: 11px;
  }

  h1 {
    font-size: 2.05rem;
    line-height: 1;
  }

  .hero .subtitle {
    font-size: 0.92rem;
  }

  .hero-narrative {
    padding: 12px;
    border-radius: 14px;
    font-size: 0.88rem;
  }

  .hero-status-row,
  .brand-row,
  .panel-header,
  .watchdog-chat-header,
  .watchdog-chat-actions {
    align-items: stretch;
  }

  .hero-status-row > *,
  .panel-header > *,
  .watchdog-chat-actions > * {
    min-width: 0;
  }

  .hero-insight {
    min-height: 0;
    padding: 14px;
    border-radius: 16px;
  }

  .hero-insight-value {
    font-size: 1.8rem;
  }

  .toolbar {
    position: static;
    gap: 12px;
    padding: 12px;
  }

  .toolbar-left,
  .toolbar-right,
  .quick-actions-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .search-field input,
  .select-field select,
  .select-field input,
  .toggle-chip,
  .view-toggle,
  .quick-action-button,
  .button {
    width: 100%;
    min-width: 0;
  }

  .view-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 4px;
  }

  .context-bar,
  .stats-grid,
  .rack-overview-grid,
  .router-grid,
  .device-grid,
  .watchdog-metrics {
    gap: 10px;
  }

  .router-card,
  .device-card,
  .panel {
    padding: 14px;
  }

  .router-card header,
  .device-card-header,
  .watchdog-item-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .router-actions,
  .device-actions,
  .editor-form {
    grid-template-columns: 1fr;
  }

  .table-shell {
    border-radius: 14px;
    margin-inline: -2px;
    -webkit-overflow-scrolling: touch;
  }

  .device-table thead th,
  .device-table tbody td {
    padding: 11px 12px;
  }

  .watchdog-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .watchdog-chat-section {
    margin-top: 14px;
    border-radius: 16px;
  }

  .watchdog-chat-header {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .watchdog-chat-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .watchdog-chat-messages {
    min-height: 280px;
    max-height: 58svh;
    padding: 12px;
  }

  .watchdog-chat-bubble {
    max-width: 100%;
  }

  .watchdog-chat-form {
    display: grid;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .watchdog-chat-input {
    min-height: 46px;
  }

  .modal-shell {
    padding: 10px;
    align-items: stretch;
  }

  .modal-panel {
    width: 100%;
    max-height: calc(100svh - 20px);
    border-radius: 16px;
  }
}

/* Watchdog styles */
.watchdog-controls {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.watchdog-controls .select-field {
  flex: 1;
  min-width: 200px;
}

.watchdog-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.metric-card strong {
  display: block;
  font-size: 20px;
  color: var(--text);
  margin-bottom: 4px;
}

.metric-card span {
  font-size: 12px;
  color: var(--text-secondary);
}

.watchdog-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .watchdog-sections {
    grid-template-columns: 1fr;
  }
}

.watchdog-section h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.watchdog-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watchdog-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.watchdog-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.watchdog-item-header strong {
  font-size: 13px;
  color: var(--text);
}

.watchdog-item-header small {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 11px;
}

.watchdog-item p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.watchdog-item-actions {
  display: flex;
  gap: 8px;
}

.watchdog-login-banner {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 13px;
}

.watchdog-login-banner a {
  color: #b45309;
  font-weight: 600;
  text-decoration: underline;
}

/* Watchdog Chat */
.watchdog-chat-section {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.watchdog-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.watchdog-chat-header h3 {
  font-size: 14px;
  margin: 0;
  color: var(--text);
}

.watchdog-chat-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.watchdog-chat-status {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.watchdog-chat-status-busy {
  color: var(--primary);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.watchdog-chat-messages {
  flex: 1;
  min-height: 260px;
  max-height: 480px;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-gutter: stable;
}

.watchdog-chat-messages::-webkit-scrollbar {
  width: 8px;
}

.watchdog-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.watchdog-chat-messages::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(184, 198, 219, 0.18);
}

.watchdog-chat-empty {
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
  padding: 40px 20px;
}

.watchdog-chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.watchdog-chat-bubble-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
}

.watchdog-chat-bubble-header small {
  color: var(--text-soft);
  margin-left: auto;
}

.watchdog-chat-actor {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.watchdog-chat-bubble-user {
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(255, 122, 69, 0.18), rgba(255, 122, 69, 0.10));
  border: 1px solid rgba(255, 122, 69, 0.25);
  border-bottom-right-radius: 4px;
}

.watchdog-chat-bubble-user .watchdog-chat-actor {
  color: var(--primary);
}

.watchdog-chat-bubble-assistant {
  align-self: flex-start;
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.12), rgba(52, 211, 153, 0.06));
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-bottom-left-radius: 4px;
}

.watchdog-chat-bubble-assistant .watchdog-chat-actor {
  color: var(--accent);
}

.watchdog-chat-bubble-observation {
  align-self: flex-start;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.06));
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-bottom-left-radius: 4px;
  max-width: 95%;
}

.watchdog-chat-bubble-observation .watchdog-chat-actor {
  color: #60a5fa;
}

.watchdog-chat-form {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.watchdog-chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-dark);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.watchdog-chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 122, 69, 0.12);
}

.watchdog-chat-input::placeholder {
  color: var(--text-soft);
}

.button-small {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
}


/* ── IP Renewal Pool ─────────────────────────────────────────── */

.pool-panel {
  margin-bottom: 16px;
  background: linear-gradient(135deg, #1a1f2e 0%, #23283a 100%);
  border: 1px solid rgba(255,122,69,0.25);
}

.pool-panel .panel-header {
  border-bottom: 1px solid rgba(255,122,69,0.15);
}

.pool-stats {
  display: flex;
  gap: 12px;
  align-items: center;
}

.pool-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
}

.pool-stat.ready {
  color: #4ade80;
  background: rgba(74,222,128,0.12);
}

.pool-stat.inuse {
  color: #60a5fa;
  background: rgba(96,165,250,0.12);
}

.pool-stat.refreshing {
  color: #fbbf24;
  background: rgba(251,191,36,0.12);
}

.pool-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  flex-wrap: wrap;
}

.pool-status-text {
  font-size: 12px;
  color: var(--text-soft);
  margin-left: auto;
}

.pool-ready-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
}

.pool-ready-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(74,222,128,0.1);
  border: 1px solid rgba(74,222,128,0.2);
  font-size: 12px;
  color: #4ade80;
}

.pool-ready-chip .ip {
  font-family: monospace;
  opacity: 0.8;
}

/* -- Octo Browser proxy pool ------------------------------------- */

.octo-panel {
  margin-bottom: 16px;
  background: rgba(14, 19, 29, 0.92);
  border: 1px solid rgba(96, 165, 250, 0.22);
}

.octo-panel .panel-header {
  border-bottom: 1px solid rgba(96, 165, 250, 0.14);
  padding-bottom: 12px;
}

.octo-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.octo-stat {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.octo-stat strong {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.octo-stat.ready {
  border-color: rgba(74, 222, 128, 0.24);
  background: rgba(74, 222, 128, 0.08);
}

.octo-stat.warming {
  border-color: rgba(251, 191, 36, 0.24);
  background: rgba(251, 191, 36, 0.08);
}

.octo-stat.quarantine {
  border-color: rgba(248, 113, 113, 0.22);
  background: rgba(248, 113, 113, 0.07);
}

.octo-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0;
}

.octo-proxy-list {
  display: grid;
  gap: 8px;
}

.octo-proxy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.octo-proxy-row.is-ready {
  border-color: rgba(74, 222, 128, 0.26);
}

.octo-proxy-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.octo-proxy-main strong,
.octo-proxy-main span,
.octo-proxy-main small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.octo-proxy-main span,
.octo-proxy-main small {
  color: var(--text-soft);
}

.octo-proxy-main span {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.octo-proxy-main small {
  font-size: 11px;
}

.octo-proxy-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ── Device Screenshot Panel ─────────────────────────────────── */

.screenshot-panel {
  margin-bottom: 16px;
  background: linear-gradient(135deg, #1a1f2e 0%, #23283a 100%);
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.screenshot-panel .panel-header {
  border-bottom: 1px solid rgba(96, 165, 250, 0.15);
}

.screenshot-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0;
  min-height: 200px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  margin-top: 12px;
}

.screenshot-frame img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  object-fit: contain;
}

.screenshot-placeholder {
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
  padding: 40px 20px;
}

.screenshot-placeholder p {
  margin: 0;
}

@media (max-width: 560px) {
  .nav-pills {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .watchdog-chat-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .watchdog-chat-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .pool-actions,
  .pool-stats,
  .octo-actions,
  .octo-stats,
  .octo-proxy-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .pool-status-text,
  .octo-proxy-actions {
    margin-left: 0;
  }

  .octo-proxy-actions {
    justify-content: stretch;
  }

  .octo-proxy-actions .button {
    width: 100%;
  }

  .activity-item,
  .queue-item,
  .watchdog-item,
  .router-card,
  .device-card {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .activity-item *,
  .queue-item *,
  .watchdog-item *,
  .router-card *,
  .device-card * {
    min-width: 0;
  }
}
