:root {
  --brand: #0f6b4f; --brand-2: #0b3a2b; --accent: #ffd27a;
  --ink: #142019; --ink-2: #33433a; --muted: #6b7a71; --line: #e1e7e2; --soft: #eef3ef;
  --bg: #f4f6f3; --panel: #fff; --bad: #c62828; --ok: #0f6b4f;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,40,28,.06), 0 8px 24px rgba(16,40,28,.07);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 15px; line-height: 1.8; -webkit-font-smoothing: antialiased; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.5; margin: 0; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { background: var(--brand-2); color: #fff; position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; }
.logo svg { width: 34px; height: 34px; flex: none; }
.grow { flex: 1; }
.nav { display: flex; gap: 4px; }
.nav a { color: #cfe5d8; padding: 4px 12px; border-radius: 8px; white-space: nowrap; }
.nav a.on, .nav a:hover { color: #fff; background: rgba(255,255,255,.12); }

/* buttons, forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); border-radius: 10px; padding: 8px 16px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0c5a42; color: #fff; }
.btn.light { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn.light:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1d2a12; font-weight: 700; }
.btn.block { width: 100%; }
.btn.sm { padding: 4px 12px; font-size: 14px; }
.btn:disabled { opacity: .6; cursor: default; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.inp { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; outline: none; }
.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,107,79,.12); }
.inp[aria-invalid="true"] { border-color: var(--bad); }
.ltr { direction: ltr; text-align: left; }
.hint { color: var(--muted); font-size: 13px; }
.err { background: #fdecec; color: var(--bad); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin-bottom: 12px; }
.okmsg { background: #e8f5ee; color: var(--ok); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin-bottom: 12px; }
.pw { position: relative; display: block; }
.pw .inp { padding-left: 64px; }
.pw button { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--brand); cursor: pointer; font-size: 13px; }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: s .8s linear infinite; }
@keyframes s { to { transform: rotate(360deg); } }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 18px; margin-bottom: 4px; }

/* auth pages */
.auth { flex: 1; display: grid; place-items: center; padding: 32px 16px; }
.auth .card { width: min(440px, 100%); padding: 28px; }
.auth h1 { font-size: 22px; }
.auth .sub { color: var(--muted); margin: 2px 0 20px; }
.auth .alt { text-align: center; margin-top: 14px; font-size: 14px; color: var(--muted); }

/* landing */
.hero { background: radial-gradient(1000px 420px at 85% -10%, rgba(217,154,27,.25), transparent 60%), linear-gradient(160deg, #0d3d2e, #0f5a43);
  color: #fff; padding: 72px 0 80px; }
.hero h1 { font-size: 36px; font-weight: 900; max-width: 700px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: #d4eadd; font-size: 17px; max-width: 620px; margin: 12px 0 26px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* dashboard */
.page { flex: 1; padding: 26px 0 48px; }
.page h1 { font-size: 24px; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; margin-top: 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: 12px; border-radius: 999px; padding: 1px 10px; background: var(--soft); color: var(--ink-2); }
.badge.submitted { background: #e3f0ff; color: #1557a6; }
.badge.cancelled { background: #eceff1; color: #546e7a; }
.badge.queued { background: #fff4d6; color: #8a5a00; }
.badge.processing { background: #e6ecff; color: #3346a8; }
.badge.ready { background: #e3f5ea; color: #0f6b4f; }
.badge.failed { background: #fdecec; color: var(--bad); }
.badge.admin { background: #fff1d1; color: #7a4c00; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: right; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 8px 6px; white-space: nowrap; }
.tbl td { border-bottom: 1px solid var(--soft); padding: 8px 6px; vertical-align: middle; }
.scroll { overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.who { font-size: 14px; }
.titlebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.titlebar h1 { font-size: 22px; }
.code { font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; font-size: 13px; color: var(--ink-2); background: var(--soft); }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* order pages: map + side column */
.order-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; margin-top: 12px; }
.order-grid .side { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.map-card { position: sticky; top: 76px; }
.mapbox { margin-top: 8px; }
.map { width: 100%; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #dfe7e2; z-index: 0; }
.map.loading { display: grid; place-items: center; color: var(--muted); height: 420px; }
.maptools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.maptools .file { position: relative; overflow: hidden; }
.maptools .file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mapwrap { position: relative; }
.maphint { position: absolute; z-index: 500; inset-inline: 54px 10px; bottom: 24px; margin: 0; pointer-events: none;
  background: rgba(11,58,43,.88); color: #fff; font-size: 13px; line-height: 1.7; border-radius: 10px; padding: 6px 12px; }
.maphint b { color: var(--accent); }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { direction: ltr; font-size: 10px; }
.pair { display: grid; grid-template-columns: 3fr 2fr; gap: 8px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.quote { transition: opacity .2s; }
.quote.busy { opacity: .55; }
.tbl.price td:last-child { text-align: left; white-space: nowrap; }
.tbl .total td { font-weight: 800; border-top: 2px solid var(--line); font-size: 15px; }
.progress { height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--brand); border-radius: 999px; transition: width .6s; }
.progress .bar.queued, .progress .bar.running { background: repeating-linear-gradient(45deg, #0f6b4f 0 10px, #138a65 10px 20px); background-size: 28px 28px; animation: stripes 1s linear infinite; }
.progress .bar.failed { background: var(--bad); }
@keyframes stripes { to { background-position: 28px 0; } }
.log { margin-top: 10px; font-size: 13px; }
.log summary { cursor: pointer; color: var(--brand); }
.log ol { margin: 8px 0 0; padding-inline-start: 18px; }
.log li.error { color: var(--bad); }
.log li.warn { color: #8a5a00; }
.log time, .timeline time { font-size: 12px; color: var(--muted); }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }

/* pro-forma (A4 when printed) */
.invoice-page { flex: 1; padding: 20px 16px 40px; }
.invoice-bar { max-width: 800px; margin: 0 auto 12px; display: flex; justify-content: space-between; gap: 8px; }
.invoice { max-width: 800px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.invoice header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--brand); padding-bottom: 14px; }
.invoice .brand .logo { color: var(--brand-2); }
.invoice h1 { font-size: 22px; }
.invoice h3 { font-size: 14px; color: var(--muted); margin-bottom: 2px; }
.invoice .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.invoice .parties p { margin: 0; }
.invoice .lines td:nth-child(2), .invoice .lines td:nth-child(3), .invoice .lines th:nth-child(2), .invoice .lines th:nth-child(3) { text-align: left; white-space: nowrap; }
.invoice .lines tfoot td { padding: 6px; }
.invoice .lines tfoot td:first-child { text-align: left; color: var(--ink-2); }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .noprint, .top, footer { display: none !important; }
  .invoice-page { padding: 0; }
  .invoice { border: 0; box-shadow: none; padding: 0; max-width: none; }
}

footer { color: var(--muted); font-size: 13px; text-align: center; padding: 22px 16px 30px; }

@media (max-width: 800px) {
  .grid, .row2, .order-grid, .invoice .parties { grid-template-columns: minmax(0, 1fr); }
  .map-card { position: static; }
  .invoice { padding: 18px; }
  .hero { padding: 48px 0 56px; } .hero h1 { font-size: 28px; }
  .logo span, .who { display: none; }
  .tbl .hide-m { display: none; }
  /* phone: keep the service name readable (it wrapped one word per line) */
  .tbl { font-size: 13px; }
  .tbl th, .tbl td { padding: 8px 4px; }
  .tbl .code { font-size: 11.5px; }
  .tbl .svc { min-width: 7.5em; }
}
