*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1a3c6b;
  --primary-light: #2756a0;
  --accent: #e8960c;
  --danger: #c0392b;
  --success: #1e8449;
  --warning: #b7770d;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --border: #dde3ea;
  --text: #1a2332;
  --text-muted: #5a6e84;
  --radius: 10px;
}
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--primary); color: white; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-logo { padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.sidebar-logo h1 { font-size: 20px; font-weight: 700; color: white; letter-spacing: 1px; }
.sidebar-logo p { font-size: 10px; opacity: 0.7; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 8px 16px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.5; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: rgba(255,255,255,0.85); font-size: 13px; transition: all 0.15s; border-left: 3px solid transparent; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.1); color: white; border-left-color: var(--accent); text-decoration: none; }
.nav-link .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 12px; }
.sidebar-user .username { font-weight: 600; color: white; }
.sidebar-user .role { opacity: 0.6; font-size: 11px; }
.main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; }
.topbar { background: white; border-bottom: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 24px; flex: 1; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.stat-card.danger { border-left: 4px solid var(--danger); }
.stat-card.warning { border-left: 4px solid var(--accent); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.info { border-left: 4px solid var(--primary); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-value.red { color: var(--danger); }
.stat-value.orange { color: var(--warning); }
.stat-value.green { color: var(--success); }
.stat-sub { font-size: 11px; color: var(--text-muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: all 0.15s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); color: white; text-decoration: none; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #d4870a; color: white; text-decoration: none; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #a93226; color: white; text-decoration: none; }
.btn-outline { background: white; color: var(--primary); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); color: var(--primary); text-decoration: none; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #196f3d; color: white; text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-input, input[type=text], input[type=email], input[type=date], input[type=number], input[type=password], select, textarea {
  height: 38px; padding: 0 11px; border: 1px solid var(--border); border-radius: 7px;
  background: white; color: var(--text); font-size: 13px; font-family: inherit; width: 100%;
  transition: border-color 0.15s;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,60,107,0.1); }
.form-error { color: var(--danger); font-size: 12px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: #f5f7fa; padding: 10px 12px; text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-success { background: #d5f5e3; color: #1e8449; }
.badge-warning { background: #fef9e7; color: #b7770d; border: 1px solid #f9e79f; }
.badge-danger { background: #fdedec; color: #c0392b; border: 1px solid #f5b7b1; }
.badge-info { background: #d6eaf8; color: #1a5276; }
.badge-muted { background: #eaecee; color: #5d6d7e; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 7px; font-size: 13px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #d5f5e3; color: #1e8449; border: 1px solid #a9dfbf; }
.alert-error { background: #fdedec; color: #922b21; border: 1px solid #f1948a; }
.alert-warning { background: #fef9e7; color: #9a7d0a; border: 1px solid #f9e79f; }
.alert-info { background: #d6eaf8; color: #1a5276; border: 1px solid #85c1e9; }

/* Auth pages */
.auth-page { min-height: 100vh; background: linear-gradient(135deg, #1a3c6b 0%, #2756a0 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-box { background: white; border-radius: 14px; padding: 36px 32px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo h1 { font-size: 26px; color: var(--primary); font-weight: 800; }
.auth-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.auth-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; color: var(--text); }

/* Filters bar */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.filter-bar select, .filter-bar input { height: 34px; font-size: 13px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* Section header */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 15px; font-weight: 600; color: var(--text); }

/* Detail view */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-size: 12px; }
.detail-value { font-weight: 500; font-size: 13px; text-align: right; }

/* Page grid */
.page-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.page-grid.three { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 900px) {
  .sidebar { width: 100%; height: auto; position: relative; }
  .main { margin-left: 0; }
  .form-grid, .page-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
