.screen { min-height: 100%; }

#login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card { width: 100%; max-width: 380px; text-align: left; }
.login-card .brand {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: block;
  margin: 0 0 14px;
}
.login-card h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.login-card .sub { margin: 2px 0 20px; color: var(--muted); font-size: 13px; }
#login button { width: 100%; }
#passkeyBtn { margin-top: 8px; }

#dash {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brandRow { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brandSmall { width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto; }
.brandText { display: flex; flex-direction: column; min-width: 0; }
.brandText strong { font-size: 15px; letter-spacing: -0.01em; }
.meta {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }

.navItem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.navItem:hover { background: var(--panel-2); color: var(--text); }
.navItem.active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.navItem:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--line);
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.badge:empty { display: none; }
.badge.live { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.sidebarFoot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 6px;
}
.liveDot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.sidebarFoot button { width: 100%; }

.content {
  padding: 26px 34px 60px;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.viewHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
}
.viewHead h1 { margin: 0; font-size: 21px; letter-spacing: -0.015em; }
.viewHead input[type="search"] {
  width: auto;
  min-width: 240px;
  margin: 0;
}

.content h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 28px 0 10px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tileValue {
  font-size: 27px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.tileLabel { font-size: 12px; color: var(--muted); }

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:first-child td { border-top: 0; }
tbody tr:hover { background: var(--panel-2); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.muted { color: var(--muted); }
td.actions { text-align: right; white-space: nowrap; }
td.actions button + button { margin-left: 6px; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.busy { background: rgba(23,197,91,.16); color: var(--accent); }
.pill.idle { background: var(--line); color: var(--muted); }
.pill.warn { background: rgba(214,158,46,.16); color: #d69e2e; }

.empty {
  margin: 0;
  padding: 26px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.tablewrap + .empty { margin-top: 10px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.formRow {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 180px; }
.field label { font-size: 12px; color: var(--muted); margin: 0; }
.field input { margin-bottom: 0; }
.formRow > button { flex: 0 0 auto; }

.note {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 70ch;
}
.note code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12px;
}

.cmd {
  margin: 12px 0 0;
  padding: 14px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}

.facts { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12.5px; }
.facts dd { margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 11px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 26px rgba(0,0,0,.45);
  animation: toastIn .18s ease-out;
  z-index: 90;
  max-width: 340px;
}
.toast.ok { border-color: rgba(23,197,91,.5); }
.toast.bad { border-color: rgba(224,81,74,.55); color: #f0817b; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 860px) {
  #dash { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .navItem { width: auto; }
  .sidebarFoot { flex-direction: row; align-items: center; justify-content: space-between; }
  .sidebarFoot button { width: auto; }
  .content { padding: 20px 16px 50px; }
  .viewHead { flex-wrap: wrap; }
  .viewHead input[type="search"] { min-width: 0; width: 100%; }
}

.linkBtn {
  display: inline-block;
  font-size: 12.5px;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.linkBtn:hover { background: var(--panel-2); border-color: var(--muted); }
.linkBtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.viewHead + h2 { margin-top: 0; }
.viewHead + .note { margin-top: 0; }
.tablewrap + h2, .empty + h2, .cmd + h2 { margin-top: 30px; }

.tablewrap + .panel,
.empty + .panel,
.tablewrap + form.panel,
.empty + form.panel { margin-top: 14px; }

.panel + h2 { margin-top: 30px; }

.empty + .empty { display: none; }

.hint { min-height: 0; }
.hint:empty { display: none; }
.panel .hint { margin: 10px 0 0; }

.note code { white-space: nowrap; }
