/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1a1a2e;
  --accent:  #e94560;
  --surface: #ffffff;
  --surface2: #f8f9fc;
  --surface3: #eef0f5;
  --border:  #e2e5ee;
  --text:    #1a1a2e;
  --text2:   #6b7280;
  --text3:   #9ca3af;
  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;
  --radius:  10px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,.10);
}
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--primary);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: 224px;
  min-height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo-text  { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: -.5px; }
.logo-sub   { font-size: 10px; color: rgba(255,255,255,.3); margin-top: 2px; text-transform: uppercase; letter-spacing: 1px; }
.sidebar-nav  { flex: 1; padding: 14px 10px; }
.nav-section  { margin-bottom: 20px; }
.nav-label    { font-size: 10px; font-weight: 600; color: rgba(255,255,255,.28); text-transform: uppercase; letter-spacing: 1.2px; padding: 0 8px; margin-bottom: 5px; }
.nav-item     { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: rgba(255,255,255,.55); font-size: 13px; font-weight: 500; transition: all .13s; margin-bottom: 1px; text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); text-decoration: none; }
.nav-item.active { background: var(--accent); color: #fff; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }

/* ── Main ───────────────────────────────────────────────────────── */
.main    { margin-left: 224px; flex: 1; min-height: 100vh; background: var(--surface2); }
.topbar  { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 26px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow); }
.topbar h1       { font-size: 17px; font-weight: 600; }
.topbar-actions  { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 22px 26px; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card       { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { font-size: 13.5px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.stat-grid  { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 10.5px; color: var(--text2); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-sub   { font-size: 11px; color: var(--text3); margin-top: 3px; }
.stat-value.success { color: var(--success); }
.stat-value.danger  { color: var(--danger); }
.stat-value.info    { color: var(--info); }
.stat-value.warning { color: var(--warning); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn          { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: 7px; border: none; cursor: pointer; font-size: 12.5px; font-weight: 500; transition: all .13s; text-decoration: none; white-space: nowrap; vertical-align: middle; }
.btn:hover    { text-decoration: none; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #c73651; color: #fff; }
.btn-secondary { background: var(--surface3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #dc2626; color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-sm       { padding: 4px 9px; font-size: 11.5px; }
.btn-xs       { padding: 2px 7px; font-size: 11px; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group    { margin-bottom: 13px; }
.form-label    { display: block; font-size: 11px; font-weight: 600; color: var(--text2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; }
.form-control  { width: 100%; padding: 7px 11px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; color: var(--text); background: var(--surface); outline: none; transition: border .13s; font-family: inherit; }
.form-control:focus { border-color: var(--accent); }
select.form-control { cursor: pointer; }
.form-row      { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; }
.form-text     { font-size: 11px; color: var(--text3); margin-top: 3px; }
.required      { color: var(--danger); }

/* ── Tables ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table      { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th         { text-align: left; padding: 9px 11px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text2); border-bottom: 2px solid var(--border); background: var(--surface2); white-space: nowrap; }
td         { padding: 9px 11px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }
tfoot td   { background: var(--surface2) !important; font-weight: 700; border-top: 2px solid var(--border); }
.text-right { text-align: right; }
.nowrap     { white-space: nowrap; }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge         { display: inline-block; padding: 2px 7px; border-radius: 20px; font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: var(--surface3); color: var(--text2); }
.badge-purple  { background: #ede9fe; color: #5b21b6; }
.badge-orange  { background: #ffedd5; color: #9a3412; }

/* ── Alerts ─────────────────────────────────────────────────────── */
.alert         { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── Misc ────────────────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 8px; }
.section-title  { font-size: 15px; font-weight: 600; }
.divider        { height: 1px; background: var(--border); margin: 16px 0; }
.filter-bar     { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar .form-control { width: auto; min-width: 130px; }
.info-note      { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 7px; padding: 9px 13px; font-size: 12px; color: #1e40af; margin-bottom: 12px; }
.section-divider { background: var(--surface2); border-radius: 7px; padding: 8px 14px; font-size: 12px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .6px; margin: 14px 0 10px; border-left: 3px solid var(--accent); }
.grand-total-box { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; }
.grand-total-box .label { font-size: 13px; font-weight: 600; color: #92400e; }
.grand-total-box .value { font-size: 26px; font-weight: 800; color: #c2410c; }
.profit-banner  { border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
.profit-banner.positive { background: linear-gradient(135deg,#d1fae5,#a7f3d0); border: 1px solid #6ee7b7; }
.profit-banner.negative { background: linear-gradient(135deg,#fee2e2,#fca5a5); border: 1px solid #f87171; }
.profit-label   { font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.profit-amount  { font-size: 32px; font-weight: 800; }
.profit-banner.positive .profit-amount { color: #065f46; }
.profit-banner.negative .profit-amount { color: #991b1b; }
.profit-sub     { font-size: 11px; color: #374151; margin-top: 4px; }
.week-nav       { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.week-display   { font-size: 13px; font-weight: 600; padding: 7px 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; min-width: 240px; text-align: center; }
.trainee-row td { background: #faf5ff !important; }
.trainee-label  { font-size: 10px; color: #7c3aed; font-weight: 600; background: #ede9fe; padding: 1px 5px; border-radius: 4px; margin-left: 4px; }
.empty-state    { text-align: center; padding: 36px; color: var(--text3); font-size: 13px; }

/* ── Login page ─────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary); }
.login-box  { background: var(--surface); border-radius: 14px; padding: 36px 32px; width: 360px; box-shadow: var(--shadow-md); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .t { font-size: 26px; font-weight: 800; color: var(--primary); }
.login-logo .s { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 100%; min-height: auto; position: relative; }
  .main    { margin-left: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
