:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #182235;
  --muted: #68758a;
  --border: #dfe6ef;
  --primary: #1f5eff;
  --primary-2: #1748c9;
  --success: #14845f;
  --danger: #c53b42;
  --warning: #b7780b;
  --nav: #101827;
  --shadow: 0 10px 30px rgba(15, 23, 42, .07);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: embed; }

.topbar {
  height: 68px;
  background: var(--nav);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 900; font-size: 20px;
}
.brand-title { font-weight: 850; letter-spacing: .7px; }
.brand-subtitle { color: #97a6bc; font-size: 11px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-pill { color: #d6dfec; font-size: 13px; }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 14px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  transition: .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: inherit; border-color: rgba(255,255,255,.2); }
.btn-small { padding: 6px 10px; font-size: 12px; }

.input, .select {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  outline: none;
}
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,94,255,.08); }
label.field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.status-online { background: var(--success); }
.status-offline { background: var(--danger); }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 800;
  background: #edf2f7; color: #536174;
}
.badge-success { background: #e8f7f0; color: var(--success); }
.badge-danger { background: #fdecee; color: var(--danger); }
.badge-warning { background: #fff4dc; color: var(--warning); }
.badge-primary { background: #eaf0ff; color: var(--primary); }

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 12px 14px; text-align: right; border-bottom: 1px solid #edf1f6; vertical-align: middle; }
th { color: #536174; background: #f8fafc; font-size: 12px; position: sticky; top: 0; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }

.empty {
  padding: 38px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #ccd6e3;
  border-radius: 14px;
  background: #fff;
}

.toast-stack { position: fixed; left: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; }
.toast {
  min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 11px;
  color: #fff; box-shadow: 0 8px 25px rgba(0,0,0,.18); font-size: 13px;
  background: #344054;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(8,15,28,.58);
  display: grid; place-items: center; padding: 18px;
}
.modal {
  width: min(760px, 100%); max-height: 90vh; overflow: auto;
  background: #fff; border-radius: 18px; box-shadow: 0 25px 70px rgba(0,0,0,.3);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-start; }

@media (max-width: 720px) {
  .topbar { padding: 0 12px; }
  .brand-subtitle { display: none; }
  .user-pill { display: none; }
}
