:root {
  --ink: #142033;
  --ink-2: #25324a;
  --navy: #101827;
  --navy-2: #172238;
  --red: #c91d32;
  --red-dark: #a81427;
  --gold: #f4c430;
  --blue: #3b82f6;
  --green: #16a36a;
  --orange: #ee7a20;
  --paper: #ffffff;
  --canvas: #f4f6f9;
  --muted: #6f7b8e;
  --line: #e2e7ef;
  --line-dark: #cbd3df;
  --shadow: 0 12px 35px rgba(19, 31, 50, .08);
  --shadow-sm: 0 4px 16px rgba(19, 31, 50, .07);
  --radius: 18px;
  --sidebar: 252px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #eaf0fa;
  background:
    radial-gradient(circle at 10% 0%, rgba(201,29,50,.2), transparent 30%),
    linear-gradient(180deg, #111a2a 0%, #0c1320 100%);
  box-shadow: 12px 0 40px rgba(13,21,34,.12);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 10px 22px; color: inherit; text-decoration: none; }
.brand-mark { position: relative; display: grid; width: 42px; height: 42px; place-items: center; overflow: hidden; border-radius: 12px; background: var(--red); box-shadow: inset 0 0 0 2px rgba(255,255,255,.08), 0 8px 24px rgba(201,29,50,.28); transform: rotate(45deg); }
.brand-mark::after { content: ""; position: absolute; inset: 5px; border: 2px solid var(--gold); border-radius: 8px; }
.brand-mark span { position: relative; z-index: 1; color: var(--gold); font-size: 22px; font-weight: 950; transform: rotate(-45deg); }
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-size: 23px; letter-spacing: .05em; }
.brand-copy small { margin-top: 6px; color: #99a7bb; font-size: 10px; font-weight: 800; letter-spacing: .19em; }

.workspace-chip { display: flex; align-items: center; gap: 11px; margin: 2px 2px 22px; padding: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(255,255,255,.045); }
.workspace-dot { width: 9px; height: 9px; border: 2px solid rgba(255,255,255,.42); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(22,163,106,.12); }
.workspace-chip span:last-child { display: flex; min-width: 0; flex-direction: column; }
.workspace-chip small { color: #8796aa; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.workspace-chip strong { overflow: hidden; margin-top: 2px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.nav-list { display: grid; gap: 5px; }
.nav-item { display: flex; width: 100%; min-height: 46px; align-items: center; gap: 12px; padding: 0 13px; border: 0; border-radius: 12px; color: #aeb9c9; background: transparent; font-size: 14px; font-weight: 700; text-align: left; cursor: pointer; transition: .16s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.is-active { color: #fff; background: linear-gradient(90deg, rgba(201,29,50,.96), rgba(201,29,50,.72)); box-shadow: 0 7px 20px rgba(201,29,50,.2); }
.nav-icon { display: grid; width: 22px; height: 22px; flex: 0 0 22px; place-items: center; font-size: 20px; font-weight: 500; }
.nav-item b { min-width: 22px; margin-left: auto; padding: 2px 6px; border-radius: 999px; color: #fff; background: rgba(255,255,255,.14); font-size: 10px; text-align: center; }
.sidebar-bottom { display: grid; gap: 14px; margin-top: auto; padding-top: 26px; }
.sidebar-card { padding: 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(255,255,255,.045); }
.mini-label { color: #8997aa; font-size: 9px; font-weight: 850; letter-spacing: .14em; }
.sidebar-card strong { display: block; margin-top: 5px; font-size: 12px; }
.sidebar-card p { margin: 4px 0 0; color: #7e8da2; font-size: 11px; }

.main-area { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 24px; padding: 12px clamp(20px, 3vw, 42px); border-bottom: 1px solid rgba(221,227,236,.82); background: rgba(255,255,255,.9); backdrop-filter: blur(15px); }
.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar-title p { margin: 0 0 2px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.topbar-title h1 { margin: 0; font-size: 19px; line-height: 1.2; }
.mobile-menu { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; }
.topbar-actions { position: relative; display: flex; align-items: center; gap: 10px; }
.environment-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid #dce4ee; border-radius: 999px; color: #667388; background: #f9fbfd; font-size: 11px; font-weight: 750; }
.environment-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,106,.12); }
.environment-badge.is-warning i { background: #d19a00; box-shadow: 0 0 0 3px rgba(209,154,0,.14); }
.environment-badge.is-error i { background: #c91d32; box-shadow: 0 0 0 3px rgba(201,29,50,.14); }
.icon-button { position: relative; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 21px; cursor: pointer; }
.icon-button b { position: absolute; top: -4px; right: -3px; display: grid; width: 17px; height: 17px; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; background: var(--red); font-size: 8px; }
.user-button { display: flex; min-width: 220px; align-items: center; gap: 10px; padding: 5px 9px 5px 5px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; }
.avatar { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--red), #7d1020); font-size: 11px; font-weight: 850; }
.user-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; text-align: left; }
.user-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-copy small { overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: #8290a3; }
.user-menu { position: absolute; top: calc(100% + 9px); right: 0; z-index: 80; width: 245px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 18px 45px rgba(16,24,39,.16); }
.user-menu .mini-label { display: block; padding: 4px 8px 8px; }
.user-menu button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; font-size: 12px; font-weight: 700; text-align: left; cursor: pointer; }
.user-menu button:hover { background: #f2f5f8; }

.content { width: 100%; max-width: 1700px; margin: 0 auto; padding: 28px clamp(20px, 3vw, 42px) 70px; }
.page { display: none; animation: pageIn .2s ease; }
.page.is-active { display: block; }
@keyframes pageIn { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.setup-alert { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; padding: 14px 16px; border: 1px solid #f1db8f; border-radius: 15px; background: #fffaf0; box-shadow: var(--shadow-sm); }
.setup-alert .alert-icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 10px; color: #694e00; background: var(--gold); font-weight: 900; }
.setup-alert strong { font-size: 13px; }
.setup-alert p { margin: 2px 0 0; color: #7b6b3c; font-size: 11px; }
.setup-alert .button { margin-left: auto; }
.setup-alert.is-success { border-color: #b7e3cf; background: #f1fbf6; }
.setup-alert.is-success p { color: #267153; }
.user-button:disabled { cursor: default; opacity: 1; }

.hero-row, .page-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-kicker { color: #8b97a8; font-size: 10px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.hero-row h2, .page-toolbar h2, .quote-builder-head h2 { margin: 5px 0 4px; color: var(--ink); font-size: clamp(25px, 2.7vw, 36px); line-height: 1.1; letter-spacing: -.04em; }
.hero-row .lead, .page-toolbar p, .quote-builder-head p { margin: 0; color: var(--muted); font-size: 13px; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 1px solid transparent; border-radius: 11px; font-size: 12px; font-weight: 800; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--red), var(--red-dark)); box-shadow: 0 9px 22px rgba(201,29,50,.2); }
.button-dark { color: #fff; background: var(--navy); }
.button-secondary { border-color: var(--line-dark); color: var(--ink); background: #fff; }
.button-small { min-height: 34px; padding: 0 12px; font-size: 11px; }
.button-full { width: 100%; }
.button-disabled { color: #8c97a8; background: #eef1f5; cursor: not-allowed; }
.button-disabled:hover { transform: none; }
.text-button, .back-button { padding: 5px 0; border: 0; color: var(--red); background: transparent; font-size: 11px; font-weight: 850; cursor: pointer; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-grid.compact { margin: 20px 0; }
.metric-card { min-width: 0; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-sm); }
.metric-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.metric-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; font-size: 17px; font-weight: 800; }
.metric-icon.gold { color: #7a5700; background: #fff4c7; }
.metric-icon.blue { color: #1e5caf; background: #e8f1ff; }
.metric-icon.green { color: #08774a; background: #e2f7ee; }
.metric-icon.red { color: #a51326; background: #fde9ec; }
.metric-card > strong { display: block; font-size: 25px; line-height: 1; letter-spacing: -.035em; }
.metric-card > span { display: block; margin-top: 7px; color: #39465a; font-size: 12px; font-weight: 760; }
.metric-card > small { display: block; margin-top: 3px; color: #8a95a6; font-size: 10px; }
.trend { padding: 3px 7px; border-radius: 999px; color: #7c889a; background: #f2f4f7; font-size: 9px; font-weight: 850; }
.trend.good { color: #08774a; background: #e9f8f1; }
.trend.urgent { color: #9b1526; background: #fdebef; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .75fr); gap: 20px; margin-bottom: 20px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-sm); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 21px 14px; }
.panel-heading h3, .settings-heading h3 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.025em; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 16px; border-bottom: 1px solid var(--line); color: #8a95a5; font-size: 9px; font-weight: 850; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid #edf0f4; font-size: 11px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }
.cell-title { display: block; color: var(--ink); font-size: 12px; font-weight: 800; }
.cell-subtitle { display: block; margin-top: 3px; color: #8a95a6; font-size: 9px; }
.table-action { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; font-size: 9px; font-weight: 850; white-space: nowrap; }
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.draft { color: #667085; background: #eef1f4; }
.status-pill.sent { color: #1e5caf; background: #e8f1ff; }
.status-pill.approved, .status-pill.success { color: #08774a; background: #e7f8f0; }
.status-pill.follow-up, .status-pill.warning { color: #9b6310; background: #fff2d6; }
.status-pill.in-progress { color: #7b40b2; background: #f2eafd; }
.status-pill.neutral { color: #526074; background: #edf1f5; }

.quick-panel { padding-bottom: 8px; }
.quick-action { display: flex; width: calc(100% - 20px); align-items: center; gap: 11px; margin: 0 10px 6px; padding: 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.quick-action:hover { background: #f6f8fa; }
.quick-icon { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 10px; color: #4a596e; background: #eef2f6; font-size: 17px; font-weight: 700; }
.quick-icon.primary { color: #fff; background: var(--red); }
.quick-action span:nth-child(2) { min-width: 0; flex: 1; }
.quick-action strong { display: block; font-size: 11px; }
.quick-action small { display: block; overflow: hidden; margin-top: 2px; color: #8994a4; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.quick-action b { color: #9aa4b3; font-size: 18px; }

.schedule-panel { padding-bottom: 10px; }
.schedule-list { display: grid; gap: 2px; padding: 0 12px 10px; }
.schedule-item { display: grid; grid-template-columns: 54px 7px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 12px 10px; border-radius: 12px; }
.schedule-item:hover { background: #f7f9fb; }
.schedule-date { text-align: center; }
.schedule-date strong { display: block; font-size: 16px; }
.schedule-date small { color: #8d98a8; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.schedule-line { align-self: stretch; border-radius: 10px; background: var(--red); }
.schedule-copy strong { display: block; font-size: 11px; }
.schedule-copy span { display: block; margin-top: 3px; color: #7f8b9c; font-size: 9px; }
.schedule-item > small { color: #6f7c8e; font-size: 9px; font-weight: 750; }

.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.search-box { display: flex; min-width: 270px; max-width: 470px; flex: 1; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--line-dark); border-radius: 11px; background: #fff; }
.search-box span { color: #8793a5; font-size: 19px; }
.search-box input { width: 100%; height: 42px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }
.filter-pills { display: flex; align-items: center; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.filter-pills button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 9px; color: #738095; background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.filter-pills button.is-active { color: var(--ink); background: #edf1f5; }
.table-panel { overflow: hidden; }
.data-table td { padding-top: 16px; padding-bottom: 16px; }

.customer-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.customer-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.customer-top { display: flex; align-items: center; gap: 12px; }
.customer-avatar { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(135deg,#34435b,#142033); font-size: 11px; font-weight: 850; }
.customer-top div { min-width: 0; flex: 1; }
.customer-top strong, .customer-top small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-top strong { font-size: 12px; }
.customer-top small { margin-top: 3px; color: #8894a5; font-size: 9px; }
.customer-details { display: grid; gap: 7px; margin: 17px 0; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.customer-details span { display: flex; justify-content: space-between; gap: 12px; color: #8994a4; font-size: 9px; }
.customer-details b { overflow: hidden; color: #465369; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.customer-actions { display: flex; gap: 8px; }
.customer-actions button { flex: 1; }

.balance-loading, .balance-error { padding: 24px !important; color: var(--muted); text-align: center; }
.balance-error { color: var(--red); }

.kanban { display: grid; grid-template-columns: repeat(4,minmax(230px,1fr)); gap: 15px; overflow-x: auto; padding-bottom: 10px; }
.kanban-column { min-width: 230px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #edf1f5; }
.kanban-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 3px 12px; }
.kanban-head strong { font-size: 11px; }
.kanban-head span { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 7px; color: #68758a; background: #fff; font-size: 9px; font-weight: 800; }
.job-card { margin-bottom: 9px; padding: 14px; border: 1px solid #dfe4eb; border-radius: 13px; background: #fff; box-shadow: 0 3px 10px rgba(23,34,51,.05); }
.job-card:last-child { margin-bottom: 0; }
.job-card .job-number { color: var(--red); font-size: 9px; font-weight: 850; }
.job-card h4 { margin: 6px 0 5px; font-size: 12px; }
.job-card p { margin: 0; color: #7a8799; font-size: 9px; }
.job-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 13px; padding-top: 11px; border-top: 1px solid #edf0f4; }
.job-meta span { color: #748094; font-size: 9px; }
.job-meta b { font-size: 9px; }

.partner-banner { display: flex; align-items: center; gap: 15px; padding: 18px; border: 1px solid #dbe3ee; border-radius: var(--radius); background: linear-gradient(135deg,#fff,#f7f9fc); box-shadow: var(--shadow-sm); }
.partner-logo { display: grid; width: 48px; height: 48px; flex: 0 0 48px; place-items: center; border-radius: 13px; color: #fff; background: #1b4d3e; font-size: 13px; font-weight: 900; }
.partner-banner > div:nth-child(2) { min-width: 0; flex: 1; }
.partner-banner strong { font-size: 13px; }
.partner-banner p { margin: 3px 0 0; color: #748094; font-size: 10px; }

.report-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(280px,.6fr); gap: 20px; }
.chart-card { min-height: 360px; }
.bar-chart { display: flex; height: 250px; align-items: flex-end; gap: 16px; padding: 24px 28px 38px; }
.bar-chart span { position: relative; flex: 1; min-width: 24px; border-radius: 8px 8px 3px 3px; background: #dfe5ed; }
.bar-chart span.current { background: linear-gradient(180deg,var(--red),#a81327); }
.bar-chart b { position: absolute; top: calc(100% + 10px); left: 50%; color: #8995a7; font-size: 9px; transform: translateX(-50%); }
.report-summary { display: flex; flex-direction: column; justify-content: center; padding: 28px; }
.report-summary > strong { margin-top: 22px; font-size: 56px; line-height: 1; letter-spacing: -.06em; }
.report-summary h3 { margin: 8px 0 3px; }
.report-summary p { color: #7b8798; font-size: 10px; }
.progress { height: 8px; margin-top: 22px; overflow: hidden; border-radius: 999px; background: #edf1f5; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--red); }

.settings-layout { display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 20px; align-items: start; }
.settings-nav { display: grid; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow-sm); }
.settings-nav button { padding: 11px 12px; border: 0; border-radius: 9px; color: #6f7c8f; background: transparent; font-size: 10px; font-weight: 800; text-align: left; cursor: pointer; }
.settings-nav button.is-active { color: var(--ink); background: #edf1f5; }
.settings-content { min-height: 500px; padding: 23px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.settings-pane { display: none; }
.settings-pane.is-active { display: block; }
.settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.settings-heading p { margin: 5px 0 0; color: #7d899a; font-size: 10px; }
.checklist { display: grid; margin-top: 10px; }
.check-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 15px 4px; border-bottom: 1px solid var(--line); }
.check-row > span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; color: #667389; background: #eef1f5; font-size: 10px; font-weight: 850; }
.check-row.done > span { color: #fff; background: var(--green); }
.check-row strong { font-size: 11px; }
.check-row p { margin: 3px 0 0; color: #8591a2; font-size: 9px; }
.check-row > b { color: #8a95a5; font-size: 9px; }
.pricing-list, .role-list { display: grid; gap: 10px; margin-top: 16px; }
.pricing-row { display: grid; grid-template-columns: minmax(160px,1fr) 110px 130px; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.pricing-row strong { display: block; font-size: 11px; }
.pricing-row small { display: block; margin-top: 3px; color: #8793a4; font-size: 9px; }
.pricing-row label { display: block; }
.pricing-row input { width: 100%; height: 37px; padding: 0 9px; border: 1px solid var(--line-dark); border-radius: 9px; outline: 0; }
.role-row { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.role-avatar { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 11px; color: #fff; background: var(--navy); font-size: 10px; font-weight: 850; }
.role-row > div:nth-child(2) { min-width: 0; flex: 1; }
.role-row strong, .role-row small { display: block; }
.role-row strong { font-size: 11px; }
.role-row small { margin-top: 3px; color: #8591a3; font-size: 9px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px; }
.form-grid label { display: block; }
.form-grid label > span, .line-item-grid label > span { display: block; margin-bottom: 6px; color: #465267; font-size: 10px; font-weight: 800; }
.form-grid input, .form-grid select, .form-grid textarea, .line-item-grid input, .line-item-grid select { width: 100%; border: 1px solid var(--line-dark); border-radius: 10px; color: var(--ink); background: #fff; outline: none; transition: border .15s, box-shadow .15s; }
.form-grid input, .form-grid select, .line-item-grid input, .line-item-grid select { height: 43px; padding: 0 11px; }
.form-grid textarea { padding: 11px; resize: vertical; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .line-item-grid input:focus, .line-item-grid select:focus { border-color: #e57887; box-shadow: 0 0 0 3px rgba(201,29,50,.1); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; }

.quote-builder-head { position: relative; display: grid; grid-template-columns: 100px minmax(0,1fr) auto; align-items: center; gap: 18px; margin-bottom: 22px; }
.quote-builder-head h2 { font-size: 30px; }
.draft-indicator { align-self: start; margin-top: 6px; color: #7c899a; font-size: 9px; font-weight: 750; }
.draft-indicator::first-letter { color: var(--green); }
.quote-builder { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 20px; align-items: start; }
.builder-main { display: grid; gap: 18px; }
.builder-section { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.step-heading { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.step-heading > span { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: 10px; color: #fff; background: var(--navy); font-size: 11px; font-weight: 850; }
.step-heading h3 { margin: 0; font-size: 15px; }
.step-heading p { margin: 3px 0 0; color: #8591a2; font-size: 9px; }
.line-items { display: grid; gap: 12px; margin-top: 18px; }
.line-item { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #f9fafc; }
.line-item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.line-item-top strong { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.remove-line { width: 28px; height: 28px; border: 0; border-radius: 8px; color: #9c2535; background: #fbe9ec; font-size: 18px; cursor: pointer; }
.line-item-grid { display: grid; grid-template-columns: minmax(180px,1.4fr) 1fr 1fr 120px; gap: 12px; align-items: end; }
.line-item-grid small { display: block; min-height: 13px; margin-top: 4px; color: #8a95a6; font-size: 8px; }
.line-total-box { min-height: 66px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.line-total-box span, .line-total-box strong, .line-total-box small { display: block; }
.line-total-box span { color: #7f8b9d; font-size: 8px; font-weight: 750; text-transform: uppercase; }
.line-total-box strong { margin-top: 4px; font-size: 14px; }
.line-total-box small { min-height: 0; margin-top: 2px; color: #a27611; }
.input-with-prefix, .input-with-suffix { position: relative; }
.input-with-prefix > span, .input-with-suffix > span { position: absolute; top: 50%; z-index: 1; margin: 0; color: #8793a4; font-size: 10px; transform: translateY(-50%); }
.input-with-prefix > span { left: 11px; }
.input-with-prefix input { padding-left: 25px; }
.input-with-suffix > span { right: 11px; }
.input-with-suffix input { padding-right: 48px; }
.add-line { margin-top: 12px; }

.quote-summary { position: sticky; top: 98px; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.summary-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.summary-head strong { font-size: 11px; }
.summary-warning { display: flex; align-items: center; gap: 9px; margin: 14px 0; padding: 10px; border: 1px solid #f0dc9b; border-radius: 10px; background: #fff9e9; }
.summary-warning > span { display: grid; width: 25px; height: 25px; flex: 0 0 25px; place-items: center; border-radius: 8px; color: #6a4e00; background: var(--gold); font-size: 10px; font-weight: 900; }
.summary-warning p { margin: 0; color: #7c6b34; font-size: 8px; }
.summary-warning strong { display: block; color: #584713; font-size: 9px; }
.summary-lines { display: grid; gap: 9px; min-height: 55px; padding: 6px 0 14px; }
.empty-summary { align-self: center; margin: 0; color: #8c97a7; font-size: 9px; text-align: center; }
.summary-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.summary-line span { font-size: 9px; }
.summary-line span small { display: block; margin-top: 2px; color: #8a95a6; font-size: 8px; }
.summary-line strong { font-size: 9px; white-space: nowrap; }
.summary-totals { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); }
.summary-totals > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #69768a; font-size: 9px; }
.summary-totals strong { color: var(--ink); }
.summary-totals .discount-row strong { color: var(--red); }
.summary-totals .grand-total { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink); font-size: 12px; font-weight: 800; }
.summary-totals .grand-total strong { font-size: 21px; }
.quote-summary .button + .button { margin-top: 8px; }
.summary-footnote { margin: 10px 2px 0; color: #8a95a6; font-size: 8px; line-height: 1.5; text-align: center; }

.mobile-bottom-nav { display: none; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 35; display: none; background: rgba(8,14,24,.5); backdrop-filter: blur(2px); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 360px; padding: 13px 16px; border-radius: 12px; color: #fff; background: var(--navy); box-shadow: 0 16px 40px rgba(15,24,39,.25); font-size: 11px; font-weight: 700; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: none; }
.is-hidden { display: none !important; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .customer-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .line-item-grid { grid-template-columns: 1fr 1fr; }
  .line-total-box { min-height: 0; }
}

@media (max-width: 940px) {
  :root { --sidebar: 238px; }
  .dashboard-grid, .report-grid { grid-template-columns: 1fr; }
  .quote-builder { grid-template-columns: 1fr; }
  .quote-summary { position: static; }
  .user-button { min-width: 0; }
  .user-copy, .chevron, .environment-badge { display: none; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { display: flex; overflow-x: auto; }
  .settings-nav button { white-space: nowrap; }
}

@media (max-width: 760px) {
  body { padding-bottom: 68px; }
  .sidebar { width: min(290px, 86vw); transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.is-open { transform: none; }
  .drawer-backdrop.is-open { display: block; }
  .main-area { margin-left: 0; }
  .topbar { min-height: 68px; padding: 10px 14px; }
  .mobile-menu { display: block; }
  .topbar-title h1 { max-width: 180px; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-title p { display: none; }
  .icon-button { display: none; }
  .content { padding: 20px 14px 30px; }
  .setup-alert { align-items: flex-start; }
  .setup-alert .button { display: none; }
  .hero-row, .page-toolbar { align-items: flex-start; }
  .hero-row > .button, .page-toolbar > .button { min-width: 42px; padding: 0 12px; }
  .metric-grid { gap: 10px; }
  .metric-card { padding: 15px; }
  .metric-card > strong { font-size: 21px; }
  .customer-grid { grid-template-columns: 1fr; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .search-box { min-width: 0; max-width: none; }
  .filter-pills { overflow-x: auto; }
  .filter-pills button { white-space: nowrap; }
  .partner-banner { align-items: flex-start; flex-wrap: wrap; }
  .partner-banner .status-pill { margin-left: 63px; }
  .settings-content { padding: 16px; }
  .pricing-row { grid-template-columns: 1fr 90px; }
  .pricing-row > span:last-child { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .quote-builder-head { grid-template-columns: auto 1fr; }
  .quote-builder-head .draft-indicator { display: none; }
  .quote-builder-head h2 { font-size: 25px; }
  .builder-section { padding: 17px; }
  .line-item-grid { grid-template-columns: 1fr; }
  .mobile-bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 50; display: grid; grid-template-columns: repeat(5,1fr); min-height: 64px; padding: 6px max(6px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); box-shadow: 0 -8px 28px rgba(14,23,38,.08); backdrop-filter: blur(14px); }
  .mobile-bottom-nav button { display: flex; align-items: center; justify-content: center; gap: 2px; flex-direction: column; border: 0; color: #8290a4; background: transparent; font-size: 8px; font-weight: 800; }
  .mobile-bottom-nav button span { font-size: 20px; line-height: 1; }
  .mobile-bottom-nav button.is-active { color: var(--red); }
  .mobile-bottom-nav .mobile-create span { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 14px; color: #fff; background: var(--red); box-shadow: 0 8px 20px rgba(201,29,50,.25); transform: translateY(-9px); }
  .toast { right: 14px; bottom: 80px; left: 14px; max-width: none; }
}

@media (max-width: 480px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-head { margin-bottom: 12px; }
  .metric-icon { width: 30px; height: 30px; }
  .metric-card > span { font-size: 10px; }
  .metric-card > small { font-size: 8px; }
  .hero-row h2, .page-toolbar h2 { font-size: 26px; }
  .page-toolbar p { max-width: 240px; }
  .schedule-item { grid-template-columns: 45px 5px minmax(0,1fr); gap: 9px; }
  .schedule-item > small { display: none; }
  .check-row { grid-template-columns: 31px minmax(0,1fr); }
  .check-row > button, .check-row > b { grid-column: 2; justify-self: start; }
}

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

/* Live Jobs and owner receipt entry */
[hidden] { display: none !important; }
.job-link { border: 0; background: none; color: #1e5d4c; padding: 0; text-align: left; font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.job-link:hover { color: #10382f; }
.job-link:focus-visible, .table-action:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #ba9b59; outline-offset: 3px; }
.recovery-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #f1f5ef; border: 1px solid #d6e2d1; border-radius: 12px; padding: 18px 22px; margin-bottom: 18px; }
.recovery-banner p { margin: 6px 0 0; font-size: 13px; color: #566054; }
.recovery-banner.has-warning { background: #fff7e6; border-color: #ead2a2; }
.data-notice { color: #60655f; font-size: 13px; line-height: 1.6; margin: 12px 0 20px; }
.jobs-table { min-width: 950px; }
.jobs-table td { vertical-align: top; }
.job-detail-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; margin-bottom: 22px; }
.job-contact, .job-financials { padding: 24px; }
.job-contact p { line-height: 1.7; color: #535950; }
.job-contact small { color: #6b7168; line-height: 1.6; }
.job-financials dl { margin: 18px 0; }
.job-financials dl div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid #e9ebe5; }
.job-financials dt { color: #63695e; }.job-financials dd { margin: 0; font-weight: 700; }
.job-financials dl div:last-child dd { color: #1e5d4c; font-size: 23px; }
.detail-section { margin-bottom: 22px; overflow: hidden; }
.detail-note { color: #697063; font-size: 12px; line-height: 1.7; padding: 0 24px 16px; margin: 12px 0 0; }
.scope-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.payment-history { min-width: 760px; }.payment-history td { max-width: 320px; vertical-align: top; overflow-wrap: anywhere; }
.payment-form-body { padding: 0 24px 24px; }.payment-form-body .detail-note { padding: 0; }
.payment-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }.payment-fields label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
.payment-fields input, .payment-fields select, .payment-fields textarea { width: 100%; min-height: 44px; background: white; border: 1px solid #d9ded5; border-radius: 8px; padding: 10px 12px; font: inherit; }
.payment-fields .full-width { grid-column: 1 / -1; }.payment-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }
.payment-confirmation { background: #f1f5ef; border: 1px solid #d6e2d1; padding: 20px; border-radius: 10px; margin-top: 15px; line-height: 1.6; }.payment-confirmation p { font-size: 14px; }
.confirmation-check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; font-weight: 600; }.confirmation-check input { margin-top: 5px; min-width: 18px; height: 18px; }
button:disabled { opacity: .55; cursor: wait; }
@media (max-width: 720px) { .job-detail-grid, .payment-fields { grid-template-columns: 1fr; }.recovery-banner { flex-direction: column; align-items: stretch; }.job-contact, .job-financials { padding: 19px; }.payment-actions { flex-wrap: wrap; }.payment-actions button { flex: 1; } }

.backup-actions { display: flex; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }

/* Server-priced quoting */
#quoteFields{margin:0;border:0;padding:0;min-width:0}#quoteFields .builder-section{margin-bottom:18px}.quote-toolbar-actions,.quote-detail-actions{display:flex;gap:12px;flex-wrap:wrap}.quote-detail-actions{margin-bottom:22px}.live-quote-line .line-item-top{display:flex;align-items:flex-start;gap:15px}.live-quote-line .line-item-top>label{flex:1;display:grid;gap:7px;font-size:13px;font-weight:600}.quote-line-fields{display:grid;grid-template-columns:1fr 1fr;gap:17px;padding-top:16px}.quote-line-fields>label{display:grid;gap:7px;font-size:13px;font-weight:600}.quote-line-fields small{font-size:11px;line-height:1.5;font-weight:400;color:var(--muted)}.live-quote-line input:not([type=checkbox]),.live-quote-line select{min-height:44px;border:1px solid var(--border);border-radius:8px;padding:10px 12px;background:white;width:100%;font:inherit}.quote-wide{grid-column:1/-1}.quote-line-fields .quote-check{display:flex;align-items:center;gap:9px;font-size:12px}.quote-check input{width:17px;height:17px;flex-shrink:0}.quote-line-result{display:flex;justify-content:space-between;gap:15px;border-top:1px solid var(--border);padding-top:13px;margin-top:18px}.quote-line-result strong{font-size:19px;color:#1e5d4c}.quote-line-result small{font-size:11px;color:var(--muted);text-align:right}.quote-position-options{display:flex;gap:20px;flex-wrap:wrap;margin-top:12px}.quote-position-options label{display:flex;align-items:center;gap:8px;font-size:13px}.quote-position-options input{width:17px;min-height:17px}.quote-field-title{font-size:12px;font-weight:600}.quote-review-dialog{width:min(600px,calc(100vw - 32px));border:1px solid #d8dfd4;border-radius:15px;padding:28px;box-shadow:0 20px 80px #17292050;color:var(--ink)}.quote-review-dialog::backdrop{background:#101b146e}.quote-review-dialog p{font-size:14px;line-height:1.7}.quote-review-total{font-size:23px!important;font-weight:700;color:#1e5d4c}.quote-saved-line{padding:12px 24px 22px;border-bottom:1px solid var(--border)}.quote-saved-line h4{display:flex;justify-content:space-between;gap:15px;margin:8px 0}.quote-saved-line p{font-size:13px;color:var(--muted);line-height:1.6}.quote-saved-line details{font-size:12px;margin-top:12px}.quote-saved-line summary{cursor:pointer;color:#1e5d4c;font-weight:600}.quote-component{display:flex;justify-content:space-between;gap:20px;padding:7px 0}.quote-history{padding:0 24px 24px;display:grid;gap:10px}.quote-history a{font-size:13px;color:#1e5d4c}#quoteBuilderState{max-width:230px;white-space:normal;font-size:11px}#quoteError{font-size:12px;line-height:1.5}#quoteBuilder .summary-warning{display:block}#quoteBuilder .summary-warning p{font-size:12px;line-height:1.6}.quote-saved-line details small{color:var(--muted)}@media(max-width:650px){.quote-line-fields{grid-template-columns:1fr}.quote-wide{grid-column:auto}.quote-toolbar-actions{width:100%}.quote-toolbar-actions button{flex:1}.quote-detail-actions .button{flex:1}.quote-line-result{align-items:center}.quote-saved-line{padding-left:18px;padding-right:18px}}

/* Customer document delivery */
.delivery-dialog { width: min(960px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
.delivery-header, .delivery-summary, .delivery-actions { display: flex; align-items: center; gap: 12px; }
.delivery-header, .delivery-summary { justify-content: space-between; }
.delivery-header h2 { margin: 0; font-size: clamp(19px, 3vw, 25px); }
.delivery-summary { margin: 15px 0; padding: 14px 16px; border-radius: 10px; background: var(--canvas); }
.delivery-summary strong { font-size: 16px; overflow-wrap: anywhere; }
.delivery-summary span { display: block; color: var(--muted); font-size: 12px; }
.delivery-actions { flex-wrap: wrap; }
.delivery-actions .button { text-decoration: none; }
.job-document-actions { margin: 0 0 18px; }
.delivery-channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.delivery-channel { border: 1px solid var(--line); border-radius: 12px; padding: 15px; }
.delivery-channel h3, .delivery-recipient, .delivery-subject { margin: 0 0 9px; }
.delivery-recipient span { display: block; color: var(--muted); font-size: 11px; }
.delivery-recipient strong, .delivery-subject, .delivery-history small { overflow-wrap: anywhere; }
.delivery-preview { margin: 9px 0; padding: 12px; border-radius: 8px; background: var(--canvas); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.delivery-channel .confirmation-check { margin: 10px 0; }
.delivery-notice:empty { display: none; }
.delivery-notice { color: var(--ink-2); }
.delivery-history { margin: 0; padding: 0; list-style: none; }
.delivery-history li { padding: 10px 0; border-top: 1px solid var(--line); }
.delivery-history small { display: block; color: var(--muted); }
.delivery-history details, .delivery-history form { margin-top: 8px; }
.delivery-history form { display: grid; gap: 8px; max-width: 330px; }
.delivery-history label { display: grid; gap: 4px; }
@media (max-width: 650px) {
  .delivery-dialog { padding: 16px; }
  .delivery-channels { grid-template-columns: 1fr; }
}
.delivery-invoices { margin-top: 13px; }
.delivery-invoices summary { cursor: pointer; font-weight: 600; }
.delivery-blocked { color: var(--red); }
.delivery-sender { margin: 0 0 8px; color: var(--muted); }

.delivery-dialog.is-single-channel { width: min(620px, calc(100vw - 32px)); }
.delivery-dialog.is-single-channel .delivery-channels { grid-template-columns: minmax(0, 1fr); }
.delivery-dialog.is-single-channel .delivery-channel h3 { display: none; }
