:root {
  /* Brand colors from the Awesome Exteriors crest */
  --wood: #1d2d5e;        /* navy — primary */
  --wood-dark: #16234a;   /* navy hover */
  --wood-light: #3b4f8f;  /* navy focus ring */
  --maroon: #7c2d2d;      /* maroon — accent */
  --maroon-dark: #5f2020;
  --accent: #2f7d4f;
  --bg: #f4f1ec;
  --card: #ffffff;
  --ink: #2b2620;
  --muted: #7d736a;
  --line: #e3ddd3;
  --danger: #c0392b;
  --warn: #d98a16;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 6px 18px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
/* Mountain backdrop (The Lions). A fixed pseudo-element — more reliable on iOS
   than background-attachment:fixed — with a soft scrim so cards stay readable. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(rgba(247,245,241,.15), rgba(247,245,241,.05)), url('/appbg.jpg') center / cover no-repeat;
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  background: var(--wood); color: #fff;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));   /* clear the notch when installed */
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-mark { font-size: 22px; }
.brand-logo {
  height: 38px; width: 38px; object-fit: contain;
  background: #fff; border-radius: 8px; padding: 3px;
}
.menu-toggle {
  display: none; background: rgba(255,255,255,.15); border: none; color: #fff;
  font-size: 20px; width: 40px; height: 40px; border-radius: 8px; cursor: pointer;
}
.back-btn {
  display: none; background: rgba(255,255,255,.15); border: none; color: #fff;
  font-size: 15px; font-weight: 600; height: 40px; padding: 0 14px; border-radius: 8px; cursor: pointer;
}

.layout { display: flex; min-height: calc(100vh - 56px); }

/* Sidebar */
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--card);
  border-right: 1px solid var(--line); padding: 14px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.nav-link {
  display: block; padding: 11px 14px; border-radius: 9px; cursor: pointer;
  color: var(--ink); text-decoration: none; font-weight: 500; white-space: nowrap;
}
.nav-link:hover { background: var(--bg); }
.nav-link.active { background: var(--wood); color: #fff; }
.sidelink {
  display: block; padding: 11px 14px; border-radius: 9px; cursor: pointer;
  color: #fff; text-decoration: none; font-weight: 600; white-space: nowrap;
  background: var(--maroon);
}
.sidelink:hover { background: var(--maroon-dark); }

.content { flex: 1; padding: 24px; max-width: 1100px; margin: 0 auto; width: 100%; }

/* Page header */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head h1 { font-size: 24px; margin: 0; }
.page-sub { color: var(--muted); font-size: 14px; margin: 2px 0 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--wood); color: #fff; border: none; padding: 10px 16px;
  border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--wood-dark); }
.btn.secondary { background: #efe9e0; color: var(--ink); }
.btn.secondary:hover { background: #e5ddd0; }
.btn.ghost { background: transparent; color: var(--wood); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--accent); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; }
.cards { display: grid; gap: 16px; }

/* Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat .value { font-size: 27px; font-weight: 700; margin-top: 6px; }
.stat.alert .value { color: var(--danger); }
.stat.good .value { color: var(--accent); }

/* Tables */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
th { background: #faf7f2; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #faf7f2; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.search-bar {
  width: 100%; padding: 13px 16px; font-size: 16px; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: var(--shadow);
}
.search-bar:focus { outline: 2px solid var(--wood-light); border-color: var(--wood-light); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* Clickable status pill (jobs) */
.stat-pick { border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; font-size: 12px; font-weight: 600; background: #fff; color: var(--ink); cursor: pointer; max-width: 130px; }
.stat-pick.s-active { background: #def0e4; color: #1f7a45; border-color: #bfe3cb; }
.stat-pick.s-started { background: #e3eefb; color: #1f6fc4; border-color: #cfe0f7; }
.stat-pick.s-lead { background: #fdf0d8; color: #97650a; border-color: #f0dcae; }
.stat-pick.s-on-hold { background: #f1efe9; color: #7d736a; }
.stat-pick.s-completed { background: #eceae4; color: #5a534a; }
.stat-pick.s-cancelled { background: #fbe2de; color: #b0341f; border-color: #f3c9c1; }
.stat-pick.s-draft { background: #ece7df; color: #6b6359; }
.stat-pick.s-sent, .stat-pick.s-invoiced { background: #e3eefb; color: #1f6fc4; border-color: #cfe0f7; }
.stat-pick.s-accepted, .stat-pick.s-approved { background: #def0e4; color: #1f7a45; border-color: #bfe3cb; }
.stat-pick.s-declined { background: #fbe2de; color: #b0341f; border-color: #f3c9c1; }
.stat-pick.s-pending { background: #fdf0d8; color: #97650a; border-color: #f0dcae; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge.draft { background: #ece7df; color: #6b6359; }
.badge.sent { background: #e3eefb; color: #1f6fc4; }
.badge.accepted, .badge.paid, .badge.active { background: #def0e4; color: #1f7a45; }
.badge.declined, .badge.overdue { background: #fbe2de; color: #b0341f; }
.badge.unpaid { background: #fdf0d8; color: #97650a; }
.badge.partial { background: #fef3c0; color: #8a6a08; }

/* Forms */
.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--wood-light); border-color: var(--wood-light); }
textarea { resize: vertical; min-height: 70px; }

/* Timesheet "Log a day" rows — wrap nicely on narrow screens */
.ts-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.ts-row .ts-job { flex: 1 1 120px; min-width: 0; }
.ts-row .ts-hours { flex: 0 0 62px; }
.ts-row .ts-del { flex: 0 0 auto; background: none; border: none; cursor: pointer; font-size: 17px; padding: 4px 6px; width: auto; }
.ts-row .ts-label { flex: 1 1 100%; }
.ts-extra { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; margin: 2px 0 6px; }
.ts-oos-lbl { display: flex; align-items: center; gap: 5px; color: var(--ink); font-weight: 600; }
.ts-oos-lbl input { width: auto; }
.ts-photo-status { font-size: 13px; }
.ts-photo-status:not(.muted) { color: var(--accent); font-weight: 600; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow-y: auto;
}
/* When hidden, stay fully out of the way (class display:flex would otherwise
   override the plain [hidden] attribute and trap all clicks). */
.modal-backdrop[hidden] { display: none !important; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 720px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); padding: 22px; }
.modal h2 { margin: 0 0 16px; font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* Line items editor */
.items-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.items-table { width: 100%; border-collapse: collapse; margin-top: 6px; min-width: 460px; }
.items-table th { background: transparent; padding: 6px 6px; }
.items-table td { padding: 4px 4px; border-bottom: 1px solid var(--line); }
.items-table input, .items-table select { padding: 8px; }
.items-table .col-qty { width: 80px; }
.items-table .col-price { width: 110px; }
.items-table .col-sm { width: 78px; }
.items-table .col-sm input { padding: 8px 6px; }
.items-table .col-cat { width: 130px; }
.items-table .col-amt { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.items-table .col-del { width: 38px; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 17px; color: var(--muted); padding: 4px; }
.icon-btn:hover { color: var(--danger); }

/* Section editor (quotes/invoices) */
.qsection { border: 1px solid var(--line); border-radius: 10px; padding: 12px 12px 10px; margin-bottom: 12px; background: #faf9f6; }
.qsection-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.qsection-head .sec-name { font-weight: 600; }
.qsection .icon-btn.sec-del:hover { color: var(--danger); }
.sec-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.sec-subtotal-wrap { color: var(--muted); font-size: 14px; }
.sec-subtotal { color: var(--ink); }

/* Section rows on the printed document */
tr.doc-sec td { background: #faf7f2; font-weight: 700; color: var(--wood);
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc .ln { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; font-weight: 600; }
tr.doc-sec-sub td { font-weight: 600; border-bottom: 2px solid var(--line); }

.totals { margin-top: 14px; margin-left: auto; width: 280px; max-width: 100%; }
.totals .row { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .row.grand { font-weight: 700; font-size: 18px; border-top: 2px solid var(--line); margin-top: 6px; padding-top: 10px; }

/* Copy-from-quote picker */
.imp-sec { margin-bottom: 6px; }
.imp-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; cursor: pointer; border-radius: 6px; }
.imp-row:hover { background: var(--bg); }
.imp-seclabel { background: #faf7f2; font-size: 13px; }
.imp-item-row { padding-left: 24px; }
.imp-item-row > span:first-of-type { flex: 1; }
.imp-row .muted { margin-left: auto; white-space: nowrap; }

/* Template toggles */
.tpl-group { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 700; margin: 18px 0 4px; }
.tpl-row { display: flex; align-items: center; justify-content: space-between;
  padding: 11px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tpl-row:last-child { border-bottom: none; }
.tpl-row > span { font-weight: 500; }
.toggle { position: relative; width: 46px; height: 27px; -webkit-appearance: none; appearance: none;
  background: #cfc8bd; border-radius: 20px; cursor: pointer; transition: background .15s; flex-shrink: 0; outline: none; }
.toggle:checked { background: var(--accent); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  background: #fff; border-radius: 50%; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle:checked::after { left: 22px; }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px;
  z-index: 80; box-shadow: var(--shadow); font-weight: 600;
}
.toast.err { background: var(--danger); }

/* Detail / document view */
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 32px;
  box-shadow: var(--shadow); max-width: 800px; margin: 0 auto; border-top: 5px solid var(--maroon); }
.doc-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.doc-head .biz-block { display: flex; align-items: center; gap: 16px; }
.doc-logo { height: 100px; width: 100px; object-fit: contain; flex-shrink: 0; }
.doc-head .biz { font-size: 22px; font-weight: 800; color: var(--wood); letter-spacing: .01em; }
.doc-head .muted { color: var(--muted); font-size: 14px; white-space: pre-line; }
.doc-title { text-align: right; }
.doc-title h2 { margin: 0; font-size: 28px; letter-spacing: .04em; text-transform: uppercase; color: var(--maroon); }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.doc-meta h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.doc table { margin-top: 8px; }
.doc .notes { margin-top: 22px; color: var(--muted); white-space: pre-line; }
.doc .notes-head { font-size: 1.5em; font-weight: 800; color: var(--ink);
  text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.pay-list { list-style: none; padding: 0; margin: 12px 0 0; }
.pay-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }

.inline-link { color: var(--wood); cursor: pointer; text-decoration: underline; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 18px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tag-row .chip { padding: 7px 14px; border-radius: 20px; background: var(--card); border: 1px solid var(--line);
  cursor: pointer; font-size: 13px; font-weight: 600; }
.tag-row .chip.active { background: var(--wood); color: #fff; border-color: var(--wood); }

/* Catalogue category chips */
.catchips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 16px; }
.catchips .chip { padding: 6px 13px; border-radius: 20px; background: var(--card); border: 1px solid var(--line);
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink); }
.catchips .chip:hover { border-color: var(--wood-light); }
.catchips .chip.active { background: var(--wood); color: #fff; border-color: var(--wood); }
.cat-link { color: var(--wood); text-decoration: none; cursor: pointer; }
.cat-link:hover { text-decoration: underline; }
.cat-prod { display: flex; align-items: center; gap: 10px; }
.cat-thumb { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; flex: none;
  border: 1px solid var(--line); background: #f3efe8; }
.cat-thumb.ph { display: inline-flex; align-items: center; justify-content: center; font-size: 18px; opacity: .55; }
.btn.ghost.sm.prod-edit { padding: 4px 9px; font-size: 14px; }

/* Bundle editor */
.bundle-results { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.bundle-pick { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 11px; cursor: pointer; font-size: 14px; }
.bundle-pick:hover { border-color: var(--wood-light); background: #f6f2ea; }
.bundle-head, .bundle-row { display: grid; grid-template-columns: 1fr 64px 80px 38px 34px; gap: 8px; align-items: center; }
.bundle-head { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; padding: 0 2px; }
.bundle-row { margin-bottom: 6px; }
.bundle-row input[type=text], .bundle-row .bi-desc, .bundle-row .bi-qty, .bundle-row .bi-price { width: 100%; }
.bi-link { display: flex; align-items: center; justify-content: center; }

/* Inline catalogue autocomplete on quote line descriptions */
.desc-ac { position: absolute; z-index: 9999; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 26px rgba(0,0,0,.16); max-height: 290px; overflow-y: auto; }
.desc-ac-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; cursor: pointer;
  font-size: 14px; border-bottom: 1px solid var(--line); }
.desc-ac-item:last-child { border-bottom: none; }
.desc-ac-item:hover, .desc-ac-item.active { background: #f1ece3; }
.desc-ac-name { font-weight: 600; color: var(--ink); }
.desc-ac-price { color: var(--muted); white-space: nowrap; }

/* Costbook editor */
.cb-lmode { display: flex; gap: 18px; margin-bottom: 8px; flex-wrap: wrap; }
.cb-lmode label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.cb-lmode input { width: auto; margin: 0; }
.cb-lrow { display: flex; align-items: center; gap: 8px; }
.cb-lrow input { max-width: 150px; }
.cb-preview { margin-top: 6px; padding: 11px 13px; background: #f3efe8; border-radius: 9px; font-weight: 600; }
.cb-preview strong { color: var(--wood); font-size: 18px; margin: 0 6px; }
.cb-matchip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 10px;
  background: #eef2fb; border-radius: 8px; font-size: 14px; }
.linklike { background: none; border: none; color: var(--maroon); cursor: pointer; font-size: 13px; padding: 0; }
.linklike:hover { text-decoration: underline; }

/* Month bar chart (Reports) */
.month-chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.mbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 5px; }
.mbar-fill { width: 100%; background: var(--wood); border-radius: 4px 4px 0 0; min-height: 2px;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.mbar span { font-size: 11px; color: var(--muted); }

/* Scope & photos on documents */
.doc-scope { margin: 0 0 18px; }
.doc-scope h4, .doc-photos h4 { margin: 0 0 5px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.doc-photos { margin-top: 24px; }
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.photo-grid figure { margin: 0; break-inside: avoid; }
.photo-grid img { width: 100%; height: 250px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.photo-grid figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.photo-page + .photo-page { margin-top: 12px; }
/* Cover photo — its own first page when printed */
.doc-cover { text-align: center; margin-bottom: 28px; }
.doc-cover img { max-width: 100%; max-height: 620px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); }
.doc-cover-cap { margin-top: 10px; color: var(--muted); font-size: 14px; }
/* Signature — always at the end */
.doc-sign { display: flex; gap: 48px; margin-top: 48px; }
.doc-sign .sign-col { flex: 1; }
.doc-sign .sign-line { border-bottom: 1px solid #333; height: 42px; }
.doc-sign .sign-label { margin-top: 6px; font-size: 13px; color: var(--muted); }
.photo-manage { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.pm-item { position: relative; }
.pm-item img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.pm-item .icon-btn { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.92); border-radius: 6px; padding: 2px 5px; }

/* Job Recap reports */
.recap { font-size: 13px; }
.recap-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 4px; }
.recap-head h2 { text-align: center; margin: 0; font-size: 20px; }
.recap-head > div:last-child { text-align: right; }
.recap-job { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px 0; margin-bottom: 6px; }
.recap-tbl { width: 100%; border-collapse: collapse; }
.recap-tbl th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); padding: 5px 8px; }
.recap-tbl td { padding: 4px 8px; border-bottom: 1px solid #f2efe9; }
.recap-tbl td.num, .recap-tbl th.num { text-align: right; white-space: nowrap; }
.recap-tbl td.rd { padding-left: 28px; }
.recap-tbl td.rn { color: var(--muted); }
.recap-tbl .recap-sec td { background: #e4eedd; font-weight: 700; padding: 6px 8px; border-bottom: none; }
.recap-tbl .recap-sec.big td { background: #cfe0c5; }
.recap-tbl .recap-subtot td { font-weight: 600; border-top: 1px solid var(--ink); }
.recap-foot { margin-top: 20px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }

/* Receipt drop zone */
.rcpt-drop { margin: 10px 0 4px; padding: 16px; border: 2px dashed var(--line); border-radius: 10px;
  text-align: center; color: var(--muted); font-size: 14px; cursor: pointer; background: rgba(255,255,255,.6); transition: .15s; }
.rcpt-drop:hover { border-color: var(--wood-light); color: var(--ink); }
.rcpt-drop.drag { border-color: var(--wood); background: #eef1f8; color: var(--ink); }

/* Address type-ahead suggestions */
.addr-suggest { border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; max-height: 240px; overflow-y: auto; background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.addr-opt { padding: 9px 11px; cursor: pointer; font-size: 14px; border-bottom: 1px solid #f0ece4; }
.addr-opt:last-child { border-bottom: none; }
.addr-opt:hover { background: #f4f1ec; }

/* Mobile */
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .back-btn.show { display: inline-flex; align-items: center; }
  .sidebar {
    position: fixed; top: 56px; bottom: 0; left: 0; transform: translateX(-100%);
    transition: transform .2s ease; z-index: 40; box-shadow: 4px 0 18px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .doc-meta { grid-template-columns: 1fr; }
  .doc { padding: 18px; }
  .hide-sm { display: none; }
  /* iOS zooms the page when focusing inputs under 16px — keep them at 16 on mobile */
  input, select, textarea { font-size: 16px; }
}

/* Print — only the document shows */
@media print {
  .topbar, .sidebar, .detail-actions, .menu-toggle, .modal-backdrop, .toast, .no-print { display: none !important; }
  body, .content, .layout { background: #fff; margin: 0; padding: 0; display: block; }
  .doc { box-shadow: none; border: none; max-width: 100%; padding: 0; }
  .doc-cover { page-break-after: always; }
  .doc-cover img { max-height: 240mm; }
  .doc-photos { page-break-before: always; }
  .photo-page { break-inside: avoid; page-break-inside: avoid; }
  .photo-page + .photo-page { page-break-before: always; margin-top: 0; }
  .doc-sign { break-inside: avoid; page-break-inside: avoid; }
  @page { margin: 18mm; }
}
