/* ======================================
   Dashboard ERP DPG — Stylesheet
   ====================================== */
:root {
  --brand-blue: #3b5066;
  --brand-blue-dark: #2c3e54;
  --brand-coral: #f5a623;
  --bg: #f6f7f9;
  --bg-alt: #eef0f4;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --sidebar: #2c3e54;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #7a8ba0;
  --text: #1a2433;
  --muted: #64748b;
  --border: #e4e8ee;
  --border-soft: #eef0f4;
  --accent-soft: #fef3d8;
  --good: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --info: #3b82f6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* SIDEBAR */
aside.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 24px 0 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}
.brand {
  padding: 0 20px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--brand-coral);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.brand-text h1 { font-size: 14px; font-weight: 700; color: #fff; }
.brand-text small { font-size: 11px; color: var(--sidebar-muted); }

.group-label {
  font-size: 10px;
  text-transform: uppercase;
  padding: 14px 20px 6px;
  color: var(--sidebar-muted);
  letter-spacing: 1.5px;
  font-weight: 600;
}
aside.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.18s;
}
aside.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
aside.sidebar nav a:hover { background: rgba(255,255,255,0.04); color: #fff; }
aside.sidebar nav a.active {
  background: rgba(245,166,35,0.12);
  color: #fff;
  border-left-color: var(--brand-coral);
}
aside.sidebar nav a.active svg { opacity: 1; color: var(--brand-coral); }
aside.sidebar nav a .lbl { flex: 1; }
aside.sidebar nav a .chevron {
  width: 14px; height: 14px;
  opacity: 0.55;
  transition: transform 0.22s ease;
}
aside.sidebar nav a.expanded .chevron { transform: rotate(90deg); }
aside.sidebar nav a .ext { margin-left: auto; opacity: 0.5; font-size: 10px; }

.sub-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.sub-menu.open {
  max-height: 500px;
  background: rgba(0,0,0,0.22);
}
.sub-menu a {
  padding: 9px 20px 9px 44px !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  color: #95a4ba !important;
  gap: 10px !important;
  border-left: 3px solid transparent;
}
.sub-menu a svg { width: 15px !important; height: 15px !important; opacity: 0.65; flex-shrink: 0; }
.sub-menu a:hover { color: #fff !important; background: rgba(255,255,255,0.04); }
.sub-menu a:hover svg { opacity: 1; }
.sub-menu a.active {
  background: rgba(245,166,35,0.10) !important;
  color: #fff !important;
  border-left-color: var(--brand-coral) !important;
}
.sub-menu a.active svg { opacity: 1; color: var(--brand-coral); }

/* MAIN */
main.content { flex: 1; padding: 26px 32px; overflow-y: auto; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.topbar h2 { font-size: 22px; font-weight: 700; }
.topbar .user {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel);
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-coral);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.topbar .user-info b { color: var(--text); display: block; font-size: 12.5px; }
.topbar .user-info small { font-size: 11px; }
.topbar .logout {
  margin-left: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--bad);
  border: 1px solid #fecaca;
  background: transparent;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}
.topbar .logout:hover { background: #fee2e2; }

/* Section */
.section {
  background: var(--panel);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 18px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 1px 2px rgba(15,23,42,0.03);
}
.section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--brand-coral);
}
.kpi .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.kpi .value { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 6px; }
.kpi .delta { font-size: 11px; margin-top: 4px; color: var(--good); font-weight: 600; }
.kpi .delta.down { color: var(--bad); }

/* Tables */
table { width: 100%; font-size: 13px; border-collapse: separate; border-spacing: 0; }
table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-alt);
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
table th:first-child { border-radius: 8px 0 0 8px; }
table th:last-child { border-radius: 0 8px 8px 0; }
table td { padding: 12px; border-bottom: 1px solid var(--border-soft); }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--panel-soft); }

/* Badges */
.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}
.badge.green { background: #d1fae5; color: #065f46; }
.badge.yellow { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.coral { background: #ffe4dd; color: #9a3412; }
.badge.gray { background: #f1f5f9; color: #475569; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Forms */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.form-row input[type=text],
.form-row input[type=email],
.form-row input[type=password],
.form-row input[type=number],
.form-row input[type=date],
.form-row input[type=file],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--brand-coral);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.15);
}
.form-row textarea { min-height: 80px; resize: vertical; }
.form-row small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-primary { background: var(--brand-coral); color: #fff; }
.btn-primary:hover { background: #d88a17; }
.btn-secondary { background: var(--bg-alt); color: var(--text); }
.btn-secondary:hover { background: #dde2eb; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 11px; }

/* Flash */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 13px;
  border-left: 4px solid;
}
.flash.success { background: #d1fae5; color: #065f46; border-color: #065f46; }
.flash.error { background: #fee2e2; color: #991b1b; border-color: #991b1b; }
.flash.info { background: #dbeafe; color: #1e40af; border-color: #1e40af; }
.flash.warn { background: #fef3c7; color: #92400e; border-color: #92400e; }

/* Login page */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
  padding: 20px;
}
.login-card {
  background: var(--panel);
  padding: 36px 32px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.login-card .brand-logo { margin: 0 auto 16px; width: 56px; height: 56px; border-radius: 14px; }
.login-card h1 { text-align: center; font-size: 18px; margin-bottom: 6px; }
.login-card p.sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }

/* Note banner */
.note {
  background: #fef3c7;
  border-left: 4px solid #ca8a04;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 22px;
  color: #713f12;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty svg { width: 48px; height: 48px; opacity: 0.4; margin-bottom: 12px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: -1px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand-coral); border-bottom-color: var(--brand-coral); }
