/*
 * app.css — Money Counter look on top of Bootstrap 5.3.
 * No inline styles anywhere (strict Content-Security-Policy), so every custom style lives here.
 */

:root {
    --mc-navy: #0f2a44;
    --mc-navy-2: #1f4a73;
    --mc-bg: #f4f6f9;
    --mc-text: #1b2733;
    --mc-muted: #5a6675;
    --mc-border: #e1e6ec;
    --mc-in: #0a7a4b;
    --mc-in-bg: #e3f4ec;
    --mc-out: #b4530a;
    --mc-out-bg: #fdf0e3;
    --mc-blue: #0b5cad;
    --bs-body-color: #1b2733;
    --bs-body-bg: #f4f6f9;
    --bs-primary: #0b5cad;
    --bs-primary-rgb: 11, 92, 173;
}

body { background: var(--mc-bg); color: var(--mc-text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; }
.btn-primary { --bs-btn-bg: #0b5cad; --bs-btn-border-color: #0b5cad; --bs-btn-hover-bg: #084a8c; --bs-btn-hover-border-color: #084a8c; --bs-btn-disabled-bg: #c9d2dc; --bs-btn-disabled-border-color: #c9d2dc; --bs-btn-disabled-color: #3c4856; }
a { color: var(--mc-blue); }

/* ---------- Shell: side menu + content ---------- */
.mc-shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.mc-side { flex: 1 1 220px; max-width: 100%; background: var(--mc-navy); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 2px; }
.mc-main { flex: 999 1 560px; min-width: 0; padding: 26px 30px; }
.mc-wrap { max-width: 1240px; margin: 0 auto; }
.mc-brand { padding: 4px 12px 16px; }
.mc-brand-name { font-weight: 700; font-size: 1.15rem; }
.mc-brand-sub { font-size: .78rem; color: #b9c6d4; }
.mc-nav-link { display: block; padding: 9px 12px; border-radius: 8px; color: #dbe4ee; text-decoration: none; font-size: .93rem; }
.mc-nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.mc-nav-link.active { background: var(--mc-navy-2); color: #fff; font-weight: 600; }
.mc-nav-sep { height: 1px; background: #2a4866; margin: 10px 4px; }
.mc-side-foot { margin-top: auto; padding: 14px 12px 0; font-size: .8rem; color: #b9c6d4; }
.mc-side-foot strong { color: #fff; font-size: .9rem; display: block; }
.mc-side-foot .btn { margin-top: 8px; }
@media (max-width: 800px) {
    .mc-main { padding: 18px 14px; }
    .mc-side { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .mc-brand { width: 100%; padding-bottom: 6px; }
    .mc-nav-sep { display: none; }
    .mc-side-foot { width: 100%; margin-top: 8px; }
}

/* ---------- Page header ---------- */
.mc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.mc-head h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.mc-head p { margin: 4px 0 0; color: var(--mc-muted); font-size: .92rem; }
.mc-head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mc-pill { display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.mc-pill-open { background: var(--mc-in-bg); color: #0a6b42; }
.mc-pill-closed { background: var(--mc-out-bg); color: #8a3f06; }

/* ---------- Cards, stats, tables ---------- */
.mc-card { background: #fff; border: 1px solid var(--mc-border); border-radius: 12px; }
.mc-card-pad { padding: 20px; }
.mc-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; }
.mc-card-head h2 { font-size: 1rem; margin: 0; font-weight: 700; }
.mc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.mc-stat { padding: 16px 18px; }
.mc-stat-label { font-size: .82rem; color: var(--mc-muted); font-weight: 500; }
.mc-stat-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }
.mc-stat-sub { font-size: .8rem; color: var(--mc-muted); margin-top: 2px; }
.mc-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.mc-grid-2 > .mc-span-all { grid-column: 1 / -1; }
.mc-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.mc-col-main { flex: 3 1 680px; min-width: 0; }
.mc-col-side { flex: 1 1 270px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.mc-table { width: 100%; margin: 0; border-collapse: collapse; }
.mc-table th { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--mc-muted); background: #f8fafc; border-bottom: 1px solid #dfe4ea; padding: 10px 12px; white-space: nowrap; text-align: left; }
.mc-table td { padding: 9px 12px; border-bottom: 1px solid #edf0f3; font-size: .9rem; white-space: nowrap; vertical-align: middle; }
.mc-table tr.mc-total td { background: #f8fafc; font-weight: 700; }
.mc-table tr.mc-void td { color: #8b96a3; text-decoration: line-through; }
.mc-table tr.mc-void td.mc-keep { text-decoration: none; }
.mc-scroll { overflow-x: auto; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.mc-in { color: var(--mc-in) !important; font-weight: 600; }
.mc-out { color: var(--mc-out) !important; font-weight: 600; }
.mc-blue { color: var(--mc-blue) !important; }
.mc-muted { color: var(--mc-muted) !important; }
.mc-bold { font-weight: 700; }
.mc-small { font-size: .8rem; }

/* ---------- Entry type toggle ---------- */
.mc-type { display: flex; gap: 8px; margin-bottom: 18px; }
.mc-type .btn { flex: 1; padding: 12px; font-weight: 700; font-size: 1rem; }
.btn-check:checked + .btn-in { background: var(--mc-in); border-color: var(--mc-in); color: #fff; }
.btn-check:checked + .btn-out { background: var(--mc-out); border-color: var(--mc-out); color: #fff; }
.btn-in, .btn-out { background: #fff; border: 1px solid #c9d2dc; color: var(--mc-text); }

/* ---------- Note counter rows ---------- */
.mc-notes td { padding: 8px 10px; }
.mc-note-label { font-weight: 700; font-size: 1.05rem; }
.mc-note-sub { font-size: .76rem; color: var(--mc-muted); }
.mc-stepper { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: nowrap; }
.mc-step { min-width: 46px; height: 40px; padding: 0 6px; border-radius: 8px; font-weight: 600; font-size: .82rem; font-variant-numeric: tabular-nums; }
.mc-step-minus { border: 1px solid #f0c9a6; background: var(--mc-out-bg); color: #8a3f06; }
.mc-step-minus:hover { background: #fbe2c9; }
.mc-step-plus { border: 1px solid #a9d8c0; background: var(--mc-in-bg); color: #0a6b42; }
.mc-step-plus:hover { background: #cdebdb; }
.mc-qty { width: 86px; margin: 0 4px; padding: 7px 6px; border: 2px solid var(--mc-blue); border-radius: 8px; font-size: 1.05rem; font-weight: 700; text-align: center; }
.mc-qty-warn { border-color: var(--mc-out); background: #fff7ef; }
.mc-warn { font-size: .76rem; color: var(--mc-out); text-align: center; margin-top: 3px; }

/* ---------- Match bar ---------- */
.mc-matchbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-top: 16px; padding: 14px 18px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--mc-border); }
.mc-matchbar-nums { display: flex; gap: 28px; flex-wrap: wrap; }
.mc-matchbar-label { font-size: .74rem; color: var(--mc-muted); font-weight: 600; text-transform: uppercase; }
.mc-matchbar-value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.mc-matchbar-right { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mc-badge-ok { padding: 8px 12px; border-radius: 8px; background: var(--mc-in-bg); color: #0a6b42; font-weight: 600; font-size: .9rem; }
.mc-badge-bad { padding: 8px 12px; border-radius: 8px; background: var(--mc-out-bg); color: #8a3f06; font-weight: 600; font-size: .9rem; }
.mc-amount-input { font-size: 1.3rem; font-weight: 700; }

/* ---------- Percentage line ---------- */
.mc-pct { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; padding: 10px 14px; border: 1px dashed #c9d2dc; border-radius: 10px; }
.mc-pct input { width: 96px; text-align: right; }
.mc-pct-note { margin-left: auto; font-size: .76rem; color: var(--mc-muted); }

/* ---------- WhatsApp ---------- */
.mc-wa { margin-top: 16px; padding: 14px 16px; border-radius: 10px; background: #f1faf4; border: 1px solid #bfe3cd; }
.mc-wa h2 { font-size: 1rem; margin: 0 0 8px; font-weight: 700; }
.mc-wa-preview { padding: 9px 12px; background: #fff; border: 1px solid #d5ebdd; border-radius: 8px; margin-bottom: 10px; white-space: pre-line; }
.btn-wa { background: #128c4a; border: 1px solid #128c4a; color: #fff; font-weight: 600; }
.btn-wa:hover { background: #0d6b38; color: #fff; }
.btn-wa-outline { background: #fff; border: 1px solid #128c4a; color: #0d6b38; font-weight: 600; }
.btn-wa-outline:hover { background: #e3f4ec; color: #0d6b38; }

/* ---------- Side summary rows ---------- */
.mc-kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: .92rem; border-bottom: 1px solid #edf0f3; }
.mc-kv:last-child { border-bottom: 0; }
.mc-kv strong { font-variant-numeric: tabular-nums; }

/* ---------- Auth / installer pages ---------- */
.mc-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.mc-auth-box { width: 100%; max-width: 420px; }
.mc-install-box { width: 100%; max-width: 760px; }
.mc-auth-brand { text-align: center; margin-bottom: 18px; }
.mc-auth-brand h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.mc-check-ok { color: var(--mc-in); font-weight: 700; }
.mc-check-bad { color: #b42318; font-weight: 700; }
.mc-env { white-space: pre; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; background: #0f2a44; color: #e8eef5; padding: 14px; border-radius: 8px; overflow-x: auto; }

/* Hidden until JavaScript shows it */
.mc-hide { display: none !important; }

/* ---------- Print (day book, close report, ledger) ---------- */
@media print {
    .mc-side, .mc-head-actions, .mc-noprint, .btn, form.mc-filter { display: none !important; }
    .mc-main { padding: 0; }
    .mc-card { border: 0; }
    body { background: #fff; }
}

/* Phones: let the − / + buttons wrap around the count box */
@media (max-width: 600px) {
    .mc-stepper { flex-wrap: wrap; justify-content: flex-start; }
    .mc-stepper .mc-qty { order: -1; width: 100%; margin: 0 0 4px; }
    .mc-notes th:nth-child(2) { text-align: left !important; }
}
