:root {
  color-scheme: dark;
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.2), transparent 45%),
    linear-gradient(180deg, #0b1120 0%, #0f172a 55%, #111827 100%);
  color: #e5e7eb;
}

.container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 10px;
  position: sticky;
  top: 0;
  max-height: 100vh;
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-left: none;
  margin: 0;
  padding: 20px 14px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 4px;
}

.nav-btn {
  text-align: left;
  background: #111827;
  border: 1px solid #334155;
}

.nav-btn.active {
  border-color: #3b82f6;
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
}

.content-area {
  min-width: 0;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topbar-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #dbeafe;
}

.topbar-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: #9ca3af;
}

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

.last-sync {
  margin: 0;
  font-size: 12px;
  color: #93c5fd;
}

.page-header {
  margin: 0;
  padding: 24px 24px 12px;
}

.eyebrow {
  margin: 0;
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 10px;
  font-size: clamp(1.8rem, 3vw, 2.25rem);
  color: #f8fafc;
}

.subtitle {
  margin: 0;
  max-width: 760px;
  color: #cbd5e1;
  line-height: 1.45;
}

.card {
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 14px 34px rgba(2, 6, 23, 0.3);
}

#loginCard {
  max-width: 760px;
  margin: 0 24px 24px;
}

h2,
h3 {
  margin: 0;
  color: #f8fafc;
}

.section-help {
  margin: 8px 0 0;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.5;
}

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

.compact-row {
  margin-bottom: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

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

.mini-card {
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 12px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.55);
}

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

.mini-card-head h3 {
  font-size: 14px;
}

.mini-badge {
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
}

.mini-badge.danger {
  background: rgba(220, 38, 38, 0.2);
  color: #fecaca;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-item {
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 8px;
  padding: 8px;
  background: rgba(17, 24, 39, 0.55);
}

.mini-item-title {
  margin: 0;
  font-size: 12px;
  color: #e5e7eb;
  font-weight: 600;
}

.mini-item-subtitle {
  margin: 4px 0 0;
  font-size: 11px;
  color: #9ca3af;
}

.empty-state {
  margin: 10px 0 0;
  padding: 10px;
  border: 1px dashed rgba(71, 85, 105, 0.6);
  border-radius: 10px;
  color: #94a3b8;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.4);
}

.stat-card {
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 12px;
  padding: 12px 14px;
}

.stat-label {
  margin: 0;
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
}

.stat-value {
  margin: 8px 0 0;
  font-size: 24px;
  font-weight: 700;
  color: #f8fafc;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.view {
  margin-bottom: 14px;
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

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

.field label {
  font-size: 13px;
  font-weight: 700;
  color: #dbeafe;
}

.field-help {
  margin: 0;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.4;
}

.field-span-2 {
  grid-column: span 2;
}

.field-actions {
  align-self: end;
}

.field-actions button {
  width: 100%;
}

input,
button {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0b1220;
  color: #e2e8f0;
  font-size: 14px;
}

input:focus {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  outline-offset: 1px;
  border-color: #3b82f6;
}

button {
  cursor: pointer;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border: none;
  font-weight: 700;
  transition: transform 0.12s ease, filter 0.12s ease;
}

button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

button.danger {
  width: 100%;
  padding-inline: 16px;
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(51, 65, 85, 0.6);
}

.toolbar {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 10px;
}

select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0b1220;
  color: #e2e8f0;
  font-size: 14px;
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-secondary,
.btn-copy,
.btn-warning,
.btn-success {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.btn-secondary {
  background: #334155;
}

.btn-copy {
  background: #0ea5e9;
}

.btn-warning {
  background: #d97706;
}

.btn-success {
  background: #059669;
}

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.status-active {
  background: rgba(22, 163, 74, 0.2);
  color: #86efac;
}

.status-revoked,
.status-disabled {
  background: rgba(220, 38, 38, 0.18);
  color: #fecaca;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 900px;
}

th,
td {
  border-bottom: 1px solid #1f2937;
  text-align: left;
  padding: 10px;
}

th {
  background: rgba(15, 23, 42, 0.95);
  color: #bfdbfe;
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(30, 41, 59, 0.45);
}

.msg {
  color: #93c5fd;
  margin: 10px 0 0;
  min-height: 18px;
  font-size: 13px;
}

.updates-status {
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(71, 85, 105, 0.55);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.updates-status p {
  margin: 0;
  font-size: 12px;
  color: #cbd5e1;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.6);
  z-index: 50;
  padding: 16px;
}

.modal-card {
  width: min(560px, 100%);
  margin: 0;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
  font-size: 13px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 70;
}

.toast {
  min-width: 260px;
  max-width: 380px;
  border-radius: 10px;
  border: 1px solid rgba(71, 85, 105, 0.6);
  background: rgba(15, 23, 42, 0.95);
  padding: 10px 12px;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.4);
  color: #dbeafe;
  font-size: 12px;
}

.toast.success {
  border-color: rgba(5, 150, 105, 0.7);
}

.toast.error {
  border-color: rgba(220, 38, 38, 0.7);
}

.toast.info {
  border-color: rgba(37, 99, 235, 0.7);
}

.loading {
  opacity: 0.65;
  pointer-events: none;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-radius: 0;
    border-left: 1px solid rgba(71, 85, 105, 0.45);
    border-right: 1px solid rgba(71, 85, 105, 0.45);
    border-top: 1px solid rgba(71, 85, 105, 0.45);
    border-bottom: 1px solid rgba(71, 85, 105, 0.45);
  }

  .sidebar-title,
  .sidebar .danger {
    grid-column: 1 / -1;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

  .updates-status {
    grid-template-columns: 1fr;
  }

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

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .field-span-2 {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .container {
    padding: 0;
  }

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

  .content-area {
    padding: 12px;
  }

  .page-header {
    padding: 16px 12px 8px;
  }

  #loginCard {
    margin: 0 12px 16px;
  }

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

  .grid,
  .form-stack {
    grid-template-columns: 1fr;
  }

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

  .field-span-2 {
    grid-column: auto;
  }
}
