:root {
  --bg: #f3f6fb;
  --paper: #ffffff;
  --ink-strong: #0f172a;
  --ink: #334155;
  --ink-soft: #64748b;
  --line: #dbe2ea;
  --accent: #0b5fff;
  --accent-press: #094dd1;
  --ok: #157347;
  --warn: #9a6700;
  --bad: #b42318;
  --radius: 12px;
  --shadow: 0 12px 26px rgba(12, 23, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  background:
    linear-gradient(180deg, #eef3fa 0%, #f8fbff 28%, #f3f6fb 100%),
    radial-gradient(circle at 12% 0%, rgba(11, 95, 255, 0.12) 0%, rgba(11, 95, 255, 0) 44%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(6px);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  font-size: 11px;
  color: #1d4ed8;
  font-weight: 700;
}

.topbar h1 {
  margin: 2px 0;
  color: var(--ink-strong);
  font-size: 27px;
  line-height: 1.2;
}

.subtle {
  margin: 0;
  color: var(--ink-soft);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #cfd8e3;
  color: #1e293b;
  background: #f8fafc;
  font-size: 13px;
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.status-ok {
  color: #054329;
  background: #dff7e9;
  border-color: #95d5b2;
}

.status-warn {
  color: #6e4b00;
  background: #fff2cf;
  border-color: #f0cf70;
}

.status-bad {
  color: #6d1111;
  background: #ffe4e2;
  border-color: #f8b4b0;
}

.status-loading {
  color: #1d4ed8;
  background: #e7f0ff;
  border-color: #b6ccff;
}

.status-meta {
  display: flex;
  gap: 14px;
  color: var(--ink-soft);
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 14px 28px 0;
}

.tab-btn {
  appearance: none;
  border: 1px solid #cfdae8;
  background: #eef3fa;
  color: #334155;
  border-radius: 10px 10px 0 0;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--paper);
  border-bottom-color: var(--paper);
  color: var(--ink-strong);
}

.layout {
  display: grid;
  gap: 16px;
  padding: 0 20px 20px;
}

.hidden {
  display: none;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel-priority {
  border-color: #c9d7ea;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
  color: var(--ink-strong);
}

.panel-state {
  font-size: 12px;
  color: var(--ink-soft);
}

.grid-6 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

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

.metric {
  border: 1px solid #d6e0ea;
  border-radius: 10px;
  padding: 12px;
  background: #fbfdff;
}

.metric .label {
  font-size: 12px;
  color: var(--ink-soft);
}

.metric .value {
  margin-top: 5px;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink-strong);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #d8e0ea;
  border-radius: 10px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid #e4ebf2;
  text-align: left;
  padding: 10px 8px;
  font-size: 14px;
}

thead th {
  position: sticky;
  top: 0;
  background: #f6f9fd;
  color: #1f2f44;
}

ul {
  margin: 8px 0;
  padding-left: 18px;
}

li {
  margin-bottom: 6px;
}

.mobile-queue-cards {
  display: none;
  gap: 8px;
  margin-top: 10px;
}

.queue-card {
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  padding: 10px;
  background: #fbfdff;
}

.queue-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--ink-strong);
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 6px;
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
}

.status-pill.ok {
  color: #0f5132;
  background: #d1fae5;
}

.status-pill.bad {
  color: #7f1d1d;
  background: #fee2e2;
}

label {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: #29405c;
  font-weight: 600;
}

textarea,
input,
select,
button {
  width: 100%;
  margin-top: 6px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid #c7d4e2;
  font: inherit;
  padding: 9px 10px;
  background: #fff;
}

textarea {
  resize: vertical;
}

button {
  cursor: pointer;
  border: 0;
  color: #fff;
  font-weight: 600;
  background: var(--accent);
}

button:hover {
  background: var(--accent-press);
}

button.secondary {
  background: #41526a;
}

button.secondary:hover {
  background: #334155;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 8px;
}

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

.bad {
  color: var(--bad);
}

.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;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 230px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #fff;
  background: #0f172a;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.26);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.ok {
  background: #166534;
}

.toast.bad {
  background: #991b1b;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.tab-btn:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 1px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-shell {
  width: 100%;
  max-width: 460px;
  padding: 16px;
}

.login-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 4px 0 6px;
  font-size: 34px;
  color: var(--ink-strong);
}

.login-card p {
  color: var(--ink-soft);
}

.error {
  min-height: 20px;
  color: var(--bad);
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 18px 16px;
  }

  .status-strip {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 18px;
  }

  .status-meta {
    flex-direction: column;
    gap: 4px;
  }

  .tabs {
    padding: 12px 18px 0;
  }

  .layout {
    padding: 0 12px 14px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .action-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .table-wrap {
    display: none;
  }

  .mobile-queue-cards {
    display: grid;
  }
}
