@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --navy-900: #0a1424;
  --navy-800: #101e36;
  --navy-700: #17294a;
  --navy-600: #1f3560;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-alt: #f7f8fa;
  --border: #e3e6ec;
  --border-strong: #cfd4de;

  --ink: #101828;
  --ink-muted: #5d6b82;
  --ink-faint: #97a1b3;
  --ink-inverse: #eef1f7;
  --ink-inverse-muted: #97a3ba;

  --ok: #17966b;
  --ok-soft: #e2f5ed;
  --warn: #b9791e;
  --warn-soft: #faf0dd;
  --err: #c0392f;
  --err-soft: #fbe9e7;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);

  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-w: 232px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--navy-600);
}

::selection {
  background: var(--navy-700);
  color: #fff;
}

/* ================= shared components ================= */

.btn {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn:hover {
  border-color: var(--navy-600);
  background: var(--surface-alt);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff;
}

.btn-primary:hover {
  background: var(--navy-900);
  border-color: var(--navy-900);
}

.btn-danger {
  border-color: var(--border-strong);
  color: var(--err);
}

.btn-danger:hover {
  border-color: var(--err);
  background: var(--err-soft);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-muted);
  padding: 8px 4px;
}

.btn-ghost:hover {
  color: var(--ink);
  background: transparent;
  border-color: transparent;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-hint {
  font-size: 12px;
  color: var(--ink-muted);
  margin: -8px 0 14px;
}

.test-result {
  font-size: 12.5px;
  font-weight: 600;
}

.test-result.ok {
  color: #1a7a3d;
}

.test-result.fail {
  color: #b3261e;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}

.field input,
.field select,
.field textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  resize: vertical;
  font-family: var(--font-body);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-faint);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(31, 53, 96, 0.12);
}

.field-hint {
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--ink-faint);
}

.badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  background: var(--surface-alt);
  display: inline-block;
}

.lamp {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
  flex-shrink: 0;
  display: inline-block;
}

.lamp.ok {
  background: var(--ok);
}

.lamp.warn {
  background: var(--warn);
  animation: lamp-pulse 1.4s ease-in-out infinite;
}

.lamp.err {
  background: var(--err);
}

@keyframes lamp-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-faint);
  font-family: var(--font-body);
  font-size: 13px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy-900);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--err);
}

/* ================= app shell ================= */

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--navy-900);
  color: var(--ink-inverse);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 20px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--navy-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.sidebar-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  color: #fff;
}

.sidebar-brand-sub {
  font-family: var(--font-body);
  font-size: 10.5px;
  color: var(--ink-inverse-muted);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-inverse-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: var(--navy-600);
  color: #fff;
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-user {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  object-fit: cover;
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 10.5px;
  color: var(--ink-inverse-muted);
  text-transform: capitalize;
}

.sidebar-logout {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--ink-inverse-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 6px;
}

.sidebar-logout:hover {
  color: #fff;
}

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

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.page-sub {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* ================= dashboard overview ================= */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}

.stat-value.ok {
  color: var(--ok);
}

.stat-value.err {
  color: var(--err);
}

.overview-table {
  width: 100%;
  border-collapse: collapse;
}

.overview-table th {
  text-align: left;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
}

.overview-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}

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

.overview-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

/* ================= instance grid (Agent Control) ================= */

.instance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.instance-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.instance-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.card-status {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--ink-faint);
}

.card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.badge.channel-baileys {
  border-color: var(--ok-soft);
  color: var(--ok);
  background: var(--ok-soft);
}

.badge.channel-cloud_api {
  border-color: var(--navy-600);
  color: var(--navy-600);
  background: #eef1f8;
}

.new-line-card {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  min-height: 118px;
  cursor: pointer;
  color: var(--ink-faint);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.new-line-card:hover {
  border-color: var(--navy-800);
  color: var(--navy-800);
  background: var(--surface-alt);
}

.new-line-plus {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  font-weight: 600;
}

.new-line-text {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
}

/* detail view */

.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.detail-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-name-input {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--ink);
  padding: 2px 0;
  min-width: 220px;
}

.detail-name-input:focus {
  outline: none;
  border-bottom-color: var(--border-strong);
}

.detail-status-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--ink-faint);
}

.spacer {
  flex: 1;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chip {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip:hover {
  border-color: var(--navy-800);
  color: var(--navy-800);
}

.chip.active {
  border-color: var(--navy-700);
  color: var(--navy-700);
  background: #eef1f8;
}

.radio-row {
  display: flex;
  gap: 10px;
}

.radio-option {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.radio-option.selected {
  border-color: var(--navy-800);
  background: var(--surface-alt);
}

.radio-option input {
  accent-color: var(--navy-800);
}

.radio-text {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: block;
}

.radio-note {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-faint);
  display: block;
  margin-top: 1px;
}

/* ================= detail tabs ================= */

.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.detail-tab {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.detail-tab:hover {
  color: var(--ink);
}

.detail-tab.active {
  color: var(--navy-800);
  border-bottom-color: var(--navy-800);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.qr-box {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.qr-image-wrap {
  width: 160px;
  height: 160px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.qr-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder {
  width: 160px;
  height: 160px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
  padding: 10px;
  flex-shrink: 0;
}

.qr-instructions {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.6;
  max-width: 360px;
}

.webhook-url {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--navy-600);
  word-break: break-all;
  cursor: pointer;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.log-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  background: var(--surface-alt);
}

.log-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
}

.log-text {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--ink-muted);
  margin: 0 0 6px;
}

.log-reply {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--ink);
  margin: 0;
  padding-left: 10px;
  border-left: 2px solid var(--navy-600);
}

.action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ================= users view ================= */

.user-table {
  width: 100%;
  border-collapse: collapse;
}

.user-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
}

.user-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

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

.role-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}

.role-pill.admin {
  background: var(--navy-800);
  color: #fff;
}

.role-pill.user {
  background: var(--surface-alt);
  color: var(--ink-muted);
  border: 1px solid var(--border);
}

.role-pill.viewer {
  background: var(--surface-alt);
  color: var(--gold-700, #8a6d1a);
  border: 1px dashed var(--border);
}

.role-viewer #btn-new-line,
.role-viewer #btn-save,
.role-viewer #btn-start,
.role-viewer #btn-stop,
.role-viewer #btn-delete,
.role-viewer [data-resume-handoff] {
  display: none !important;
}

/* ================= activity log ================= */

.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-row {
  display: flex;
  gap: 14px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

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

.activity-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink-muted);
  flex-shrink: 0;
  text-transform: uppercase;
}

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-line {
  font-size: 13px;
  color: var(--ink);
}

.activity-line strong {
  font-weight: 700;
}

.activity-detail {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.activity-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* ================= login / setup page ================= */

.auth-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-900);
  background-image: radial-gradient(circle at 20% 15%, rgba(31, 53, 96, 0.5), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(23, 41, 74, 0.6), transparent 40%);
  padding: 20px;
  overflow: hidden;
}

.auth-bg-pattern {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 14px;
  padding: 34px 32px 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.auth-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--navy-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  color: #fff;
}

.auth-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.auth-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}

.auth-brand-sub {
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--ink-muted);
}

.auth-brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  object-fit: cover;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
}

.sso-button-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 4px;
}

.sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  width: 100%;
  padding: 10px;
}

.sso-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--ink-faint);
}

.sso-divider::before,
.sso-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-desc {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 22px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-error {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--err);
  background: var(--err-soft);
  border: 1px solid #f3c9c4;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  display: none;
}

.auth-error.show {
  display: block;
}

.auth-submit {
  margin-top: 4px;
  width: 100%;
  padding: 11px;
  font-size: 14px;
}

.auth-footnote {
  margin-top: 18px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--ink-faint);
}

@media (max-width: 860px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    overflow-x: auto;
  }

  .sidebar-brand {
    border-bottom: none;
    padding: 0 16px 0 0;
    margin-bottom: 0;
  }

  .nav-list {
    flex-direction: row;
  }

  .sidebar-spacer {
    display: none;
  }

  .sidebar-user {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
    margin-left: 12px;
  }

  .main {
    padding: 20px 16px 50px;
  }
}

/* ================= settings: logo upload ================= */

.logo-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-preview {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--navy-800);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ================= modal ================= */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 36, 0.55);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: 14px;
  padding: 26px 26px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  .lamp.warn,
  .cable.live {
    animation: none;
  }
}
