:root {
  --accent: #111111;
  --accent2: #c8102e; /* RM red accent */
  --bg: #f4f4f5;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --ok: #16a34a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); padding-bottom: env(safe-area-inset-bottom); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.err { color: #dc2626; font-size: 14px; min-height: 18px; }

.logo-badge { background: #111; color: #fff; font-weight: 800; font-size: 26px; width: 64px; height: 44px; display: grid; place-items: center; border-radius: 6px; margin: 0 auto 10px; letter-spacing: 1px; }
.logo-badge.small { width: 34px; height: 26px; font-size: 15px; margin: 0; border-radius: 4px; }

/* Login */
.screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 340px; text-align: center; }
.login-box h1 { margin: 4px 0; }
.login-box input { width: 100%; }

input, textarea, select { width: 100%; padding: 13px 14px; font-size: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; margin: 4px 0; color: var(--text); }
textarea { resize: vertical; }
button { font-size: 16px; border: none; border-radius: 12px; padding: 13px 16px; cursor: pointer; font-weight: 600; }
.primary { background: var(--accent); color: #fff; }
.ghost { background: #fff; color: var(--accent); border: 1px solid var(--border); }
.ghost.small { padding: 8px 12px; font-size: 13px; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row > * { flex: 1; }

/* App bar */
.appbar { position: sticky; top: 0; z-index: 9; display: flex; justify-content: space-between; align-items: center; background: #fff; border-bottom: 1px solid var(--border); padding: 10px 14px; }
.appbar .brand { display: flex; align-items: center; gap: 8px; }
.iconbtn { background: none; font-size: 20px; padding: 6px 10px; }

main { max-width: 560px; margin: 0 auto; }
.view { padding: 14px 16px 90px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
h2 { margin: 6px 0 12px; }

/* Wizard head */
.wizardhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.progress { flex: 1; height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
#progressBar { height: 100%; background: var(--accent); width: 0; transition: width .25s; }
.promptbtn { background: #f3f4f6; color: var(--accent); font-size: 13px; padding: 7px 11px; }

/* Start step */
.seg { display: flex; gap: 8px; margin-bottom: 14px; }
.segbtn { flex: 1; background: #fff; border: 1px solid var(--border); color: var(--muted); }
.segbtn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.bigmic-wrap { text-align: center; padding: 18px 0; }
.mic { width: 132px; height: 132px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 48px; margin: 0 auto; display: grid; place-items: center; box-shadow: 0 10px 28px rgba(0,0,0,.25); transition: transform .1s; }
.mic:active { transform: scale(.96); }
.mic.recording { background: var(--accent2); animation: pulse 1.3s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(200,16,46,.5);} 50%{ box-shadow: 0 0 0 20px rgba(200,16,46,0);} }
.rec-status { margin-top: 14px; font-weight: 600; }
.processing { margin-top: 10px; color: var(--accent); font-weight: 600; }
.manual { margin-top: 12px; min-height: 64px; }

/* Fields */
.field { display: block; margin: 10px 0; }
.field > span { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.minimic { background: #f3f4f6; border: none; font-size: 13px; padding: 3px 8px; border-radius: 8px; color: var(--accent); }
.minimic.recording { background: var(--accent2); color: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .5; } }

/* Totals */
.totals { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px 16px; margin: 12px 0; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); }
.totals .grand { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; color: var(--text); font-size: 18px; }
.totals b { color: var(--text); }

/* Job description (big, voice-first) */
.jobdesc { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.jobdesc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.jobdesc-head span { font-weight: 700; font-size: 15px; }
.minimic.big { font-size: 14px; padding: 8px 14px; background: var(--accent); color: #fff; }
.minimic.big.recording { background: var(--accent2); }
.jobtext { min-height: 110px; font-size: 16px; line-height: 1.45; overflow: hidden; }
.detail { overflow: hidden; line-height: 1.4; }

/* Services */
.seccard { background: var(--card); border: 1px solid var(--border); border-radius: 14px; margin: 12px 0; overflow: hidden; }
.sechead { background: var(--accent); color: #fff; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.4); font-size: 12px; padding: 5px 10px; }
.pill.on { background: #fff; color: var(--accent); }
.items { padding: 6px 10px; }
.srow { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid #f3f4f6; flex-wrap: wrap; }
.srow .chk { width: 26px; height: 26px; min-width: 26px; padding: 0; border: 1.5px solid var(--border); background: #fff; color: #fff; border-radius: 7px; font-size: 15px; }
.srow.on .chk { background: var(--ok); border-color: var(--ok); }
.srow .lbl { flex: 1; font-size: 15px; }
.srow.on .lbl { font-weight: 600; }
.detailwrap { display: flex; gap: 6px; width: 100%; align-items: flex-start; padding-left: 36px; }
.detailwrap textarea { margin: 2px 0; padding: 8px 10px; font-size: 14px; min-height: 40px; resize: none; }
.detailwrap .minimic { margin-top: 4px; }

/* Review */
.reviewbox .rev-sec { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; line-height: 1.5; }

/* Wizard nav */
.wizardnav { display: flex; gap: 10px; margin-top: 18px; }
.wizardnav .ghost { flex: 0 0 110px; }
.wizardnav .primary { flex: 1; }

/* List */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.tab { background: #fff; border: 1px solid var(--border); color: var(--muted); padding: 8px 14px; font-size: 14px; white-space: nowrap; }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.doclist { display: flex; flex-direction: column; gap: 10px; }
.doccard { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.doccard .top { display: flex; justify-content: space-between; align-items: start; }
.doccard .num { font-size: 13px; color: var(--muted); }
.doccard .client { font-weight: 700; font-size: 16px; }
.doccard .amt { font-size: 18px; font-weight: 700; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; text-transform: capitalize; }
.badge.unpaid { background: #fef3c7; color: #92400e; }
.badge.sent { background: #dbeafe; color: #1e40af; }
.badge.paid { background: #dcfce7; color: #166534; }
.badge.draft { background: #f3f4f6; color: #6b7280; }
.badge.cancelled { background: #fee2e2; color: #991b1b; }
.doccard .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.doccard .actions button { font-size: 13px; padding: 8px 12px; }

/* Bottom nav */
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border); display: flex; justify-content: space-around; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 10; }
.bottomnav button { background: none; color: var(--muted); font-size: 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 18px; }
.bottomnav button span { font-size: 11px; font-weight: 600; }
.bottomnav button.active { color: var(--accent); }

.toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 50; max-width: 90%; text-align: center; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(0,0,0,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
