/*
 * File          : assets/style.css
 * Updation      : dd-Mmm-yyyy date box, font size +/- buttons, A/c holder name no-wrap
 * Modified date : 29-Oct-2026
 * Modified time : 10:49 AM
 */
:root {
  --navy: #2a3289;
  --blue: #1e56b0;
  --ink: #1d2433;
  --muted: #6b7280;
  --line: #dfe3ea;
  --bg: #f3f5f9;
  --yellow: #ffff00;
  --red: #e00000;
  --green: #12805c;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Roboto, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; }
a { color: var(--blue); }
h1 { font-size: 20px; margin: 4px 0 16px; }
h2 { font-size: 16px; margin: 20px 0 10px; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 16px; background: var(--navy); color: #fff; padding: 0 16px; min-height: 52px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; }
.brand img { height: 26px; background: #fff; border-radius: 3px; padding: 2px 4px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
.topbar nav a { color: #dfe4ff; text-decoration: none; padding: 16px 10px; font-size: 13.5px; }
.topbar nav a:hover, .topbar nav a.on { color: #fff; background: rgba(255,255,255,.12); }
.topbar nav a.new { color: #ffe866; }
.topbar nav a.logout { margin-left: auto; }
.menu-btn { display: none; background: none; border: 0; color: #fff; font-size: 22px; margin-left: auto; cursor: pointer; }
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; }
  .menu-btn { display: block; }
  .topbar nav { display: none; flex-basis: 100%; flex-direction: column; padding-bottom: 8px; }
  .menu-open .topbar nav { display: flex; }
  .topbar nav a { padding: 10px; }
  .topbar nav a.logout { margin-left: 0; }
}
.wrap { max-width: 1280px; margin: 0 auto; padding: 18px 16px 40px; }
.page-foot { text-align: center; color: #9aa1ad; font-size: 12px; padding: 0 0 18px; }

/* ---------- Common bits ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash.ok { background: #e3f6ec; color: #0c5a3f; border: 1px solid #b6e2cb; }
.flash.err { background: #fde8e8; color: #9b1c1c; border: 1px solid #f5bcbc; }
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; border-radius: 6px; font-size: 13.5px; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; }
.btn:hover { border-color: #b9c1cf; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: #b42318; border-color: #f2c4c0; }
.btn.sm { padding: 4px 8px; font-size: 12.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
input[type=text], input[type=date], input[type=number], input[type=password], input[type=email], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #cdd3dd; border-radius: 5px; font: inherit; color: inherit; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9db5ec; border-color: #6d8fdc; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hl { background: var(--yellow) !important; color: var(--red) !important; font-weight: 700 !important; }
.badge { display: inline-block; font-size: 11.5px; padding: 2px 7px; border-radius: 10px; font-weight: 600; }
.badge.paid { background: #dff5e8; color: #0c6b45; }
.badge.unpaid { background: #fde8e8; color: #a61b1b; }
.badge.partial { background: #fff3d6; color: #8a5a00; }
.badge.conv { background: #e4ebff; color: #253a8f; }

/* ---------- dd-Mmm-yyyy date box ---------- */
.dmy-wrap { position: relative; display: flex; align-items: stretch; }
.dmy-wrap input.dmy { flex: 1; min-width: 0; padding-right: 30px; }
.dmy-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; font-size: 14px; padding: 2px 4px; }
.dmy-picker { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
input.dmy:invalid { outline: 2px solid #e5484d; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { padding: 8px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { background: #eef1f7; font-size: 12.5px; color: #3b4456; white-space: nowrap; position: sticky; top: 0; }
table.list tr:hover td { background: #fafbfe; }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
table.list tfoot td { font-weight: 700; background: #f6f8fb; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters > div { min-width: 150px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs a { padding: 7px 14px; border-radius: 6px; text-decoration: none; background: #fff; border: 1px solid var(--line); color: var(--ink); }
.tabs a.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, #2a3289, #1e56b0); }
.login-box { background: #fff; width: 100%; max-width: 340px; border-radius: 12px; padding: 28px 24px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-box img { height: 54px; }
.login-box h1 { margin: 12px 0 4px; }
.login-box input { text-align: center; font-size: 26px; letter-spacing: 12px; margin: 16px 0 12px; }
.login-box .btn { width: 100%; padding: 11px; font-size: 15px; }

/* ---------- Invoice entry ---------- */
.inv-head { display: grid; gap: 16px; grid-template-columns: 1.4fr 1fr; }
@media (max-width: 800px) { .inv-head { grid-template-columns: 1fr; } }
.cust-wrap { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid #cdd3dd; border-radius: 0 0 6px 6px; max-height: 260px; overflow-y: auto; z-index: 10; box-shadow: 0 8px 20px rgba(0,0,0,.12); display: none; }
.suggest div { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #f0f2f6; }
.suggest div:hover, .suggest div.sel { background: #eef3ff; }
.suggest small { color: var(--muted); display: block; }
.new-cust { font-size: 12px; color: var(--green); margin-top: 4px; display: none; }

table.lines { width: 100%; border-collapse: collapse; }
table.lines th { font-size: 12px; color: var(--muted); text-align: left; padding: 6px 4px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.lines td { padding: 4px; border-bottom: 1px solid #eef0f4; vertical-align: middle; }
table.lines input.desc { border-color: transparent; background: #f8f9fc; }
table.lines input.desc:focus { background: #fff; }
table.lines .w-qty { width: 70px; }
table.lines .w-amt { width: 120px; }
table.lines input.n { text-align: right; }
.fmt { display: flex; gap: 2px; }
.fmt button { width: 28px; height: 30px; border: 1px solid #d5dae3; background: #fff; border-radius: 4px; cursor: pointer; font-size: 13px; padding: 0; color: #333; }
.fmt button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.fmt .sw { width: 22px; }
.fmt .fs { min-width: 26px; text-align: center; font-size: 12px; color: #444; align-self: center; }
.fmt .sw span { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }
.fmt .sw.on { background: #fff; outline: 2px solid var(--navy); outline-offset: -2px; color: inherit; }
.row-act { display: flex; gap: 2px; }
.row-act button { border: 0; background: none; cursor: pointer; font-size: 14px; padding: 4px 5px; color: #5c6577; border-radius: 4px; }
.row-act button:hover { background: #eef1f7; }
.row-act button.del { color: #c0362c; }
@media (max-width: 800px) {
  table.lines thead { display: none; }
  table.lines tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.lines td { border: 0; }
  table.lines td.c-desc { grid-column: 1 / -1; }
  table.lines .w-qty, table.lines .w-amt { width: auto; }
}
.totals { margin-left: auto; max-width: 380px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { font-size: 17px; border-top: 1px solid var(--line); padding-top: 8px; }
.words { font-style: italic; color: #555; font-size: 13px; }
.sticky-save { position: sticky; bottom: 0; background: rgba(243,245,249,.95); padding: 10px 0; border-top: 1px solid var(--line); z-index: 5; }

/* ---------- Printable invoice (A4) ---------- */
.doc { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 16mm 12mm 12mm; font-family: Roboto, Arial, sans-serif; color: #222; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.doc .bar-top { height: 9px; background: var(--navy); }
.doc .bar-bot { height: 3px; background: #1d3b3a; margin-top: 18px; }
.doc .co { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 12mm 6px 14mm; }
.doc .co-name { font-size: 29px; color: #0f4c97; letter-spacing: .3px; }
.doc .co-name b { font-weight: 700; }
.doc .co-addr { color: #555; font-size: 13.5px; line-height: 1.65; margin-top: 4px; }
.doc .co-kv { font-size: 13.5px; color: #555; margin-top: 4px; }
.doc .co-kv b { color: #111; margin-left: 18px; }
.doc .logo { text-align: center; padding-right: 30px; }
.doc .logo img { height: 52px; }
.doc .logo div { font-size: 10.5px; font-weight: 700; color: #1d2b4f; }
.doc .rule { border-top: 3px solid #1d3b3a; }
.doc .title { text-align: center; color: var(--navy); font-size: 31px; font-weight: 700; margin: 10px 0 22px; }
.doc .body { padding: 0 14mm; }
.doc .bill { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid #ccc; }
.doc .bill-to .lbl { font-weight: 700; color: #444; font-size: 15px; }
.doc .bill-to .nm { font-size: 18px; font-weight: 700; color: #666; margin: 5px 0 8px; }
.doc .bill-to .ad { font-size: 15px; color: #333; white-space: pre-line; }
.doc .bill-to .gs { font-size: 13px; color: #555; font-weight: 700; margin-top: 18px; }
.doc .meta { width: 235px; text-align: center; flex-shrink: 0; }
.doc .meta .lbl { font-weight: 700; color: #444; font-size: 15px; margin: 0 0 4px; }
.doc .meta .val { background: var(--yellow); color: var(--red); font-weight: 700; border: 1px solid #222; padding: 4px; font-size: 14.5px; margin-bottom: 14px; }
.doc table.items { width: 100%; border-collapse: collapse; margin-top: 30px; }
.doc table.items th { color: var(--navy); font-size: 16px; text-align: left; padding: 6px 4px 10px; }
.doc table.items th.r, .doc table.items td.r { text-align: right; }
.doc table.items td { padding: 5px 4px; font-size: 13.5px; vertical-align: top; }
.doc table.items tbody tr:nth-child(odd) td { background: #f2f2f2; }
.doc table.items tbody tr:last-child td { border-bottom: 1px solid #bbb; }
.doc table.items td.desc { white-space: pre-wrap; }
.doc table.items td.amt { color: #666; white-space: nowrap; }
.doc .sum { display: flex; justify-content: flex-end; margin-top: 14px; }
.doc .sum table td { padding: 4px 0 4px 26px; font-size: 13.5px; text-align: right; }
.doc .sum td.k { color: var(--navy); }
.doc .sum td.k2 { color: #666; }
.doc .sum td.v { font-weight: 700; min-width: 110px; }
.doc .sum td.big { background: var(--yellow); color: var(--red); font-weight: 700; border: 1px solid #222; padding-right: 4px; }
.doc .foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 10px; }
.doc .h { font-weight: 700; color: #555; font-size: 13px; margin: 10px 0 6px; }
.doc .w { font-style: italic; color: #666; font-size: 13px; }
.doc .bank td { padding: 4px 0; font-size: 13px; color: #666; }
.doc .bank td:first-child { width: 205px; }
.doc .bank td b { color: #555; }
.doc .bank td:last-child { white-space: nowrap; }
.doc .bank td.dk { color: #222; }
.doc .sign { color: #999; font-size: 13.5px; padding-top: 34px; min-width: 230px; }
.doc .sign .sp { height: 60px; }
.doc .stamp { display: inline-block; border: 2px solid #12805c; color: #12805c; font-weight: 700; padding: 2px 10px; border-radius: 4px; transform: rotate(-6deg); font-size: 15px; }
.doc-tools { max-width: 210mm; margin: 0 auto 12px; }

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .no-print, .doc-tools, .topbar, .page-foot { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .doc { box-shadow: none; margin: 0; width: 210mm; min-height: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media screen and (max-width: 840px) {
  .doc { width: 100%; padding: 8px; min-height: 0; }
  .doc .co, .doc .body { padding-left: 4px; padding-right: 4px; }
  .doc .bill { flex-direction: column; }
  .doc .meta { width: 100%; }
}

/* ---------- GST report ---------- */
table.list.gst td, table.list.gst th { font-size: 12.5px; padding: 6px; }
table.list.gst input.dmy { width: 118px; padding: 3px 24px 3px 4px; font-size: 12px; }
.st-cell { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.st-cell input[type=checkbox] { width: 16px; height: 16px; }
.st-done { background: #e8f7ef !important; }
.sumbox { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.sumbox div { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.sumbox b { display: block; font-size: 17px; margin-top: 2px; }
.print-head { display: none; }
@media print {
  .print-head { display: block; text-align: center; margin: 10mm 0 4mm; }
  table.list.gst { font-size: 10px; }
  table.list.gst th { position: static; }
  .gst-wrap { padding: 0 8mm; }
}
