/* ===========================================================================
   AYIRE 101  -  Financial Management System
   Design system. Brand: orange #ED8B00, green #1B9E47, ink #12151c.
   Developer: Baasa Cloud
   =========================================================================== */

:root {
    --orange: #ED8B00;
    --orange-600: #d97d00;
    --orange-700: #b86a00;
    --orange-soft: #fff3e0;
    --green: #1B9E47;
    --green-600: #15833a;
    --green-soft: #e6f6ec;
    --red: #d64545;
    --red-soft: #fdecec;
    --amber: #c98a00;
    --amber-soft: #fff6e0;

    --ink: #12151c;
    --ink-2: #1b2029;
    --ink-3: #262d3a;
    --text: #1a1f29;
    --muted: #6b7280;
    --muted-2: #9aa3b2;
    --line: #e7eaf0;
    --line-2: #eef1f6;
    --bg: #f4f6fa;
    --surface: #ffffff;

    --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.05);
    --shadow: 0 4px 14px rgba(16,24,40,.07), 0 2px 6px rgba(16,24,40,.04);
    --shadow-lg: 0 18px 48px rgba(16,24,40,.14);
    --radius: 14px;
    --radius-sm: 10px;
    --sidebar-w: 256px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
svg { display: block; }

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

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #161b24 0%, #11151c 100%);
    color: #cfd6e2;
    position: fixed; inset: 0 auto 0 0;
    display: flex; flex-direction: column;
    z-index: 40;
    border-right: 1px solid rgba(255,255,255,.04);
}
.brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand .logo {
    width: 42px; height: 42px; border-radius: 11px; flex: none;
    background: linear-gradient(135deg, var(--orange), var(--orange-700));
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 18px;
    box-shadow: 0 6px 16px rgba(237,139,0,.35);
}
.brand .logo-tile {
    height: 48px; width: auto; border-radius: 12px; flex: none;
    background: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 5px 8px;
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.brand .logo-tile img { height: 38px; width: auto; max-width: 150px; display: block; } /* keep aspect, never squeeze */
.brand .name { color: #fff; font-weight: 800; font-size: 17px; letter-spacing: .02em; line-height: 1; }
.brand .tag { color: var(--muted-2); font-size: 11px; margin-top: 3px; letter-spacing: .08em; text-transform: uppercase; }

.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-label {
    font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
    color: #5b6575; padding: 14px 12px 7px; font-weight: 700;
}
.nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px; margin-bottom: 2px;
    color: #aeb7c6; font-weight: 500; font-size: 14px;
    transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active {
    background: linear-gradient(90deg, rgba(237,139,0,.18), rgba(237,139,0,.04));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--orange);
}
.nav a.active svg { opacity: 1; color: var(--orange); }
.nav a .pill {
    margin-left: auto; background: var(--orange); color: #fff;
    font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 8px;
}

.sidebar-foot {
    padding: 14px; border-top: 1px solid rgba(255,255,255,.06);
    font-size: 11px; color: #5b6575;
}
.sidebar-foot a { color: var(--orange); font-weight: 600; }

/* ------------------------------------------------------------------ Main */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 66px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 16px;
    padding: 0 28px; position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 19px; font-weight: 700; }
.topbar .crumb { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.topbar .date-chip {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--line);
    padding: 7px 13px; border-radius: 10px; color: var(--muted); font-size: 13px; font-weight: 500;
}
.user-chip {
    display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 12px;
    border: 1px solid var(--line); border-radius: 30px; background: var(--surface);
}
.user-chip .uname { font-weight: 600; font-size: 13px; line-height: 1.1; }
.user-chip .urole { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: none;
    background: linear-gradient(135deg, var(--green), var(--green-600));
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.avatar.org { background: linear-gradient(135deg, var(--orange), var(--orange-700)); }

.content { padding: 28px; max-width: 1380px; width: 100%; }
.menu-toggle { display: none; }

/* --------------------------------------------------------------- Headings */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page-head .spacer { flex: 1; }

/* ------------------------------------------------------------------ Cards */
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head {
    padding: 16px 22px; border-bottom: 1px solid var(--line-2);
    display: flex; align-items: center; gap: 12px;
}
.card-head h3 { font-size: 15px; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px){ .cols-4{grid-template-columns:repeat(2,1fr)} .cols-3{grid-template-columns:repeat(2,1fr)} }
@media (max-width: 720px){ .cols-2,.cols-3,.cols-4{grid-template-columns:1fr} }

/* ------------------------------------------------------------- Stat cards */
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
    transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, border-color .22s ease;
    --accent: var(--orange); --glow: rgba(16,24,40,.12);
}
/* colored top accent that grows on hover */
.stat::after {
    content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px;
    background: var(--accent); transform: scaleX(0); transform-origin: left;
    transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.stat:hover { transform: translateY(-5px); box-shadow: 0 18px 36px var(--glow); border-color: var(--accent); }
.stat:hover::after { transform: scaleX(1); }
.stat:hover .ico { transform: scale(1.1) rotate(-3deg); }
.stat:hover .card-go { transform: translateX(4px); opacity: .9; }
/* accent palettes */
.stat.a-orange { --accent: var(--orange); --glow: rgba(237,139,0,.20); }
.stat.a-green  { --accent: var(--green);  --glow: rgba(27,158,71,.18); }
.stat.a-blue   { --accent: #1a73c2;       --glow: rgba(26,115,194,.18); }
.stat.a-red    { --accent: var(--red);    --glow: rgba(214,69,69,.18); }
.stat.a-amber  { --accent: var(--amber);  --glow: rgba(201,138,0,.18); }
.stat.a-purple { --accent: #7c4dff;       --glow: rgba(124,77,255,.18); }
.stat .ico {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px;
    transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.stat .ico.orange { background: var(--orange-soft); color: var(--orange-700); }
.stat .ico.green { background: var(--green-soft); color: var(--green-600); }
.stat .ico.blue { background: #e8f0fe; color: #1a73c2; }
.stat .ico.red { background: var(--red-soft); color: var(--red); }
.stat .ico.amber { background: var(--amber-soft); color: var(--amber); }
.stat .ico.purple { background: #efe9ff; color: #7c4dff; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat .value .ccy { font-size: 14px; color: var(--muted); font-weight: 600; }
.stat .delta { font-size: 12.5px; margin-top: 8px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.stat .delta.up { color: var(--green-600); }
.stat .delta.down { color: var(--red); }
.stat .delta .card-go { margin-left: auto; opacity: .45; }
a.stat { text-decoration: none; }
.stat.feature { background: linear-gradient(135deg, #161b24, #11151c); color: #fff; border: none; }
.stat.feature .label { color: #9aa3b2; }
.stat.feature .value { color: #fff; }
.stat.feature .ico.orange { background: rgba(237,139,0,.2); color: var(--orange); }

/* ------------------------------------------------------------------ Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
    text-align: left; padding: 11px 18px; color: var(--muted);
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    border-bottom: 1px solid var(--line); background: #fbfcfe; white-space: nowrap;
}
tbody td { padding: 13px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.t-strong { font-weight: 700; }
.t-muted { color: var(--muted); }
.t-mono { font-variant-numeric: tabular-nums; }

.empty {
    padding: 48px 20px; text-align: center; color: var(--muted);
}
.empty svg { margin: 0 auto 12px; opacity: .4; width: 40px; height: 40px; }

/* ----------------------------------------------------------------- Badges */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 30px; font-size: 11.5px; font-weight: 700;
    text-transform: capitalize; line-height: 1.6;
}
.badge-hang { background: var(--red-soft); color: var(--red); margin-top: 4px; }
tr.row-hang td { background: var(--red-soft); }
tr.row-hang:hover td { background: #fbdcdc; }
.badge-open { background: var(--green-soft); color: var(--green-600); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-closed { background: #eef1f6; color: var(--muted); }
.badge-muted { background: #eef1f6; color: var(--muted); }
.chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
    border-radius: 7px; font-size: 11.5px; font-weight: 600; background: var(--bg); color: var(--muted);
    border: 1px solid var(--line);
}
.chip.cat-bank { background: #e8f0fe; color: #1a63b8; border-color: #d4e3fb; }
.chip.cat-mobile_money { background: var(--amber-soft); color: var(--amber); border-color: #f4e6c0; }
.chip.cat-remittance { background: #f0e9fb; color: #6b3fc0; border-color: #e2d6f6; }
.chip.cat-forex { background: var(--green-soft); color: var(--green-600); border-color: #cdeed8; }
.chip.cat-wallet { background: var(--orange-soft); color: var(--orange-700); border-color: #f7e3c4; }

.pos { color: var(--green-600); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }

/* Service brand marks */
.svc-logo {
    display: inline-grid; place-items: center; border-radius: 9px; flex: none;
    font-weight: 800; letter-spacing: -.02em; text-transform: lowercase;
    box-shadow: var(--shadow-sm);
}
.svc-logo-img { vertical-align: middle; }
.svc-cell { display: flex; align-items: center; gap: 11px; }
.svc-cell .nm { font-weight: 700; }

/* ----------------------------------------------------------------- Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
    border: 1px solid transparent; cursor: pointer; transition: all .15s; white-space: nowrap;
    font-family: inherit;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 4px 12px rgba(237,139,0,.28); }
.btn-primary:hover { background: var(--orange-600); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-3); }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 4px 12px rgba(27,158,71,.25); }
.btn-green:hover { background: var(--green-600); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--muted-2); background: #fafbfd; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #fbdcdc; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ------------------------------------------------------------------- Forms */
.field { margin-bottom: 16px; }
.field label, .lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
input, select, textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
    font-size: 14px; font-family: inherit; color: var(--text); background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(237,139,0,.14);
}
input[readonly] { background: var(--bg); color: var(--muted); }
.input-money { position: relative; }
.input-money .pre {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 13px; font-weight: 600; pointer-events: none;
}
.input-money input { padding-left: 46px; font-variant-numeric: tabular-nums; font-weight: 600; }
.form-grid { display: grid; gap: 0 18px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 620px){ .form-grid{grid-template-columns:1fr} }
.divider { height: 1px; background: var(--line-2); margin: 4px 0 18px; }

/* segmented type picker */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label {
    flex: 1; min-width: 120px; cursor: pointer; margin: 0;
    border: 1.5px solid var(--line); border-radius: 11px; padding: 12px 14px;
    display: flex; align-items: center; gap: 10px; transition: all .15s; background: var(--surface);
}
.seg label:hover { border-color: var(--muted-2); }
.seg input { display: none; }
.seg .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--bg); color: var(--muted); }
.seg .tt { font-weight: 700; font-size: 13.5px; }
.seg .ds { font-size: 11.5px; color: var(--muted); }
.seg input:checked + .ic + .tt {} /* placeholder */
.seg label.on { border-color: var(--orange); background: var(--orange-soft); }
.seg label.on .ic { background: var(--orange); color: #fff; }

/* --------------------------------------------------------------- Flash msgs */
.flash-stack { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.flash {
    background: var(--surface); border-left: 4px solid var(--green); border-radius: 10px;
    box-shadow: var(--shadow-lg); padding: 13px 18px; min-width: 280px; max-width: 380px;
    display: flex; align-items: center; gap: 11px; font-weight: 500; font-size: 14px;
    animation: slideIn .3s ease;
}
.flash.error { border-color: var(--red); }
.flash.warn { border-color: var(--amber); }
.flash .fi { flex: none; }
.flash.success .fi { color: var(--green); }
.flash.error .fi { color: var(--red); }
.flash.warn .fi { color: var(--amber); }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------- Modal */
.modal-bg {
    position: fixed; inset: 0; background: rgba(18,21,28,.55); backdrop-filter: blur(3px);
    z-index: 80; display: none; align-items: flex-start; justify-content: center; padding: 60px 20px; overflow-y: auto;
}
.modal-bg.show { display: flex; }
.modal {
    background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 520px; animation: pop .2s ease;
}
.modal.wide { max-width: 760px; }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; }
.modal-head h3 { font-size: 17px; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 8px; }
.modal-head .x:hover { background: var(--bg); }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; justify-content: flex-end; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }

/* ----------------------------------------------------------------- Misc */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.kpi-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.kpi-line:last-child { border: none; }
.kpi-line .k { color: var(--muted); }
.kpi-line .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-line.total { border-top: 2px solid var(--line); margin-top: 4px; padding-top: 12px; font-size: 15px; }
.kpi-line.total .v { color: var(--orange-700); }

.bar { height: 8px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--orange), var(--green)); }

.note-box {
    background: var(--orange-soft); border: 1px solid #f7e3c4; border-radius: 12px;
    padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: #8a5a00;
}
.note-box.green { background: var(--green-soft); border-color: #cdeed8; color: var(--green-600); }
.note-box svg { flex: none; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 12px; }

/* Mini bar chart for reports */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.chart .col .bars { width: 100%; display: flex; gap: 3px; align-items: flex-end; justify-content: center; height: 150px; }
.chart .col .b { width: 46%; border-radius: 5px 5px 0 0; min-height: 3px; }
.chart .col .b.com { background: linear-gradient(180deg, var(--orange), var(--orange-700)); }
.chart .col .b.exp { background: var(--line); }
.chart .col .lab { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.legend { display: flex; gap: 18px; font-size: 12.5px; color: var(--muted); }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* PWA install banner */
.install-banner {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 95;
    width: calc(100% - 32px); max-width: 460px;
    background: #161b24; color: #fff; border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px; box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 14px; padding: 12px 14px;
    animation: slideUp .3s ease;
}
.install-banner[hidden] { display: none; }
.install-banner img { width: 46px; height: 46px; border-radius: 11px; flex: none; }
.install-banner .ib-text { flex: 1; line-height: 1.3; }
.install-banner .ib-text strong { display: block; font-size: 14.5px; }
.install-banner .ib-text span { font-size: 12.5px; color: #aeb7c6; }
.install-banner .ib-x { background: none; border: none; color: #9aa3b2; font-size: 22px; cursor: pointer; padding: 0 6px; line-height: 1; }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Login - centered, single column */
.login-only {
    min-height: 100vh; display: grid; place-items: center; padding: 32px 20px;
    background:
        radial-gradient(900px 420px at 50% -8%, rgba(237,139,0,.10), transparent 60%),
        radial-gradient(760px 420px at 50% 108%, rgba(27,158,71,.10), transparent 60%),
        var(--bg);
}
.login-card {
    width: 100%; max-width: 400px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 18px; box-shadow: var(--shadow-lg); padding: 38px 34px;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 20px; }
.login-logo img { height: 64px; width: auto; max-width: 100%; display: block; } /* rectangle preserved */
@media (max-width: 480px){ .login-card { padding: 30px 22px; } }

@media (max-width: 980px){
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .sidebar.open { transform: none; }
    .main { margin-left: 0; }
    .menu-toggle { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
    .content { padding: 18px; }
}
