:root {
  --bg: #0b1626;
  --surface: #112238;
  --surface-2: #172d49;
  --border: rgba(255, 255, 255, 0.1);
  --navy: #0f233c;
  --orange: #f47b1e;
  --green: #3fa438;
  --red: #ef4444;
  --text: #f8fafc;
  --muted: #94a3b8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid rgba(244, 123, 30, 0.35);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

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

.logo-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--navy);
  border: 2px solid var(--orange);
  flex-shrink: 0;
}

.logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
}

.wordmark {
  font-size: 21px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.8px;
}

.wordmark .x {
  color: var(--orange);
}

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

.sidebar {
  width: 245px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 11px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-btn.active,
.nav-btn:hover {
  background: var(--surface-2);
  color: #fff;
}

.nav-btn.active {
  border-left: 3px solid var(--orange);
}

.main {
  flex: 1;
  padding: 20px 24px;
  overflow-x: hidden;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 800;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.pill.ok {
  color: #86efac;
  border-color: rgba(63, 164, 56, 0.5);
}

.pill.warn {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.5);
}

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

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.kpi-val {
  font-size: 28px;
  font-weight: 900;
  margin-top: 6px;
}

.kpi-lbl {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

label.field-lbl {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 10px 0 5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: #fff;
  font-size: 13.5px;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

.btn {
  padding: 10px 15px;
  border-radius: 10px;
  border: none;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.btn-orange {
  background: var(--orange);
  color: #fff;
}

.btn-dark {
  background: var(--surface-2);
  color: #fff;
  border: 1px solid var(--border);
}

.btn-green {
  background: var(--green);
  color: #fff;
}

.btn-red {
  background: var(--red);
  color: #fff;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11.5px;
}

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

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 11px;
  margin-top: 10px;
  border: 1px solid var(--border);
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--orange);
  color: #fff;
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 13px;
  z-index: 99;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

@media (max-width: 820px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .nav-btn {
    white-space: nowrap;
    width: auto;
  }
}
