/* TIR — THE INDIA ROADWAYS
   Highway-sign green + reflective yellow, Hind for Hindi/English text,
   Barlow Condensed for signboard headings and numbers. */
:root {
  --sign: #0b5d3b;
  --sign-dark: #083f28;
  --reflect: #f4b400;
  --paper: #f4f5f1;
  --card: #ffffff;
  --ink: #1c2321;
  --muted: #5d6a63;
  --line: #d5dbd2;
  --due: #b42318;
  --due-bg: #fdecea;
  --ok: #17663f;
  --ok-bg: #e5f3ea;
  --radius: 6px;
  --cond: "Barlow Condensed", "Arial Narrow", "Hind", sans-serif;
  --body: "Hind", "Nirmala UI", "Mangal", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--body); }
a { color: var(--sign); }
h1, h2 { font-family: var(--cond); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: .01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
.h-small { font-size: 1.25rem; margin-bottom: .75rem; }
.light { font-weight: 500; color: var(--muted); font-size: .7em; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--reflect); outline-offset: 2px; }

/* ---------- Top bar: the signboard ---------- */
.topbar { background: var(--sign); color: #fff; border-bottom: 5px solid var(--reflect); }
.topbar-in { max-width: 1320px; margin: 0 auto; padding: .7rem 1.25rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--cond); font-weight: 700; font-size: 1.65rem; letter-spacing: .03em; }
.brand-sub { font-size: .8rem; opacity: .85; }
.mainnav { display: flex; gap: .15rem; flex-wrap: wrap; align-items: center; flex: 1; }
.mainnav a { color: #fff; text-decoration: none; padding: .35rem .7rem; border-radius: 4px; font-weight: 500; font-size: .95rem; }
.mainnav a:hover { background: rgba(255,255,255,.12); }
.mainnav a.on { background: #fff; color: var(--sign); }
.nav-user { margin-left: auto; display: flex; gap: .15rem; }
.nav-user .logout { opacity: .8; }
.nav-toggle { display: none; margin-left: auto; background: transparent; color: #fff; border: 2px solid #fff; border-radius: 4px; padding: .3rem .8rem; font: 600 1rem var(--body); }

.wrap { max-width: 1320px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.foot { max-width: 1320px; margin: 0 auto; padding: 1rem 1.25rem 2rem; display: flex; gap: 1.5rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }

/* ---------- Panels, forms ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin: 0 0 1.25rem; }
fieldset.panel { min-width: 0; }
legend { font-family: var(--cond); font-weight: 700; font-size: 1.15rem; padding: 0 .4rem; margin-left: -.4rem; color: var(--sign); }
fieldset:not(.panel) { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 1rem; padding: .75rem 1rem; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-tools { display: flex; gap: .5rem; flex-wrap: wrap; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }

label { display: flex; flex-direction: column; gap: .2rem; font-size: .88rem; font-weight: 500; color: var(--muted); position: relative; margin-bottom: .7rem; }
input, select, textarea {
  font: 500 1rem var(--body); color: var(--ink); background: #fff;
  border: 1px solid #b9c2b8; border-radius: 4px; padding: .5rem .6rem; min-height: 42px; width: 100%;
}
input:focus, select:focus { border-color: var(--sign); outline: 2px solid var(--reflect); outline-offset: 0; }
label.key input { border: 2px solid var(--sign); font-weight: 700; font-size: 1.1rem; }
.pfx { position: absolute; left: .6rem; bottom: .62rem; color: var(--muted); font-size: .9rem; pointer-events: none; }
.pfx + input { padding-left: 3.4rem; }
.grid { display: grid; gap: 0 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.hint { font-size: .88rem; color: var(--muted); margin: -.2rem 0 .6rem; min-height: 1.2em; }
.hint.due { color: var(--due); font-weight: 600; }
.money .total-box output { display: block; font-family: var(--cond); font-weight: 700; font-size: 1.9rem; color: var(--sign); line-height: 42px; }
.sub-money { border-top: 1px dashed var(--line); padding-top: .7rem; margin-top: .2rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 42px; padding: .45rem 1rem;
  border: 1px solid #aab4aa; background: #fff; color: var(--ink); border-radius: 4px; font: 600 .95rem var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--sign); color: var(--sign); }
.btn-primary { background: var(--sign); border-color: var(--sign); color: #fff; }
.btn-primary:hover { background: var(--sign-dark); color: #fff; }
.btn-danger { color: var(--due); border-color: #e3b1ab; }
.btn-danger:hover { background: var(--due); color: #fff; border-color: var(--due); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-small { min-height: 32px; padding: .2rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; position: sticky; bottom: 0; background: var(--paper); padding: .8rem 0; border-top: 1px solid var(--line); }
.push-right { margin-left: auto; }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok); border-left: 4px solid var(--ok); }
.flash-err { background: var(--due-bg); color: var(--due); border-left: 4px solid var(--due); }

.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.filters label { margin: 0; min-width: 150px; }
.filters .grow { flex: 1 1 260px; }
.inline-search { display: flex; gap: .4rem; flex-wrap: wrap; }
.inline-search input { width: auto; min-width: 150px; }
.summary { margin: 0 0 .8rem; color: var(--muted); }
.summary b { color: var(--ink); font-family: var(--cond); font-size: 1.15rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: .5rem .6rem; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.tbl td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:hover { background: #f7faf6; }
.tbl tfoot th { border-top: 2px solid var(--ink); border-bottom: 0; color: var(--ink); font-size: .95rem; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.due { color: var(--due); }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions a { margin-left: .8rem; font-weight: 600; }
.tbl .ob td { color: var(--muted); font-style: italic; }
.tbl .closing th { font-size: 1.05rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: .05rem .45rem; border-radius: 3px; background: #eceee9; color: var(--muted); }
.tag-paid { background: var(--ok-bg); color: var(--ok); }
.tag-unpaid { background: var(--due-bg); color: var(--due); }
.empty { color: var(--muted); padding: 1rem 0; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { color: var(--sign); text-decoration: underline; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; }

/* ---------- Home ---------- */
.home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.home-date { margin: 0 0 .15rem; color: var(--muted); font-weight: 500; }
.home-head h1 { font-size: 2.4rem; }
.today { display: flex; gap: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; flex-wrap: wrap; }
.today > div { padding: .55rem 1.1rem; border-right: 1px solid var(--line); }
.today > div:last-child { border-right: 0; }
.today dt { font-size: .8rem; color: var(--muted); }
.today dd { margin: 0; font-family: var(--cond); font-weight: 700; font-size: 1.6rem; line-height: 1.1; }
.today .warn dd { color: var(--due); }

.signs { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 1rem; margin-bottom: 1.75rem; }
.sign { display: block; background: var(--sign); color: #fff; text-decoration: none; border-radius: 12px; padding: 6px; box-shadow: 0 3px 0 var(--sign-dark); transition: transform .12s ease, box-shadow .12s ease; }
.sign-in { display: grid; grid-template-rows: auto auto 1fr; height: 100%; min-height: 150px; border: 3px solid #fff; border-radius: 8px; padding: 1rem 1.1rem .8rem; }
.sign-title { font-family: var(--cond); font-weight: 700; font-size: 1.9rem; line-height: 1; }
.sign-hi { font-size: .95rem; opacity: .92; margin-top: .3rem; }
.sign-arrow { width: 42px; height: 42px; fill: #fff; align-self: end; justify-self: end; }
.sign:hover, .sign:focus-visible { transform: translateY(-2px); box-shadow: 0 5px 0 var(--sign-dark); }
.sign:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--sign-dark); }
.sign-main { background: var(--reflect); color: var(--ink); box-shadow: 0 3px 0 #b88700; }
.sign-main .sign-in { border-color: var(--ink); }
.sign-main .sign-arrow { fill: var(--ink); }
.sign-main .sign-title { font-size: 2.3rem; }
.sign-main:hover, .sign-main:focus-visible { box-shadow: 0 5px 0 #b88700; }

/* ---------- Ledger statement ---------- */
.st-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.st-head h2 { font-size: 1.7rem; }
.st-head p { margin: .1rem 0 0; }
.st-range { font-weight: 600; }
.print-only { display: none; }

/* ---------- Login ---------- */
.page-auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; background: var(--sign); }
.auth { width: 100%; max-width: 560px; }
.auth-sign { color: #fff; border: 3px solid #fff; border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 1rem; display: flex; flex-direction: column; box-shadow: 0 0 0 6px var(--sign), 0 0 0 9px var(--reflect); }
.auth-sign .brand-name { font-size: 2.2rem; }
.page-auth .panel { padding: 1.4rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .signs { grid-template-columns: 1fr 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .mainnav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; }
  .nav-open .mainnav { display: flex; }
  .nav-user { margin-left: 0; border-top: 1px solid rgba(255,255,255,.3); padding-top: .4rem; }
  .two-col, .g3 { grid-template-columns: 1fr; }
  .signs { grid-template-columns: 1fr; }
  .sign-in { min-height: 110px; }
  .home-head h1 { font-size: 1.9rem; }
  .today > div { flex: 1 1 45%; border-bottom: 1px solid var(--line); }
  .span2 { grid-column: auto; }
}
@media (max-width: 460px) {
  .g2, .g4 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .sign { transition: none; }
}

/* ---------- Print (debtors / ledger) ---------- */
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; font-size: 11pt; }
  .topbar, .foot, .no-print, .flash, .form-actions { display: none !important; }
  .print-only { display: block; }
  .wrap { padding: 0; max-width: none; }
  .panel { border: 0; padding: 0; }
  .tbl th, .tbl td { padding: 3px 5px; border-bottom: 1px solid #999; }
  .tbl tbody tr:hover { background: none; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Login (split) ---------- */
.page-login { margin: 0; min-height: 100vh; background: #fff; }
.login-split { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-art { position: relative; background: #bfe0f2; display: grid; place-items: center; overflow: hidden; padding: 2rem; }
.login-art::before { content: ""; position: absolute; left: -10%; right: -10%; bottom: 110px; height: 180px; background: #5f9e76; border-radius: 50% 50% 0 0; }
.login-board { position: relative; z-index: 1; background: var(--sign); color: #fff; border-radius: 14px; padding: 1.6rem 2rem 1.4rem; box-shadow: inset 0 0 0 4px var(--sign), inset 0 0 0 8px #fff, 0 8px 0 rgba(0,0,0,.12); display: flex; flex-direction: column; gap: .3rem; text-align: center; margin-bottom: 120px; }
.lb-top { font-size: .95rem; opacity: .9; }
.lb-name { font-family: var(--cond); font-weight: 800; font-size: clamp(2.2rem, 4.5vw, 3.6rem); line-height: 1; letter-spacing: .03em; }
.lb-route { display: flex; align-items: center; justify-content: center; gap: .7rem; font-family: var(--cond); font-size: 1.5rem; color: var(--reflect); margin-top: .3rem; }
.lb-route i { display: block; width: 70px; height: 4px; background: repeating-linear-gradient(90deg, var(--reflect) 0 12px, transparent 12px 20px); }
.login-road { position: absolute; left: 0; right: 0; bottom: 0; height: 110px; background: #3b403d; border-top: 6px solid var(--reflect); }
.login-road span { position: absolute; left: 0; right: 0; top: 48px; height: 6px; background: repeating-linear-gradient(90deg, #f1f1ea 0 60px, transparent 60px 104px); }
.login-box { display: flex; flex-direction: column; justify-content: center; max-width: 440px; width: 100%; margin: 0 auto; padding: 2.5rem 1.5rem; }
.login-box h1 { font-size: 2.6rem; margin: 1rem 0 .3rem; }
.login-box .muted { margin: 0 0 1.4rem; }
.login-box .small { font-size: .88rem; margin-top: 1.2rem; }
.back-link { font-weight: 600; text-decoration: none; }
.pw-wrap { display: flex; }
.pw-wrap input { border-radius: 4px 0 0 4px; }
.pw-eye { border: 1px solid #b9c2b8; border-left: 0; background: #f1f3ef; border-radius: 0 4px 4px 0; padding: 0 .9rem; font: 600 .9rem var(--body); color: var(--ink); cursor: pointer; }
.btn-lg { min-height: 50px; font-size: 1.05rem; margin-top: .4rem; }
@media (max-width: 800px) {
  .login-split { grid-template-columns: 1fr; }
  .login-art { min-height: 250px; padding: 1.2rem; }
  .login-art::before { bottom: 60px; height: 90px; }
  .login-board { margin-bottom: 60px; padding: 1rem 1.3rem; }
  .login-road { height: 60px; }
  .login-road span { top: 24px; }
  .login-box { padding-top: 1.2rem; }
}

/* ---------- Users / backup ---------- */
.tbl .me-row td { background: #f7faf6; }
.inline-form { display: inline; }
.link-danger { background: none; border: 0; color: var(--due); font: 600 .92rem var(--body); cursor: pointer; padding: 0; margin-left: .8rem; }
.link-danger:hover { text-decoration: underline; }
.danger-zone { border-color: #e3b1ab; }
.danger-zone h2 { color: var(--due); }
.stat-row { display: flex; gap: 2rem; flex-wrap: wrap; margin: 0 0 1rem; }
.stat-row div { font-size: .9rem; color: var(--muted); }
.stat-row b { display: block; font-family: var(--cond); font-size: 1.7rem; color: var(--ink); line-height: 1.1; }
details.edit-user { margin-top: .3rem; }
details.edit-user summary { cursor: pointer; color: var(--sign); font-weight: 600; }
label.check { flex-direction: row; color: var(--ink); font-size: .95rem; }
label.check span { display: flex; gap: .5rem; align-items: center; }
label.check input { width: 20px; min-height: 20px; }
.login-board::before, .login-board::after { content: ""; position: absolute; top: 100%; width: 12px; height: 124px; background: #6b746e; z-index: -1; }
.login-board::before { left: 22%; }
.login-board::after { right: 22%; }
@media (max-width: 800px) { .login-board::before, .login-board::after { height: 64px; } }
.quick { display: flex; flex-wrap: wrap; gap: .5rem; margin: -0.5rem 0 1.5rem; }
.quick a { text-decoration: none; font-weight: 600; padding: .45rem .9rem; border: 1px solid var(--line); background: #fff; border-radius: 4px; color: var(--ink); }
.quick a:hover { border-color: var(--sign); color: var(--sign); }
.mainnav a { font-size: .9rem; padding: .35rem .55rem; }
.small-text { font-size: .82rem; color: var(--muted); }
/* delivery status in lists */
.dlv-select { min-height: 32px; padding: .15rem .4rem; font-size: .85rem; font-weight: 600; width: auto; border-radius: 4px; }
.dlv-ok { background: var(--ok-bg); color: var(--ok); border-color: #9fd0b3; }
.dlv-no { background: var(--due-bg); color: var(--due); border-color: #e3b1ab; }
.dlv-none { color: var(--muted); }
.dlv-saved { outline: 2px solid var(--ok); }
.today .ok dd, .today .ok dd a { color: var(--ok); }
.today .warn dd a { color: var(--due); }
.today dd a { text-decoration: none; }
/* consignor GST + hide checkbox */
.gst-wrap { display: flex; gap: .5rem; align-items: center; }
.gst-wrap input[name="c_gst"] { flex: 1; min-width: 0; }
.hide-chk { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; font-size: .8rem; color: var(--ink); background: #f1f3ef; border: 1px solid var(--line); border-radius: 4px; padding: .3rem .5rem; cursor: pointer; }
.hide-chk input { width: 16px; min-height: 16px; margin: 0; }
.field { display: flex; flex-direction: column; gap: .2rem; margin-bottom: .7rem; }
.field > label { margin: 0; font-size: .88rem; font-weight: 500; color: var(--muted); }
.hide-chk { flex-direction: row; margin: 0; }
/* delivery filter tabs */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.seg a { padding: .5rem .9rem; text-decoration: none; font-weight: 600; font-size: .9rem; color: var(--ink); border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--ink); color: #fff; }
.seg a.seg-ok.on { background: var(--ok); }
.seg a.seg-no.on { background: var(--due); }
/* receipt photo buttons */
.pod { display: inline-flex; gap: .3rem; align-items: center; white-space: nowrap; }
.pod-btn { display: inline-flex; align-items: center; gap: .3rem; min-height: 32px; min-width: 32px; justify-content: center; padding: .15rem .5rem; border: 1px solid var(--line); background: #fff; border-radius: 4px; font: 600 .82rem var(--body); color: var(--ink); text-decoration: none; cursor: pointer; }
.pod-btn svg { width: 16px; height: 16px; fill: currentColor; }
.pod-btn:hover { border-color: var(--sign); color: var(--sign); }
.pod-view { color: var(--ok); border-color: #9fd0b3; background: var(--ok-bg); }
.pod-del:hover { color: var(--due); border-color: var(--due); }
.pod-empty { color: var(--muted); border-style: dashed; }
.pod-busy { opacity: .45; pointer-events: none; }
.field-lbl { font-size: .88rem; font-weight: 500; color: var(--muted); }
textarea { font: 500 1rem/1.5 var(--body); resize: vertical; }
.qr-current { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.qr-current img { width: 120px; height: auto; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }
.page-setup-lbl { flex-direction: row; align-items: center; gap: .4rem; margin: 0; color: var(--ink); font-weight: 600; }
.page-setup { width: auto; min-height: 42px; }
.branch-badge { display: inline-block; background: var(--reflect); color: var(--ink); font-size: .72rem; font-weight: 700; padding: 0 .4rem; border-radius: 3px; margin-left: .2rem; vertical-align: middle; }
.login-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.lc-head { display: flex; align-items: center; gap: .6rem; }
.lc-head h2 { margin: 0; }
.login-card .small-text { margin: .2rem 0 .8rem; }
.import-box summary { cursor: pointer; font-size: 1.05rem; }
.import-box[open] summary { margin-bottom: .8rem; }
.import-form { max-width: 720px; }
.import-form label.check { margin-bottom: .4rem; }
.pod { gap: .5rem; }
.pod-slot { display: inline-flex; gap: 2px; }
.pod-slot .pod-view { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pod-slot .pod-view + .pod-del { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; }
.pod { gap: .5rem; }
.pod-slot { display: inline-flex; gap: 0; }
.pod-slot .pod-view { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pod-slot .pod-view + .pod-del { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; }
.serial-tbl td { vertical-align: middle; }
.num-in { width: 120px; min-height: 38px; }
/* select GRs to print together */
.sel-col { width: 34px; text-align: center; }
.sel-col input { width: 18px; min-height: 18px; margin: 0; cursor: pointer; }
.tbl tr.is-picked td { background: #fff8db; }
.print-selected:disabled { opacity: .55; cursor: default; }
.gst-wrap { gap: .35rem; }
.hide-chk { padding: .3rem .45rem; }
.today dd.sub { font-family: var(--body); font-size: .72rem; font-weight: 500; color: var(--muted); line-height: 1.2; margin-top: .1rem; }
.pay-select { min-width: 104px; }
