:root { --blue:#1565c0; --border:#ccc; --ink:#222; }
* { box-sizing:border-box; }
body { font-family:"Segoe UI", Arial, sans-serif; margin:0; background:#f0f2f5; color:var(--ink); }
#app { max-width:1320px; margin:0 auto; padding:16px; }
h1 { font-size:20px; margin:8px 0 14px; }
h3 { margin:4px 0 8px; }
.card { background:#fff; border:1px solid var(--border); border-radius:8px; padding:14px; margin-bottom:14px; }
.hint { font-size:12px; color:#777; margin:2px 0 10px; }
.btn { background:var(--blue); color:#fff; border:none; border-radius:5px; padding:9px 16px; font-size:14px; cursor:pointer; margin-right:8px; }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.btn.sec { background:#546e7a; }
.btn.warn { background:#c62828; }
.btn.small { padding:4px 10px; font-size:12px; margin-right:4px; }
.amount { text-align:right; white-space:nowrap; }
.right { text-align:right; }

/* ---------- top bar ---------- */
#topbar { background:#0d47a1; color:#fff; padding:10px 16px; display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
#topbar .brand { font-size:16px; font-weight:bold; }
#topbar .spacer { flex:1; }
#topbar .who { font-size:12px; opacity:.9; }
#topbar button { background:rgba(255,255,255,.15); color:#fff; border:1px solid rgba(255,255,255,.35);
                 border-radius:5px; padding:5px 12px; font-size:12px; cursor:pointer; }

/* ---------- login ---------- */
#loginWrap { max-width:360px; margin:9vh auto; }
#loginWrap input { width:100%; padding:9px; border:1px solid var(--border); border-radius:4px; font-size:14px; margin-bottom:10px; }
#loginWrap .btn { width:100%; margin:0; }
.err { color:#c62828; font-size:13px; margin:6px 0; }
p.ok { color:#1b5e20; font-size:13px; margin:6px 0; }
#zohoReport { margin:6px 0 4px; }
#turnoverBox .minitable, #turnoverBox2 .minitable { width:100%; }

/* the running turnover figure, big enough to read across the room */
.bignum { background:#f1f8e9; border:1px solid #c5e1a5; border-radius:6px; padding:10px 14px; margin:0 0 10px;
  font-size:15px; color:#33691e; }
.bignum b { font-size:24px; margin-left:6px; vertical-align:-2px; }
.bignum span { display:block; font-size:12px; color:#607d3b; margin-top:3px; }

/* year-on-year movement */
.minitable td.up { color:#1b5e20; font-weight:bold; }
.minitable td.down { color:#c62828; font-weight:bold; }
.minitable td.up small, .minitable td.down small { font-weight:normal; }
/* months across, years down — keep the year label in view while scrolling */
.yearwise th, .yearwise td { white-space:nowrap; padding:5px 9px; }
.yearwise td:first-child, .yearwise th:first-child { position:sticky; left:0; background:#fff; z-index:1; }
.yearwise tr.gtotal td:first-child { background:#fff8e1; }
.yearwise td.yr-tot { background:#f3f6fb; font-weight:bold; }

/* ---------- settings ---------- */
.settings { display:flex; flex-wrap:wrap; gap:12px; }
.settings label { display:flex; flex-direction:column; font-size:12px; color:#555; gap:3px; }
.settings input, .settings select { padding:6px 8px; border:1px solid var(--border); border-radius:4px; font-size:13px; }
textarea.block { width:100%; padding:6px; border:1px solid var(--border); border-radius:4px; font-size:12px; font-family:inherit; }

/* ---------- drop zone ---------- */
#drop { border:2px dashed #999; border-radius:8px; padding:30px; text-align:center; color:#666; cursor:pointer; background:#fafafa; }
#drop.over { border-color:var(--blue); background:#e3f0fc; }

/* ---------- tables ---------- */
table.tx { width:100%; border-collapse:collapse; font-size:13px; }
table.tx th, table.tx td { border:1px solid #e0e0e0; padding:5px 6px; text-align:left; vertical-align:top; }
table.tx th { background:#f5f5f5; position:sticky; top:0; z-index:1; }
table.tx input[type=text], table.tx textarea, table.tx select { width:100%; border:1px solid #ddd; border-radius:3px; padding:4px; font-size:12px; font-family:inherit; }
table.tx textarea { resize:vertical; min-height:44px; }
tr.skipped { background:#fff3f3; opacity:.65; }
tr.missing-name { background:#fff3e0; }
tr.missing-name input.name { border:2px solid #d32f2f; background:#fff; }
tr.issued { background:#f1f8e9; }
tr.cancelled { background:#fafafa; color:#999; text-decoration:line-through; }
.scroller { max-height:60vh; overflow:auto; }

.badge { font-size:10px; border-radius:3px; padding:1px 6px; display:inline-block; white-space:nowrap; }
.badge.draft { background:#eceff1; color:#546e7a; }
.badge.issued { background:#2e7d32; color:#fff; }
.badge.cancelled { background:#b71c1c; color:#fff; }
.badge.excluded { background:#d32f2f; color:#fff; }
.badge.lock { background:#ef6c00; color:#fff; }
.locknote { font-size:9.5px; color:#6a1b9a; margin-top:2px; }
.agentnote { font-size:9.5px; color:#00695c; margin-top:2px; }

/* ---------- summary boxes ---------- */
#taxbox table, #filebox table, #expbox table, .minitable { border-collapse:collapse; font-size:13px; margin:6px 0 12px; }
#taxbox th, #taxbox td, #filebox th, #filebox td, #expbox th, #expbox td,
.minitable th, .minitable td { border:1px solid #bbb; padding:5px 12px; text-align:right; }
#taxbox th, #filebox th, #expbox th, .minitable th { background:#eceff1; }
#taxbox td:first-child, #taxbox th:first-child, #filebox td:first-child, #filebox th:first-child,
#expbox td:first-child, #expbox th:first-child,
.minitable td:first-child, .minitable th:first-child { text-align:left; }
#taxbox tr.gtotal, #expbox tr.gtotal, .minitable tr.gtotal { background:#fff8e1; font-weight:bold; }
#filebox td.ok { color:#1b5e20; font-weight:bold; }
#filebox tr.bad { background:#ffebee; }
.gsthighlight { font-size:15px; font-weight:bold; color:#b71c1c; margin:4px 0 10px; }
#summary, #expsummary { font-size:13px; color:#444; margin:10px 0; }

/* ---------- tabs ---------- */
.tabs { display:flex; gap:6px; margin:4px 0 12px; flex-wrap:wrap; }
.tabs button { border:1px solid var(--border); border-bottom:none; background:#e8eaed; color:#444;
               padding:9px 18px; font-size:14px; border-radius:6px 6px 0 0; cursor:pointer; }
.tabs button.on { background:#fff; color:var(--blue); font-weight:bold; box-shadow:0 -2px 0 var(--blue) inset; }

/* ---------- GST banner ---------- */
#gstbanner { background:#0d47a1; color:#fff; border-radius:8px; padding:12px 16px; margin-bottom:12px;
             display:flex; flex-wrap:wrap; align-items:center; gap:26px; }
#gstbanner .gcell { font-size:12px; opacity:.85; }
#gstbanner .gcell b { display:block; font-size:18px; opacity:1; margin-top:2px; }
#gstbanner .pay { background:#fff; color:#0d47a1; border-radius:6px; padding:8px 18px; }
#gstbanner .pay .lbl { font-size:12px; font-weight:bold; letter-spacing:.5px; }
#gstbanner .pay b { font-size:26px; display:block; }
#gstbanner .note { font-size:11px; opacity:.8; max-width:280px; line-height:1.4; }

/* ---------- save indicator ---------- */
#saveState { font-size:12px; padding:4px 10px; border-radius:12px; display:inline-block; }
#saveState.clean { background:#e8f5e9; color:#1b5e20; }
#saveState.dirty { background:#fff8e1; color:#e65100; }
#saveState.saving { background:#e3f2fd; color:#0d47a1; }
#saveState.failed { background:#ffebee; color:#b71c1c; }

/* ---------- history filters ---------- */
.filters { display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; margin-bottom:10px; }
.filters label { display:flex; flex-direction:column; font-size:12px; color:#555; gap:3px; }
.filters input, .filters select { padding:6px 8px; border:1px solid var(--border); border-radius:4px; font-size:13px; }

/* ---------- print / PDF pages ---------- */
#printArea { display:none; }
@media print {
  body { background:#fff; }
  #app, #topbar { display:none; }
  #printArea { display:block; }
}
@page { size:A4; margin:9mm; }

.inv { page-break-after:always; font-family:Arial, Helvetica, sans-serif; font-size:11.5px; line-height:1.45; color:#222; border:1px solid #90a4ae; width:100%; }
.inv table { border-collapse:collapse; width:100%; }
.inv .hdr td { padding:14px 14px 10px; vertical-align:top; }
.inv .co { font-size:17px; font-weight:bold; color:#1a237e; letter-spacing:.3px; }
.inv .title { font-size:25px; text-align:right; letter-spacing:2px; color:#455a64; font-weight:300; }
.inv .orig { text-align:right; font-size:9.5px; color:#78909c; letter-spacing:1px; }
.inv .meta td { border-top:1px solid #b0bec5; padding:4px 14px; }
.inv .meta .lbl { color:#607d8b; width:110px; }
.inv .billtohead { background:#1565c0; color:#fff; border-top:1px solid #0d47a1; border-bottom:1px solid #0d47a1; padding:6px 14px; font-weight:bold; font-size:11px; letter-spacing:1px; }
.inv .billto { padding:10px 14px 14px; background:#f5f9ff; border-bottom:2px solid #1565c0; }
.inv .billto .recipient-label { display:block; color:#607d8b; font-size:10px; letter-spacing:.7px; text-transform:uppercase; margin-bottom:2px; }
.inv .billto .recipient-name { display:block; color:#111; font-size:17px; font-weight:bold; }
.inv .items th { background:#37474f; color:#fff; padding:6px; font-size:10.5px; border:1px solid #37474f; font-weight:600; }
.inv .items td { border:1px solid #cfd8dc; border-top:none; padding:8px 6px; vertical-align:top; }
.inv .totals td { padding:4px 14px; }
.inv .totals .tlabel { text-align:right; color:#546e7a; }
.inv .totals .tval { text-align:right; width:110px; white-space:nowrap; }
.inv .grand td { font-weight:bold; font-size:13px; color:#000; border-top:1px solid #b0bec5; }
.inv .words { font-style:italic; font-weight:bold; }
.inv .notes { font-size:11px; line-height:1.55; color:#37474f; }
.inv .notes b { color:#1a237e; }
.inv .sigline { display:inline-block; border-top:1px solid #555; padding:5px 30px 0; margin-top:55px; color:#455a64; }
.inv .cancelstamp { color:#b71c1c; border:3px solid #b71c1c; padding:4px 14px; font-size:20px; font-weight:bold;
                    letter-spacing:3px; display:inline-block; transform:rotate(-6deg); margin:10px 14px; }
.inv .trail { font-size:9px; color:#90a4ae; padding:4px 14px 8px; }

.taxsum h2 { font-size:17px; }
.taxsum table { border-collapse:collapse; font-size:13px; margin:8px 0 14px; width:auto; }
.taxsum th, .taxsum td { border:1px solid #777; padding:6px 14px; text-align:right; }
.taxsum td:first-child, .taxsum th:first-child { text-align:left; }
.taxsum tr.gtotal { font-weight:bold; background:#eee; }

.exp { page-break-after:always; font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#222;
       border:1px solid #90a4ae; width:100%; padding:14px; }
.exp h2 { font-size:16px; margin:0 0 2px; color:#4e342e; letter-spacing:1px; }
.exp .sub { font-size:10.5px; color:#6d4c41; margin-bottom:10px; }
.exp .co { font-size:15px; font-weight:bold; color:#3e2723; }
.exp table { border-collapse:collapse; width:100%; font-size:10.5px; }
.exp th { background:#4e342e; color:#fff; border:1px solid #4e342e; padding:5px 4px; font-size:10px; }
.exp td { border:1px solid #d7ccc8; padding:5px 4px; vertical-align:top; }
.exp td.r, .exp th.r { text-align:right; }
.exp tr.gtotal td { background:#efebe9; font-weight:bold; }
.exp .foot { margin-top:10px; font-size:10px; color:#6d4c41; }
