:root {
  --bg: #f4f6f8; --card: #fff; --ink: #1c2530; --muted: #5d6b7a; --line: #dde3ea;
  --brand: #0f4c75; --brand-ink: #fff; --brand-soft: #e6eff6;
  --ok: #1d7a46; --ok-bg: #e4f4ea; --warn: #8a5a00; --warn-bg: #fff2d6; --bad: #a32020; --bad-bg: #fde6e6; --info: #1d5f8f; --info-bg: #e3effa;
  --radius: 8px; --shadow: 0 1px 2px rgba(20,30,40,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Gujarati", sans-serif; color: var(--ink); background: var(--bg); }
body.plain { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: .2rem 0 .6rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
p { margin: .4rem 0 .8rem; }
.muted { color: var(--muted); }
.hint { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; font-weight: 400; }
.req { color: var(--bad); font-size: .8rem; font-weight: 400; margin-left: 4px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--bad); }

.top { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 20; }
.top a { color: var(--brand-ink); text-decoration: none; }
.bar { max-width: 1200px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.bar.sub { background: rgba(0,0,0,.18); max-width: none; justify-content: flex-start; }
.bar.sub nav { max-width: 1200px; margin: 0 auto; width: 100%; }
.brand { font-weight: 700; font-size: 1.05rem; margin-right: 8px; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top nav a { padding: 6px 10px; border-radius: 6px; }
.top nav a:hover, .top nav a.on { background: rgba(255,255,255,.18); }
.who { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.who .muted { color: #cfe0ec; }
.page { max-width: 1200px; margin: 0 auto; padding: 16px 16px 90px; }
.foot { text-align: center; padding: 16px; font-size: .8rem; }

.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.head h1 { margin-bottom: .2rem; }
.count { font-size: .9rem; color: var(--muted); font-weight: 400; }
.crumb { font-size: .85rem; color: var(--muted); margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; box-shadow: var(--shadow); }
.wide640 { width: 100%; max-width: 640px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.card.narrow, main.narrow { width: 100%; max-width: 440px; }
.card.attention { border-color: #e2b24b; background: #fffbf0; }
.empty { text-align: center; color: var(--muted); }

.btn, button.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 6px; padding: 8px 14px; font: inherit; font-size: .95rem; cursor: pointer; text-decoration: none; line-height: 1.3; min-height: 38px; }
.btn:hover { background: #f1f4f7; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0b3c5e; }
.btn.danger { color: var(--bad); border-color: #e3b5b5; }
.btn.small { padding: 4px 10px; font-size: .85rem; min-height: 30px; }
.btn.block { display: block; width: 100%; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #7fb2d9; outline-offset: 1px; }
button.link, .linklike { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.who button.link { color: var(--brand-ink); }
form.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }

label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 10px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
input[type=text], input[type=search], input[type=tel], input[type=password], input[type=file], select, textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; border: 1px solid #b9c4cf; border-radius: 6px; background: #fff; color: var(--ink); min-height: 40px; }
textarea { resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; }
.form .row2, .form .row3, .form .row4 { display: grid; gap: 12px; }
.row2 { grid-template-columns: 1fr 1fr; } .row3 { grid-template-columns: repeat(3, 1fr); } .row4 { grid-template-columns: repeat(4, 1fr); }

.flash { padding: 10px 14px; border-radius: 6px; margin: 0 0 12px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: #b7dfc7; color: #14532d; }
.flash.err { background: var(--bad-bg); border-color: #efb9b9; color: #7a1a1a; }

.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e9edf1; color: #3b4856; vertical-align: middle; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.info { background: var(--info-bg); color: var(--info); }
.chip.busy { background: var(--info-bg); color: var(--info); }
.chip.stage-closed { background: #dfe5ea; } .chip.stage-subsidy { background: #efe3fb; color: #5a2d8a; }
.chip.stage-install, .chip.stage-inspection { background: var(--warn-bg); color: var(--warn); }
.chip.stage-applied, .chip.stage-feasibility { background: var(--info-bg); color: var(--info); }

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto auto; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input, .filters select { margin-top: 0; }
.filters .check { margin: 0; white-space: nowrap; }

.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.card .tablewrap { border: 0; margin-bottom: 0; }
table.list { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.list th, table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th.num, table.list td.num { text-align: right; }
table.list thead th { background: #f0f4f8; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); position: sticky; top: 0; }
table.list tbody tr:hover { background: #fafcfd; }
table.list tfoot th { background: #f0f4f8; }
tr.voided td { text-decoration: line-through; color: var(--muted); }
tr.voided td:last-child { text-decoration: none; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 12px 0; }

.menu { position: relative; display: inline-block; }
.menu summary { list-style: none; } .menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(20,30,40,.15); min-width: 230px; z-index: 30; display: flex; flex-direction: column; }
.menu-body a { padding: 9px 14px; color: var(--ink); text-decoration: none; } .menu-body a:hover { background: var(--brand-soft); }
.addbox { padding: 12px 16px; } .addbox summary { cursor: pointer; display: inline-block; list-style: none; } .addbox summary::-webkit-details-marker { display: none; } .addbox form { margin-top: 14px; }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin: 8px 0 16px; overflow-x: auto; }
.tabs a { padding: 9px 16px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; font-weight: 600; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }

ul.checks { list-style: none; padding: 0; margin: 0; } ul.checks li { padding: 5px 0; border-bottom: 1px dashed var(--line); } ul.checks li:last-child { border-bottom: 0; }
.sugg { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid #ecd9a8; }

.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
fieldset.group { margin: 0 0 16px; } fieldset.group legend { font-weight: 700; padding: 0 6px; font-size: 1.02rem; }
.frow { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 8px 0; border-bottom: 1px solid #eef1f4; }
.frow:last-child { border-bottom: 0; }
.frow > label:first-child { margin: 8px 0 0; }
.frow input[type=text], .frow textarea { margin-top: 0; }
.frow .vtick { margin: 8px 0 0; display: flex; gap: 6px; align-items: center; font-weight: 400; font-size: .88rem; white-space: nowrap; }
.frow .src { grid-column: 2 / 4; font-size: .78rem; color: var(--muted); }
.frow .warntext { grid-column: 2 / 4; font-size: .85rem; color: var(--warn); }
.frow.haswarn input, .frow.haswarn textarea { border-color: #e2b24b; background: #fffdf5; }
.frow .ro { grid-column: 2 / 4; padding-top: 8px; }
.stickybar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 10px 16px; text-align: center; z-index: 15; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat .v { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .s { font-size: .82rem; color: var(--muted); }

.doc { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.doc .thumb { display: block; width: 96px; height: 72px; background: #eef2f6; border-radius: 6px; overflow: hidden; text-align: center; }
.doc .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc .pdficon { display: grid; place-items: center; height: 100%; font-weight: 800; color: #a32020; }
.doc .readmsg { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }
.doc .ops { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 330px; }
.doc .ops select { margin: 0; min-height: 30px; padding: 3px 6px; font-size: .85rem; max-width: 200px; }

table.copy th { width: 38%; font-weight: 600; background: #fafbfc; }
table.copy td.val { word-break: break-word; }
table.copy td.ops { text-align: right; white-space: nowrap; }
table.copy .vtick { display: inline-flex; gap: 6px; align-items: center; margin: 0 0 0 8px; font-weight: 400; }
table.copy tr.empty { opacity: .6; }

pre.log { background: #11181f; color: #d6e2ee; padding: 12px; border-radius: 6px; overflow-x: auto; font-size: .8rem; max-height: 340px; }
.note p { margin-top: 0; }
details.void summary { cursor: pointer; color: var(--bad); }
.btn.copied { background: var(--ok-bg); border-color: #b7dfc7; }

@media (max-width: 800px) {
  .filters, .row2, .row3, .row4 { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 1fr; } .frow .src, .frow .warntext, .frow .ro { grid-column: 1; }
  .frow > label:first-child { margin-top: 0; }
  .doc { grid-template-columns: 80px 1fr; } .doc .thumb { width: 80px; height: 64px; } .doc .ops { grid-column: 1 / 3; justify-content: flex-start; max-width: none; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 2px solid var(--line); padding: 6px 0; }
  table.stack td { border: 0; padding: 3px 12px; text-align: left !important; display: flex; justify-content: space-between; gap: 12px; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; flex: 0 0 40%; }
  table.stack td:not([data-label])::before { content: none; }
  table.stack tfoot { display: none; }
  .menu-body { right: auto; left: 0; }
  .bar { gap: 6px 12px; }
  .brand { flex: 1 1 auto; margin: 0; }
  .who { order: 2; } .who .muted { display: none; }
  .top nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .top nav a { white-space: nowrap; }
  .top { position: static; }
}
table.list td[data-label="Date"], table.list td[data-label="By"], table.list td[data-label="When"] { white-space: nowrap; }
@media print { .top, .stickybar, .actions, .tabs, .foot { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }

/* Quotations and invoices: a page that looks like paper on screen and prints as A4. */
body.printpage { background: #e9edf1; margin: 0; padding: 16px; }
.doctools { box-sizing: border-box; max-width: 210mm; margin: 0 auto 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.doctools p { margin: 4px 0; }
.docactions, .docform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.flashbox { max-width: 210mm; margin: 0 auto 12px; }
.paper { position: relative; box-sizing: border-box; width: 210mm; max-width: 100%; margin: 0 auto; background: #fff; color: #111; padding: 14mm; box-shadow: 0 1px 6px rgba(0, 0, 0, .15); font-size: 10.5pt; line-height: 1.4; font-family: "Noto Sans Gujarati", "Noto Sans", "Segoe UI", Arial, sans-serif; }
.paper h1 { font-size: 16pt; margin: 0 0 4px; }
.paper h3 { font-size: 10pt; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 3px; color: #333; }
.paper p { margin: 2px 0; }
.paper section { margin: 8px 0; }
.paper .lh { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #222; padding-bottom: 8px; margin-bottom: 10px; }
.paper .lh p { font-size: 9.5pt; }
.paper .doctitle { font-size: 15pt; font-weight: 800; letter-spacing: .08em; white-space: nowrap; align-self: flex-start; }
.paper table.meta { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.paper table.meta th { text-align: left; width: 17%; font-weight: 600; color: #444; padding: 3px 6px; background: #f4f4f4; }
.paper table.meta td { width: 33%; padding: 3px 6px; border-bottom: 1px solid #ddd; }
.paper table.items { width: 100%; border-collapse: collapse; margin: 10px 0 6px; }
.paper table.items th, .paper table.items td { border: 1px solid #555; padding: 4px 6px; vertical-align: top; }
.paper table.items thead th { background: #eee; font-weight: 600; }
.paper table.items .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.paper table.items tfoot td { font-weight: 600; }
.paper table.items tr.grand td { background: #f0f0f0; font-size: 11pt; }
.paper .words { font-weight: 600; margin: 4px 0; }
.paper .taxwords, .paper .validity, .paper .declaration { font-size: 9.5pt; color: #333; }
.paper ol.terms { margin: 2px 0 4px 18px; padding: 0; }
.paper .sign { margin-top: 24px; text-align: right; }
.paper .signline { margin-top: 38px; border-top: 1px solid #555; display: inline-block; padding-top: 3px; min-width: 55mm; }
.paper .stamp { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%) rotate(-20deg); font-size: 54pt; font-weight: 800; color: rgba(180, 0, 0, .28); border: 6px solid rgba(180, 0, 0, .28); padding: 4px 24px; pointer-events: none; letter-spacing: .1em; }
.paper .stamp.soft { color: rgba(100, 100, 100, .22); border-color: rgba(100, 100, 100, .22); }
@page { size: A4; margin: 12mm; }
@media print {
  body.printpage { background: #fff; padding: 0; }
  .noprint { display: none !important; }
  .paper { box-shadow: none; width: auto; padding: 0; font-size: 9.5pt; line-height: 1.3; }
  .paper h1 { font-size: 14pt; }
  .paper section { margin: 5px 0; }
  .paper table.items { margin: 6px 0 4px; }
  .paper .sign { margin-top: 12px; }
  .paper .signline { margin-top: 26px; }
  .paper table.items tr, .paper section, .paper .sign, .paper .bank { break-inside: avoid; }
}
/* screen only: a printed page is about 700px wide and must keep the full layout */
@media screen and (max-width: 800px) {
  body.printpage { padding: 8px; }
  .paper { padding: 10px; font-size: 10pt; }
  .paper .lh { flex-direction: column; }
  .paper table.items { display: block; overflow-x: auto; }
}

/* Document numbers, dates and site references stay on one line in lists. */
table.list td[data-label="Number"], table.list td[data-label="Site"], table.list td[data-label="Date"], table.list td[data-label="Valid until"] { white-space: nowrap; }
