/* HACO CSMS — Branded Stylesheet */
/* Brand Palette extracted from haco.co.ke */

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

:root {
  --gold:       #B8922A;
  --gold-light: #D4A843;
  --gold-pale:  #F5EDD6;
  --gold-deep:  #8A6B1A;
  --navy:       #1C1F2E;
  --navy-mid:   #252A3E;
  --navy-light: #2E3450;
  --navy-border:#3A4060;
  --bg:         #F7F6F2;
  --white:      #FFFFFF;
  --border:     #E2DDD4;
  --border-lt:  #EDE9E0;
  --text-1:     #1A1A18;
  --text-2:     #3D3C38;
  --text-3:     #7A7870;
  --green:      #1E6B3C; --green-bg:#EAF3DE; --green-txt:#1E6B3C;
  --amber:      #B8730A; --amber-bg:#FEF3DC; --amber-txt:#8A5500;
  --red:        #C0392B; --red-bg:#FDECEA;   --red-txt:#A32D2D;
  --blue:       #1A4B8C; --blue-bg:#E6F0FB;  --blue-txt:#1A4B8C;
}

body { font-family: "DM Sans", sans-serif; background: var(--bg); color: var(--text-1); display: flex; height: 100vh; overflow: hidden; font-size: 14px; }

/* ── SIDEBAR ── */
.sidebar { width: 240px; min-width: 240px; background: var(--navy); display: flex; flex-direction: column; border-right: 1px solid var(--navy-border); overflow: hidden; }
.sidebar-head { padding: 20px 18px 16px; border-bottom: 1px solid var(--navy-border); display: flex; align-items: center; gap: 12px; }
.haco-mark { width: 36px; height: 36px; background: var(--gold); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.haco-mark svg { width: 22px; height: 22px; }
.brand { color: var(--gold-light); font-family: "Playfair Display", serif; font-size: 16px; font-weight: 700; letter-spacing: .04em; display: block; }
.sub { color: #6B7090; font-size: 10px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.sidebar > nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-group { margin-bottom: 4px; }
.nav-label-group { font-size: 10px; color: #4A5070; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: 10px 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #8890B0; font-size: 13px; font-weight: 400; margin-bottom: 1px; text-decoration: none; transition: background .15s, color .15s; border-left: 2px solid transparent; }
.nav-item:hover { background: var(--navy-light); color: #C8D0E8; }
.nav-item.active { background: rgba(184,146,42,.12); color: var(--gold-light); font-weight: 600; border-left-color: var(--gold); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.notif-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); display: inline-block; margin-left: auto; }
.sidebar-foot { padding: 12px 8px; border-top: 1px solid var(--navy-border); }
.user-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.user-av { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,var(--gold-deep),var(--gold-light)); display: flex; align-items: center; justify-content: center; color: var(--navy); font-size: 11px; font-weight: 700; flex-shrink: 0; }
.user-nm { color: #C8D0E8; font-size: 12px; font-weight: 600; }
.user-rl { color: #6B7090; font-size: 11px; }
.btn-logout { width: 100%; background: transparent; border: 1px solid var(--navy-border); color: #6B7090; border-radius: 6px; padding: 6px; font-size: 12px; cursor: pointer; font-family: "DM Sans", sans-serif; transition: all .15s; }
.btn-logout:hover { border-color: var(--red-txt); color: var(--red-txt); }

/* ── MAIN WRAP ── */
#main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── TOPBAR ── */
.topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 28px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; height: 64px; }
.page-title { font-size: 17px; font-weight: 700; color: var(--text-1); letter-spacing: -.02em; }
.page-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.topbar-right { display: flex; gap: 10px; align-items: center; }
.topbar-badge { background: var(--gold-pale); color: var(--gold-deep); border: 1px solid var(--gold-light); border-radius: 20px; padding: 5px 14px; font-size: 12px; font-weight: 600; }
.topbar-filters { display: flex; gap: 8px; align-items: center; }
.filter-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; font-family: "DM Sans", sans-serif; background: var(--white); cursor: pointer; color: var(--text-1); }

/* ── CONTENT ── */
.main-content { flex: 1; overflow-y: auto; padding: 24px 28px; }

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

/* ── METRIC CARDS ── */
.mcard { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; border-top: 3px solid var(--border); text-decoration: none; color: inherit; display: block; transition: box-shadow .15s; }
a.mcard.click:hover, .mcard.click:hover { box-shadow: 0 3px 14px rgba(0,0,0,.07); }
.kpi-gold { border-top-color: var(--gold) !important; }
.kpi-green { border-top-color: var(--green) !important; }
.kpi-red { border-top-color: var(--red) !important; }
.kpi-amber { border-top-color: var(--amber) !important; }
.mlabel { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; font-weight: 500; }
.mval { font-size: 27px; font-weight: 700; color: var(--text-1); line-height: 1.1; margin-bottom: 4px; }
.mval-unit { font-size: 16px; font-weight: 400; color: var(--text-3); }
.msub { font-size: 12px; color: var(--text-3); }
.mdrill { font-size: 11px; color: var(--gold); margin-top: 8px; font-weight: 500; }

/* ── PANELS ── */
.panel { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; margin-bottom: 14px; }
.panel.p-0 { padding: 0; overflow: hidden; }
.ptitle { font-size: 14px; font-weight: 600; color: var(--text-1); margin-bottom: 3px; }
.psub { font-size: 12px; color: var(--text-3); margin-bottom: 16px; }
.psub-inline { font-size: 11px; color: var(--text-3); }

/* ── TABLES ── */
.dt { width: 100%; border-collapse: collapse; font-size: 13px; }
.dt th { text-align: left; padding: 8px 12px; font-size: 11px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); background: #FAFAF8; }
.dt td { padding: 10px 12px; border-bottom: 1px solid var(--border-lt); color: var(--text-2); vertical-align: middle; }
.dt tr:last-child td { border-bottom: none; }
.dt tr.cl:hover td, .dt tr:hover td { background: #FAFAF8; cursor: pointer; }
.dt .b { font-weight: 600; color: var(--text-1); }
.dt .lk { font-weight: 600; color: var(--gold-deep); text-decoration: none; }
.dt .lk:hover { color: var(--gold); text-decoration: underline; }
.row-overdue { background: rgba(192,57,43,.03); }

/* ── BADGES ── */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.bg-green { background: var(--green-bg); color: var(--green-txt); }
.bg-amber { background: var(--amber-bg); color: var(--amber-txt); }
.bg-red { background: var(--red-bg); color: var(--red-txt); }
.bg-blue { background: var(--blue-bg); color: var(--blue-txt); }
.bg-gray { background: #F1EFE8; color: #5F5E5A; }
.bg-gold { background: var(--gold-pale); color: var(--gold-deep); }
.pill-b { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 20px; }
.pill-green { background: var(--green-bg); color: var(--green-txt); }
.pill-amber { background: var(--amber-bg); color: var(--amber-txt); }
.pill-red { background: var(--red-bg); color: var(--red-txt); }

/* ── PROGRESS BARS ── */
.prow { margin-bottom: 13px; }
.phdr { display: flex; justify-content: space-between; margin-bottom: 5px; }
.plbl { font-size: 12px; color: var(--text-2); }
.pval { font-size: 12px; font-weight: 600; }
.ptrack { height: 5px; background: var(--bg); border-radius: 3px; border: 1px solid var(--border-lt); }
.pfill { height: 100%; border-radius: 3px; }
.pfill-red { background: var(--red); }
.pfill-amber { background: var(--amber); }
.pfill-green { background: var(--green); }
.pfill-gold { background: var(--gold); }

/* ── FORMS ── */
.form-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 28px 32px; max-width: 760px; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.form-input, .form-select, .form-textarea { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: "DM Sans", sans-serif; color: var(--text-1); background: var(--white); outline: none; transition: border-color .15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--gold); }
.form-textarea { resize: vertical; min-height: 80px; }
.field-error { font-size: 11px; color: var(--red-txt); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── BUTTONS ── */
.btn { padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; font-family: "DM Sans", sans-serif; cursor: pointer; border: none; transition: all .15s; text-decoration: none; display: inline-block; }
.btn-gold { background: var(--gold); color: var(--white); }
.btn-gold:hover { background: var(--gold-deep); color: var(--white); }
.btn-sec { background: var(--bg); color: var(--text-1); border: 1px solid var(--border); }
.btn-sec:hover { background: var(--border-lt); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-full { width: 100%; text-align: center; padding: 12px; }

/* ── SEARCH BAR ── */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.si { flex: 1; min-width: 200px; padding: 9px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: "DM Sans", sans-serif; outline: none; background: var(--white); }
.si:focus { border-color: var(--gold); }
.fsel { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: "DM Sans", sans-serif; background: var(--white); cursor: pointer; color: var(--text-1); }
.filter-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }

/* ── ALERTS ── */
.alert { padding: 10px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: var(--green-bg); color: var(--green-txt); border: 1px solid #c3dbb5; }
.alert-error { background: var(--red-bg); color: var(--red-txt); border: 1px solid #f5c6c3; }

/* ── PAGINATION ── */
.pagination { display: flex; align-items: center; gap: 14px; margin-top: 16px; justify-content: flex-end; }
.page-btn { padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text-2); text-decoration: none; background: var(--white); }
.page-btn:hover { border-color: var(--gold); color: var(--gold-deep); }
.page-info { font-size: 12px; color: var(--text-3); }

/* ── UTILITIES ── */
.text-red { color: var(--red-txt); }
.text-green { color: var(--green-txt); }
.text-amber { color: var(--amber-txt); }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 11px; }
.fw-600 { font-weight: 600; }

/* ── LOGIN PAGE ── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--navy); font-family: "DM Sans", sans-serif; overflow: auto; }
.login-wrap { width: 100%; max-width: 420px; padding: 24px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.login-mark { width: 44px; height: 44px; background: var(--gold); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.login-brand-name { font-family: "Playfair Display", serif; font-size: 22px; font-weight: 700; color: var(--gold-light); letter-spacing: .04em; }
.login-brand-sub { font-size: 12px; color: #6B7090; letter-spacing: .02em; }
.login-card { background: var(--white); border-radius: 14px; padding: 32px; }
.login-heading { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-desc { font-size: 13px; color: var(--text-3); margin-bottom: 24px; }
.login-footer { text-align: center; font-size: 12px; color: #4A5070; margin-top: 20px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3d1c7; border-radius: 3px; }
