:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --text-main: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --info: #0369a1;
  --info-bg: #e0f2fe;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* AUTH OVERLAY */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.auth-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 500px;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.28);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-badge {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-brand h1 {
  font-size: 18px;
  font-weight: 700;
}

.auth-brand p {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 13px;
}

.auth-form input,
.input-control,
select.input-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.quick-demo-bar {
  background: #f1f5f9;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}

.chip-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}

.chip-btn:hover {
  background: #e2e8f0;
}

/* LAYOUT */
.app-layout {
  display: grid;
  grid-template-columns: 265px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-sidebar);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 14px;
}

.sidebar-title {
  font-weight: 700;
  font-size: 16px;
}

.sidebar-subtitle {
  font-size: 11px;
  color: #94a3b8;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  text-align: left;
  background: transparent;
  color: #cbd5e1;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-name {
  font-weight: 700;
  font-size: 13px;
}

.user-role {
  font-size: 11px;
  color: #93c5fd;
}

.main-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 700;
}

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

.content-body {
  padding: 22px 24px;
}

/* CARDS & STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  margin: 6px 0 4px;
  color: var(--text-main);
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

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

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

.panel-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-bar .input-control {
  width: auto;
  min-width: 190px;
}

/* TABLES */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

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

table.data-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

table.data-table tr:hover td {
  background: #f8fafc;
}

/* BADGES & BUTTONS */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: #e2e8f0; color: #334155; }

.status-pill {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-online { background: var(--success-bg); color: var(--success); }
.status-info   { background: var(--info-bg); color: var(--info); }

.btn-primary,
.btn-outline,
.btn-danger,
.btn-success {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border-color: #cbd5e1; color: inherit; }
.btn-danger  { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }
.btn-success { background: var(--success-bg); color: var(--success); border-color: #bbf7d0; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; padding: 11px; }

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
}

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

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1100;
}

.modal-dialog {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.btn-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
}
