:root {
    --brand: #1f4e79;
    --brand-2: #2b6299;
    --accent: #f0a830;
    --sidebar-bg: #17324d;
    --ground: #f4f6f7;
}
body { background: var(--ground); font-size: 0.95rem; }
.topbar { background: var(--brand); color: #fff; height: 56px; position: sticky; top: 0; z-index: 1030; }
.topbar .brand { color: #fff; font-weight: 600; font-size: 1.05rem; }
.brand-logo { height: 34px; width: auto; border-radius: 4px; background: #fff; }
.app-body { min-height: calc(100vh - 56px); }
.sidebar { background: var(--sidebar-bg) !important; width: 250px; min-width: 250px; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; } }
.sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--sidebar-bg); --bs-offcanvas-color: #fff; }
.sidebar .nav-link { color: #c9d8db; padding: .55rem 1.1rem; border-left: 3px solid transparent; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar .nav-link.active { color: #fff; background: rgba(255,255,255,.1); border-left-color: var(--accent); }
.sidebar .nav-link .bi { width: 1.4rem; display: inline-block; }
.sidebar .sub .nav-link { padding-left: 2.9rem; font-size: .9rem; }
.sidebar .nav-link .chev { transition: transform .2s; }
.sidebar .nav-link.collapsed .chev { transform: rotate(-90deg); }
.content { min-width: 0; }
.page-title { font-size: 1.4rem; font-weight: 600; color: var(--brand); margin-bottom: 1rem; }
.card { border: 1px solid #e1e6e8; box-shadow: none; }
.card-header { background: #fff; font-weight: 600; }
.stat { border-radius: .5rem; background: #fff; border: 1px solid #e1e6e8; padding: 1rem 1.1rem; }
.stat .v { font-size: 1.6rem; font-weight: 700; color: var(--brand); line-height: 1.2; }
.stat .l { color: #5c6b70; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-2); --bs-btn-hover-border-color: var(--brand-2); --bs-btn-active-bg: var(--brand-2); }
.table thead th { background: #eef3f4; color: #23424a; font-weight: 600; white-space: nowrap; }
.table td, .table th { vertical-align: middle; }
.avatar { width: 40px; height: 40px; object-fit: cover; border-radius: 50%; background: #dfe7e9; }
.photo-lg { width: 120px; height: 140px; object-fit: cover; border-radius: .4rem; background: #dfe7e9; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--brand) 0%, #0f2236 100%); }
.login-card { width: 100%; max-width: 400px; }
.sheet { background: #fff; border: 1px solid #e1e6e8; padding: 1.2rem; }
.sheet-head { text-align: center; border-bottom: 2px solid var(--brand); margin-bottom: 1rem; padding-bottom: .6rem; }
.sheet-head img { height: 64px; }
.sheet-head h2 { font-size: 1.3rem; margin: .2rem 0; color: var(--brand); }
.small-muted { font-size: .8rem; color: #6c757d; }
@media print {
    @page { margin: 10mm; }
    body { background: #fff; }
    .no-print, .topbar, .sidebar, .alert { display: none !important; }
    .content { padding: 0 !important; }
    .sheet { border: 0; padding: 0; }
    .card { border: 0; }
    .page-title { display: none; }
    .table thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .page-break { page-break-after: always; break-after: page; }
}

/* copyright */
.content { display: flex; flex-direction: column; }
.app-footer { margin-top: auto; padding-top: 1.5rem; text-align: center; font-size: .8rem; color: #6c757d; }
.login-wrap { position: relative; }
.login-copy { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-size: .8rem; color: rgba(255,255,255,.75); }
@media print { .app-footer { padding-top: .5rem; font-size: 7pt; } }

/* analytical dashboard */
.dash-h { font-size: 1.05rem; font-weight: 700; color: #23424a; margin: .25rem 0 .75rem; padding-bottom: .35rem; border-bottom: 1px solid #e1e6e8; }
.chart-title { font-size: .95rem; font-weight: 600; color: #23424a; margin: 0; }
.chart-sub { font-size: .78rem; color: #5c6b70; margin-bottom: .5rem; }
.chart-box { position: relative; width: 100%; }
.bar-track { height: 6px; background: #eef1f2; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar-track > span { display: block; height: 100%; background: #2a78d6; border-radius: 0 3px 3px 0; }
@media print { details { display: none; } .chart-box { break-inside: avoid; } .card { break-inside: avoid; } }

/* profit & loss statement */
.pnl td, .pnl th { padding-top: .35rem; padding-bottom: .35rem; }
.pnl .pnl-sec th { background: #f4f7f8; color: #23424a; font-size: .8rem; letter-spacing: .04em; padding-top: .6rem; }
.pnl .pnl-tot th { border-top: 1.5px solid #23424a; }
.pnl .pnl-bal th { background: #eef3f4; }
.pnl .pnl-net th { font-size: 1.05rem; border-top: 2px solid #23424a; border-bottom: 3px double #23424a; }
.pnl .pnl-net.is-profit th { color: #0b7a0b; }
.pnl .pnl-net.is-loss th { color: #b42f2f; }
.bar-track.exp > span { background: #eb6834; }
.stat .v { overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .stat .v { font-size: 1.2rem; } .stat { padding: .75rem .8rem; } }
.pnl-tiles .stat .v { font-size: 1.3rem; white-space: nowrap; }
@media (max-width: 575.98px) { .pnl-tiles .stat .v { font-size: 1.05rem; } }

/* print / export toolbar on every report and list */
.print-head { display: none; }
.page-tools .btn { white-space: nowrap; }
@media print {
    .print-head { display: block; text-align: center; border-bottom: 2px solid var(--brand); margin-bottom: 10px; padding-bottom: 6px; }
    .print-head .ph-school { font-size: 15pt; font-weight: 700; color: var(--brand); }
    .print-head .ph-title { font-size: 12pt; font-weight: 600; text-transform: uppercase; }
    .print-head .ph-meta { font-size: 8pt; color: #555; }
    body:has(.sheet-head) .print-head, body:has(.no-print-head) .print-head { display: none; }
    .page-tools, .title-row .btn { display: none !important; }
    main form[method="get"], main form[method="GET"], main .btn { display: none !important; }
    .print-head .ph-filters { font-size: 9pt; margin-top: 2px; }
    table .btn, table form, table .form-check, .card-header .btn, .card-body > form .btn { display: none !important; }
    table input.form-control, table select.form-select { border: 0; padding: 0; background: transparent; appearance: none; }
    a { color: inherit !important; text-decoration: none !important; }
    .table-responsive { overflow: visible !important; }
    .card { box-shadow: none; }
    .collapse:not(.show) { display: none !important; }
    tr.collapse { display: none !important; }
}

/* Mifugo */
.daily-table input { min-width: 85px; }
.daily-table td.unit { color: #6c757d; font-size: .8rem; white-space: nowrap; }
.kpi-good { color: #1e7b34; } .kpi-bad { color: #b02a37; }
.stock-low { background: #fff1f0 !important; }

/* ===================== phones & tablets ===================== */
.bottom-nav { display: none; }
@media (max-width: 991.98px) {
    .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; background: #fff; border-top: 1px solid #d9e0e5;
        box-shadow: 0 -2px 10px rgba(0,0,0,.06); padding-bottom: env(safe-area-inset-bottom); }
    .bottom-nav a, .bottom-nav button { flex: 1; text-align: center; color: #5c6b70; font-size: .7rem; padding: .45rem 0 .4rem; text-decoration: none; background: none; border: 0; line-height: 1.1; }
    .bottom-nav .bi { display: block; font-size: 1.35rem; margin-bottom: 2px; }
    .bottom-nav .active { color: var(--brand); font-weight: 600; }
    .bottom-nav .pos-link .bi { color: #fff; background: var(--brand); border-radius: 50%; width: 42px; height: 42px; line-height: 42px; margin: -14px auto 2px; font-size: 1.3rem; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
    .content { padding-bottom: 84px !important; }
    .app-footer { padding-bottom: .5rem; }
}
@media (max-width: 575.98px) {
    body { font-size: .9rem; }
    .content { padding: .75rem !important; padding-bottom: 84px !important; }
    .page-title { font-size: 1.2rem; margin-bottom: .5rem; }
    .title-row { margin-bottom: .25rem; }
    .page-tools .btn { padding: .2rem .5rem; font-size: .8rem; }
    .topbar .brand span { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
    /* no zoom on iPhone when typing */
    .form-control, .form-select, .input-group-text { font-size: 16px; }
    .form-control-sm, .form-select-sm { font-size: 15px; }
    .card-header { padding: .5rem .75rem; }
    .card-body { padding: .75rem; }
    .stat { padding: .65rem .75rem; }
    .stat .l { font-size: .7rem; }
    .table { font-size: .85rem; }
    .table td, .table th { padding: .4rem .45rem; }
    .sheet { padding: .75rem; }
    .btn-lg { padding: .5rem 1rem; font-size: 1.05rem; }
    /* filter forms: two fields per row */
    form.row.g-2 > .col-auto { flex: 1 1 45%; }
    form.row.g-2 > .col-auto .form-control, form.row.g-2 > .col-auto .form-select { width: 100%; }
    form.row.g-2 > .col-auto.align-self-end { flex-basis: 100%; }
}
/* wide tables: keep the first column visible while scrolling sideways */
@media (max-width: 767.98px) {
    .table-responsive { position: relative; }
    .table-responsive > .table > thead > tr > th:first-child, .table-responsive > .table > tbody > tr > td:first-child, .table-responsive > .table > tfoot > tr > *:first-child {
        position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 #e1e6e8; max-width: 44vw; }
    .table-responsive > .table > thead > tr > th:first-child { background: #eef3f4; }
    .table-responsive > .table > tbody > tr.stock-low > td:first-child { background: #fff1f0; }
    .table-responsive.scrolls::after { content: '\2194  swipe'; position: absolute; right: 6px; bottom: 4px; font-size: .65rem; color: #fff; background: rgba(31,78,121,.75); padding: 1px 6px; border-radius: 8px; pointer-events: none; }
    .table-responsive.scrolled::after { display: none; }
}
/* item lines in forms (production, sale, transfer): one card per line on phones */
@media (max-width: 575.98px) {
    table.lines thead { display: none; }
    table.lines tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .6rem; padding: .65rem 2.4rem .65rem .75rem; border-bottom: 1px solid #e1e6e8; position: relative; }
    table.lines tbody td { display: block; border: 0; padding: 0 !important; text-align: left !important; }
    table.lines tbody td:first-child { grid-column: 1 / -1; position: static; max-width: none; box-shadow: none; }
    table.lines tbody td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; color: #6c757d; text-transform: uppercase; letter-spacing: .03em; }
    table.lines tbody td:last-child { position: absolute; top: .6rem; right: .6rem; }
    table.lines tbody td:last-child .del { font-size: 1.4rem; }
    table.lines tbody td:empty { display: none; }
    table.lines tfoot tr { display: flex; justify-content: space-between; padding: .5rem .75rem; }
    table.lines tfoot th, table.lines tfoot td { border: 0; padding: 0; }
    table.lines tfoot th:empty, table.lines tfoot td:empty { display: none; }
}
@media (max-width: 767.98px) {
    .lines-wrap > .table > tbody > tr > td:first-child, .lines-wrap > .table > thead > tr > th:first-child, .lines-wrap > .table > tfoot > tr > *:first-child { position: static; box-shadow: none; max-width: none; }
    .lines-wrap.scrolls::after { display: none; }
}

/* ---- login page with Nesatech information ---- */
.login-wrap { flex-direction: column; gap: 1.25rem; padding-top: 2rem !important; padding-bottom: 1rem !important; }
.login-grid { display: flex; gap: 1.5rem; align-items: stretch; justify-content: center; width: 100%; max-width: 900px; }
.login-grid .login-card { flex: 0 0 400px; align-self: center; }
.login-copy { position: static !important; }
.nesa-card { flex: 1 1 0; min-width: 0; max-width: 470px; color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: .75rem; padding: 1.25rem 1.4rem; }
.nesa-brand { font-size: 1.35rem; font-weight: 700; letter-spacing: .02em; }
.nesa-brand .bi { margin-right: .25rem; }
.nesa-lead { font-size: .9rem; color: rgba(255,255,255,.82); margin: .35rem 0 .9rem; }
.nesa-products { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .55rem; }
.nesa-products li { display: flex; gap: .65rem; align-items: flex-start; padding: .5rem .6rem; border-radius: .5rem; }
.nesa-products li.is-current { background: rgba(255,255,255,.12); }
.nesa-products .bi { font-size: 1.25rem; line-height: 1.2; opacity: .9; }
.nesa-products b { font-size: .95rem; }
.nesa-products span:not(.nesa-tag) { display: block; font-size: .8rem; color: rgba(255,255,255,.75); line-height: 1.35; }
.nesa-tag { font-size: .68rem; background: #fff; color: #222; border-radius: 1rem; padding: 0 .45rem; margin-left: .25rem; vertical-align: 1px; }
.nesa-demo { border-top: 1px solid rgba(255,255,255,.2); padding-top: .9rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.nesa-demo-title { width: 100%; font-weight: 600; font-size: .95rem; }
.nesa-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: .45rem; font-size: .88rem; font-weight: 600; text-decoration: none; }
.nesa-wa { background: #25d366; color: #0b2e17; }
.nesa-wa:hover { background: #1fbd5a; color: #0b2e17; }
.nesa-mail { background: #fff; color: #1d2b36; }
.nesa-mail:hover { background: #e9eef3; color: #1d2b36; }
@media (max-width: 860px) {
    .login-grid { flex-direction: column; align-items: center; }
    .login-grid .login-card { flex: none; width: 100%; max-width: 400px; }
    .nesa-card { width: 100%; max-width: 400px; padding: 1rem; }
}

/* sales targets */
.tbar { position: relative; display: flex; align-items: center; gap: .5rem; min-width: 140px; }
.tbar-track { position: relative; flex: 1; }
.tbar .progress { height: .7rem; }
.tbar-mark { position: absolute; top: -3px; width: 2px; height: calc(.7rem + 6px); background: #1f2b30; opacity: .55; margin-left: -1px; pointer-events: none; }
.tbar-pct { font-weight: 700; font-size: .85rem; min-width: 3.2em; text-align: right; }
.tbar.big .progress { height: 1.1rem; }
.tbar.big .tbar-mark { height: calc(1.1rem + 6px); }
.tbar.big .tbar-pct { font-size: 1.1rem; }
.tgt-items { list-style: none; padding: 0; margin: .35rem 0 0; font-size: .8rem; }
.tgt-items li { display: flex; gap: .5rem; justify-content: space-between; }

/* ================= Look shared with Dawa MS: fonts, surfaces, dashboard welcome ================= */
@font-face { font-family: 'Outfit'; font-weight: 600; font-display: swap; src: url(../fonts/outfit-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Outfit'; font-weight: 700; font-display: swap; src: url(../fonts/outfit-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Outfit'; font-weight: 800; font-display: swap; src: url(../fonts/outfit-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'Jakarta'; font-weight: 400; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Jakarta'; font-weight: 500; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Jakarta'; font-weight: 600; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Jakarta'; font-weight: 700; font-display: swap; src: url(../fonts/plus-jakarta-sans-latin-700-normal.woff2) format('woff2'); }
:root { --ground: #f3f5f9; --line: #e0e5ee; --ink: #15233a; --muted: #5a6779; --display: 'Outfit', system-ui, sans-serif;
        --panel: #1f3f62; --window: #10243a; --glow: #f0a830; }
body { font-family: 'Jakarta', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); }
.page-title, .topbar .brand, .stat .v, .h-display { font-family: var(--display); letter-spacing: -.01em; }
.page-title { font-weight: 700; font-size: 1.55rem; }
.topbar .brand { font-weight: 700; font-size: 1.15rem; }
.card { border-color: var(--line); border-radius: 14px; }
.card > .card-header:first-child { border-radius: 14px 14px 0 0; }
.card-header { border-bottom-color: var(--line); padding: .8rem 1rem; }
.stat { border-radius: 14px; border-color: var(--line); padding: 1rem 1.15rem; height: 100%; }
.stat .l { text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 600; color: var(--muted); }
.stat .v { font-weight: 700; font-size: 1.75rem; color: var(--ink); }
.stat .v.kpi-good { color: #1e7b34; } .stat .v.kpi-bad { color: #b02a37; }
.btn { border-radius: 10px; font-weight: 600; }
.form-control, .form-select { border-radius: 10px; }
.table > thead th { font-weight: 600; color: var(--muted); font-size: .85rem; }
.sidebar .nav-link { border-radius: 0 10px 10px 0; margin-right: .6rem; }
.welcome { background: var(--sidebar-bg); color: #fff; border-radius: 20px; padding: 26px 28px; display: flex; gap: 28px; align-items: stretch; flex-wrap: wrap; margin-bottom: 1.25rem; position: relative; overflow: hidden; }
.welcome .w-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; }
.welcome .w-date { color: rgba(255,255,255,.7); font-size: .9rem; }
.welcome h2 { font-family: var(--display); font-weight: 800; font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: -.015em; margin: .15rem 0 .35rem; }
.welcome .w-line { color: rgba(255,255,255,.8); margin: 0; }
.welcome .w-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: auto; padding-top: 1.2rem; }
.welcome .w-actions a { display: inline-flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.1); color: #fff; text-decoration: none; padding: .6rem .95rem; border-radius: 12px; font-weight: 600; font-size: .92rem; }
.welcome .w-actions a:hover { background: rgba(255,255,255,.18); }
.welcome .w-actions a.primary { background: var(--glow); color: #241a05; }
.welcome .w-actions a.primary:hover { background: color-mix(in srgb, var(--glow) 75%, white); }
.w-today { flex: 0 1 300px; min-width: 240px; display: grid; gap: .5rem; align-content: center; background: rgba(255,255,255,.06); border-radius: 14px; padding: 14px 16px; }
.w-today .wt { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; color: rgba(255,255,255,.8); }
.w-today .wt b { color: #fff; }
.w-today .wt.total { border-top: 1px solid rgba(255,255,255,.18); padding-top: .45rem; font-size: 1rem; }
.w-today .wt.total b { color: var(--glow); font-size: 1.2rem; }
.share { height: 5px; background: #edf1f3; border-radius: 3px; margin-top: .4rem; overflow: hidden; }
.share i { display: block; height: 100%; background: var(--c, var(--brand)); border-radius: 3px; }
.top-svc { padding: .3rem 0; }
@media (max-width: 575.98px) { .welcome { padding: 20px 18px; border-radius: 16px; } .w-today { flex-basis: 100%; } }
