:root {
  --indigo: #4f46e5; --indigo-d: #4338ca; --ink: #1e2230; --muted: #6b7280;
  --line: #e6e8ef; --bg: #f5f6fa; --card: #fff; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 234px; background: #14162b; color: #cdd2e4; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-text { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -.3px; }
.brand-text span { color: #818cf8; }
.nav { display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: #cdd2e4; text-decoration: none; font-size: 14px; }
.nav a:hover { background: #20233f; color: #fff; }
.nav a.active { background: var(--indigo); color: #fff; }
.ic { width: 18px; text-align: center; }
.side-foot { margin-top: auto; padding: 14px 18px; font-size: 12px; color: #8b90ad; display: flex; align-items: center; gap: 8px; border-top: 1px solid #23263f; }
.conn { width: 9px; height: 9px; border-radius: 50%; background: #6b7280; }
.conn.ok { background: var(--ok); } .conn.bad { background: var(--bad); }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; border-bottom: 1px solid var(--line); background: #fff; }
#pageTitle { font-size: 18px; font-weight: 650; }
.agency { font-size: 13px; color: var(--muted); }
.view { padding: 24px 28px; max-width: 1040px; }
.view.wide { max-width: 100%; }

/* Cards / sections */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; }
.card h3 { margin: 0 0 14px; font-size: 14px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }

/* Accordion sections */
details.acc { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
details.acc > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 8px; user-select: none; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before { content: "▸"; color: var(--muted); font-size: 12px; transition: transform .15s; }
details.acc[open] > summary::before { transform: rotate(90deg); }
details.acc > summary:hover { background: #fafbff; }
details.acc > summary .count { margin-left: auto; font-weight: 500; font-size: 12px; color: var(--muted); }
.acc-body { padding: 6px 18px 18px; border-top: 1px solid var(--line); }
/* Compact variant for the quotes list (many rows) */
details.acc.compact { margin-bottom: 6px; border-radius: 9px; }
details.acc.compact > summary { padding: 9px 14px; font-size: 13.5px; gap: 10px; }
details.acc.compact > summary::before { font-size: 10px; }
.q-right { margin-left: auto; display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.q-prem { font-weight: 700; }
.q-prem.ok { color: var(--ok); } .q-prem.bad { color: var(--bad); } .q-prem.wait { color: var(--muted); font-weight: 500; }
.lob-tabs { display: inline-flex; gap: 6px; background: #eef0f6; padding: 4px; border-radius: 10px; margin-bottom: 16px; }
.lob-tabs button { border: 0; background: transparent; padding: 8px 16px; border-radius: 7px; font-size: 14px; font-weight: 600; color: #555; cursor: pointer; }
.lob-tabs button.on { background: #fff; color: var(--indigo); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--muted); }
input, select { padding: 9px 10px; border: 1px solid #d3d6e0; border-radius: 8px; font-size: 14px; background: #fff; width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border: 0; border-radius: 9px; background: var(--indigo); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--indigo-d); }
.btn.sec { background: #eef0f6; color: #2a2e3e; }
.btn.sec:hover { background: #e2e5ef; }
.btn.danger { background: #fee2e2; color: #b91c1c; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* Repeating blocks (drivers/vehicles) */
.block { border: 1px solid var(--line); border-radius: 11px; padding: 14px; margin-bottom: 12px; position: relative; background: #fafbff; }
.block .rm { position: absolute; top: 10px; right: 10px; }
.block-title { font-weight: 600; font-size: 13px; margin-bottom: 10px; color: #374151; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.on { background: #dcfce7; color: #166534; } .tag.off { background: #f1f5f9; color: #64748b; }
.tag.bridge { background: #e0e7ff; color: #3730a3; }

/* Quote result */
.premium { font-size: 30px; font-weight: 800; color: var(--indigo); }
.muted { color: var(--muted); } .small { font-size: 12px; }
.banner { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.banner.info { background: #eef2ff; color: #3730a3; } .banner.warn { background: #fef3c7; color: #92400e; }
.banner.ok { background: #dcfce7; color: #166534; } .banner.err { background: #fee2e2; color: #991b1b; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #c7d2fe; border-top-color: var(--indigo); border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hint code, .card code { background: #eef0f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
pre.code { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 14px 16px; margin: 10px 0 0; font-size: 12px; line-height: 1.5; overflow-x: auto; white-space: pre; font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* Embedded carrier rater (New Quote page) */
.rater-frame { width: 100%; border: 0; border-radius: 12px; height: calc(100vh - 190px); min-height: 640px; background: #f4f6fb; }
