:root {
  --bg: #f4f5f6;
  --surface: #fff;
  --surface-2: #f8f9fa;
  --text: #16191c;
  --muted: #697178;
  --border: #e2e5e8;
  --primary: #166a45;
  --primary-soft: #e8f4ee;
  --success: #188553;
  --warning: #a66a0a;
  --danger: #c43d45;
  --shadow: 0 12px 36px rgba(20, 30, 25, 0.08);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #151719;
  --surface: #1c1f22;
  --surface-2: #22262a;
  --text: #f0f2f3;
  --muted: #9ba3aa;
  --border: #30353a;
  --primary: #50c58a;
  --primary-soft: #19382a;
  --success: #53c98e;
  --warning: #e0a543;
  --danger: #ee747a;
  --shadow: 0 14px 42px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
.shell {
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 26px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: var(--surface);
  border-radius: 11px;
  font-weight: 800;
}
.brand span:last-child {
  display: flex;
  flex-direction: column;
}
.brand small,
.account small {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.sidebar nav {
  display: grid;
  gap: 3px;
}
.sidebar nav button {
  border: 0;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 550;
}
.sidebar nav button:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sidebar nav button.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.account {
  margin-top: auto;
  padding: 16px 10px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.account span {
  display: flex;
  flex-direction: column;
}
.main {
  margin-left: 248px;
  min-height: 100vh;
}
.topbar {
  height: 96px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
}
.topbar h1 {
  font-size: 22px;
  margin: 0;
}
.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
}
.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
}
.status.online i {
  background: var(--success);
}
.content {
  padding: 28px 32px 48px;
  max-width: 1500px;
  margin: 0 auto;
}
.icon-button,
.ghost,
.secondary,
.danger,
.primary {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--surface);
  font-weight: 600;
}
.icon-button {
  padding: 8px 11px;
}
.primary {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}
.secondary:hover,
.icon-button:hover,
.ghost:hover {
  background: var(--surface-2);
}
.danger {
  color: var(--danger);
  background: transparent;
}
.full {
  width: 100%;
}
.mobile-menu {
  display: none;
}
.grid {
  display: grid;
  gap: 16px;
}
.metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
}
.metric {
  padding: 18px;
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.metric strong {
  display: block;
  font-size: 27px;
  margin-top: 8px;
  letter-spacing: -0.03em;
}
.panel {
  padding: 20px;
}
.panel h2 {
  font-size: 15px;
  margin: 0 0 16px;
}
.overview-grid {
  grid-template-columns: 1.5fr 1fr;
  margin-top: 16px;
}
.insights {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
}
.insight strong {
  display: block;
  margin-bottom: 5px;
}
.insight span {
  color: var(--muted);
  font-size: 13px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar input,
.toolbar select {
  max-width: 260px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  padding: 13px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-2);
}
tr:last-child td {
  border-bottom: 0;
}
.table-actions {
  display: flex;
  gap: 7px;
}
.table-actions button {
  padding: 6px 9px;
  font-size: 12px;
}
.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 650;
  background: var(--surface-2);
  color: var(--muted);
}
.badge.success {
  background: var(--primary-soft);
  color: var(--success);
}
.badge.danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.badge.warning {
  background: color-mix(in srgb, var(--warning) 13%, transparent);
  color: var(--warning);
}
.list {
  display: grid;
}
.list-item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child {
  border-bottom: 0;
}
.list-item > div {
  min-width: 0;
  flex: 1;
}
.list-item strong,
.list-item span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.empty,
.loading {
  text-align: center;
  padding: 48px;
  color: var(--muted);
}
.empty strong {
  color: var(--text);
}
.empty p {
  margin: 6px 0;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 11px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea {
  min-height: 110px;
  resize: vertical;
}
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.check {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 7px 9px;
  border-radius: 7px;
  font-weight: 500;
}
.check input {
  width: auto;
}
.dialog {
  width: min(720px, calc(100% - 24px));
  max-height: 90vh;
  overflow: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.dialog::backdrop {
  background: #0b0d0f99;
}
.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 {
  margin: 0;
  font-size: 17px;
}
.dialog-body {
  padding: 20px;
}
.dialog-actions {
  border: 0;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
  gap: 9px;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  padding: 12px 16px;
  border-radius: 9px;
  background: var(--text);
  color: var(--surface);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
}
.toast.show {
  transform: none;
  opacity: 1;
}
.toast.error {
  background: var(--danger);
  color: #fff;
}
.backdrop {
  display: none;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 0, var(--primary-soft), transparent 38%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.login-brand {
  padding: 0 0 35px;
}
.login-card h1 {
  margin: 0 0 7px;
  font-size: 25px;
}
.login-card > div > p {
  color: var(--muted);
  margin: 0 0 28px;
}
.login-card form {
  display: grid;
  gap: 16px;
}
.form-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 12px;
}
.switch {
  position: relative;
  width: 38px;
  height: 22px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: var(--border);
}
.switch span:before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + span {
  background: var(--primary);
}
.switch input:checked + span:before {
  transform: translateX(16px);
}
@media (max-width: 1050px) {
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }
  .overview-grid {
    grid-template-columns: 1fr;
  }
  .insights {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 760px) {
  .sidebar {
    transform: translateX(-100%);
    transition: 0.2s;
  }
  .sidebar.open {
    transform: none;
  }
  .backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: #0007;
    z-index: 15;
  }
  .main {
    margin-left: 0;
  }
  .topbar {
    height: 82px;
    padding: 0 16px;
  }
  .mobile-menu {
    display: block;
  }
  .topbar p {
    display: none;
  }
  .content {
    padding: 20px 14px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .insights {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .wide {
    grid-column: auto;
  }
  .status {
    font-size: 0;
    padding: 10px;
  }
  .table-actions {
    flex-direction: column;
  }
  .section-head {
    align-items: flex-start;
  }
  .toolbar {
    flex-wrap: wrap;
  }
}
