/* base.css: reset and design tokens only. No components, no layout.
   Each section has its own CSS file under assets/css/<section>/. */
:root{
  /* Colors */
  --bg:#f5f7fa;
  --surface:#ffffff;
  --fg:#0f172a;
  --text-2:#334155;
  --muted:#64748b;
  --faint:#94a3b8;
  --border:#e3e8ef;
  --divider:#eef1f5;
  --primary:#1565c0;
  --primary-ink:#ffffff;
  --primary-soft:#e8f0fe;
  --ok:#047857;   --ok-soft:#e7f6ee;
  --err:#b91c1c;  --err-soft:#fdeeee;
  --warn:#b45309; --warn-soft:#fff4e0;

  /* Shape */
  --radius:12px;
  --radius-sm:8px;
  --shadow:0 1px 2px rgba(15,23,42,.05);

  /* Type scale. Nothing smaller than 12px. Inputs use 16px so iOS never zooms. */
  --font:"Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs:12px;
  --fs-sm:13px;
  --fs-base:15px;
  --fs-md:16px;
  --fs-lg:18px;
  --fs-xl:22px;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%; text-size-adjust:100%}
html,body{margin:0; padding:0}
body{
  background:var(--bg); color:var(--fg);
  font-family:var(--font); font-size:var(--fs-base); line-height:1.45;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}
a{color:var(--primary); text-decoration:none}
button, input, select, textarea{font-family:inherit}
h1,h2,h3,p{margin:0}
.num{font-variant-numeric:tabular-nums}

/* Mobile safety: inputs (especially date inputs) may shrink to their column, and the
   page never scrolls sideways. overflow-x:clip keeps sticky headers working. */
input, select, textarea, button{min-width:0; max-width:100%}
html, body{overflow-x:clip}

/* Baki (money still to collect) is always red */
.baki-amt{color:var(--err) !important; font-weight:700}
.qk-toast .baki-amt{background:#fff; padding:1px 6px; border-radius:6px; white-space:nowrap}

/* BS date picker popup */
.bsp-trigger{
  width:32px; height:32px; border:0; background:transparent; cursor:pointer;
  display:grid; place-items:center; border-radius:8px; padding:0;
  color:var(--muted);
}
.bsp-trigger:hover{background:var(--divider)}
.bsp-trigger svg{width:18px; height:18px; pointer-events:none}
.bsp-popup{
  position:absolute; z-index:9000; width:272px;
  background:#fff; border:1px solid var(--border); border-radius:14px;
  box-shadow:0 8px 32px rgba(0,0,0,.14); padding:10px;
  font-family:var(--font); font-size:14px;
}
.bsp-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:8px}
.bsp-nav{
  width:32px; height:32px; border:1px solid var(--border); border-radius:8px;
  background:#fff; cursor:pointer; font-size:20px; line-height:1;
  display:grid; place-items:center; color:var(--fg);
}
.bsp-nav:hover{background:var(--divider)}
.bsp-title{font-size:14px; font-weight:700; color:var(--fg)}
.bsp-grid{display:grid; grid-template-columns:repeat(7,1fr); grid-auto-rows:34px; gap:3px; align-items:center}
.bsp-dh{display:grid; place-items:center; height:24px; font-size:11px; font-weight:700; color:var(--muted)}
/* Every day box the same fixed size, number centred (no row can grow taller than another) */
.bsp-cell{
  display:grid; place-items:center; height:34px; padding:0; margin:0; border-radius:9px; cursor:pointer;
  font-size:13px; font-weight:500; color:var(--fg); line-height:1; box-sizing:border-box;
}
.bsp-cell:hover:not(.empty):not(.disabled){background:var(--primary-soft); color:var(--primary)}
.bsp-cell.today{font-weight:700; color:var(--primary); box-shadow:inset 0 0 0 1.5px var(--primary)}
.bsp-cell.sel{background:var(--primary); color:#fff; font-weight:700; box-shadow:0 2px 6px rgba(21,101,192,.3)}
.bsp-cell.sel:hover{background:var(--primary)}
.bsp-cell.disabled{color:var(--faint); cursor:default}
/* The blank boxes before day 1 share the class "empty" with the app's empty-state message: undo its padding */
.bsp-popup .bsp-cell.empty{cursor:default; padding:0; margin:0; border:0; background:transparent; height:34px; min-height:0; font-size:0; box-shadow:none}
.bsp-foot{margin-top:8px; border-top:1px solid var(--divider); padding-top:8px; text-align:right}
.bsp-today-btn{
  height:28px; padding:0 12px; border-radius:7px; border:1px solid var(--border);
  background:#fff; cursor:pointer; font-family:var(--font); font-size:12px;
  font-weight:600; color:var(--primary);
}
.bsp-today-btn:hover{background:var(--primary-soft)}

/* Global save toast — appears bottom-center, auto-dismisses */
.g-toast{
  position:fixed; bottom:calc(env(safe-area-inset-bottom,0px) + 72px); left:50%; transform:translateX(-50%) translateY(12px);
  z-index:9999; min-width:200px; max-width:calc(100vw - 32px); padding:12px 18px;
  border-radius:12px; font-size:14px; font-weight:600; line-height:1.4; text-align:center;
  box-shadow:0 4px 24px rgba(0,0,0,.18); pointer-events:none;
  opacity:0; transition:opacity .25s, transform .25s;
}
.g-toast.show{opacity:1; transform:translateX(-50%) translateY(0)}
.g-toast.ok{background:#0f5132; color:#fff}
.g-toast.err{background:#7f1d1d; color:#fff}
.g-toast .baki-amt{color:#fca5a5 !important; background:transparent; padding:0}
