:root {
  --sidebar-width: 260px;
  --topbar-height: 56px;
  --primary: #003366;
  --primary-light: #0055a5;
  --accent: #f0a500;
  --bg: #f4f6fb;
  --sidebar-bg: #0a1628;
  --sidebar-text: #a8b8d0;
  --sidebar-active: #0055a5;
}

* { box-sizing: border-box; }
body { background: var(--bg); font-family: 'Segoe UI', Arial, sans-serif; margin: 0; overflow-x: hidden; }

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-width);
  background: var(--sidebar-bg); display: flex; flex-direction: column;
  z-index: 1000; transition: transform 0.3s ease; overflow-y: auto;
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }

.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-logo {
  width: 42px; height: 42px; background: var(--primary-light); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff;
}
.brand-name { font-size: 18px; font-weight: 700; color: #fff; line-height: 1; }
.brand-sub  { font-size: 9px; color: var(--sidebar-text); line-height: 1.4; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 10px; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px;
  color: rgba(168,184,208,0.5); padding: 14px 8px 4px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none; font-size: 13.5px;
  transition: all 0.2s; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item i { font-size: 16px; width: 18px; flex-shrink: 0; }

.sidebar-footer { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,0.08); }

/* ─── Main ────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; transition: margin-left 0.3s ease; }
.main-content.expanded { margin-left: 0; }

.topbar {
  height: var(--topbar-height); background: #fff; display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 999;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }

.content-area { padding: 24px; }

/* ─── Cards ───────────────────────────────────────────────── */
.stat-card {
  background: #fff; border-radius: 14px; padding: 22px 24px;
  display: flex; align-items: center; gap: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06); border: none; transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.stat-value { font-size: 28px; font-weight: 700; color: #1a1a2e; line-height: 1; }
.stat-label { font-size: 12px; color: #888; margin-top: 3px; }

.card { border: none; border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.card-header { background: #fff; border-bottom: 1px solid #eee; border-radius: 14px 14px 0 0 !important; padding: 16px 20px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--primary); margin: 0; }

/* ─── Tables ──────────────────────────────────────────────── */
.table { font-size: 13.5px; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #888; border-top: none; }
.table-hover tbody tr:hover { background: #f0f4ff; }

/* ─── Status Badges ───────────────────────────────────────── */
.badge-pending     { background: #fff3cd; color: #856404; }
.badge-in_progress { background: #cfe2ff; color: #0a58ca; }
.badge-completed   { background: #d1e7dd; color: #146c43; }
.badge-cancelled   { background: #f8d7da; color: #842029; }
.badge-draft       { background: #e2e3e5; color: #41464b; }
.badge-submitted   { background: #cfe2ff; color: #0a58ca; }
.badge-approved    { background: #d1e7dd; color: #146c43; }

/* ─── Forms ───────────────────────────────────────────────── */
.form-label { font-size: 13px; font-weight: 500; }
.form-control, .form-select { font-size: 13.5px; border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(0,85,165,0.12); }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }

/* ─── Page Header ─────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--primary); margin: 0; }
.page-subtitle { font-size: 13px; color: #888; margin-top: 2px; }

/* ─── Work Form ───────────────────────────────────────────── */
.form-section { background: #fff; border-radius: 12px; padding: 22px; margin-bottom: 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.form-section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--primary); border-bottom: 2px solid var(--primary); padding-bottom: 8px; margin-bottom: 16px; }

/* ─── Certificate Preview ─────────────────────────────────── */
.cert-preview { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 30px; }

/* ─── Login ───────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0a1628 0%, #003366 100%); }
.login-card { background: #fff; border-radius: 20px; padding: 42px 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 48px; color: var(--primary); }
.login-logo h1 { font-size: 24px; font-weight: 800; color: var(--primary); margin: 6px 0 2px; }
.login-logo p { font-size: 12px; color: #888; }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}
