:root { --gold: #e0b25a; --gold-d: #b98a32; --ink: #1f1d1a; --muted: #77716a; --line: #e7e2da; --bg: #f7f5f1; --card: #fff; --red: #c0392b; --green: #2e7d4f; }
* { box-sizing: border-box; }
html, body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; }
a { color: var(--gold-d); }
h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 18px 0 8px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .grow { flex: 1; } .right { text-align: right; }
.center { display: grid; place-items: center; min-height: 60vh; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }

/* shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 210px; flex: none; background: var(--ink); color: #fff; display: flex; flex-direction: column; padding: 16px 10px; position: sticky; top: 0; height: 100vh; }
.side a { color: #ddd; text-decoration: none; padding: 9px 12px; border-radius: 6px; }
.side a.active, .side a:hover { background: #33302b; color: var(--gold); }
.side-foot { margin-top: auto; padding: 10px 12px; border-top: 1px solid #3a3631; }
.side-foot .link { color: var(--gold); padding: 0; }
.brand { font-weight: 700; letter-spacing: .5px; padding: 4px 12px 16px; color: var(--gold); }
.brand span { color: #fff; font-weight: 400; }
.main { flex: 1; min-width: 0; }
.top { display: none; }
.page { padding: 20px 24px 90px; max-width: 1100px; }
.bottom { display: none; }
.note-bar { background: #fff4dc; border-bottom: 1px solid #f0dcae; padding: 6px 24px; font-size: .85rem; }
.note-bar.warn { background: #fde8e6; border-color: #f2c2bd; }

@media (max-width: 760px) {
  .side { display: none; }
  .top { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 5; }
  .top .brand { padding: 0; } .top .link { color: var(--gold); }
  .page { padding: 14px 12px 90px; }
  .note-bar { padding: 6px 14px; }
  .bottom { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 5; padding-bottom: env(safe-area-inset-bottom); }
  .bottom a { flex: 1; text-align: center; padding: 12px 2px; text-decoration: none; color: var(--muted); font-size: .85rem; }
  .bottom a.active { color: var(--gold-d); font-weight: 600; }
}

/* controls */
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 14px; border-radius: 8px; font: inherit; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1408; font-weight: 600; }
.btn.danger { color: var(--red); border-color: #efc7c2; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: none; color: var(--gold-d); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: .95rem; }
input, select, textarea { font: inherit; color: var(--ink); padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }
label.check input { width: auto; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #f1d9a6; border-color: var(--gold); }
.error { background: #fde8e6; color: var(--red); padding: 8px 12px; border-radius: 8px; margin: 10px 0; }
.ok { background: #e6f4ec; color: var(--green); padding: 8px 12px; border-radius: 8px; margin: 10px 0; }

/* cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.tile .num { font-size: 1.5rem; font-weight: 700; margin-top: 4px; }
.tile.alert .num { color: var(--red); }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: inherit; text-decoration: none; }
a.item:hover { border-color: var(--gold); }
.item .main-col { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); padding: 16px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th { background: var(--gold); text-align: left; padding: 8px 10px; font-size: .85rem; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
tr.total td { background: #fbf6ea; font-weight: 700; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #eee; white-space: nowrap; }
.st-enquiry { background: #e8eefc; color: #2f55b3; } .st-finalized { background: #fff1d6; color: #8a6312; }
.st-inprogress { background: #e3f3ea; color: var(--green); } .st-onhold { background: #eee; color: #555; }
.st-completed { background: var(--ink); color: var(--gold); } .st-lost { background: #fde8e6; color: var(--red); }
.pay-due { background: #fff1d6; color: #8a6312; } .pay-overdue { background: #fde8e6; color: var(--red); }
.pay-paid { background: #e3f3ea; color: var(--green); } .pay-upcoming { background: #eee; color: #555; } .pay-billed { background: #e8eefc; color: #2f55b3; }

.bar { height: 6px; background: #eee; border-radius: 99px; overflow: hidden; min-width: 70px; }
.bar div { height: 100%; background: var(--gold); }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 14px 0; }
.tabs button { background: none; border: none; padding: 10px 12px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-color: var(--gold); font-weight: 600; }
.tabs button.money { color: var(--gold-d); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.chips button { border: 1px solid var(--line); background: #fff; padding: 5px 12px; border-radius: 99px; font: inherit; font-size: .85rem; cursor: pointer; }
.chips button.on { background: var(--ink); color: var(--gold); border-color: var(--ink); }

.map { width: 100%; height: 260px; border: 1px solid var(--line); border-radius: 10px; }
.head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.head h1 { margin: 0; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--ink); }
.login .card { width: 100%; max-width: 380px; }
.brand-big { font-size: 1.4rem; font-weight: 700; color: var(--gold-d); }
.brand-big span { color: var(--ink); font-weight: 400; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fde8e6; padding: 10px 16px; z-index: 10; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
.loading { display: grid; place-items: center; height: 100vh; color: var(--gold-d); font-family: "Segoe UI", sans-serif; }
a.tile { color: inherit; text-decoration: none; } a.tile:hover { border-color: var(--gold); }
input[type=range] { accent-color: var(--gold-d); padding: 0; border: none; }

/* bill sheet (A4 on the letterhead) */
.sheet-wrap { overflow: hidden; }
.sheet { width: 210mm; height: 297mm; position: relative; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.18); transform-origin: top left;
  font-family: "Segoe UI", Arial, sans-serif; color: #1f2233; font-size: 10.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet .bg { position: absolute; inset: 0; width: 210mm; height: 297mm; }
.sheet .content { position: absolute; left: 20mm; right: 20mm; top: 47mm; }
.sheet .top { display: flex; justify-content: space-between; background: none; color: inherit; position: static; padding: 0; gap: 0; z-index: auto; }
.sheet h1 { text-align: center; font-size: 20pt; letter-spacing: 3px; margin: 7mm 0 2mm; }
.sheet .rule { border-top: 1.2px solid #1f2233; margin-bottom: 6mm; }
.sheet .to { line-height: 1.55; margin-bottom: 6mm; }
.sheet table { width: 100%; border-collapse: collapse; background: transparent; }
.sheet th { background: #e0b25a; color: #1f2233; font-size: 10pt; text-align: left; padding: 2.2mm 2mm; border: 1px solid #c99a45; }
.sheet td { padding: 2.5mm 2mm; border: 1px solid #bbb; vertical-align: top; background: rgba(255,255,255,.85); }
.sheet .r { text-align: right; white-space: nowrap; } .sheet .c { text-align: center; }
.sheet .sub { font-size: 9pt; color: #444; margin-top: 1mm; line-height: 1.4; }
.sheet tr.total td { font-weight: 700; font-size: 11.5pt; background: #f3ead8; }
.sheet .words { margin: 4mm 0 6mm; }
.sheet .notes { font-size: 9.5pt; line-height: 1.6; }
.sheet .notes ol { margin: 1mm 0 0; padding-left: 5mm; }
.sheet .bank { font-size: 9.5pt; margin-top: 4mm; white-space: pre-line; }
.sheet .sign { margin-top: 14mm; text-align: right; line-height: 1.5; }
.sheet .sign .line { display: inline-block; width: 55mm; border-top: 1px solid #1f2233; margin-top: 14mm; padding-top: 1mm; text-align: center; }
.print-bar { position: sticky; top: 0; z-index: 5; background: var(--ink); padding: 8px 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.print-page { background: #8a857d; min-height: 100vh; padding: 0 8px 20px; }
.print-page .sheet-wrap { margin: 12px auto 0; width: fit-content; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff; }
  .print-bar { display: none; }
  .print-page { background: none; padding: 0; min-height: 0; }
  .print-page .sheet-wrap { margin: 0; height: auto !important; width: auto !important; }
  .sheet { transform: none !important; box-shadow: none; }
}

/* public client form */
.public { min-height: 100vh; background: var(--bg); }
.public-head { display: flex; gap: 12px; align-items: center; background: var(--ink); padding: 14px 16px; }
.public-head img { width: 48px; height: 48px; border-radius: 10px; }
.public-body { max-width: 680px; margin: 0 auto; padding: 16px 12px 40px; }
