:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --shadow: 0 16px 40px rgba(31, 41, 55, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
.shell { min-height: 100vh; display: flex; }
.sidebar {
  width: 260px;
  background: #101828;
  color: #eef4ff;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 4px 24px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 800;
}
.brand-name { font-weight: 750; font-size: 16px; }
.brand-sub { color: #b8c4d8; font-size: 12px; }
.nav { display: grid; gap: 6px; }
.nav a {
  padding: 10px 12px; border-radius: 8px; color: #cdd7e7; font-weight: 650;
}
.nav a.active, .nav a:hover { background: #1d2939; color: #fff; }
.sidebar-footer {
  margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12);
  color: #cdd7e7; display: grid; gap: 8px; font-size: 13px;
}
.main { flex: 1; padding: 24px; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
h1, h2, p { margin: 0; }
h1 { font-size: 24px; font-weight: 760; letter-spacing: 0; }
h2 { font-size: 16px; font-weight: 760; letter-spacing: 0; }
.topbar p, .panel-head p, .muted, .help { color: var(--muted); font-size: 12px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.dashboard-money {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}
.metric, .panel, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric { padding: 14px 16px; display: grid; gap: 4px; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 650; }
.metric strong { font-size: 26px; line-height: 1.1; }
.metric.warn strong { color: var(--warn); }
.panel { margin-bottom: 16px; overflow: visible; }
.panel-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 16px; border-bottom: 1px solid var(--line);
}
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 900px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #475467; font-size: 12px; font-weight: 750; background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.badge {
  display: inline-flex; align-items: center; min-height: 24px;
  padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 750;
  background: #eef2f6; color: #344054;
}
.badge.active, .badge.ok { background: #dcfae6; color: var(--ok); }
.badge.suspended, .badge.read_only, .badge.expired { background: #fef0c7; color: var(--warn); }
.badge.blocked { background: #fee4e2; color: var(--danger); }
.btn {
  min-height: 36px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer;
}
.btn.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-strong); }
.field { display: grid; gap: 6px; }
label { color: #344054; font-size: 12px; font-weight: 750; }
input, select, textarea {
  width: 100%; min-height: 38px; padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--text); font: inherit; outline: none;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.grid-form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; padding: 16px;
}
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; }
.search { display: flex; gap: 8px; min-width: 320px; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; display: inline-flex; align-items: center; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute; right: 0; top: 42px; z-index: 10;
  width: 280px; display: grid; gap: 12px; padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
}
.dropdown-menu form { display: grid; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.dropdown-menu form:last-child { border-bottom: 0; padding-bottom: 0; }
.node-line { display: grid; gap: 4px; margin-bottom: 8px; }
.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: 5px 10px;
  font-size: 12px;
  color: var(--muted);
}
.snapshot-grid strong { color: var(--text); font-size: 13px; }
.dashboard-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  padding: 16px;
}
.dashboard-summary-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}
.dashboard-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.dashboard-summary-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}
.alert {
  margin-bottom: 14px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 650;
}
.alert.success { border-color: #abefc6; color: var(--ok); background: #f6fef9; }
.alert.error { border-color: #fecdca; color: var(--danger); background: #fffbfa; }
.auth-main {
  min-height: 100vh; width: 100%; display: grid; place-items: center; padding: 24px;
}
.login-panel {
  width: min(880px, 100%); display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; align-items: center;
}
.login-copy h1 { font-size: 34px; margin-bottom: 8px; }
.login-copy p { color: var(--muted); font-size: 16px; }
.form-stack { padding: 18px; display: grid; gap: 12px; }

@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { width: 100%; min-height: auto; }
  .main { padding: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-money, .dashboard-summary-grid { grid-template-columns: 1fr; }
  .panel-head, .login-panel { display: grid; grid-template-columns: 1fr; }
  .grid-form { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .search { min-width: 0; width: 100%; }
}
