:root {
  --stripe-indigo: #635BFF;
  --text: #425466;
  --bg: #f6f9fc;
  --card: #ffffff;
  --border: #e3e8ee;
  --muted: #697386;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app { display: flex; min-height: 100vh; }

/* Lets mobile topbar + sidebar + backdrop participate in .app flex via display:contents on desktop. */
.nav-root { display: contents; }

.sidebar {
  width: 240px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--stripe-indigo);
  margin-bottom: 2rem;
}

.mobile-topbar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.nav-toggle:hover { background: var(--bg); }

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: #0a2540;
  border-radius: 1px;
}

.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; }

.sidebar nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--bg);
  color: var(--stripe-indigo);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--stripe-indigo);
  cursor: pointer;
  padding: 0;
  font-size: 0.85rem;
}

.content {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  min-width: 0;
}

/* Audit (and similar) pages: use all remaining width beside the sidebar */
.content.content-wide {
  max-width: none;
  width: auto;
  flex: 1 1 0%;
  min-width: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

.card-flush .audit-pager {
  padding: 0.85rem 1.25rem;
  margin-top: 0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-header h2 { margin: 0; font-size: 1.25rem; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-primary { background: var(--stripe-indigo); color: #fff; }
.btn-primary:hover { filter: brightness(0.92); }

.btn-secondary {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover { background: var(--bg); }

.btn-danger {
  background: #fff;
  color: #df1b41;
  border: 1px solid #f8c9d2;
}
.btn-danger:hover {
  background: #fff5f7;
  border-color: #df1b41;
}

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  align-items: center;
}
.table-actions form { margin: 0; }

.form label { display: block; margin-bottom: 0.75rem; font-weight: 500; }

.form input,
.form select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 0.25rem;
  font-size: 1rem;
}

.form button { margin-top: 1rem; }

.table { width: 100%; border-collapse: collapse; margin-top: 1rem; }

.table th,
.table td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.table-audit {
  table-layout: fixed;
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.table-audit .audit-col-time { width: 10.5rem; }
.table-audit .audit-col-actor { width: 7.5rem; }
.table-audit .audit-col-event { width: 13rem; }
.table-audit .audit-col-object { width: 16rem; }
.table-audit .audit-col-details { width: auto; }

.table-audit th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-audit td {
  vertical-align: top;
  font-size: 0.875rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  /* Do NOT use break-all here — it collapses columns to 1 character wide */
  overflow-wrap: break-word;
  word-break: normal;
}

.table-audit tbody tr:last-child td { border-bottom: none; }

.audit-time {
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.audit-actor-type {
  font-weight: 600;
  color: #0a2540;
  font-size: 0.9rem;
  white-space: nowrap;
}

.audit-actor-id {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-event code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-object-type {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  margin-bottom: 0.2rem;
}

.audit-object-id,
.mono-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.mono-link {
  color: var(--stripe-indigo);
  text-decoration: none;
  font-weight: 600;
}

.mono-link:hover { text-decoration: underline; }

.audit-details {
  display: block;
  max-height: 5.5rem;
  overflow: auto;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  color: var(--text);
}

.audit-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
}

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--bg);
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.stat-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }

.stat-value { font-size: 2rem; font-weight: 700; color: var(--stripe-indigo); }

.stat-value-sm { font-size: 1.55rem; }

.stat-sub {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.dash-stats { margin-bottom: 1.25rem; }

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge-live {
  background: #d1fae5;
  color: #065f46;
  font-weight: 600;
}

.badge-test {
  background: #fff7ed;
  color: #c45c00;
  font-weight: 600;
}

.badge-warn {
  background: #fff7ed;
  color: #b45309;
  font-weight: 600;
}

.dash-checklist { margin-bottom: 1.5rem; }

.dash-checklist-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.dash-checklist-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.dash-checklist-list li.is-ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.dash-check-mark {
  width: 1.5rem;
  text-align: center;
  font-weight: 700;
  color: var(--stripe-indigo);
}

.dash-checklist-list li.is-ok .dash-check-mark { color: #065f46; }

.dash-check-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.dash-table { margin-top: 0; }

.dash-empty {
  padding: 1.25rem 0.25rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.dash-entity-list,
.dash-audit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dash-entity-list li,
.dash-audit-list li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.dash-entity-list li:last-child,
.dash-audit-list li:last-child { border-bottom: none; }

.dash-entity-main,
.dash-audit-top {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.dash-entity-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.dash-audit-meta {
  font-size: 0.82rem;
  word-break: break-word;
}

.dash-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 1rem;
}

.dash-links a {
  color: var(--stripe-indigo);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.35rem 0;
}

.dash-links a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .dash-links { grid-template-columns: 1fr; }
  .dash-header-actions { width: 100%; }
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  padding: 2.5rem 2rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow:
    0 4px 6px rgba(50, 50, 93, 0.06),
    0 10px 30px rgba(50, 50, 93, 0.08);
}

.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, rgba(99, 91, 255, 0.08), transparent 55%),
    var(--bg);
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--stripe-indigo), #7a73ff);
  box-shadow: 0 4px 12px rgba(99, 91, 255, 0.35);
  position: relative;
}

.auth-logo::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-top: 3px solid #fff;
  border-bottom: 3px solid #fff;
  border-radius: 1px;
}

.auth-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0a2540;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.auth-brand .muted {
  font-size: 0.95rem;
}

.auth-form {
  margin-top: 0.5rem;
}

.auth-form .label-text {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.auth-form label {
  margin-bottom: 1rem;
}

.auth-form input {
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--stripe-indigo);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.15);
}

.btn-block {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.7rem 1rem;
  font-size: 1rem;
}

.auth-page .alert {
  margin-bottom: 1rem;
}

.alert { padding: 1rem; border-radius: 8px; margin-bottom: 1rem; }

.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.muted { color: var(--muted); font-size: 0.9rem; }

h1 { margin-top: 0; margin-bottom: 1.5rem; }

h2 { margin-top: 0; margin-bottom: 1rem; font-size: 1.25rem; }

.config-hint { margin-top: 1rem; }

.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  font-weight: normal;
  cursor: pointer;
}

.radio-row input { margin-top: 0.2rem; width: auto; }

.stripe-mode-card h2 { margin-bottom: 0.5rem; }

.stripe-test { border-top: 3px solid #635bff; }
.stripe-live { border-top: 3px solid #0a2540; }

.url-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1rem;
  overflow-x: auto;
}

.url-block code, .url-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  word-break: break-all;
}

.code-block {
  margin: 0.75rem 0 0;
  padding: 1rem 1.1rem;
  background: #0a2540;
  color: #e6edf7;
  border-radius: 8px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre;
}

.url-table td { vertical-align: top; }

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 { margin-bottom: 0.35rem; }

.page-header .muted { max-width: 42rem; }

.page-header code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.page-grid { margin-bottom: 1.5rem; }

.card-muted { background: linear-gradient(180deg, #fff, var(--bg)); }

.label-text {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.label-hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; }

.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

.form-compact label { margin-bottom: 1rem; }

.form-compact .form-grid label { margin-bottom: 0; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-compact button[type="submit"] { margin-top: 0.25rem; }

.mono-input, .input-disabled {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
}

.input-disabled {
  background: var(--bg);
  color: var(--muted);
  cursor: not-allowed;
}

.form input:focus,
.form select:focus {
  outline: none;
  border-color: var(--stripe-indigo);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.12);
}

.info-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text);
}

.info-list li { margin-bottom: 0.65rem; }

.info-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  background: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.badge-count {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
  font-weight: 600;
}

.badge-disabled {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 600;
}

.badge-connected {
  background: #e0e7ff;
  color: #3730a3;
  font-weight: 600;
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.queue-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.queue-card:hover {
  border-color: #c9d0db;
  box-shadow: 0 2px 8px rgba(50, 50, 93, 0.06);
}

.queue-card-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.queue-card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.queue-card-title h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #0a2540;
}

.queue-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.code-pill {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  background: var(--bg);
  color: var(--stripe-indigo);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-weight: 600;
}

.queue-location {
  font-size: 0.875rem;
  color: var(--text);
}

.queue-location code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
}

.queue-location-missing { color: var(--muted); font-style: italic; }

.meta-label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.25rem;
}

.queue-card-actions { flex-shrink: 0; }

/* Devices page */
.device-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.device-table-head,
.device-row-summary {
  display: grid;
  /* Fixed actions width so header + rows share the same tracks (separate grids). */
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.15fr) 8.5rem 18.5rem;
  gap: 1rem;
  align-items: center;
  padding: 0.65rem 1rem;
}

.device-table-head {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.device-row {
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.device-row:last-child { border-bottom: none; }

.device-row-summary {
  padding: 0.9rem 1rem;
}

.device-row-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}

.device-row-name strong {
  font-size: 0.98rem;
  color: #0a2540;
}

.device-row-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.device-row-sub code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text);
}

.device-opt {
  color: var(--stripe-indigo);
  font-weight: 600;
  font-size: 0.75rem;
}

.device-opt-test {
  color: #c45c00;
}

.device-opt::before {
  content: "·";
  margin-right: 0.45rem;
  color: var(--border);
  font-weight: 400;
}

.device-row-station {
  font-size: 0.9rem;
  color: var(--text);
}

.device-station {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.device-warn {
  color: #b45309;
  font-size: 0.8rem;
  font-style: italic;
}

.device-row-seen {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.device-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.device-row-actions .btn-sm {
  flex-shrink: 0;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: none;
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--stripe-indigo);
}

.btn-danger-text {
  color: #b42318;
}

.btn-danger-text:hover {
  background: #fef3f2;
  color: #912018;
}

.inline-form { margin: 0; }

.device-edit {
  padding: 1rem 1.15rem 1.15rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.device-edit-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.device-edit-top h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  color: #0a2540;
}

.device-edit-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--muted);
}

.device-edit-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.25rem;
}

.device-edit-grid h4 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: #0a2540;
}

.device-edit-grid .form {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.75rem 0 1rem;
}

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

.info-list.numbered {
  list-style: decimal;
  padding-left: 1.25rem;
}

.info-list.numbered li { margin-bottom: 0.5rem; }

.info-list a {
  color: var(--stripe-indigo);
  font-weight: 500;
}

.queue-edit-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-weight: 400;
  font-size: 0.9rem;
  cursor: pointer;
}

.checkbox-row input {
  width: auto;
  margin-top: 0.2rem;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0.85rem 0 0.25rem;
  cursor: pointer;
  font-weight: 400;
}

.switch-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.9rem;
  color: var(--text);
}

.switch-copy strong {
  font-size: 0.92rem;
  color: #0a2540;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: #c9d0db;
  border-radius: 999px;
  transition: background 0.15s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-slider {
  background: var(--stripe-indigo);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--stripe-indigo);
  outline-offset: 2px;
}

.station-delete-form {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.form-actions button { margin-top: 0; }

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.empty-state h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  color: #0a2540;
}

[x-cloak] { display: none !important; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 1rem; padding-top: 4.25rem; }
  .form-grid { grid-template-columns: 1fr; }
  .queue-card-main { flex-direction: column; }
  .device-table-head { display: none; }
  .device-row-summary {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
  .device-row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
  }
  .device-edit-grid { grid-template-columns: 1fr; }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    height: 3.25rem;
    padding: 0 0.85rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
  }

  .mobile-brand {
    margin: 0;
    font-size: 1rem;
  }

  .desktop-brand { display: none; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(15, 23, 42, 0.4);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 2px 0 16px rgba(15, 23, 42, 0.12);
    border-right: 1px solid var(--border);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }
}
