:root {
  --sidebar-bg: #0f1f15;
  --sidebar-w: 230px;
  --green: #1a7c4f;
  --green-dark: #155f3c;
  --green-light: #e8f5ee;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
  --border: #e5e7eb;
  --text: #1a1a2e;
  --muted: #6b7280;
  --bg: #f4f6f9;
  --white: #fff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', 'Manrope', sans-serif; background: var(--bg); color: var(--text);
       display: flex; min-height: 100vh; font-size: 14px; }
a { text-decoration: none; color: inherit; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--sidebar-bg);
  display: flex; flex-direction: column; height: 100vh;
  position: fixed; top: 0; left: 0; z-index: 50; overflow: hidden;
}
.sidebar-logo {
  padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-logo img { height: 42px; width: auto; object-fit: contain; }
.sidebar-logo-text { display: flex; align-items: center; gap: 10px; }
.sidebar-logo-text .logo-icon {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo-text strong { font-size: .95rem; font-weight: 800; color: #fff; display: block; }
.sidebar-logo-text span { font-size: .62rem; color: rgba(255,255,255,.45); }

.sidebar-nav {
  flex: 1; min-height: 0; overflow-y: auto; padding: 14px 10px;
  display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.nav-section { font-size: .62rem; font-weight: 800; text-transform: uppercase;
               letter-spacing: .08em; color: rgba(255,255,255,.25);
               padding: 10px 14px 4px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: 9px;
  font-size: .84rem; font-weight: 600; color: rgba(255,255,255,.6);
  cursor: pointer; transition: all .15s; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--green); color: #fff; }
.nav-item svg { flex-shrink: 0; width: 17px; height: 17px; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: .62rem; font-weight: 800; padding: 2px 7px; border-radius: 20px;
}
.nav-item .tag {
  margin-left: auto; background: rgba(255,255,255,.1); color: rgba(255,255,255,.45);
  font-size: .58rem; font-weight: 800; padding: 2px 7px; border-radius: 20px;
}
.nav-divider { height: 1px; background: rgba(255,255,255,.07); margin: 8px 0; }

/* ── Main ── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  height: 60px; display: flex; align-items: center; gap: 16px;
  padding: 0 28px; position: sticky; top: 0; z-index: 40;
}
.topbar-title { font-size: 1rem; font-weight: 800; color: var(--text); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-user {
  display: flex; align-items: center; gap: 9px;
  font-size: .84rem; font-weight: 700; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
}
.topbar-user .role-badge {
  font-size: .62rem; font-weight: 800; padding: 2px 8px; border-radius: 20px;
  background: var(--green-light); color: var(--green);
}
.topbar-user .role-badge.admin { background: #eff6ff; color: var(--blue); }
.btn-logout {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 14px; font-size: .8rem; font-weight: 700; color: var(--muted);
  cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 7px;
  transition: all .15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); background: #fef2f2; }

.content { flex: 1; padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; }
.page-title { font-size: 1.2rem; font-weight: 800; color: var(--text); }
.page-sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* ── Cards ── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; }
.card-body { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border);
             display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { font-size: .92rem; font-weight: 800; }

/* ── KPI grid ── */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.kpi-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.kpi-card .kpi-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.kpi-card .kpi-value { font-size: 1.8rem; font-weight: 900; color: var(--text); line-height: 1; }
.kpi-card .kpi-sub { font-size: .72rem; color: var(--muted); margin-top: 4px; }
.kpi-card.green .kpi-value { color: var(--green); }
.kpi-card.amber .kpi-value { color: var(--amber); }
.kpi-card.red   .kpi-value { color: var(--red);   }
.kpi-card.blue  .kpi-value { color: var(--blue);  }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
thead th { background: #f8f9fa; padding: 10px 14px; text-align: left;
           font-size: .7rem; font-weight: 800; color: var(--muted);
           text-transform: uppercase; letter-spacing: .04em;
           border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:hover { background: #fafcff; }
tbody td { padding: 12px 14px; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* ── Badges / pills ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px;
         font-size: .68rem; font-weight: 800; white-space: nowrap; }
.badge-green  { background: #e8f5ee; color: var(--green); }
.badge-amber  { background: #fef3c7; color: #b45309; }
.badge-red    { background: #fef2f2; color: var(--red); }
.badge-blue   { background: #eff6ff; color: var(--blue); }
.badge-purple { background: #f5f3ff; color: #7c3aed; }
.badge-gray   { background: #f1f3f5; color: var(--muted); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px;
       border-radius: 9px; font-size: .82rem; font-weight: 700; cursor: pointer;
       border: none; font-family: inherit; transition: all .15s; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--green); color: var(--green); }
.btn-danger { background: #fef2f2; color: var(--red); border: 1.5px solid #fecaca; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: .76rem; }
.btn-amber { background: #fef3c7; color: #b45309; border: 1.5px solid #fde68a; }
.btn-amber:hover { background: var(--amber); color: #fff; }
.btn-blue { background: #eff6ff; color: var(--blue); border: 1.5px solid #bfdbfe; }
.btn-blue:hover { background: var(--blue); color: #fff; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: .78rem; font-weight: 700; color: var(--text); }
.form-control {
  border: 1.5px solid var(--border); border-radius: 9px;
  padding: 9px 12px; font-size: .84rem; font-family: inherit;
  outline: none; transition: border-color .15s; width: 100%;
  background: var(--white);
}
.form-control:focus { border-color: var(--green); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

/* ── Filter bar ── */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
              padding: 14px 20px; border-bottom: 1px solid var(--border); background: #fafafa; }
.filter-bar select, .filter-bar input {
  border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 12px;
  font-size: .8rem; font-family: inherit; outline: none; background: var(--white);
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--green); }
.filter-bar .filter-search { flex: 1; min-width: 200px; }
.filter-spacer { flex: 1; }

/* ── Alerts ── */
.alert { padding: 10px 16px; border-radius: 8px; font-size: .84rem; font-weight: 600; }
.alert-success { background: #e8f5ee; color: var(--green); border: 1px solid #a7f3d0; }
.alert-error   { background: #fef2f2; color: var(--red);   border: 1px solid #fecaca; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 2px solid var(--border); gap: 0; }
.tab-btn {
  padding: 12px 20px; font-size: .84rem; font-weight: 700; color: var(--muted);
  background: none; border: none; cursor: pointer; font-family: inherit;
  border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all .15s;
  display: flex; align-items: center; gap: 7px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--green); border-bottom-color: var(--green); }
/* anchor-based tabs (e.g. ?tab= navigation) */
.tab-item {
  padding: 12px 20px; font-size: .84rem; font-weight: 700; color: var(--muted);
  text-decoration: none; background: none; cursor: pointer; font-family: inherit;
  border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all .15s;
  display: flex; align-items: center; gap: 7px;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--green); border-bottom-color: var(--green); }
.tab-badge {
  background: var(--green); color: #fff; font-size: .68rem; font-weight: 700;
  padding: 1px 7px; border-radius: 20px; line-height: 1.6;
}
.tab-panel { display: none; padding: 20px; }
.tab-panel.active { display: block; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 6px; padding: 16px 20px; border-top: 1px solid var(--border); }
.pg-btn { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 8px;
          background: var(--white); cursor: pointer; font-size: .82rem; font-weight: 700;
          display: flex; align-items: center; justify-content: center; transition: all .15s; }
.pg-btn:hover:not(:disabled) { border-color: var(--green); color: var(--green); }
.pg-btn.active { background: var(--green); color: #fff; border-color: var(--green); }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-info { font-size: .78rem; color: var(--muted); margin-left: auto; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--white); border-radius: 16px; padding: 28px;
  width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h3 { font-size: 1rem; font-weight: 800; }
.modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Status timeline ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 20px; position: relative; }
.tl-item:not(:last-child)::before {
  content: ''; position: absolute; left: 15px; top: 32px;
  width: 2px; height: calc(100% - 16px); background: var(--border);
}
.tl-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--green);
           display: flex; align-items: center; justify-content: center;
           color: #fff; font-size: .72rem; font-weight: 800; flex-shrink: 0; z-index: 1; }
.tl-body { flex: 1; padding-top: 4px; }
.tl-title { font-size: .84rem; font-weight: 700; }
.tl-meta { font-size: .72rem; color: var(--muted); margin-top: 2px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state svg { margin: 0 auto 12px; opacity: .3; display: block; }
.empty-state p { font-size: .9rem; font-weight: 600; }

/* ── Login page ── */
.login-wrap { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center;
              background: linear-gradient(135deg, #0f1f15 0%, #1a3d25 100%); padding: 20px; }
.login-card { background: var(--white); border-radius: 20px; padding: 40px;
              width: 100%; max-width: 420px; box-shadow: 0 24px 64px rgba(0,0,0,.25); }
.login-logo { display: flex; justify-content: center; margin-bottom: 28px; }
.login-logo img { height: 52px; width: auto; object-fit: contain; }
.login-logo-fallback {
  display: flex; align-items: center; gap: 10px;
}
.login-logo-fallback .licon {
  width: 40px; height: 40px; border-radius: 50%; background: var(--green);
  display: flex; align-items: center; justify-content: center;
}
.login-logo-fallback strong { font-size: 1.1rem; font-weight: 800; }
.login-logo-fallback span { font-size: .7rem; color: var(--muted); display: block; }
.login-title { font-size: 1.2rem; font-weight: 800; text-align: center; margin-bottom: 6px; }
.login-sub { font-size: .82rem; color: var(--muted); text-align: center; margin-bottom: 28px; }
.login-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--red);
               border-radius: 9px; padding: 10px 14px; font-size: .82rem; font-weight: 600; margin-bottom: 16px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon-wrap .form-control { padding-left: 38px; }

/* ── Responsive ── */
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
}

/* ── Scrollbar ── */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

/* ── Misc ── */
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.text-muted  { color: var(--muted); }
.fw-800 { font-weight: 800; }
.mt-16  { margin-top: 16px; }
.gap-10 { gap: 10px; }
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; }
