/* FleurShine OS — back office. Brand: navy #0B2545, orange #F26A1B, bright blue #1E9BE9, white.
   Accessibility rules carried over from the public site (WCAG 2.1 AA): text on orange is navy, never white;
   body links use the darker blue; form borders are dark enough to see; one clear focus ring everywhere. */
:root {
  --navy: #0B2545; --navy-2: #123a6b; --orange: #F26A1B; --blue: #1E9BE9;
  --ink: #14213a; --muted: #56617a; --line: #d5dce8; --bg: #f4f7fb; --card: #fff;
  --link: #0b6fb3; --field-line: #6b7a90; --focus: #0b6fb3;
  --ok-bg: #e3f4e8; --ok-ink: #14532d; --warn-bg: #fff1dc; --warn-ink: #7a3b00; --bad: #b3261e; --bad-bg: #fdecea;
  --r: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--link); }
h1, h2, h3 { color: var(--navy); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.25rem; margin-top: 1.8em; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
code { font: .95em ui-monospace, SFMono-Regular, Menlo, monospace; background: #eaf0f7; padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.wrap { width: min(100% - 32px, 1180px); margin-inline: auto; }
.narrow { max-width: 520px; margin-inline: auto; }
.muted { color: var(--muted); font-size: .9rem; }
.lead { color: var(--muted); max-width: 70ch; }
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--field-line); border-radius: var(--r); padding: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 8px; background: #fff; color: var(--navy); font-weight: 700; padding: 10px 16px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
main { padding: 24px 0 48px; }
main:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.topbar :focus-visible { outline-color: #ffd0b5; }

/* top bar and navigation */
.topbar { background: var(--navy); color: #fff; }
.topbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 0; }
.brand { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: #fff; margin-right: auto; }
.brand-shine { color: var(--orange); } .brand-os { font-weight: 500; color: #c9d6e6; }
.search { display: flex; gap: 6px; flex: 1 1 260px; max-width: 460px; }
.search input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid #fff; font: inherit; }
.who { display: flex; align-items: center; gap: 12px; margin: 0; }
.who-name { color: #dbe4f0; font-size: .9rem; }
.topbar .link-button { color: #fff; }
.mainnav { background: var(--navy-2); }
.mainnav ul { list-style: none; margin: 0 auto; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.mainnav a { display: block; padding: 10px 14px; color: #e6eef8; text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.mainnav a:hover { background: rgba(255,255,255,.08); }
.mainnav a[aria-current="page"] { color: #fff; border-bottom-color: var(--orange); }
.pagefoot { color: var(--muted); font-size: .85rem; padding: 0 0 28px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 16px; border-radius: 8px; border: 2px solid var(--orange); background: var(--orange); color: var(--navy); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { background: #ff7a2e; border-color: #ff7a2e; }
.btn-ghost { background: #fff; border-color: var(--navy); color: var(--navy); }
.btn-ghost:hover { background: #eaf0f7; border-color: var(--navy); }
.btn-small { min-height: 34px; padding: 5px 12px; font-size: .92rem; }
.link-button { background: none; border: 0; padding: 4px 2px; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.page-head h1, .page-head h2 { margin-bottom: .3em; }
.crumbs { color: var(--muted); font-size: .9rem; margin-bottom: 6px; }

/* cards, layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.card > h2:first-child, .card > .page-head:first-child h2 { margin-top: 0; }
.columns, .cards { display: grid; gap: 16px; }
@media (min-width: 52em) { .columns { grid-template-columns: 1.2fr 1fr; align-items: start; } .cards { grid-template-columns: repeat(2, 1fr); } }
.plain { list-style: none; padding: 0; margin: 0; } .plain li { padding: 8px 0; border-bottom: 1px solid var(--line); } .plain li:last-child { border-bottom: 0; }
.facts { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 12px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.stats dt { color: var(--muted); font-size: .9rem; } .stats dd { margin: 0; font-size: 1.7rem; font-weight: 800; color: var(--navy); }
.note { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: var(--r); padding: 12px 16px; margin-bottom: 10px; }
.note p { margin: 0 0 4px; }
.steps { padding-left: 1.3em; } .steps li { margin-bottom: 10px; }
.qr { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 6px; }
.secret { font-size: 1.05rem; letter-spacing: .08em; overflow-wrap: anywhere; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; } .codes code { font-size: 1.1rem; }

/* tables */
.table-wrap { position: relative; overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: #eaf0f7; color: var(--navy); font-size: .9rem; white-space: nowrap; }
tbody th { font-weight: 600; } tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

/* tabs, tags, notices */
.tabs { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 16px; }
.tabs a { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--field-line); background: #fff; color: var(--navy); text-decoration: none; font-weight: 600; font-size: .93rem; }
.tabs a[aria-current="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.count { font-weight: 400; opacity: .85; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .82rem; font-weight: 700; background: #e6ebf3; color: var(--navy); }
.tag-ok, .tag-converted { background: var(--ok-bg); color: var(--ok-ink); }
.tag-warn, .tag-new { background: var(--warn-bg); color: var(--warn-ink); }
.tag-muted, .tag-lost, .tag-no_response { background: #e6ebf3; color: #3b4658; }
.notice { background: #e8f3fc; border: 1px solid #9cc9ee; border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; }
.notice p:last-child { margin-bottom: 0; }
.notice-warn { background: var(--warn-bg); border-color: #e0a45c; color: var(--warn-ink); } .notice-warn a { color: var(--warn-ink); }
.messages { margin-bottom: 16px; }
.message { padding: 10px 14px; border-radius: 8px; background: var(--ok-bg); color: var(--ok-ink); border: 1px solid #9fd3ad; font-weight: 600; }
.message-error { background: var(--bad-bg); color: var(--bad); border-color: #e8a8a3; }

/* forms */
.form-grid { display: grid; gap: 14px; }
@media (min-width: 44em) { .form-grid { grid-template-columns: 1fr 1fr; } .field-wide, .field-check { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-weight: 700; color: var(--navy); }
.field input, .field select, .field textarea { font: inherit; padding: 10px; border: 1px solid var(--field-line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; min-height: 44px; }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: #eef2f7; color: #3b4658; }
.field-check { flex-direction: row; align-items: center; gap: 10px; } .field-check input { width: 22px; height: 22px; min-height: 0; }
.field-bad input, .field-bad select, .field-bad textarea, [aria-invalid="true"] { border: 2px solid var(--bad); }
.field-error { color: var(--bad); font-weight: 700; font-size: .92rem; margin: 0; }
.field-error::before { content: "⚠ "; }
.form-errors { background: var(--bad-bg); border: 1px solid #e8a8a3; color: var(--bad); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-weight: 700; }
.form-errors p { margin: 0; }
.hint { color: var(--muted); font-size: .88rem; margin: 0; }
.req { color: #ad470b; }
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; } .filters .actions { margin-top: 0; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 3px solid var(--line); }
.timeline li { padding: 6px 0 10px 16px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 12px; width: 13px; height: 13px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; }
.timeline time { display: block; color: var(--muted); font-size: .85rem; }
.changes { margin: 6px 0 0; } .changes dt { font-weight: 700; } .changes dd { margin: 0 0 6px; overflow-wrap: anywhere; }
.old { color: var(--bad); text-decoration: line-through; } .new { color: var(--ok-ink); }
.pagination { display: flex; gap: 16px; align-items: center; margin: 12px 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------------- Phase 2: quotes, price book, policies, customer pages ---------------- */
h4 { font-size: .95rem; color: var(--navy); margin: .8em 0 .3em; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.group { border: 1px solid var(--line); padding: 16px 18px 18px; }
fieldset.group > legend { font-weight: 800; color: var(--navy); font-size: 1.1rem; padding: 0 6px; }
fieldset.checks { grid-column: 1 / -1; }
fieldset.checks > legend { font-weight: 700; color: var(--navy); padding: 0; margin-bottom: 6px; }
fieldset.checks > div { display: grid; gap: 6px 18px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
fieldset.checks label { font-weight: 400; display: flex; align-items: center; gap: 8px; }
fieldset.checks input { width: 20px; height: 20px; min-height: 0; flex: none; }
@media (min-width: 60em) { .form-grid-3 { grid-template-columns: repeat(3, 1fr); } }
.result { border-left: 5px solid var(--orange); }
.result:focus { outline: none; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); margin-top: 0; }
.agreement { white-space: normal; overflow-wrap: anywhere; background: #fbfcfe; border: 1px solid var(--field-line); border-radius: 8px; padding: 14px 16px; max-height: 26rem; overflow-y: auto; font-size: .95rem; }
.price-table { margin: 0 0 12px; } .price-table th { font-weight: 400; } .price-table td { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-table tr.total th, .price-table tr.total td { font-weight: 800; font-size: 1.15rem; border-top: 2px solid var(--navy); color: var(--navy); }
.disclaimer { color: var(--muted); font-size: .92rem; border-top: 1px solid var(--line); padding-top: 10px; }
.progress { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 8px; padding: 0; margin: 0 0 16px; color: var(--muted); font-size: .9rem; }
.progress li:not(:last-child)::after { content: "›"; margin-left: 8px; }
.progress li[aria-current] { color: var(--navy); }
.photos { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.photos img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.photos span { font-size: .88rem; color: var(--muted); }
.edit-table td.field { display: table-cell; } .edit-table input, .edit-table select { min-width: 90px; }
.edit-table input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; min-width: 0; }
details { margin: 10px 0; } summary { cursor: pointer; font-weight: 700; color: var(--link); padding: 4px 0; }
.tag-needs_review, .tag-changes_requested, .tag-deposit_pending, .tag-sent, .tag-viewed { background: var(--warn-bg); color: var(--warn-ink); }
.tag-approved, .tag-deposit_paid { background: var(--ok-bg); color: var(--ok-ink); }
.tag-declined, .tag-expired, .tag-void, .tag-draft, .tag-ready { background: #e6ebf3; color: #3b4658; }
.narrow-page { max-width: 780px; }
.public .brand { font-size: 1.1rem; } .public .brand-os { font-size: .95rem; }
.phone { color: #fff; font-weight: 700; }

/* ---------------- Phase 3: invoices, payments, ledger ---------------- */
.mode { display: inline-block; padding: 6px 12px; border-radius: 8px; font-size: .9rem; margin: 0 0 14px; border: 1px solid var(--field-line); background: #fff; }
.mode-fake, .mode-test { background: var(--warn-bg); color: var(--warn-ink); border-color: #e0a45c; }
.mode-off { background: #e6ebf3; color: #3b4658; }
.mode-live { background: var(--ok-bg); color: var(--ok-ink); border-color: #9fd3ad; }
td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total th, tr.total td { font-weight: 800; border-top: 2px solid var(--navy); }
.tag-inv-paid, .tag-pay-succeeded, .tag-pay-dispute_won { background: var(--ok-bg); color: var(--ok-ink); }
.tag-inv-sent, .tag-inv-viewed, .tag-inv-partially_paid, .tag-pay-pending, .tag-pay-disputed, .tag-pay-partially_refunded { background: var(--warn-bg); color: var(--warn-ink); }
.tag-pay-failed, .tag-pay-dispute_lost { background: var(--bad-bg); color: var(--bad); }
.consent-box { background: #eef4fa; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.consent-text { margin: 6px 0 12px; }

/* Phase 4 — employee app (phones first): big touch targets, one column */
body.field .wrap { width: min(100% - 24px, 640px); }
body.field .btn { min-height: 48px; padding-inline: 18px; font-size: 1.05rem; }
.jobcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; color: var(--ink); text-decoration: none; }
.jobcard:hover { border-color: var(--field-line); }
.jobcard strong { color: var(--navy); font-size: 1.1rem; }
.bigactions { display: grid; gap: 10px; margin: 14px 0; }
.bigactions form, .bigactions .btn { width: 100%; }
.bigactions .btn { width: 100%; text-align: center; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .done { color: var(--muted); text-decoration: line-through; }
.code-reveal { font: 700 2rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; color: var(--navy); background: var(--warn-bg); border-radius: var(--r); padding: 12px 16px; display: inline-block; }
.cal-day { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 12px; }
.cal-day h3 { margin: 0 0 6px; }
.cal-item { padding: 6px 0; border-top: 1px dashed var(--line); }
.cal-item:first-of-type { border-top: 0; }
.problems { margin: 0 0 12px; padding-left: 1.2em; }

/* Time screen (Phase 4) */
.waiting-item { border-top: 1px solid var(--line, #ddd); padding: 12px 0; }
.waiting-item:first-of-type { border-top: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input { flex: 1 1 12rem; min-width: 0; }

/* Messages (Phase 4) */
.message-body { white-space: pre-wrap; font: inherit; background: var(--bg); border-radius: var(--r); padding: 10px 12px; margin: 8px 0; overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Customer portal (Phase 5) */
.portal-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.portal-nav .tabs { margin: 0; }
.policy-text { max-height: 18rem; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 12px 0; background: var(--bg); }

.copyable { overflow-wrap: anywhere; user-select: all; }

.row-head { background: var(--bg); text-align: left; }

.h3 { font-size: 1.05rem; margin-top: 0; }

select { max-width: 100%; }
.filters { flex-wrap: wrap; }

.restock-row { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.restock-row legend { font-weight: 600; width: 100%; }
.restock-row input { width: 5rem; }

.offline-banner { background: var(--warn-bg); padding: 10px 14px; border-radius: var(--r); margin-top: 12px; }
.offline-banner[hidden] { display: none; }

.field-links { display: flex; flex-wrap: wrap; gap: 6px 16px; } .field-links li { border: 0; padding: 4px 0; }
