:root {
  --navy: #0B1F3A;
  --navy-light: #132B4D;
  --accent: #1D4ED8;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #0F172A;
  --muted: #64748B;
}
html.dark {
  --bg: #020617;
  --surface: #0F172A;
  --border: #1E293B;
  --text: #F1F5F9;
  --muted: #94A3B8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 18px; }
.top-bar { background: var(--navy); color: #CBD5E1; font-size: 12px; padding: 7px 0; }
.top-bar .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Header & Public Nav */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand img { height: 40px; width: auto; border-radius: 6px; background: #fff; padding: 2px; }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 500; display: block; }
.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-links a { padding: 7px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--text); }
.nav-links a:hover, .nav-links a.active { background: var(--navy); color: #fff; }

/* ERP Shell */
.erp-shell { display: flex; min-height: 100vh; }
.erp-sidebar {
  width: 256px; background: var(--navy); color: #CBD5E1; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; transition: width .2s;
}
.erp-sidebar.collapsed { width: 68px; }
.erp-sidebar.collapsed .nav-label, .erp-sidebar.collapsed .user-meta { display: none; }
.erp-sidebar-brand { height: 64px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #1E293B; }
.erp-nav { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.erp-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: #CBD5E1; }
.erp-nav a:hover { background: var(--navy-light); color: #fff; }
.erp-nav a.active { background: #2563EB; color: #fff; }
.erp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.erp-topbar {
  height: 64px; background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 22px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30;
}
.erp-content { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; }

/* Cards, Grid, Buttons, Inputs, Tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }

.stat-card { border-top: 4px solid var(--navy); }
.stat-card.green { border-top-color: #059669; }
.stat-card.blue { border-top-color: #2563EB; }
.stat-card.amber { border-top-color: #D97706; }
.stat-card.red { border-top-color: #E11D48; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.stat-val { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: .15s;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-light); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: rgba(148,163,184,.12); }
.btn-danger { background: #E11D48; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.input, select, textarea {
  width: 100%; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit;
}
label.lbl { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); background: rgba(148,163,184,.08); }
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-green { background: #DCFCE7; color: #166534; }
.badge-blue { background: #DBEAFE; color: #1E40AF; }
.badge-teal { background: #CCFBF1; color: #115E59; }
.badge-indigo { background: #E0E7FF; color: #3730A3; }
.badge-amber { background: #FEF3C7; color: #92400E; }
.badge-red { background: #FFE4E6; color: #9F1239; }
.badge-gray { background: #E2E8F0; color: #334155; }

.alert { padding: 11px 15px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; font-weight: 500; }
.alert-success { background: #ECFDF5; border: 1px solid #10B981; color: #065F46; }
.alert-error { background: #FFF1F2; border: 1px solid #F43F5E; color: #9F1239; }
.alert-info { background: #EFF6FF; border: 1px solid #3B82F6; color: #1E40AF; }

.hero { background: linear-gradient(135deg, #0B1F3A, #132B4D, #1E3A8A); color: #fff; padding: 56px 0; }
.footer { background: var(--navy); color: #CBD5E1; padding: 40px 0 24px; margin-top: 56px; font-size: 13px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 22px; }
.breadcrumbs { font-size: 12px; color: var(--muted); margin-bottom: 3px; }

@media (max-width: 900px) {
  .erp-sidebar { display: none; position: fixed; left: 0; top: 0; z-index: 60; }
  .erp-sidebar.mobile-open { display: flex; }
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; width: 100%; padding: 10px 0; }
}
@media print { .no-print { display: none !important; } }
