/* ===========================================================================
   MobuWealth ERP - stylesheet
   Brand: Navy #05044A, Gold #C9A227, Forest Green #317D3C, Font: Inter
   =========================================================================== */
:root {
  --navy:        #05044A;
  --navy-soft:   #14134f;
  --green:       #317D3C;
  --green-light: #20BA5A;
  --gold:        #C9A227;
  --bg:          #f0f2f8;
  --card:        #ffffff;
  --text:        #0F172A;
  --muted:       #64748b;
  --border:      #e2e4ec;
  --danger:      #b91c1c;
  --danger-bg:   #fee2e2;
  --shadow:      0 1px 3px rgba(5,4,74,.06), 0 1px 2px rgba(5,4,74,.04);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

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

.sidebar {
  width: 240px;
  background: var(--navy);
  color: #cdd2e8;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--gold); color: var(--navy);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: .5px;
}
.brand-text b { color: #fff; font-size: 15px; display: block; line-height: 1.2; }
.brand-text span { color: #8e94c0; font-size: 11px; }

.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: #b9bedd; font-weight: 500; font-size: 13.5px;
  margin-bottom: 2px;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: var(--green); color: #fff; }
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.nav-divider { height: 1px; background: rgba(255,255,255,.08); margin: 10px 12px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  color: #6c72a0; padding: 8px 12px 4px; font-weight: 600; }
.nav-badge {
  margin-left: auto; background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 10px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
}

.sidebar-footer {
  padding: 12px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold); color: var(--navy);
  display: grid; place-items: center; font-weight: 700;
}
.sidebar-footer .who { flex: 1; min-width: 0; }
.sidebar-footer .who b { color: #fff; font-size: 13px; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .who span { color: #8e94c0; font-size: 11px; text-transform: capitalize; }
.icon-btn {
  background: rgba(255,255,255,.08); border: none; color: #cdd2e8;
  width: 30px; height: 30px; border-radius: 7px; cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.icon-btn svg { width: 15px; height: 15px; }

/* ----- Main ---------------------------------------------------------------*/
.main { margin-left: 240px; flex: 1; min-width: 0; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 19px; font-weight: 700; color: var(--navy); }
.topbar .date { color: var(--muted); font-size: 13px; }
.content { padding: 24px 28px 48px; }

/* ----- Buttons ------------------------------------------------------------*/
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--green); color: #fff; border: none;
  padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 13px;
  cursor: pointer; font-family: inherit;
}
.btn:hover { background: #276630; }
.btn svg { width: 15px; height: 15px; }
.btn-light { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn-light:hover { background: #f7f8fc; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: #b8911f; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ----- Cards / KPI --------------------------------------------------------*/
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-bottom: 8px; }
.kpi .value { font-size: 25px; font-weight: 800; color: var(--navy); letter-spacing: -.5px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.accent { border-top: 3px solid var(--gold); }
.kpi.green .value { color: var(--green); }
.kpi.danger .value { color: var(--danger); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); margin-bottom: 22px;
}
.card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-head h2 { font-size: 15px; font-weight: 700; color: var(--navy); }
.card-head .hint { color: var(--muted); font-size: 12px; }
.card-body { padding: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 1000px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ----- Tables -------------------------------------------------------------*/
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 600; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: #fafbfd;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid #eef0f6; font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
.t-strong { font-weight: 600; color: var(--navy); }
.t-mono { font-variant-numeric: tabular-nums; }
.t-right { text-align: right; }

/* ----- Badges -------------------------------------------------------------*/
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
}
.badge-green   { background: #dcfce7; color: #166534; }
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-amber   { background: #fef9c3; color: #854d0e; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: #f1f5f9; color: #64748b; }
.badge-navy    { background: var(--navy); color: #fff; }
.badge-gold    { background: #fdf6e3; color: #8a6d10; }

/* ----- Forms / modals -----------------------------------------------------*/
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 13.5px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(49,125,60,.1);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,4,74,.45);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 60px 20px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(5,4,74,.3);
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; color: var(--navy); }
.modal-head .close { background: none; border: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end; }

/* ----- Flash --------------------------------------------------------------*/
.flash-wrap { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.flash {
  background: #fff; border-left: 4px solid var(--green); border-radius: 8px;
  padding: 12px 18px; box-shadow: 0 6px 24px rgba(5,4,74,.18); font-size: 13.5px;
  min-width: 280px; font-weight: 500;
}
.flash.error { border-left-color: var(--danger); }

/* ----- Funnel / bars ------------------------------------------------------*/
.funnel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.funnel-row .fl-label { width: 110px; font-size: 13px; font-weight: 500; }
.funnel-row .fl-bar-wrap { flex: 1; background: #eef0f6; border-radius: 6px; height: 26px; overflow: hidden; }
.funnel-row .fl-bar { height: 100%; background: var(--green); border-radius: 6px;
  display: flex; align-items: center; padding: 0 10px; color: #fff; font-size: 12px; font-weight: 600; min-width: 30px; }
.funnel-row .fl-val { width: 130px; text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ----- Pipeline board -----------------------------------------------------*/
.board { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; overflow-x: auto; }
.board-col { background: #f5f6fb; border-radius: 10px; padding: 10px; min-width: 150px; }
.board-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
  margin-bottom: 10px; display: flex; justify-content: space-between; }
.deal-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 11px; margin-bottom: 9px; box-shadow: var(--shadow); }
.deal-card .dn { font-weight: 600; font-size: 12.5px; color: var(--navy); margin-bottom: 4px; }
.deal-card .dc { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.deal-card .dv { font-weight: 700; color: var(--green); font-size: 13px; }

/* ----- Inbox --------------------------------------------------------------*/
.inbox-list { display: flex; flex-direction: column; }
.inbox-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #eef0f6; align-items: flex-start; }
.inbox-item.unread { background: #f7f9ff; }
.inbox-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.inbox-icon.alert { background: var(--danger-bg); color: var(--danger); }
.inbox-icon.task { background: #dcfce7; color: #166534; }
.inbox-item .it-body { flex: 1; }
.inbox-item .it-title { font-weight: 600; color: var(--navy); font-size: 13.5px; }
.inbox-item .it-text { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.inbox-item .it-time { color: #9aa3b8; font-size: 11px; margin-top: 4px; }

/* ----- Login --------------------------------------------------------------*/
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--navy);
  background-image: radial-gradient(circle at 20% 20%, #14134f 0, var(--navy) 55%); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; width: 100%; max-width: 400px; padding: 38px 34px;
  box-shadow: 0 24px 70px rgba(0,0,0,.4); }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .brand-icon { width: 54px; height: 54px; font-size: 20px; margin: 0 auto 14px; border-radius: 13px; }
.login-brand h1 { color: var(--navy); font-size: 22px; }
.login-brand p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; }
.login-hint { text-align: center; margin-top: 18px; font-size: 12px; color: var(--muted); }
.login-hint code { background: #f1f5f9; padding: 2px 6px; border-radius: 5px; color: var(--navy); font-weight: 600; }

/* ----- Misc ---------------------------------------------------------------*/
.page-actions { display: flex; gap: 10px; align-items: center; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; }
.tab { padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--muted); border: 1px solid transparent; }
.tab.active { background: #fff; color: var(--navy); border-color: var(--border); box-shadow: var(--shadow); font-weight: 600; }
.search { flex: 1; max-width: 320px; }
.search input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 13.5px; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .35; margin-bottom: 12px; }
.welcome-banner {
  background: linear-gradient(100deg, var(--navy), #1b1a63); color: #fff;
  border-radius: 14px; padding: 22px 26px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.welcome-banner h2 { font-size: 18px; margin-bottom: 5px; }
.welcome-banner p { color: #c9cdec; font-size: 13.5px; max-width: 640px; }
.welcome-banner .x { background: rgba(255,255,255,.12); border: none; color: #fff; width: 28px; height: 28px; border-radius: 7px; cursor: pointer; font-size: 16px; }
.checklist { list-style: none; }
.checklist li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eef0f6; font-size: 13.5px; align-items: center; }
.checklist li:last-child { border: none; }
.check { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; font-size: 12px; }
.check.done { background: #dcfce7; color: #166534; }
.check.todo { background: #f1f5f9; color: #cbd5e1; }
.danger-zone { border: 1px solid var(--danger-bg); background: #fffafa; border-radius: 12px; padding: 20px; }
.danger-zone h3 { color: var(--danger); font-size: 15px; margin-bottom: 6px; }
.help-table td { font-size: 13px; }
.probability { background: #eef0f6; border-radius: 6px; height: 6px; overflow: hidden; width: 70px; display: inline-block; vertical-align: middle; }
.probability i { display: block; height: 100%; background: var(--gold); }
