:root {
  --ink: #14212b;
  --ink-soft: #3d4f5c;
  --muted: #6b7c88;
  --paper: rgba(255, 252, 247, 0.78);
  --paper-solid: #fffaf3;
  --line: rgba(20, 33, 43, 0.1);
  --teal: #0f7a6c;
  --teal-soft: #d7f2ec;
  --amber: #b86a1a;
  --amber-soft: #ffe8c9;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(20, 33, 43, 0.12);
  --radius: 18px;
  --font-display: "Syne", sans-serif;
  --font-body: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: #e8eef1;
}

body {
  position: relative;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(15, 122, 108, 0.28), transparent 60%),
    radial-gradient(800px 480px at 92% 0%, rgba(184, 106, 26, 0.22), transparent 55%),
    linear-gradient(165deg, #dfe9ee 0%, #f4efe6 48%, #e7eef2 100%);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem 0.75rem;
  max-width: 1280px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background:
    linear-gradient(145deg, #0f7a6c 0%, #1aa897 55%, #f0b35a 100%);
  box-shadow: 0 10px 24px rgba(15, 122, 108, 0.35);
}

.brand-kicker {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.brand h1 {
  margin: 0.1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 2.5rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0.75rem 0 1.1rem;
}

.stat {
  background: var(--paper);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.stat strong {
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.tabs {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.3rem;
  background: rgba(255, 250, 243, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-bottom: 1rem;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 650;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.tab.is-active {
  background: var(--ink);
  color: #fffaf3;
}

.panel {
  display: none;
  background: var(--paper);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

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

.panel-lead {
  margin: 0.25rem 0 1rem;
  color: var(--ink-soft);
  max-width: 52rem;
  line-height: 1.5;
}

.toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.85rem;
}

.search {
  flex: 1 1 260px;
}

.search input,
.filters select,
.modal-card input,
.reason-input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  outline: none;
}

.search input:focus,
.filters select:focus,
.modal-card input:focus,
.reason-input:focus {
  border-color: rgba(15, 122, 108, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 122, 108, 0.15);
}

.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filters select {
  width: auto;
  min-width: 120px;
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  background: rgba(15, 122, 108, 0.08);
  border: 1px solid rgba(15, 122, 108, 0.18);
}

.table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.92rem;
}

.data-table th {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f7f3ec;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tbody tr:hover {
  background: rgba(15, 122, 108, 0.04);
}

.col-check {
  width: 42px;
}

.col-toggle {
  width: 110px;
}

.col-actions {
  width: 140px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem !important;
}

.mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.btn {
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  padding: 0.62rem 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #0f7a6c, #159987);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 122, 108, 0.28);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-soft {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.btn-danger {
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.2);
}

.btn-tiny {
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill-ok {
  background: var(--teal-soft);
  color: var(--teal);
}

.pill-bad {
  background: #fde8e6;
  color: var(--danger);
}

.pill-muted {
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  border: 1px solid var(--line);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
  font-weight: 650;
  font-size: 0.86rem;
}

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

.slider {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #c9d2d8;
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

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

.switch.abi input:checked + .slider {
  background: var(--amber);
}

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

.row-actions {
  display: flex;
  gap: 0.35rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

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

.vendor-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 1rem;
}

.vendor-card h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
}

.vendor-card p {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  min-height: 2rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.35rem 0.55rem 0.35rem 0.75rem;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 700;
  font-size: 0.82rem;
}

.vendor-card.abi .chip {
  background: var(--amber-soft);
  color: var(--amber);
}

.chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
}

.chip-add {
  display: flex;
  gap: 0.45rem;
}

.vendor-actions {
  margin-top: 1rem;
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 2rem);
}

.modal::backdrop {
  background: rgba(20, 33, 43, 0.45);
  backdrop-filter: blur(4px);
}

.modal-card {
  width: min(460px, 92vw);
  background: var(--paper-solid);
  border-radius: 22px;
  padding: 1.25rem;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.85rem;
}

.modal-card header h2 {
  margin: 0;
  font-family: var(--font-display);
}

.modal-card header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-card label {
  display: grid;
  gap: 0.35rem;
  font-weight: 650;
  font-size: 0.88rem;
}

.toggle-row {
  display: grid;
  gap: 0.65rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  background: var(--ink);
  color: #fffaf3;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-width: min(360px, calc(100vw - 2rem));
  font-weight: 650;
}

.toast.is-error {
  background: #7a1f18;
}

/* Login (control-logs pattern, Packet Forward look) */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.login-screen[hidden],
.main-screen[hidden] {
  display: none !important;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 1.6rem 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.login-brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

#login-form label {
  display: block;
  margin-bottom: 0.95rem;
}

#login-form label span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

#login-form input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper-solid);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

#login-form input:focus {
  outline: none;
  border-color: rgba(15, 122, 108, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 122, 108, 0.18);
}

#login-form .btn-primary {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.8rem;
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0 0 0.55rem;
  font-weight: 600;
}

.login-hint {
  margin: 1.15rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .shell,
  .topbar {
    padding-left: 1rem;
    padding-right: 1rem;
  }

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

  .stat strong {
    font-size: 1.4rem;
  }
}
