/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  border: 1px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-glow); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-outline { background: var(--surface-card); border-color: var(--surface-border); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--brand-violet); color: var(--brand-violet); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-card-alt); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Cards */
.card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.card-flat { box-shadow: none; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); margin-bottom: var(--space-5); }
@media (max-width: 1200px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card .stat-icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-gradient-soft); color: var(--brand-violet);
  margin-bottom: var(--space-4);
}
.stat-card .stat-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; margin-bottom: 6px; }
.stat-card .stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 800; }
.stat-card .stat-value .unit { font-size: 15px; color: var(--text-muted); font-weight: 600; }
.stat-card .stat-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; margin-top: var(--space-3); padding: 3px 8px; border-radius: var(--radius-pill); }
.stat-delta.up { color: var(--success); background: var(--success-bg); }
.stat-delta.down { color: var(--danger); background: var(--danger-bg); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); text-transform: capitalize; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { color: var(--success); background: var(--success-bg); }
.badge-danger { color: var(--danger); background: var(--danger-bg); }
.badge-warning { color: var(--warning); background: var(--warning-bg); }
.badge-info { color: var(--info); background: var(--info-bg); }
.badge-neutral { color: var(--neutral); background: var(--neutral-bg); }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--surface-border); background: var(--surface-card); }
table.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 700; padding: 14px 18px; border-bottom: 1px solid var(--surface-border);
  background: var(--surface-card-alt);
  white-space: nowrap;
}
.data-table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--surface-border-soft); font-size: 13.5px; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: var(--surface-card-alt); }
.cell-strong { font-weight: 700; color: var(--text-primary); }
.cell-muted { color: var(--text-muted); font-size: 12.5px; }
.cell-mono { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; color: var(--text-secondary); }

/* Filters bar */
.filters-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-bottom: var(--space-4); }
.select, .input {
  padding: 9px 14px; border-radius: var(--radius-sm); border: 1px solid var(--surface-border);
  background: var(--surface-card); color: var(--text-primary); font-size: 13px; font-weight: 600;
}
.select:focus, .input:focus { outline: none; border-color: var(--brand-violet); }

/* Tabs */
.tabs { display: flex; gap: 6px; background: var(--surface-card-alt); border: 1px solid var(--surface-border); padding: 5px; border-radius: var(--radius-pill); width: fit-content; margin-bottom: var(--space-5); }
.tab { padding: 8px 16px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 700; color: var(--text-secondary); }
.tab.active { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-glow); }

/* Panel grid */
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--space-5); }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }

/* Progress bars (permission matrix / rates) */
.bar-track { width: 100%; height: 6px; border-radius: var(--radius-pill); background: var(--surface-border-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--radius-pill); background: var(--brand-gradient); }

/* Activity list */
.activity-item { display: flex; align-items: center; gap: var(--space-3); padding: 12px 0; border-bottom: 1px solid var(--surface-border-soft); }
.activity-item:last-child { border-bottom: none; }
.activity-ic { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.activity-meta { flex: 1; min-width: 0; }
.activity-meta .t1 { font-weight: 700; font-size: 13px; }
.activity-meta .t2 { font-size: 11.5px; color: var(--text-muted); }
.activity-amt { font-family: var(--font-display); font-weight: 800; font-size: 13.5px; }

/* Permission matrix */
.matrix-table th, .matrix-table td { text-align: center; }
.matrix-table th:first-child, .matrix-table td:first-child { text-align: left; }
.chk {
  width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--surface-border);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.chk.on { background: var(--brand-gradient); border-color: transparent; color: #fff; }

/* Empty state */
.empty-state { text-align: center; padding: var(--space-7) var(--space-5); color: var(--text-muted); }

/* Login page */
.auth-wrap { min-height: 100vh; display: flex; }
.auth-side {
  flex: 1; background: var(--brand-gradient); position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; padding: 60px;
  color: #fff;
}
.auth-side h1 { font-size: 34px; max-width: 420px; line-height: 1.25; }
.auth-side p { margin-top: var(--space-4); opacity: 0.85; max-width: 380px; font-size: 14px; }
.auth-form-col { width: 480px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-box { width: 100%; max-width: 360px; }
.field { margin-bottom: var(--space-4); }
.field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; color: var(--text-secondary); }
.field .input { width: 100%; padding: 12px 14px; }
@media (max-width: 900px) { .auth-side { display: none; } .auth-form-col { width: 100%; } }

/* Utility */
.flex { display: flex; align-items: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; } .mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.w-full { width: 100%; }
