/* ─── Variables ──────────────────────────────────────────────── */
:root {
  --bg: #0d0f14;
  --bg2: #141720;
  --bg3: #1c2030;
  --border: #252a3a;
  --text: #e8eaf0;
  --text2: #8890a8;
  --accent: #5b8dee;
  --accent2: #7c3aed;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --cyan: #06b6d4;
  --sidebar-w: 240px;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ─── Layout ──────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform .25s;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.brand-name { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 13px; display: block; }
.brand-sub { font-size: 10px; color: var(--text2); }

.sidebar-nav { flex: 1; padding: 12px 10px; }

.nav-section-label {
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--text2);
  padding: 14px 8px 6px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text2);
  font-size: 13px;
  transition: all .15s;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(91,141,238,.15); color: var(--accent); }
.nav-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-cat { font-size: 12px; }
.nav-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.user-chip { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.user-name { display: block; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--text2); }
.logout-btn {
  color: var(--text2); text-decoration: none; font-size: 16px;
  padding: 4px; border-radius: 6px; transition: color .15s;
}
.logout-btn:hover { color: var(--red); }

/* ─── Main ────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.menu-toggle { display: none; background: none; border: none; color: var(--text2); font-size: 20px; cursor: pointer; }
.page-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.role-badge {
  padding: 3px 10px; border-radius: 20px; font-size: 11px;
  font-family: 'Syne', sans-serif; font-weight: 600; letter-spacing: .05em;
}
.role-admin { background: rgba(91,141,238,.15); color: var(--accent); }
.role-supervisor { background: rgba(16,185,129,.15); color: var(--green); }

.page-body { padding: 28px; flex: 1; }

/* ─── Flash ───────────────────────────────────────────────────── */
.flash {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 20px; display: flex; align-items: center; gap: 8px; font-size: 13px;
}
.flash-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: var(--green); }
.flash-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: var(--red); }
.flash-info { background: rgba(91,141,238,.1); border: 1px solid rgba(91,141,238,.3); color: var(--accent); }

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  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-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; }

/* ─── Grid ────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ─── Stat Cards ──────────────────────────────────────────────── */
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent-color, var(--accent));
}
.stat-value { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 28px; line-height: 1; }
.stat-label { font-size: 11px; color: var(--text2); margin-top: 4px; text-transform: uppercase; letter-spacing: .08em; }
.stat-sub { font-size: 12px; color: var(--text2); margin-top: 8px; }

/* ─── Progress ────────────────────────────────────────────────── */
.progress-bar-wrap {
  background: var(--bg3);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .6s ease;
}

/* ─── Category Progress Cards ─────────────────────────────────── */
.cat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: all .2s;
}
.cat-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cat-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.cat-name { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 13px; }
.cat-count { font-size: 11px; color: var(--text2); }
.cat-pct { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 20px; }

/* ─── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: 'Syne', sans-serif; font-weight: 600; font-size: 11px;
  letter-spacing: .08em; color: var(--text2); text-transform: uppercase;
}
td { padding: 12px 14px; border-bottom: 1px solid rgba(37,42,58,.5); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ─── Status Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px;
  font-family: 'Syne', sans-serif; font-weight: 600;
}
.badge-pending  { background: rgba(245,158,11,.12); color: var(--yellow); }
.badge-approved { background: rgba(16,185,129,.12); color: var(--green); }
.badge-rejected { background: rgba(239,68,68,.12);  color: var(--red); }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px; border: none;
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: all .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #4a7de0; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #0ea271; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #dc2626; }
.btn-ghost { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* ─── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 6px; letter-spacing: .04em; }
input[type=text], input[type=email], input[type=password], input[type=url],
textarea, select {
  width: 100%; padding: 10px 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 13px;
  transition: border .15s;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
select option { background: var(--bg3); }

/* ─── Milestone Detail ────────────────────────────────────────── */
.milestone-row {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s;
}
.milestone-row:hover { border-color: var(--accent); }
.milestone-title { flex: 1; font-weight: 500; font-size: 13px; }
.milestone-progress { font-size: 12px; color: var(--text2); white-space: nowrap; }
.milestone-pct { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; color: var(--accent); }
.milestone-badges { display: flex; gap: 4px; }

/* ─── Submission Card ─────────────────────────────────────────── */
.submission-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.submission-card.approved { border-left: 3px solid var(--green); }
.submission-card.pending  { border-left: 3px solid var(--yellow); }
.submission-card.rejected { border-left: 3px solid var(--red); }
.sub-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sub-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; }
.sub-date { font-size: 11px; color: var(--text2); }
.sub-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sub-link {
  padding: 4px 10px; border-radius: 5px; font-size: 11px;
  background: var(--bg3); color: var(--text2); text-decoration: none;
  border: 1px solid var(--border); transition: color .15s;
}
.sub-link:hover { color: var(--accent); }
.sub-comment {
  background: var(--bg3); border-radius: 6px; padding: 10px 14px;
  font-size: 12px; color: var(--text2); margin-top: 10px;
  border-left: 2px solid var(--accent);
}

/* ─── Login Page ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 50%, rgba(91,141,238,.08) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(124,58,237,.08) 0%, transparent 60%);
}
.login-box {
  width: 380px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo .brand-icon {
  margin: 0 auto 10px;
  width: 48px; height: 48px; font-size: 22px;
}
.login-logo h2 { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 18px; }
.login-logo p { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* ─── Misc ────────────────────────────────────────────────────── */
.section-title {
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px;
  margin-bottom: 16px;
}
.text-muted { color: var(--text2); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-accent { color: var(--accent); }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
