/* Boyd's Painting admin. Colours, type and layout follow the approved design artboards. */
:root {
  --ink: #141414;
  --orange: #E87000;
  --yellow: #F8D838;
  --cream: #F5F3EE;
  --paper: #ffffff;
  --line: #e3e0d9;
  --field: #b9b5ab;
  --muted: #4a4a4a;
  --faint: #8a867c;
  --brown: #B45309;
  --brown-dark: #7c3a06;
  --soft-yellow: #FFF6C8;
  --green: #1f6f43;
  --head: 'League Spartan', Arial, sans-serif;
  --body: Inter, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; }
a { color: var(--brown); }
a:hover { color: var(--brown-dark); }
h1, h2, h3 { font-family: var(--head); font-weight: 800; margin: 0; line-height: 1.15; }
button { font: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* ---------- shell */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 240px; max-width: 260px; min-width: 220px; background: var(--ink); color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; text-decoration: none; color: #fff; }
.side .brand img { height: 44px; width: auto; }
.side .brand span { font-family: var(--head); font-weight: 700; font-size: 13px; letter-spacing: 1.5px; color: var(--yellow); }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 8px; color: #fff; font-weight: 600; text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.nav-link:hover { background: #2a2a2a; color: #fff; }
.nav-link[aria-current="page"] { background: var(--orange); color: var(--ink); font-weight: 700; }
.nav-link.quiet { color: #d9d9d9; font-weight: 500; }
.nav-link svg { flex: none; }
.side .grow { flex: 1; }
.main { flex: 999 1 640px; min-width: 0; padding: 32px 40px; display: flex; flex-direction: column; gap: 24px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 38px; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }
.eyebrow { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 1.5px; color: var(--brown); text-transform: uppercase; }
.row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-narrow { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-wide { flex: 999 1 520px; min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 24px; min-width: 0; }
.card.flush { padding: 0; overflow-x: auto; }
.card h2 { font-size: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head a, .link-btn { font-weight: 600; font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.kpi.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi .label { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi.dark .label { color: #d9d9d9; }
.kpi .value { margin: 6px 0 0; font-family: var(--head); font-weight: 800; font-size: 32px; line-height: 1.1; }
.kpi .value.warn { color: var(--brown); }
.kpi.dark .value { color: var(--yellow); }
.kpi .value .of { font-size: 18px; color: var(--muted); }
.kpi .note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.mb { margin-bottom: 12px; }
.mt { margin-top: 16px; }
.h-num { font-family: var(--head); font-weight: 800; font-size: 22px; }
.warn-text { color: var(--brown); }
.attn-title { margin: 22px 0 8px; font-family: var(--body); font-size: 15px; font-weight: 700; }
.btn-text { background: none; border: 0; padding: 0; color: var(--brown); text-decoration: underline; cursor: pointer; }
.pre { white-space: pre-wrap; }
.split .pre { text-align: right; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.receipt-preview { max-width: 100%; max-height: 220px; border-radius: 8px; border: 1px solid var(--line); }
.small { font-size: 13px; }
.empty { margin: 0; font-size: 14px; color: var(--faint); }

/* ---------- buttons */
.btn { display: inline-flex; white-space: nowrap; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 8px; border: 0; background: var(--orange); color: var(--ink); font-weight: 800; text-decoration: none; cursor: pointer; }
.btn:hover { background: #ff8a1f; color: var(--ink); }
.btn.big { min-height: 50px; letter-spacing: 1px; }
.btn.outline { background: var(--paper); border: 2px solid var(--ink); font-weight: 700; }
.btn.outline:hover { background: var(--cream); }
.btn.quiet { background: var(--paper); border: 1px solid var(--field); font-weight: 600; min-height: 44px; }
.btn.quiet:hover { background: var(--cream); }
.btn.danger { background: var(--paper); border: 1px solid var(--brown); color: var(--brown); font-weight: 700; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.grow { flex: 1 1 160px; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--field); border-radius: 8px; background: var(--paper); font-size: 18px; cursor: pointer; }

/* ---------- forms: the one pattern for every form (even 2-column grid, 46px controls) */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: end; }
.form-grid > p { margin: 0; }
.form-grid > h2, .form-grid > h3, .form-grid > p, .form-grid > .span-2, .form-grid > .btn, .form-grid > .form-msg, .form-grid > fieldset, .form-grid > .check { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 14px; font-weight: 600; }
.field input, .field select, .field textarea, .control {
  height: 46px; width: 100%; box-sizing: border-box; border: 1px solid var(--field); border-radius: 8px;
  padding: 0 12px; font: inherit; font-size: 16px; font-weight: 400; background: var(--paper); color: var(--ink);
}
.field textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; }
.field input[type="file"] { padding: 10px 12px; height: auto; min-height: 46px; }
.field .hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--orange); outline: 2px solid var(--orange); outline-offset: 0; }
.field input[aria-invalid="true"] { border-color: var(--brown); }
.form-grid .btn { width: 100%; }
fieldset.pills { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.pills legend { font-size: 14px; font-weight: 600; margin-bottom: 6px; padding: 0; }
.pill-opt { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid var(--field); border-radius: 99px; font-size: 14px; cursor: pointer; background: var(--paper); }
.pill-opt:has(input:checked) { border: 2px solid var(--ink); font-weight: 600; }
.pill-opt input, .check input { accent-color: var(--orange); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.check input { width: 20px; height: 20px; flex: none; }
.form-msg { margin: 0; font-size: 14px; padding: 10px 12px; border-radius: 8px; }
.form-msg.error { background: #fdecea; color: #8a1c0f; border: 1px solid #e8b4ad; }
.form-msg.ok { background: #e7f4ec; color: var(--green); border: 1px solid #b6dcc5; }
.form-msg.info { background: var(--soft-yellow); border: 1px solid var(--yellow); }
@media (max-width: 460px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* line items editor */
.items { display: flex; flex-direction: column; gap: 10px; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 120px 44px; gap: 8px; align-items: end; }
.item-row .field { font-size: 12px; }
@media (max-width: 560px) { .item-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; } .item-row .desc { grid-column: 1 / -1; } }

/* ---------- tags */
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.tag.quote, .tag.sent, .tag.requested, .tag.needs { background: var(--yellow); color: var(--ink); }
.tag.job, .tag.in_progress { background: var(--ink); color: #fff; }
.tag.consult { background: var(--soft-yellow); border: 1px solid var(--yellow); }
.tag.draft, .tag.void { border: 1px solid var(--faint); }
.tag.overdue { background: var(--brown); color: #fff; }
.tag.paid { background: var(--green); color: #fff; }
.tag.completed, .tag.quoted, .tag.scheduled { background: var(--line); }

/* ---------- tables */
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; color: var(--muted); font-size: 13px; padding: 14px 8px; font-weight: 600; }
table.list td { padding: 14px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
table.list th:first-child, table.list td:first-child { padding-left: 16px; }
table.list th:last-child, table.list td:last-child { padding-right: 16px; }
table.list .num { text-align: right; font-weight: 700; white-space: nowrap; }
table.list tr.sel { background: var(--soft-yellow); }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover { background: var(--cream); }
table.list tr.total td { border-top: 2px solid var(--ink); font-weight: 800; }
.card table.list td:first-child, .card table.list th:first-child { padding-left: 0; }
.card table.list td:last-child, .card table.list th:last-child { padding-right: 0; }
.card.flush table.list td:first-child, .card.flush table.list th:first-child { padding-left: 16px; }
.card.flush table.list td:last-child, .card.flush table.list th:last-child { padding-right: 16px; }
.scroll-x { overflow-x: auto; }
.minw-560 { min-width: 560px; }
.minw-420 { min-width: 420px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { min-height: 40px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--field); background: var(--paper); cursor: pointer; }
.tab[aria-selected="true"] { border: 0; background: var(--ink); color: #fff; font-weight: 700; }

/* ---------- dashboard */
.upcoming { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.upcoming li { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 8px; background: var(--cream); }
.daybox { width: 56px; text-align: center; flex: none; }
.daybox .dow { margin: 0; font-size: 12px; font-weight: 700; color: var(--brown); }
.daybox .dom { margin: 0; font-family: var(--head); font-weight: 800; font-size: 22px; }
.upcoming .what { flex: 1; min-width: 0; }
.upcoming .what p { margin: 0; }
.upcoming .what .t { font-weight: 700; }
.upcoming .what .d { font-size: 13px; color: var(--muted); }
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 16px; }
.stage { border-radius: 8px; border: 1px solid var(--line); padding: 14px; }
.stage p { margin: 0; }
.stage .k { font-size: 13px; color: var(--muted); }
.stage .n { margin-top: 2px; font-family: var(--head); font-weight: 800; font-size: 26px; }
.stage.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.stage.dark .k { color: #d9d9d9; }
.stage.dark .n { color: var(--yellow); }
.attention { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- week view */
.week { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); min-width: 720px; }
.week.days-7 { grid-template-columns: repeat(7, minmax(110px, 1fr)); min-width: 820px; }
.week .dh { padding: 12px; border-bottom: 1px solid var(--line); font-weight: 700; }
.week .dh .dow { color: var(--brown); font-size: 12px; display: block; }
.week .dh.today { background: var(--soft-yellow); }
.week .dc { padding: 10px; min-height: 420px; display: flex; flex-direction: column; gap: 8px; }
.week .dh + .dh, .week .dc.notfirst { border-left: 1px solid var(--line); }
.ev { border-radius: 8px; background: var(--soft-yellow); border: 1px solid var(--yellow); padding: 10px; font-size: 13px; text-align: left; cursor: pointer; font: inherit; font-size: 13px; color: var(--ink); width: 100%; }
.ev.job { background: var(--ink); color: #fff; border-color: var(--ink); }
.ev.job strong { color: var(--yellow); }
.ev .where { color: var(--muted); }
.ev.job .where { color: #d9d9d9; }
.ev.requested { border-style: dashed; }
.week-nav { display: flex; gap: 8px; align-items: center; }
.week-nav span { font-weight: 700; padding: 0 8px; }
.inbox-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.inbox-row p { margin: 0; }

/* ---------- invoices */
.inv-totals { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; border-top: 2px solid var(--ink); font-size: 14px; }
.inv-totals div { display: flex; justify-content: space-between; }
.inv-totals .grand { font-family: var(--head); font-weight: 800; font-size: 22px; }
.split { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.divider { border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- expenses */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 200px; padding: 24px; border: 2px dashed var(--orange); border-radius: 12px; background: var(--paper); text-align: center; cursor: pointer; }
.drop.has-file { border-style: solid; }
.drop .t { font-family: var(--head); font-weight: 800; font-size: 20px; }
.drop .d { font-size: 14px; color: var(--muted); }
.drop input { font-size: 14px; max-width: 100%; }
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.mini { padding: 12px; border-radius: 8px; background: var(--cream); }
.mini p { margin: 0; }
.mini .k { font-size: 13px; color: var(--muted); }
.mini .v { font-weight: 800; }

/* ---------- tax */
.notice { padding: 14px; border-radius: 8px; background: var(--soft-yellow); border: 1px solid var(--yellow); font-size: 14px; }
.disclaimer { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- dialogs + toasts */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 40px rgba(20, 20, 20, .25); }
dialog::backdrop { background: rgba(20, 20, 20, .5); }
dialog .dlg { padding: 24px; }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.error { background: #8a1c0f; }
.loading { color: var(--faint); }

/* ---------- sign-in pages */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--ink); color: #fff; }
.auth .pitch { flex: 1 1 420px; min-width: 0; padding: 64px 56px; display: flex; flex-direction: column; justify-content: center; gap: 22px; border-right: 4px solid var(--orange); }
.auth .pitch img { height: 84px; width: auto; align-self: flex-start; }
.auth .pitch .eyebrow { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--yellow); }
.auth .pitch .eyebrow::before { content: ''; display: inline-block; width: 36px; height: 3px; background: var(--orange); }
.auth .pitch h1 { font-size: 52px; line-height: 1.05; }
.auth .pitch ul { margin: 0; padding-left: 20px; font-size: 17px; color: #d9d9d9; display: flex; flex-direction: column; gap: 8px; }
.auth .panel { flex: 1 1 420px; min-width: 0; padding: 64px 56px; display: flex; align-items: center; justify-content: center; background: var(--cream); color: var(--ink); }
.auth form { width: 100%; max-width: 420px; background: var(--paper); border-radius: 14px; padding: 40px; box-shadow: 0 20px 40px rgba(20, 20, 20, .12); }
.auth form h2 { font-size: 32px; }
.auth .label-row { display: flex; justify-content: space-between; align-items: baseline; }
.auth .fine { margin: 0; font-size: 13px; color: var(--muted); }

@media (max-width: 760px) {
  .side { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; padding: 12px; gap: 4px; }
  .side .brand { padding: 4px 8px; width: 100%; }
  .side .nav-link { width: auto; flex: 1 1 auto; padding: 0 10px; font-size: 14px; }
  .side .nav-link svg { display: none; }
  .side .grow { display: none; }
  .main { padding: 20px 16px; }
  .page-head h1 { font-size: 30px; }
  .auth .pitch, .auth .panel { padding: 32px 16px; }
  .auth .pitch h1 { font-size: 36px; }
  .auth form { padding: 24px; }
}
@media print { .side, .no-print { display: none !important; } .main { padding: 0; } }
