/* ============================================================
   RAW FINANCE — SHARED STYLESHEET
   Edit colour variables at the top to rebrand instantly.
   ============================================================ */

/* ── CSS Variables (Brand Colours) ────────────────────────── */
:root {
  --navy:        #0b1f44;
  --navy-dark:   #061630;
  --navy-mid:    #142d5e;
  --orange:      #f5731e;
  --orange-dark: #d45e0e;
  --white:       #ffffff;
  --bg:          #f0f4fa;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text-main:   #1a202c;
  --text-sub:    #4a5568;
  --text-muted:  #9aa5b4;
  --green:       #27500a;
  --green-bg:    #eaf3de;
  --red:         #791f1f;
  --red-bg:      #fcebeb;
  --amber:       #633806;
  --amber-bg:    #faeeda;
  --blue:        #0c447c;
  --blue-bg:     #e6f1fb;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 2px 16px rgba(11,31,68,.08);
  --nav-width:   220px;
  --top-height:  72px;
  --font:        'DM Sans', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); color: var(--text-main); background: var(--bg); font-size: 14px; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); font-size: 13px; }

/* ── Google Font import ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500&family=Cormorant+Garamond:wght@300;600&display=swap');

/* ─────────────────────────────────────────────────────────────
   LAYOUT  (topbar + sidenav + main)
   ───────────────────────────────────────────────────────────── */
#app-nav { display: contents; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-height);
  background: var(--navy); z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px 0 16px;
  border-bottom: 3px solid var(--orange);
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-logo  { height: 68px; filter: brightness(0) invert(1); }
.topbar-divider { width: 1px; height: 22px; background: rgba(255,255,255,.2); }
.topbar-title { font-size: 15px; font-weight: 500; color: rgba(255,255,255,.8); letter-spacing: .3px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user  { font-size: 13px; color: rgba(255,255,255,.5); }
.btn-logout   { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
                color: rgba(255,255,255,.8); padding: 5px 12px; border-radius: 6px; font-size: 12px;
                transition: background .15s; }
.btn-logout:hover { background: rgba(255,255,255,.15); }

.sidenav {
  position: fixed; top: var(--top-height); left: 0; bottom: 0;
  width: var(--nav-width); background: var(--navy-dark);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 0 16px; overflow-y: auto; z-index: 90;
}
.sidenav-links { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 7px; font-size: 13px; font-weight: 400;
  color: rgba(255,255,255,.55); transition: all .15s;
}
.nav-link:hover  { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.nav-link.active { background: var(--orange); color: #fff; font-weight: 500; }
.nav-icon        { font-size: 14px; width: 18px; text-align: center; }
.sidenav-footer  { padding: 0 16px; font-size: 10px; color: rgba(255,255,255,.2); }

.main-content {
  margin-top: var(--top-height);
  margin-left: var(--nav-width);
  padding: 28px 28px;
  min-height: calc(100vh - var(--top-height));
}

.page-header { margin-bottom: 22px; }
.page-title  { font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 600; color: var(--navy); }
.page-sub    { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ─────────────────────────────────────────────────────────────
   KPI CARDS
   ───────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
            padding: 18px 20px; position: relative; overflow: hidden; }
.kpi-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--navy); }
.kpi-card.orange::before { background: var(--orange); }
.kpi-card.green::before  { background: #27ae60; }
.kpi-card.red::before    { background: #c0392b; }
.kpi-label { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .8px;
             color: var(--text-muted); margin-bottom: 8px; }
.kpi-value { font-size: 24px; font-weight: 600; color: var(--navy); letter-spacing: -.5px; }
.kpi-value.orange { color: var(--orange); }
.kpi-value.red    { color: #c0392b; }
.kpi-value.green  { color: #27ae60; }
.kpi-sub   { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ─────────────────────────────────────────────────────────────
   CARDS / TABLES
   ───────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
        box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between;
               border-bottom: 1px solid var(--border); }
.card-title-sm { font-size: 13px; font-weight: 600; color: var(--navy); }

.toolbar { padding: 12px 16px; display: flex; gap: 10px; align-items: center;
           border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { padding: 10px 14px; text-align: left; font-size: 10px; font-weight: 600; text-transform: uppercase;
     letter-spacing: .5px; color: var(--text-muted); background: #f8fafc;
     border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.td-right { text-align: right; font-weight: 500; }
.td-center { text-align: center; }

/* ─────────────────────────────────────────────────────────────
   AGING BARS
   ───────────────────────────────────────────────────────────── */
.aging-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.aging-row  { display: flex; align-items: center; padding: 7px 0; font-size: 12px; }
.aging-label { width: 110px; color: var(--text-sub); flex-shrink: 0; }
.aging-bar-wrap { flex: 1; height: 5px; background: #eef0f4; border-radius: 3px; margin: 0 12px; }
.aging-bar  { height: 5px; border-radius: 3px; }
.aging-amt  { width: 90px; text-align: right; font-weight: 500; font-size: 12px; color: var(--text-main); }

/* ─────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius);
       font-size: 12px; font-weight: 500; border: 1px solid var(--border);
       background: var(--surface); color: var(--text-sub); transition: all .12s; }
.btn:hover { background: #f0f4fa; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-mid); }
.btn-orange { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-orange:hover { background: var(--orange-dark); }
.btn-danger { color: var(--red); border-color: #f09595; }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* ─────────────────────────────────────────────────────────────
   STATUS PILLS
   ───────────────────────────────────────────────────────────── */
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red   { background: var(--red-bg);   color: var(--red); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-blue  { background: var(--blue-bg);  color: var(--blue); }
.pill-gray  { background: #f1efe8; color: #444; }

/* ─────────────────────────────────────────────────────────────
   FORM ELEMENTS
   ───────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 10px; font-weight: 500; color: var(--text-sub); text-transform: uppercase; letter-spacing: .7px; }
.form-group.span2 { grid-column: span 2; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; background: #fafbfc; color: var(--text-main); outline: none;
  transition: border .15s, box-shadow .15s; width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--navy); background: #fff; box-shadow: 0 0 0 3px rgba(11,31,68,.07);
}
.search-input { width: 200px; }

/* ─────────────────────────────────────────────────────────────
   MODAL
   ───────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(11,31,68,.45);
  z-index: 200; align-items: center; justify-content: center;
}
.modal-box { background: #fff; border-radius: var(--radius-lg); padding: 28px; width: 500px;
             max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,.2); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title-text { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 600; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); line-height: 1; }
.modal-close:hover { color: var(--text-main); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px;
                padding-top: 16px; border-top: 1px solid var(--border); }

/* ─────────────────────────────────────────────────────────────
   TOAST
   ───────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 18px; border-radius: 8px;
         font-size: 13px; font-weight: 500; z-index: 500; opacity: 0;
         transform: translateY(8px); transition: all .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--green-bg); color: var(--green); border: 1px solid #c6efce; }
.toast-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid #f09595; }

/* ─────────────────────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon  { font-size: 32px; margin-bottom: 10px; }

/* ─────────────────────────────────────────────────────────────
   LOGIN PAGE
   ───────────────────────────────────────────────────────────── */
.login-wrap { display: flex; min-height: 100vh; }
.login-left {
  width: 52%; background: var(--navy); display: flex; flex-direction: column;
  justify-content: space-between; padding: 48px 52px 40px; position: relative; overflow: hidden;
}
.login-left::before { content: ''; position: absolute; width: 340px; height: 340px;
  border-radius: 50%; border: 65px solid rgba(245,115,30,.09); bottom: -90px; left: -70px; }
.login-left::after  { content: ''; position: absolute; width: 200px; height: 200px;
  border-radius: 50%; border: 44px solid rgba(245,115,30,.07); top: 40px; right: -50px; }
.login-orange-bar { position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--orange); }
.login-logo  { width: 150px; filter: brightness(0) invert(1); margin-bottom: 44px; position: relative; z-index: 2; }
.login-headline { font-family: 'Cormorant Garamond', serif; font-weight: 300; font-size: 40px;
  line-height: 1.22; color: #fff; letter-spacing: -.5px; margin-bottom: 16px; position: relative; z-index: 2; }
.login-headline em { color: var(--orange); font-style: normal; font-weight: 600; }
.login-sub { font-size: 13px; color: rgba(255,255,255,.45); line-height: 1.8;
  max-width: 290px; position: relative; z-index: 2; }
.login-left-bot { position: relative; z-index: 2; }
.login-divline  { height: .5px; background: rgba(255,255,255,.1); margin-bottom: 20px; }
.login-stats    { display: flex; gap: 0; margin-bottom: 20px; }
.login-stat     { flex: 1; padding-right: 20px; }
.login-stat + .login-stat { padding-left: 20px; border-left: .5px solid rgba(255,255,255,.1); }
.login-stat-n   { font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 600;
  color: var(--orange); line-height: 1; margin-bottom: 3px; }
.login-stat-l   { font-size: 10px; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: 1px; }
.login-copy     { font-size: 10px; color: rgba(255,255,255,.2); }
.login-copy span { color: rgba(245,115,30,.5); }

.login-right { width: 48%; background: var(--bg); display: flex; align-items: center;
  justify-content: center; padding: 40px; position: relative; }
.login-right::before { content: ''; position: absolute; top: 0; left: 0; bottom: 0;
  width: 4px; background: var(--navy); }
.login-card { background: #fff; border-radius: var(--radius-lg); padding: 38px 34px;
  width: 100%; max-width: 330px; box-shadow: 0 4px 32px rgba(11,31,68,.1); }
.login-card-logo  { width: 110px; display: block; margin: 0 auto 8px; }
.login-card-title { font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 600;
  color: var(--navy); text-align: center; margin-bottom: 4px; }
.login-card-sub   { font-size: 12px; color: var(--text-muted); text-align: center; margin-bottom: 26px; }
.login-err { background: #fff5f0; border-left: 3px solid var(--orange); border-radius: 0 6px 6px 0;
  padding: 9px 12px; font-size: 12px; color: #c05518; margin-bottom: 14px; display: none; }
.login-err.show { display: block; }
.login-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.login-rem { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-sub); cursor: pointer; }
.login-rem input { accent-color: var(--navy); }
.login-fgt { font-size: 12px; color: var(--orange); cursor: pointer; font-weight: 500; }
.login-fgt:hover { text-decoration: underline; }
.btn-login { width: 100%; padding: 12px; background: var(--navy); color: #fff; border: none;
  border-radius: var(--radius); font-size: 13px; font-weight: 500; letter-spacing: .4px;
  position: relative; overflow: hidden; transition: background .15s; }
.btn-login:hover { background: var(--navy-mid); }
.btn-login .lbar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--orange); }
.login-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; font-size: 11px; color: #c0c8d4; }
.login-or::before, .login-or::after { content: ''; flex: 1; height: .5px; background: var(--border); }
.btn-sso { width: 100%; padding: 10px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: #fff; font-size: 12px; color: var(--text-sub); display: flex; align-items: center;
  justify-content: center; gap: 8px; transition: all .12s; }
.btn-sso:hover { background: var(--bg); border-color: var(--navy); }
.sso-ic { width: 18px; height: 18px; background: var(--navy); border-radius: 3px; display: flex;
  align-items: center; justify-content: center; color: #fff; font-size: 9px; font-weight: 700; flex-shrink: 0; }
.login-foot { text-align: center; margin-top: 18px; font-size: 11px; color: var(--text-muted); }
.login-foot a { color: var(--navy); font-weight: 500; text-decoration: underline; cursor: pointer; }

.login-ok { display: none; text-align: center; padding: 16px 0; }
.login-ok .chk { width: 50px; height: 50px; background: var(--green-bg); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; font-size: 22px; }
.login-ok h3 { font-family: 'Cormorant Garamond', serif; font-size: 22px; color: var(--navy); margin-bottom: 6px; }
.login-ok p  { font-size: 12px; color: var(--text-muted); }

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --nav-width: 0px; }
  .sidenav { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .aging-grid { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { width: 100%; }
}
