/* CarpetLoopIQ production styles. Tokens and look follow the approved M1 prototype (css/app.css): navy rail,
   light canvas, Loop Blue actions, Loop Green confirmations, Plus Jakarta Sans. No inline styles (CSP). */
@font-face { font-family: "Plus Jakarta Sans"; src: url("/assets/fonts/PlusJakartaSans-latin-var.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
:root {
  color-scheme: light;
  --navy: #0B1F44; --navy-2: #13295A; --navy-3: #1E3A73;
  --blue: #0569F0; --blue-dk: #0453C2; --blue-50: #EDF4FF; --blue-100: #D9E8FF;
  --green: #46C21A; --green-dk: #2A8A0E; --green-50: #ECF8E6;
  --iq-grad: linear-gradient(135deg, #0569F0 0%, #1C9BD8 50%, #46C21A 100%);
  --ink: #0B1F44; --ink-2: #3E4F6C; --ink-3: #6A7A95; --line: #E2E8F1; --line-2: #EDF1F7; --canvas: #F3F6FA; --card: #fff;
  --amber: #E59400; --amber-dk: #9A5B00; --amber-50: #FFF6E3; --red: #D6342C; --red-dk: #B0241D; --red-50: #FDEDEC;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --shadow: 0 1px 2px rgba(11,31,68,.06), 0 2px 8px rgba(11,31,68,.04);
  --rail: 236px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-3); } .small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* shell */
.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail { background: var(--navy); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; min-height: 100vh; max-height: 100vh; overflow-y: auto; }
.rail-foot form button { margin-top: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 800; font-size: 18px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand b { color: #4C9BFF; }
.rail a { color: #C9D4E8; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.rail a.brand { justify-content: flex-start; padding: 4px 8px 18px; font-size: 18px; color: #fff; }
.rail a.brand:hover { background: none; }
.rail a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.rail a.on { background: var(--navy-3); color: #fff; }
.rail .soon { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #8FA3C7; }
.rail .sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 8px; }
.rail-foot { margin-top: auto; font-size: 13px; color: #8FA3C7; padding: 8px 12px; }
.rail-foot .co { color: #fff; font-weight: 700; display: block; }
.main { padding: 28px 32px 80px; max-width: 1080px; width: 100%; }
.topline { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.tabbar { display: none; }

/* plain pages (sign-in, signup) */
.plain { max-width: 560px; margin: 0 auto; padding: 40px 16px 80px; }
.plain.wide { max-width: 980px; }
.plain .brand { color: var(--navy); justify-content: center; padding-bottom: 24px; }
.plain .brand b { color: var(--blue); }

/* cards and layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--line-2); display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.list li:first-child { border-top: 0; }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line-2); vertical-align: middle; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); border-top: 0; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; } dl.kv dt { color: var(--ink-3); } dl.kv dd { margin: 0; }

/* forms */
label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; color: var(--ink-2); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=time], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #CBD5E3; border-radius: var(--r-sm); padding: 10px 12px; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 2px solid var(--blue-100); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin-bottom: 16px; }
.fields .wide { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 14px; color: var(--ink); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; }
.hint { font-size: 13px; color: var(--ink-3); margin: 4px 0 0; }
.btn, button { font: inherit; font-weight: 700; border-radius: 10px; padding: 10px 16px; min-height: 44px; border: 1px solid var(--blue); background: var(--blue); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover, button:hover { background: var(--blue-dk); text-decoration: none; }
.btn.ghost, button.ghost { background: #fff; color: var(--blue); border-color: #CBD5E3; }
.btn.ghost:hover, button.ghost:hover { background: var(--blue-50); }
button.danger { background: #fff; color: var(--red-dk); border-color: #F1C4C1; }
button.danger:hover { background: var(--red-50); }
button.small, .btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; }
form.inline { display: inline; }

/* status */
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--blue-50); color: var(--blue-dk); }
.pill.ok { background: var(--green-50); color: var(--green-dk); }
.pill.warn { background: var(--amber-50); color: var(--amber-dk); }
.pill.bad { background: var(--red-50); color: var(--red-dk); }
.pill.gray { background: var(--line-2); color: var(--ink-3); }
.alert-box { border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--blue-100); background: var(--blue-50); }
.alert-box.ok { background: var(--green-50); border-color: #CDEBC0; }
.alert-box.warn { background: var(--amber-50); border-color: #F5DDA8; }
.alert-box.err { background: var(--red-50); border-color: #F1C4C1; }
.alert-box p:last-child { margin: 0; }
.banner { padding: 10px 32px; font-size: 14px; font-weight: 600; background: var(--amber-50); color: var(--amber-dk); border-bottom: 1px solid #F5DDA8; }
.banner.info { background: var(--blue-50); color: var(--blue-dk); border-color: var(--blue-100); }
.banner.practice { background: #FFF0F6; color: #8A1F4E; border-color: #F4C6DA; }

/* plans */
.plan { border: 2px solid var(--line); border-radius: var(--r-lg); padding: 18px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.plan.rec { border-color: var(--blue); }
.plan .price { font-size: 28px; font-weight: 800; } .plan .price span { font-size: 14px; color: var(--ink-3); font-weight: 600; }
.plan input[type=radio] { width: 20px; height: 20px; }
.disclose { background: var(--canvas); border-radius: var(--r); padding: 14px 16px; margin: 0 0 16px; }
.disclose li { margin: 4px 0; }

/* onboarding */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.steps li:first-child { border-top: 0; }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #CBD5E3; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--ink-3); }
.steps li.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.steps .grow { flex: 1; }
.meter { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--iq-grad); }
.meter i.w0 { width: 0 } .meter i.w1 { width: 11% } .meter i.w2 { width: 22% } .meter i.w3 { width: 33% } .meter i.w4 { width: 44% } .meter i.w5 { width: 56% } .meter i.w6 { width: 67% } .meter i.w7 { width: 78% } .meter i.w8 { width: 89% } .meter i.w9 { width: 100% }

.later { border: 1px dashed #CBD5E3; border-radius: var(--r-lg); padding: 28px; text-align: center; background: #fff; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--line-2); padding: 2px 6px; border-radius: 6px; }

/* M3: Schedule & Crews board and My Day */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.crew-col .list li { align-items: flex-start; }
button.big { width: 100%; min-height: 52px; font-size: 17px; }
.codes { font-size: 20px; font-weight: 800; letter-spacing: .02em; white-space: pre-wrap; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .main { padding: 18px 16px 96px; }
  .banner { padding: 10px 16px; }
  .grid2, .fields, .grid4 { grid-template-columns: 1fr; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
  .tabbar a { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 6px 2px; }
  .tabbar a.on { color: var(--blue); }
  table.t, table.t tbody, table.t tr, table.t td { display: block; width: 100%; }
  table.t thead { display: none; }
  table.t tr { border-top: 1px solid var(--line-2); padding: 8px 0; }
  table.t td { border: 0; padding: 4px 0; }
}

/* M2 customers */
.grow { flex: 1; min-width: 200px; }
details { margin-top: 12px; }
details > summary { cursor: pointer; font-weight: 700; color: var(--blue); padding: 8px 0; }
details[open] > summary { margin-bottom: 8px; }
textarea { min-height: 64px; resize: vertical; }
p.code { font-size: 18px; padding: 12px 14px; display: inline-block; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
@media (max-width: 860px) {
  table.t td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--ink-3); }
}

/* M2 Quick Lead */
.label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.chips .check { margin: 0; }

/* M2 price book */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
table.pb td { padding: 6px 0; }
.pb-row { display: grid; grid-template-columns: minmax(160px, 2fr) minmax(120px, 1fr) 110px 90px 80px 64px 84px; gap: 8px; align-items: center; }
.pb-row input, .pb-row select { min-height: 38px; padding: 6px 10px; }
.pb-row .check { margin: 0; display: flex; align-items: center; gap: 6px; }
.t.pb th.pb-head, .t.pb td:has(> .pb-row) { padding-left: 0; padding-right: 0; }
.pb-head { text-transform: none; letter-spacing: 0; font-size: .8rem; color: var(--muted, #667085); font-weight: 600; padding-bottom: 2px; }
@media (max-width: 860px) { .pb-row { grid-template-columns: 1fr 1fr; } .pb-row .pb-name { grid-column: 1 / -1; } .pb-head { display: none; }
  .pb-row .sr { position: static; width: auto; height: auto; overflow: visible; clip: auto; display: block; font-size: .8rem; } }

/* Quick Quote */
.qlines { display: grid; gap: 8px; margin-bottom: 12px; }
.qline { display: grid; grid-template-columns: minmax(0, 3fr) 80px minmax(90px, 1fr); gap: 8px; align-items: center; }
.qline.head { font-size: .8rem; font-weight: 600; color: var(--ink-3); }
.qline select, .qline input { min-height: 38px; padding: 6px 10px; width: 100%; }
.quote-lines tfoot td { border-top: 0; padding-top: 4px; padding-bottom: 4px; }
.quote-lines tfoot tr.total td { border-top: 1px solid var(--line-2); padding-top: 10px; font-size: 1.05rem; }
.tabs { gap: 14px; flex-wrap: wrap; margin: 4px 0 12px; }
.sticky { position: sticky; top: 16px; }
input.copy { width: 100%; font-family: ui-monospace, monospace; font-size: 13px; }
.customer .co-name { font-weight: 700; color: var(--navy); font-size: 1.1rem; margin: 0 0 4px; }
@media (max-width: 860px) { .qline { grid-template-columns: 1fr 70px 100px; } .qline.head span:last-child { font-size: .7rem; } .sticky { position: static; } }
table.quote-lines .each-line { display: none; }
@media (max-width: 860px) {
  table.quote-lines tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; }
  table.quote-lines td { width: auto; padding: 2px 0; }
  table.quote-lines tbody td:nth-child(2), table.quote-lines tbody td:nth-child(3) { display: none; }
  table.quote-lines .each-line { display: block; font-size: 13px; color: var(--ink-3); }
  table.quote-lines tfoot { display: block; width: 100%; }
  table.quote-lines tfoot tr { padding: 4px 0; border-top: 0; }
  table.quote-lines tfoot tr.total { border-top: 1px solid var(--line-2); padding-top: 8px; }
  table.quote-lines tfoot tr.total td { border-top: 0; }
}
