:root {
  color-scheme: light;
  font: 15px/1.5 "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: #f5f9ff;
  --ink: #142b49;
  --muted: #52677f;
  --line: #dce8f5;
  --accent: #1769dc;
  --accent-hover: #1058bf;
  --accent-soft: #eaf4ff;
  --paper: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 222px minmax(0, 1fr); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #1976e9; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1, h2, .metric-value { font-family: "Manrope", "DM Sans", system-ui, sans-serif; }

.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: linear-gradient(165deg, #0d3f91, #0c5abc); color: #ffffff; padding: 30px 17px 22px; }
.brand { display: grid; gap: 8px; width: min(100%, 144px); margin: 0 auto 28px; text-align: center; }
.brand img {
  display: block;
  width: 100%;
  height: auto;
  /* Screen blending removes the inverted white background. */
  filter: grayscale(1) invert(1) contrast(1.2) brightness(1.03);
  mix-blend-mode: screen;
}
.brand-name { color: #ffffff; font: 800 18px/1.1 "Manrope", "DM Sans", system-ui, sans-serif; letter-spacing: .12em; }
nav { display: grid; gap: 5px; }
nav a { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: #e2efff; font-weight: 600; }
nav a:hover, nav a[aria-current] { background: #ffffff24; color: #ffffff; }
nav a[aria-current] { box-shadow: inset 3px 0 #92ddff; }
[data-icon], .icon { display: inline-flex; flex-shrink: 0; vertical-align: middle; }
.icon { width: 19px; height: 19px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #ffffff30; padding: 17px 7px 0; color: #e2efff; font-size: 12px; }
.mode-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #92ddff; vertical-align: 1px; }

main { width: 100%; max-width: 1550px; margin-inline: auto; padding: 30px clamp(20px, 3.2vw, 52px) 42px; }
.topbar, .section-header, .dialog-header, .dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.topbar { margin-bottom: 22px; }
.topbar p, .intro p, .section-header p, .empty p { color: var(--muted); }
.topbar p { font-weight: 700; font-size: 13px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 15px; border-radius: 9px; border: 1px solid transparent; font-weight: 700; white-space: nowrap; transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease; }
.primary { background: var(--accent); color: white; box-shadow: 0 3px 12px #1474d82e; }
.primary:hover { background: var(--accent-hover); }
.secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.secondary:hover, .text-link:hover { background: var(--accent-soft); border-color: #b6d6fa; }
.button.destructive { color: #a12f2f; background: #ffffff; border-color: #edc5c5; }
.button.destructive:hover { background: #fff0f0; border-color: #dca6a6; }
.button.primary.destructive { color: #ffffff; background: #ad3232; border-color: #ad3232; box-shadow: 0 3px 12px #ad323225; }
.button.primary.destructive:hover { background: #902626; border-color: #902626; }
.intro { margin-bottom: 22px; }
.intro h1, .hero h1 { font-size: clamp(28px, 3.3vw, 46px); font-weight: 800; letter-spacing: -.055em; line-height: 1.12; }
.intro p, .hero p { margin-top: 9px; }
.hero { position: relative; isolation: isolate; overflow: hidden; background: radial-gradient(ellipse at 85% 12%, #76caff70, transparent 55%), linear-gradient(120deg, #104aa3, #1769dc); color: #ffffff; border-radius: 17px; padding: clamp(24px, 4vw, 48px); margin-bottom: 19px; }
.hero::after { content: ""; position: absolute; z-index: -1; top: -78%; right: -65px; width: 370px; aspect-ratio: 1; border-radius: 47% 53% 42% 58%; transform: rotate(-27deg); background: repeating-radial-gradient(ellipse at 49% 53%, transparent 0 13px, #d4efff38 14px 15px); pointer-events: none; }
.hero p { color: #eef7ff; max-width: 420px; }
.hero .hero-motto { margin-top: 18px; max-width: none; color: #ffffff; font-size: clamp(18px, 2vw, 26px); font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 19px; }
.metric, .panel { border: 1px solid var(--line); border-radius: 13px; background: var(--paper); box-shadow: 0 3px 16px #1269bd05; }
.metric { min-width: 0; padding: 15px 16px; }
.metric-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }
.metric-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.metric-value { font-size: clamp(18px, 2.35vw, 32px); letter-spacing: -.05em; font-weight: 800; overflow-wrap: anywhere; }
.metric-preview { position: relative; padding: 0; }
.metric-preview[open] { z-index: 5; border-color: #a6ccf7; }
.metric-trigger { height: 100%; padding: 15px 16px; border-radius: inherit; list-style: none; cursor: pointer; }
.metric-trigger::-webkit-details-marker { display: none; }
.metric-trigger .metric-label, .metric-trigger .metric-value { display: block; }
.metric-preview:hover, .metric-preview:focus-within { border-color: #a6ccf7; }
.metric-preview-panel { position: absolute; top: 100%; left: 0; width: max(100%, 340px); max-width: calc(100vw - 40px); padding-top: 8px; }
.metric-preview:nth-child(n+3) .metric-preview-panel { right: 0; left: auto; }
.metric-preview-body { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 12px 30px #142b4926; }
.metric-preview-body h2 { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 800; }
.metric-preview-body h2 span { color: var(--muted); font-weight: 600; }
.metric-preview-list { max-height: min(340px, 50vh); overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 0; padding: 0; }
.metric-preview-list li + li { border-top: 1px solid var(--line); }
.metric-preview-project { display: grid; gap: 3px; padding: 11px 14px; font-size: 13px; overflow-wrap: anywhere; }
.metric-preview-project:hover, .metric-preview-project:focus-visible { background: var(--accent-soft); }
.metric-preview-project:focus-visible { outline-offset: -3px; }
.metric-preview-meta, .metric-preview-empty { color: var(--muted); font-size: 12px; }
.metric-preview-empty { padding: 13px 14px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(205px, 1fr); align-items: start; gap: 16px; }
.section-header { padding: 17px 18px; }
.section-header h2 { font-size: 17px; font-weight: 800; letter-spacing: -.025em; }
.section-header p { font-size: 13px; }
.text-link { border-radius: 7px; padding: 5px 8px; color: var(--accent); white-space: nowrap; font-size: 13px; font-weight: 700; }
.table-scroll { overflow-x: auto; border-radius: 0 0 12px 12px; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 13px; }
th, td { padding: 12px 16px; }
th { color: var(--muted); background: #f1f7ff; font-weight: 700; white-space: nowrap; }
td { border-top: 1px solid var(--line); }
td:last-child, th:last-child { text-align: right; }
td a { text-decoration: underline; text-underline-offset: 2px; }
.record-link { border: 0; background: transparent; color: var(--ink); font-weight: 700; text-align: left; padding: 0; }
.record-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.record-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.number { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.project-list :is(th, td) { padding-inline: clamp(7px, 1vw, 16px); }
.project-list th { white-space: normal; }
.project-list td:first-child { min-width: 110px; overflow-wrap: anywhere; }
.project-list .project-type { font-weight: 600; cursor: help; }
.project-type-preview { position: fixed; z-index: 20; width: max-content; max-width: min(460px, calc(100vw - 24px)); padding: 10px 13px; border: 1px solid #304766; border-radius: 9px; background: #142b49; color: #ffffff; box-shadow: 0 8px 24px #142b4933; font-size: 12px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; pointer-events: none; }
td.deadline-overdue { color: #9e2525; background: #fff0f0; box-shadow: inset 3px 0 #d94444; font-weight: 700; }
.deadline-warning { display: block; margin-top: 2px; font-size: 11px; font-weight: 700; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--tint); color: var(--tone); }
.estimating { --tint: #e9f2ff; --tone: #2d60a3; }
.waiting { --tint: #f8efd8; --tone: #79561e; }
.revision { --tint: #f8efd8; --tone: #79561e; }
.ready { --tint: #e4f2ff; --tone: #135ca4; }
.sent { --tint: #edf0ff; --tone: #4d58a6; }
.sold { --tint: #e5efdf; --tone: #325838; }
.lost { --tint: #f5e7e4; --tone: #853e36; }
.account-active { --tint: #e5efdf; --tone: #325838; }
.account-inactive { --tint: #edf1f6; --tone: #5d6c7e; }
.meeting-status { --tint: #e9f2ff; --tone: #2d60a3; }
.meeting-overdue { --tint: #f8e5e3; --tone: #962f2a; }
tr.meeting-overdue td { background: var(--tint); }
.pipeline { display: grid; padding: 0 18px 14px; }
.pipeline a { display: flex; align-items: center; gap: 8px; padding: 9px 1px; border-bottom: 1px solid var(--line); font-size: 13px; }
.pipeline a:hover { color: var(--accent); text-decoration: underline; }
.pipeline a:last-child { border-bottom: 0; }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.pipeline strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
#report-filters { align-items: center; }
.report-range, .report-classification-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.search { flex: 1 1 220px; }
input, select, textarea { min-width: 0; max-width: 100%; border: 1px solid #c5d6e9; border-radius: 8px; background: white; color: var(--ink); padding: 8px 10px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 4px #83c5ff30; }
textarea { resize: vertical; min-height: 82px; }
.empty { padding: 28px 18px; }
.empty strong { display: block; margin-bottom: 4px; }

dialog { width: min(510px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: var(--ink); padding: 0; box-shadow: 0 18px 65px #12345b38; }
dialog::backdrop { background: #0d294c80; }
.dialog-header, .dialog-footer { padding: 16px 21px; }
.dialog-header { border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 20px; }
.dialog-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.icon-button { border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 25px; line-height: 1; width: 34px; height: 34px; }
.icon-button:hover { background: var(--accent-soft); }
.fields { display: grid; gap: 12px; padding: 17px 21px; }
.fields label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; }
.fields .checkbox { display: flex; align-items: center; gap: 8px; }
.fields .checkbox input { accent-color: var(--accent); }
.fields small { font-size: 12px; color: var(--muted); font-weight: 400; }
.address-field { display: grid; gap: 4px; }
.address-control input { width: 100%; font-size: 13px; font-weight: 700; }
.address-dropdown { margin-top: 6px; border: 1px solid #b6d6fa; border-radius: 9px; overflow: hidden; background: var(--paper); box-shadow: 0 5px 18px #1769dc12; }
#address-suggestions { max-height: 210px; overflow-y: auto; }
.address-option { display: grid; gap: 2px; width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; background: var(--paper); color: var(--ink); text-align: left; }
.address-option:hover, .address-option[aria-selected="true"] { background: var(--accent-soft); }
.address-option strong { font-size: 13px; }
.address-option span, .address-attribution { font-size: 11px; color: var(--muted); }
.address-attribution { display: flex; justify-content: flex-end; padding: 10px 12px 6px; background: #ffffff; }
.address-attribution img { display: block; height: 18px; width: auto; }
.policy-links { font-size: 12px; color: var(--muted); }
.policy-links a { text-decoration: underline; text-underline-offset: 2px; }
.policy-page { display: block; }
.policy-page main { max-width: 800px; padding: 36px 24px; }
.policy-page h1 { margin: 22px 0 8px; font-size: 34px; }
.policy-page h2 { margin: 28px 0 8px; font-size: 20px; }
.policy-page p { margin: 12px 0; }
.policy-page p a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.notification-recipients { margin: 0; padding: 0; border: 0; }
.notification-recipients legend { padding: 0 0 5px; font-size: 13px; font-weight: 700; }
.notification-recipients > div, .notification-timing { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 20px; }
.notification-timing input[type="number"] { max-width: 8ch; }
#save-notification-settings:disabled { opacity: .6; cursor: wait; }
.error { padding: 0 21px 12px; color: #853e36; }
#toast:not(:empty) { position: fixed; z-index: 1; bottom: 20px; right: 20px; max-width: calc(100vw - 40px); border-radius: 9px; background: #123e74; color: white; padding: 10px 15px; box-shadow: 0 5px 20px #0d3f9124; }

body:has(.sidebar[hidden]) { display: block; }
body:has(.sidebar[hidden]) main { max-width: none; padding: 0; }
.auth { display: grid; grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1fr); min-height: 100dvh; }
.auth-visual { position: relative; overflow: hidden; isolation: isolate; display: grid; align-content: center; padding: clamp(30px, 7vw, 110px); background: radial-gradient(ellipse at 10% 15%, #5abaff45, transparent 60%), linear-gradient(145deg, #0d3f91, #1769dc); color: #ffffff; }
.auth-visual::after { content: ""; position: absolute; z-index: -1; width: 690px; aspect-ratio: 1; border-radius: 47% 53% 42% 58%; bottom: -400px; right: -110px; transform: rotate(-30deg); background: repeating-radial-gradient(ellipse at 49% 53%, transparent 0 17px, #d4efff38 18px 19px); }
.auth-visual .brand { width: min(100%, 185px); margin: 0 0 26px; }
.auth-visual .brand-name { font-size: 23px; }
.auth-visual h1 { font-size: clamp(31px, 4.3vw, 65px); line-height: 1.02; letter-spacing: -.06em; max-width: 500px; }
.auth-form { align-self: center; justify-self: center; width: min(440px, 100%); padding: 30px; }
.auth-form .fields { padding: 22px 0 16px; }
.auth-form .primary { width: 100%; }
.auth-form .error { padding-inline: 0; }
.auth-form > p { color: var(--muted); margin-top: 8px; }
.profile-name { display: block; font-size: 13px; font-weight: 700; color: #ffffff; overflow-wrap: anywhere; }
.staging-label { display: block; margin-top: 6px; color: #c6eaff; font-size: 12px; font-weight: 700; }
.sign-out { display: block; padding: 5px 0 0; border: 0; background: transparent; color: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.view { display: grid; gap: 17px; }
.view > .intro, .view > .topbar, .view > .metrics { margin: 0; }
.intro .badge { margin: 6px 0 0; }
.panel { min-width: 0; }
.table-scroll table { min-width: 490px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(255px, 1fr); gap: 17px; align-items: start; }
.detail-list { display: grid; grid-template-columns: minmax(85px, auto) minmax(0, 1fr); gap: 10px 18px; padding: 3px 18px 18px; margin: 0; font-size: 14px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.view-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.button.small { min-height: 34px; padding: 4px 9px; font-size: 12px; }
.sales-tabs { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.sales-tab { display: grid; justify-items: stretch; gap: 3px; }
.sales-medal { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 600; }
.sales-medal-icon { font-size: 20px; line-height: 1.2; }
.sales-tabs a[aria-current] { color: white; background: var(--accent); }
.timeline { list-style: none; padding: 0 18px 17px; margin: 0; }
.timeline li { position: relative; border-left: 1px solid #c5ddf5; padding: 3px 0 16px 16px; margin-left: 4px; }
.timeline li::before { content: ""; position: absolute; top: 8px; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: #3486df; }
.timeline li:last-child { padding-bottom: 0; }
.timeline p, .multiline { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline p { margin-top: 4px; }
.muted { color: var(--muted); }
.money-grid .metric-icon { display: none; }
.status-metrics { padding: 0 18px 18px; margin: 0; }
.search-result { padding: 9px 11px; background: var(--accent-soft); border-radius: 8px; font-size: 13px; }
.search-result a { color: var(--accent); text-decoration: underline; font-weight: 700; }
.group-heading { margin: 0; padding: 12px 16px; font-weight: 700; border-top: 1px solid var(--line); background: #f1f7ff; }
.attention { color: #853e36; }
.dialog-footer button:disabled, .auth-form button:disabled { opacity: .6; cursor: wait; }
#editor-form:invalid .dialog-footer button:disabled { cursor: not-allowed; }

@media (max-width: 1020px) {
  body { grid-template-columns: 176px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  body { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 16px; }
  .sidebar .brand { width: min(100%, 116px); margin: 0 0 12px; }
  .sidebar .brand-name { font-size: 15px; }
  nav { display: flex; gap: 5px; flex-wrap: wrap; }
  nav a { min-height: 38px; font-size: 13px; padding: 0 9px; }
  .sidebar-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; border-top: 0; padding: 9px 2px 0; }
  main { padding-top: 17px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric-preview:nth-child(odd) .metric-preview-panel { right: auto; left: 0; }
  .metric-preview:nth-child(even) .metric-preview-panel { right: 0; left: auto; }
  .topbar { margin-bottom: 15px; }
  .topbar p { font-size: 12px; }
  .hero::after { right: -205px; }
  .section-header { padding-inline: 12px; }
  th, td { padding-inline: 11px; }
  .auth { display: block; }
  .auth-visual { min-height: 220px; }
  .auth-visual .brand { width: min(100%, 144px); margin-bottom: 18px; }
  .auth-visual .brand-name { font-size: 18px; }
  .auth-form { margin: 0 auto; }
  .topbar { align-items: start; }
}
