/* ============================================================
   Business P&L — SkillTapPro
   Bahi-khata inspired: ink blue ledger + marigold accent
   Mobile-first, big touch targets, no external dependencies
   ============================================================ */
:root {
  --ink: #1b2a4a;         /* deep ledger blue */
  --ink-soft: #33456b;
  --paper: #f7f5ef;       /* ledger paper */
  --card: #ffffff;
  --line: #e3ded2;
  --marigold: #e8940a;    /* accent */
  --marigold-dark: #c67c04;
  --profit: #1e7d46;
  --loss: #c0392b;
  --credit: #8a4baf;
  --muted: #7a7466;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(27,42,74,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Segoe UI', 'Noto Sans Devanagari', 'Mukta', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 40px;
}

/* ---------- Header ---------- */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .brand { font-weight: 700; font-size: 17px; line-height: 1.2; }
.topbar .brand small { display: block; font-weight: 400; font-size: 12px; color: #f4c66d; }
.topbar .nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.topbar a {
  color: #fff; text-decoration: none; font-size: 13px;
  padding: 6px 12px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  white-space: nowrap;
}
.topbar a:hover { background: rgba(255,255,255,.12); }
.topbar a.lang { background: var(--marigold); border-color: var(--marigold); color: #1b2a4a; font-weight: 600; }

.wrap { max-width: 960px; margin: 0 auto; padding: 16px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 {
  font-size: 17px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--marigold);
  display: inline-block;
}
.card h2 .icon { margin-right: 6px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=tel], input[type=month], select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--ink);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--marigold);
  outline-offset: 1px;
  border-color: var(--marigold);
}
.btn {
  display: inline-block;
  width: 100%;
  margin-top: 14px;
  padding: 13px 20px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: var(--ink);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.btn:hover { background: var(--ink-soft); }
.btn.gold { background: var(--marigold); color: #1b2a4a; }
.btn.gold:hover { background: var(--marigold-dark); color: #fff; }
.btn.small { width: auto; padding: 6px 12px; font-size: 13px; margin-top: 0; border-radius: 8px; }
.btn.green { background: var(--profit); }
.btn.red { background: var(--loss); }
.btn.outline { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .grid2.stack-sm { grid-template-columns: 1fr; } }

/* ---------- Entry type selector (big buttons) ---------- */
.type-select { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 4px; }
.type-select input { position: absolute; opacity: 0; pointer-events: none; }
.type-select label.type-opt {
  margin: 0;
  padding: 14px 8px;
  text-align: center;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: #fffdf8;
  transition: all .12s;
}
.type-select input:checked + label.type-opt {
  border-color: var(--marigold);
  background: #fdf3df;
  box-shadow: 0 0 0 1px var(--marigold);
}
.type-opt .emoji { display: block; font-size: 22px; margin-bottom: 2px; }

/* ---------- Summary tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.tile .t-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile .t-value { font-size: 19px; font-weight: 800; margin-top: 2px; word-break: break-all; }
.tile.hero { grid-column: span 2; background: var(--ink); color: #fff; border: none; }
.tile.hero .t-label { color: #f4c66d; }
.tile.hero .t-value { font-size: 28px; }
.pos { color: var(--profit); }
.neg { color: var(--loss); }
.tile.hero .pos { color: #6fe3a1; }
.tile.hero .neg { color: #ff9d8a; }

/* ---------- Tables / entry lists ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: none; }
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge.sale { background: #e2f3e9; color: var(--profit); }
.badge.purchase { background: #e7ecf7; color: var(--ink-soft); }
.badge.expense { background: #fdeae7; color: var(--loss); }
.badge.drawing { background: #fdf3df; color: var(--marigold-dark); }
.badge.credit { background: #f1e6f8; color: var(--credit); }
.badge.ok { background: #e2f3e9; color: var(--profit); }
.badge.off { background: #eee; color: #777; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.alert.ok { background: #e2f3e9; color: var(--profit); border: 1px solid #bfe5cf; }
.alert.err { background: #fdeae7; color: var(--loss); border: 1px solid #f3c2ba; }
.alert.warn { background: #fdf3df; color: #8a6202; border: 1px solid #f0d9a5; }

/* ---------- Login page ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-box { width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 18px; }
.login-logo .mark {
  width: 68px; height: 68px; border-radius: 18px;
  background: var(--ink);
  color: var(--marigold);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800;
  box-shadow: var(--shadow);
}
.login-logo h1 { font-size: 21px; margin-top: 10px; }
.login-logo p { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button {
  flex: 1; padding: 10px 4px; font-size: 13px; font-weight: 700; font-family: inherit;
  border: 1.5px solid var(--line); background: #fffdf8; border-radius: 10px; cursor: pointer; color: var(--ink-soft);
}
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.lang-switch { text-align: center; margin-top: 14px; }
.lang-switch a { color: var(--ink-soft); font-size: 14px; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); font-size: 13px; }
.mt { margin-top: 12px; }
.right { text-align: right; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.stat-line:last-child { border-bottom: none; }
.stat-line b { font-variant-numeric: tabular-nums; }
.stat-line.total { border-top: 2px solid var(--ink); border-bottom: none; margin-top: 4px; padding-top: 10px; font-size: 17px; }
.hidden { display: none !important; }

@media print {
  .topbar, .no-print, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}


/* ---------- v2 additions ---------- */
.brand-tag { display: block; font-size: 11px; font-weight: 600; color: #f4c66d; letter-spacing: .3px; }
.topbar a.on { background: var(--marigold); border-color: var(--marigold); color: #1b2a4a; font-weight: 700; }
.site-foot { text-align: center; font-size: 12px; color: var(--muted); padding: 20px 10px 8px; }
.badge.offr { background: #fdeae7; color: var(--loss); }
.badge.warnb { background: #fdf3df; color: #8a6202; }
.settle-btns form { margin-bottom: 4px; }
.settle-btns .btn { margin-bottom: 4px; }

/* Bill rows */
.bill-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.7fr 0.8fr auto auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.bill-row input, .bill-row select { padding: 9px 10px; font-size: 14px; }
.bi-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 14px; }
@media (max-width: 640px) {
  .bill-row { grid-template-columns: 1fr 1fr; }
  .bill-row .bi-item { grid-column: span 2; }
  .bill-row .bi-name { grid-column: span 2; }
}

/* Bill print receipt */
.bill-print { max-width: 480px; margin-left: auto; margin-right: auto; }
.bill-head { text-align: center; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.bill-shop { font-size: 20px; font-weight: 800; }
@media print {
  .bill-print { max-width: 100%; border: none; }
}

/* Danger zone */
.danger-zone { border: 1.5px dashed var(--loss); background: #fffafa; }
.danger-zone h2 { color: var(--loss); }


/* ---------- v2.1 additions ---------- */

/* Remove number input up/down spinners (scroll was changing values) */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* WhatsApp button */
.btn.wa { background: #25d366; color: #fff; border-color: #25d366; }
.bill-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.bill-actions .btn { flex: 1; min-width: 110px; text-align: center; }

/* Compact receipt on screen */
.bill-print { max-width: 400px; font-size: 14px; }
.bill-print .tbl th, .bill-print .tbl td { padding: 6px 8px; font-size: 13px; }
.bill-shop { font-size: 18px; }

/* Half-A4 (A5) print */
@media print {
  @page { size: A5 portrait; margin: 7mm; }
  body { background: #fff; }
  .topbar, .site-foot, .no-print { display: none !important; }
  .bill-print {
    max-width: 100%;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    font-size: 12px;
  }
  .bill-print .tbl th, .bill-print .tbl td { padding: 4px 6px; font-size: 11px; }
  .bill-shop { font-size: 16px; }
  .bill-head { padding-bottom: 6px; }
}

/* Part payment inline form */
.part-pay { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.part-pay input[type=number] { width: 110px; padding: 7px 9px; font-size: 14px; }
.part-pay input[type=date] { width: 140px; padding: 7px 9px; font-size: 13px; }
.settle-row td { background: #f7fbf7; }


/* ---------- Education mode ---------- */
.edu-banner {
  background: repeating-linear-gradient(45deg, #fdf3df, #fdf3df 14px, #fbe9c6 14px, #fbe9c6 28px);
  color: #8a6202; font-weight: 700; text-align: center;
  padding: 7px 10px; font-size: 13px; letter-spacing: .3px;
  border-bottom: 1.5px solid var(--marigold);
}
.edu-bill { position: relative; overflow: hidden; }
.edu-watermark {
  position: absolute; top: 45%; left: 50%;
  transform: translate(-50%, -50%) rotate(-28deg);
  font-size: 42px; font-weight: 800; color: rgba(198, 137, 16, 0.14);
  white-space: nowrap; pointer-events: none; z-index: 1;
}
@media print {
  .edu-banner { display: none; }
  .edu-watermark { display: block !important; color: rgba(150, 110, 20, 0.18); }
}
