/* Vantazia CRM: brand orange #F16623, charcoal #383532, Roboto */
:root {
  --orange: #F16623;
  --orange-dark: #B4410C;
  --orange-tint: #FEF0E8;
  --ink: #383532;
  --muted: #5F5A55;
  --line: #E4E1DE;
  --bg: #F7F6F5;
  --card: #FFFFFF;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--orange-dark); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.prewrap { white-space: pre-wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.topbar { background: var(--orange); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; }
.brand img { display: block; width: 150px; height: auto; }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topnav > a, .topnav .linklike { color: #fff; text-decoration: none; font-weight: 700; padding: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.topnav > a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
.topnav .btn-light { background: #fff; color: var(--ink); border-color: #fff; padding: 10px 14px; }
.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }

.page { max-width: 1000px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 16px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--orange); border-color: var(--orange); color: #1C1917; }
.btn-primary:hover { background: #E2581A; border-color: #E2581A; }

form.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .95rem; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); padding: 10px 12px; min-height: 44px; border: 1px solid #B9B4AF; border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid #F9B38F; outline-offset: 1px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
legend { font-weight: 700; font-size: 1.05rem; margin-bottom: 10px; padding: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

.flash { background: #EAF6EE; border: 1px solid #9ACDAA; padding: 10px 14px; border-radius: 8px; }
.flash p:last-child { margin: 0; }
.flash-error { background: #FDECEC; border-color: #E5A3A3; }
.flash-warn { background: var(--orange-tint); border-color: #F6B28F; }

.dupbox { background: var(--orange-tint); border: 1px solid #F6B28F; border-radius: 8px; padding: 14px; }
.dupbox h2 { margin-bottom: .25rem; }
.choice { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; padding: 10px 0; border-top: 1px solid #F6CDB7; }
.choice input { width: 22px; min-height: 22px; height: 22px; margin-top: 2px; flex-shrink: 0; accent-color: var(--orange); }

.search { display: flex; gap: 8px; flex: 1 1 320px; max-width: 460px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs a { white-space: nowrap; padding: 10px 12px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--orange); }
.count { background: #EEECEA; border-radius: 999px; padding: 0 8px; font-size: .8rem; color: var(--ink); }

.leadlist { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.leadlist li + li { border-top: 1px solid var(--line); }
.leadrow { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; color: var(--ink); text-decoration: none; flex-wrap: wrap; }
.leadrow:hover { background: #FBFAF9; }
.lr-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 280px; }
.lr-name { font-weight: 700; }
.lr-sub, .lr-when { color: var(--muted); font-size: .9rem; }
.lr-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.empty { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 24px; text-align: center; }

.tag { font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; vertical-align: middle; }
.tag-warn { background: var(--orange-tint); color: #8A3109; }
.stage { font-size: .8rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: #EEECEA; color: var(--ink); white-space: nowrap; }
.stage-big { font-size: .95rem; padding: 6px 14px; }
.stage-new { background: #FDE2D3; color: #7A2C08; }
.stage-contacted, .stage-survey_booked { background: #FFF1C2; color: #5C4300; }
.stage-quoted, .stage-date_confirmed { background: #DCEBFB; color: #123E6B; }
.stage-deposit_paid, .stage-booked { background: #D8F0DF; color: #14532D; }
.stage-completed { background: #E2E0DD; color: #383532; }
.stage-lost { background: #F4D6D6; color: #7A1F1F; }

.replies { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts-wide { grid-template-columns: minmax(120px, max-content) 1fr; }
.plain { margin: 0; padding-left: 18px; }
.timeline { list-style: none; padding: 0; margin: 16px 0 0; }
.timeline li { display: flex; flex-direction: column; padding: 10px 0; border-top: 1px solid var(--line); }

@media (max-width: 520px) {
  .brand img { width: 120px; }
  .page { padding: 14px 12px 48px; }
  .card { padding: 14px; }
  .lr-meta { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
}

/* Today and follow-ups */
.badge { background: #fff; color: #8A3109; border-radius: 999px; padding: 0 8px; font-size: .8rem; margin-left: 4px; }
.btn-small { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.todo-group { margin-bottom: 20px; }
.todo-group h2 { display: flex; align-items: center; gap: 8px; }
.todo-overdue h2 { color: #9B1C1C; }
.todolist { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.todolist li + li { border-top: 1px solid var(--line); }
.todo { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; flex-wrap: wrap; }
.todo-overdue .todo { border-left: 4px solid #C53030; }
.todo-main { flex: 1 1 300px; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.todo-name { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.todo-name:hover { text-decoration: underline; }
.todo-why { flex-basis: 100%; margin: 2px 0 0; }
.todo-sub { flex-basis: 100%; margin: 0; }
.todo-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.due { font-size: .8rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: #EEECEA; }
.due-overdue { background: #FDE2E2; color: #8B1A1A; }
.followup-overdue { border-left: 4px solid #C53030; }
.followup-today { border-left: 4px solid var(--orange); }
.due-line { font-size: 1.05rem; }
.snoozes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.setdate summary { cursor: pointer; font-weight: 600; color: var(--orange-dark); min-height: 44px; display: flex; align-items: center; }
.setdate form { margin-top: 8px; }
.linkbtn { background: none; border: 0; color: var(--orange-dark); text-decoration: underline; font: inherit; cursor: pointer; padding: 10px 0; }

/* Quotes and settings */
.wide-ish { max-width: 760px; }
.grid-price { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.priceitem { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.priceitem.inactive { opacity: .7; }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; min-height: 44px; }
.check input { width: 22px; height: 22px; min-height: 22px; accent-color: var(--orange); }
.extra-row { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.extra-head { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.qstate-draft { background: #EEECEA; }
.qstate-sent, .qstate-viewed { background: #DCEBFB; color: #123E6B; }
.qstate-accepted { background: #D8F0DF; color: #14532D; }
.qstate-expired { background: #F4D6D6; color: #7A1F1F; }
@media (max-width: 520px) { .grid-price { grid-template-columns: 1fr; } }

/* Bookings */
.bstate-provisional { background: #FFF1C2; color: #5C4300; }
.bstate-booked { background: #D8F0DF; color: #14532D; }
.bstate-completed { background: #E2E0DD; color: #383532; }
.bstate-cancelled { background: #F4D6D6; color: #7A1F1F; }
.card-accent { border-left: 4px solid var(--orange); }
.message { white-space: pre-wrap; font: inherit; font-size: .9rem; background: #FBFAF9; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0 0 12px; max-height: 320px; overflow: auto; }
.steps { padding-left: 1.3rem; margin: 0 0 12px; }
.steps li { margin-bottom: 6px; }
details.card > summary { cursor: pointer; font-weight: 700; min-height: 32px; }
details.card[open] > summary { margin-bottom: 12px; }
.bookcard .facts { margin-bottom: 8px; }

/* Invoices and money */
.istate-paid { background: #D8F0DF; color: #14532D; }
.istate-unpaid, .istate-part { background: #DCEBFB; color: #123E6B; }
.istate-overdue { background: #FDE2D3; color: #7A2C08; }
.istate-void { background: #E2E0DD; color: #383532; }
.lines { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: .95rem; }
.lines th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 6px 8px 6px 0; }
.lines td { border-bottom: 1px solid var(--line); padding: 8px 8px 8px 0; vertical-align: top; }
.lines tfoot th { color: var(--ink); border-bottom: 0; border-top: 2px solid var(--ink); }
.lines .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
.monthnav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 12px; }
.monthnav h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 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; }
.stat strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stack-tight { margin: 0 0 12px; }

/* Reports */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tabs-inline { border-bottom: 0; margin-bottom: 0; }
.stats-tight { margin-bottom: 8px; }
.report .barcol { width: 28%; min-width: 80px; padding-right: 0; }
.report td.barcol { vertical-align: middle; }
progress.bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 10px; border: 0; border-radius: 999px; background: var(--orange-tint); overflow: hidden; }
progress.bar::-webkit-progress-bar { background: var(--orange-tint); border-radius: 999px; }
progress.bar::-webkit-progress-value { background: var(--orange); border-radius: 999px; }
progress.bar::-moz-progress-bar { background: var(--orange); border-radius: 999px; }
@media (max-width: 640px) { .report .barcol { display: none; } }
@media (max-width: 640px) { .report .hide-sm { display: none; } }

/* Crew phone view */
.crewhead h1 { margin-bottom: 2px; }
.crewday { margin: 22px 0 8px; font-size: 1.05rem; }
.crewday-today { color: var(--orange-dark); }
a.crewjob { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); border-left: 4px solid var(--orange); margin-bottom: 10px; }
a.crewjob:hover, a.crewjob:focus-visible { background: var(--orange-tint); }
.crewtime { font-weight: 700; font-size: 1.15rem; }
.crewwho { font-size: 1.1rem; font-weight: 600; }
.crewroute { font-variant-numeric: tabular-nums; }
.crewdate { margin: 0; color: var(--orange-dark); font-weight: 700; }
.crewcard h1 { margin: 2px 0 6px; }
.crewbig { font-size: 1.15rem; }
.crewaddr { font-size: 1.05rem; white-space: pre-wrap; margin-bottom: 6px; }
.crewnote { background: var(--orange-tint); border-radius: 8px; padding: 10px 12px; }
.crewnotes { margin-top: 12px; }
.crewnotes li { margin-bottom: 6px; }
.crewrow { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.crewrow h3 { margin: 0 0 6px; }

/* Delete a lead */
#delete summary { cursor: pointer; font-weight: 700; color: #9F1D1D; min-height: 32px; }
#delete details[open] summary { margin-bottom: 12px; }
.btn-danger { background: #B42318; border-color: #B42318; color: #fff; }
.btn-danger:hover { background: #8F1C13; border-color: #8F1C13; }
