:root {
    --blue: #4ba3db;
    --blue-dark: #173d5a;
    --blue-ink: #102f46;
    --blue-soft: #edf7fc;
    --orange: #ee720a;
    --orange-soft: #fff5eb;
    --green: #168864;
    --red: #bc4242;
    --ink: #183042;
    --muted: #687f8f;
    --line: #dce7ed;
    --surface: #ffffff;
    --canvas: #f3f7fa;
    --sidebar: 248px;
    --shadow: 0 10px 28px rgba(20, 58, 82, .07);
}
/* tpilot-hot-reload-css */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font: 14px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid rgba(75, 163, 219, .4); outline-offset: 3px; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: var(--sidebar);
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    color: #fff;
    background: linear-gradient(180deg, #173d5a 0%, #102f46 100%);
    border-right: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 25px; border-bottom: 1px solid rgba(255,255,255,.11); }
.sidebar-brand img { width: 42px; height: 42px; object-fit: contain; border-radius: 11px; background: #fff; box-shadow: 0 7px 18px rgba(0,0,0,.15); }
.sidebar-brand strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.sidebar-brand span { display: block; margin-top: 1px; color: #a9c5d6; font-size: 12px; }
.main-nav { display: grid; gap: 7px; margin-top: 28px; }
.nav-item { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; min-height: 46px; padding: 9px 12px; color: #c7dce8; text-decoration: none; border-radius: 10px; font-weight: 700; }
.nav-item.is-active { color: #fff; background: rgba(75,163,219,.2); box-shadow: inset 3px 0 var(--blue); }
.nav-item.is-disabled { color: #829eae; cursor: default; }
.nav-icon { font-size: 18px; line-height: 1; }
.nav-item small { padding: 2px 6px; color: #b7d3e2; background: rgba(255,255,255,.08); border-radius: 5px; font-size: 10px; letter-spacing: .03em; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 15px 8px 2px; color: #d4e6ef; border-top: 1px solid rgba(255,255,255,.11); }
.sidebar-foot strong, .sidebar-foot span { display: block; }
.sidebar-foot strong { font-size: 12px; }
.sidebar-foot span { color: #8eabba; font-size: 11px; }
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #54c695; box-shadow: 0 0 0 4px rgba(84,198,149,.13); }

.app-main { min-height: 100vh; margin-left: var(--sidebar); }
.mobile-bar { display: none; }
.nav-backdrop { display: none; }
.dashboard { width: min(1440px, 100%); margin: 0 auto; padding: 34px 38px 48px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 4px; color: var(--blue); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.page-header h1 { margin: 0; color: var(--blue-ink); font-size: clamp(26px, 3vw, 34px); line-height: 1.15; letter-spacing: -.035em; }
.page-intro { max-width: 660px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.sync-panel { display: flex; align-items: center; gap: 12px; min-width: max-content; padding: 11px 12px 11px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.sync-copy span, .sync-copy strong { display: block; }
.sync-copy span { color: var(--muted); font-size: 11px; }
.sync-copy strong { margin-top: 1px; font-size: 12px; }
.sync-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; color: var(--green); background: #eaf8f2; border-radius: 7px; font-size: 11px; font-weight: 800; }
.sync-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sync-badge.demo { color: #a75b14; background: var(--orange-soft); }
.sync-badge.error { color: var(--red); background: #fff0f0; }
.refresh-button { display: grid; place-items: center; width: 36px; height: 36px; color: var(--blue-dark); text-decoration: none; background: var(--blue-soft); border-radius: 8px; font-size: 18px; transition: transform .2s, background .2s; }
.refresh-button:hover { transform: rotate(30deg); background: #dceff9; }

.grid { display: grid; gap: 16px; }
.hero-grid { grid-template-columns: minmax(280px, .82fr) minmax(0, 2.18fr); }
.crm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.card-pad { padding: 22px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { margin: 0; color: var(--blue-ink); font-size: 15px; line-height: 1.3; }
.chip { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 10px; color: #286f9c; background: var(--blue-soft); border-radius: 7px; font-size: 11px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.context-link { display: inline-flex; margin-top: 14px; color: #247bab; font-size: 12px; font-weight: 800; text-underline-offset: 3px; }
.context-link::after { content: " →"; }

.goal-card, .chart-card { min-height: 300px; }
.ring-wrap { display: grid; place-items: center; margin: 4px 0 17px; }
.ring { position: relative; display: grid; place-items: center; width: 158px; height: 158px; border-radius: 50%; }
.ring::after { content: ""; position: absolute; inset: 16px; background: #fff; border-radius: 50%; }
.ring-in { position: relative; z-index: 1; text-align: center; }
.ring-main { color: var(--blue-ink); font-size: 32px; font-weight: 900; line-height: 1; letter-spacing: -.045em; }
.ring-sub { margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.goal-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-box { padding: 11px; background: #f7fafc; border: 1px solid #e6edf1; border-radius: 9px; }
.mini-box span, .mini-box strong { display: block; }
.mini-box span { margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.mini-box strong { font-size: 16px; letter-spacing: -.02em; }

.chart-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.chart-value { margin-top: 5px; color: var(--blue-ink); font-size: 31px; font-weight: 900; line-height: 1.15; letter-spacing: -.04em; }
.chart-delta { margin-left: 6px; color: var(--green); font-size: 12px; font-weight: 850; letter-spacing: normal; }
.chart-delta.is-negative { color: var(--orange); }
.chart-caption { margin-top: 4px; color: var(--muted); font-size: 12px; }
.chart { height: 158px; margin-top: 17px; overflow: hidden; background: linear-gradient(#eaf1f5 1px,transparent 1px) 0 0/100% 39px, linear-gradient(90deg,#eef3f6 1px,transparent 1px) 0 0/12.5% 100%; border-radius: 9px; }
.chart svg { display: block; width: 100%; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.l-now { background: var(--blue); } .l-prev { background: #6377dc; } .l-yoy { background: #e9ae36; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 29px 2px 11px; }
.section-head h2 { margin: 0; color: var(--blue-ink); font-size: 19px; line-height: 1.2; letter-spacing: -.02em; }
.section-head span { color: var(--muted); font-size: 12px; text-align: right; }
.finance-main { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 13px; }
.finance-box { padding: 16px; background: #f7fafc; border: 1px solid #e5edf1; border-radius: 10px; }
.finance-box .label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.finance-box .num { margin-top: 6px; color: var(--blue-ink); font-size: 24px; font-weight: 900; letter-spacing: -.035em; }
.finance-box .help { margin-top: 3px; color: #7f929e; font-size: 12px; }
.coverage { padding: 15px 16px; background: var(--orange-soft); border: 1px solid #f2d5b6; border-radius: 10px; }
.coverage-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.coverage-title { font-size: 13px; font-weight: 850; }
.coverage-value { color: #a65a16; font-size: 17px; font-weight: 900; }
.coverage-text { margin-top: 3px; color: #806c58; font-size: 12px; }
.progress { height: 9px; margin-top: 11px; overflow: hidden; background: #f0dfcf; border-radius: 99px; }
.progress span { display: block; height: 100%; background: var(--orange); border-radius: inherit; }
.coverage-danger { background: #fff1f1; border-color: #efcece; }
.coverage-danger .coverage-value { color: var(--red); }
.coverage-danger .progress { background: #f1dada; }
.coverage-danger .progress span { background: var(--red); }
.coverage-success { background: #edf9f4; border-color: #caeadc; }
.coverage-success .coverage-value { color: var(--green); }
.coverage-success .progress { background: #dcefe7; }
.coverage-success .progress span { background: var(--green); }
.gap-box { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 10px; padding: 12px 14px; color: #955113; background: #fff7ed; border-radius: 9px; }
.gap-box span { font-size: 12px; font-weight: 700; }
.gap-box strong { font-size: 17px; white-space: nowrap; }
.coverage-rule { margin-top: 10px; color: var(--muted); font-size: 11px; }
.coverage-rule .r { color: var(--red); } .coverage-rule .o { color: #a65a16; } .coverage-rule .g { color: var(--green); }

.sales-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sales-type { padding: 18px; background: #f7fafc; border: 1px solid #e5edf1; border-radius: 11px; }
.sales-type .name { font-size: 14px; font-weight: 850; }
.sales-type .big { margin-top: 4px; color: var(--blue-ink); font-size: 23px; font-weight: 900; letter-spacing: -.035em; }
.sales-type .small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.old-list { display: grid; gap: 7px; margin-top: 12px; }
.old { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 10px; padding: 10px 11px; background: #fff; border: 1px solid #e3ebef; border-radius: 8px; }
.old .client { overflow: hidden; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.old .age { padding: 3px 6px; color: #a65a16; background: var(--orange-soft); border-radius: 5px; font-size: 11px; white-space: nowrap; }
.old .amt { font-size: 12px; font-weight: 850; white-space: nowrap; }

.crm-stage { padding: 20px; }
.qualification { background: linear-gradient(145deg, #fff3e6, #fff 72%); border-color: #efcfad; box-shadow: 0 10px 28px rgba(238,114,10,.09); }
.stage-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stage-name { font-size: 15px; font-weight: 900; }
.qualification .stage-name { color: #a44f09; }
.stage-count { color: var(--blue-ink); font-size: 26px; font-weight: 900; }
.qualification .stage-count { color: var(--orange); }
.stage-sum { min-height: 36px; margin-top: 1px; color: var(--muted); font-size: 12px; }
.stage-list { display: grid; gap: 7px; margin-top: 12px; }
.stage-item { min-height: 58px; padding: 10px; background: #f8fafb; border: 1px solid #e3ebef; border-radius: 8px; }
.qualification .stage-item { background: #fffaf5; border-color: #f0dcc8; }
.stage-item strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.stage-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.stage-item b { color: #a75b14; }
.empty { display: grid; min-height: 90px; margin-top: 12px; place-items: center; padding: 16px; color: var(--muted); text-align: center; background: #fafcfd; border: 1px dashed #cfdee6; border-radius: 9px; }
.empty strong, .empty span { display: block; }
.empty strong { color: #526b7a; font-size: 12px; }
.empty span { margin-top: 3px; font-size: 11px; }
.qualification .context-link { color: #a5500a; }

.eff-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 11px; }
.eff-card { position: relative; min-height: 150px; padding: 16px; background: #f7fafc; border: 1px solid #e4ecf0; border-radius: 10px; }
.eff-card.won { background: #eff9f5; border-color: #d3eadf; }
.eff-card.lost { background: #fff5f5; border-color: #ecdcdc; }
.eff-title { max-width: calc(100% - 66px); color: var(--muted); font-size: 11px; font-weight: 900; line-height: 1.3; text-transform: uppercase; letter-spacing: .045em; }
.eff-change { position: absolute; top: 13px; right: 13px; padding: 4px 6px; border-radius: 5px; font-size: 10px; font-weight: 900; }
.chg-good { color: var(--green); background: #dff3ea; }
.chg-bad { color: #ad5914; background: #ffead9; }
.eff-value { margin-top: 28px; color: var(--blue-ink); font-size: clamp(20px, 2vw, 26px); font-weight: 900; line-height: 1.05; letter-spacing: -.04em; }
.eff-sub { margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.eff-sub strong { color: #354e5d; }

.projects { display: grid; gap: 8px; }
.project { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(100px,.45fr) minmax(100px,.5fr) auto; align-items: center; gap: 14px; padding: 12px 13px; text-decoration: none; background: #fff; border: 1px solid #e2eaef; border-radius: 9px; transition: border-color .2s, transform .2s; }
a.project:hover { transform: translateX(2px); border-color: #a9cfe5; }
.p-name { overflow: hidden; font-size: 13px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.p-sub { overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.p-data span, .p-data strong { display: block; }
.p-data span { color: var(--muted); font-size: 11px; }
.p-data strong { margin-top: 1px; font-size: 12px; }
.status { padding: 5px 8px; border-radius: 6px; font-size: 11px; font-weight: 900; white-space: nowrap; }
.s-red { color: var(--red); background: #ffeded; }
.s-orange { color: #a65a16; background: var(--orange-soft); }
.long-wait { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 10px; padding: 11px 13px; color: var(--muted); background: #f4f7f9; border: 1px solid #e1e9ed; border-radius: 8px; }
.long-wait span { font-size: 12px; }
.long-wait strong { color: #445e6d; font-size: 12px; white-space: nowrap; }

.quote-card { color: #fff; background: linear-gradient(130deg, #173d5a 0%, #185c82 62%, #247caf 100%); border: 0; box-shadow: 0 15px 34px rgba(23,61,90,.18); }
.quote-wrap { padding: 26px; }
.quote-kicker { color: #bfe1f3; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.quote-text { max-width: 900px; margin: 9px 0 6px; font-size: 25px; font-weight: 800; line-height: 1.25; letter-spacing: -.025em; }
.quote-author { color: #c5dae6; font-size: 12px; }
.ai-box { margin-top: 17px; padding: 15px 16px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.15); border-radius: 9px; }
.ai-label { color: #cde8f6; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.ai-text { margin-top: 5px; color: #f4fbff; font-size: 14px; line-height: 1.55; }
.dashboard-footer { margin-top: 22px; color: var(--muted); font-size: 11px; text-align: center; }

/* Dashboard direction: month, finance, production, commercial, efficiency, direction. */
.dashboard-header-actions { display: flex; align-items: flex-start; gap: 10px; }
.dashboard-header-actions .secondary-button { min-height: 60px; }
.section-head-first { margin-top: 0; }
.month-grid { grid-template-columns: minmax(340px, .9fr) minmax(520px, 1.7fr); }
.month-scorecard, .revenue-chart-card { min-height: 380px; }
.month-main { padding: 18px; background: linear-gradient(145deg, #edf7fc, #fff); border: 1px solid #d7eaf5; border-radius: 11px; }
.month-main > span { display: block; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.month-main > strong { display: block; margin-top: 6px; color: var(--blue-ink); font-size: clamp(30px, 3vw, 40px); line-height: 1.05; letter-spacing: -.045em; }
.month-main > strong small { font-size: 12px; letter-spacing: .04em; }
.month-main p { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.month-main .progress { margin-top: 16px; }
.month-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 11px; }
.month-metrics > div { padding: 11px 12px; background: #f7fafc; border: 1px solid #e5edf1; border-radius: 9px; }
.month-metrics span, .month-metrics strong { display: block; }
.month-metrics span { color: var(--muted); font-size: 10px; font-weight: 750; }
.month-metrics strong { margin-top: 3px; color: var(--blue-ink); font-size: 14px; }
.dynamic-chart { position: relative; width: 100%; height: 255px; margin-top: 15px; }
.dynamic-chart canvas { display: block; width: 100%; height: 100%; }
.chart-tooltip { position: absolute; z-index: 3; min-width: 190px; padding: 10px 11px; color: #fff; pointer-events: none; background: rgba(16, 47, 70, .96); border-radius: 8px; box-shadow: 0 9px 24px rgba(16,47,70,.22); font-size: 11px; }
.chart-tooltip > strong { display: block; margin-bottom: 5px; }
.chart-tooltip span { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 7px; padding-top: 3px; }
.chart-tooltip i { width: 7px; height: 7px; border-radius: 50%; }
.chart-tooltip b { margin-left: 8px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 15px; margin: 7px 0 0 58px; color: var(--muted); font-size: 11px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 50%; }
.finance-zone { grid-template-columns: 1.1fr .9fr 1.2fr; }
.finance-zone .card { min-width: 0; }
.primary-value, .secondary-value { margin-top: 8px; color: var(--blue-ink); font-size: clamp(28px, 3vw, 38px); font-weight: 900; line-height: 1; letter-spacing: -.045em; }
.secondary-value { color: #247bab; }
.metric-help { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.bank-list { display: grid; gap: 6px; margin-top: 17px; }
.bank-list > div:not(.compact-empty) { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; background: #f7fafc; border: 1px solid #e5edf1; border-radius: 7px; font-size: 11px; }
.bank-list strong { color: var(--blue-ink); white-space: nowrap; }
.cash-card .coverage { margin-top: 18px; }
.cash-card .coverage small { display: block; margin-top: 8px; color: inherit; }
.receivable-main { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 15px; background: #f7fafc; border: 1px solid #e5edf1; border-radius: 10px; }
.receivable-main strong { color: var(--blue-ink); font-size: 27px; letter-spacing: -.035em; }
.receivable-main span { color: var(--muted); font-size: 11px; }
.receivable-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.receivable-grid > div { padding: 10px; background: #fff6f3; border-radius: 8px; }
.receivable-grid > div:first-child { grid-column: 1 / -1; }
.receivable-grid span, .receivable-grid strong { display: block; }
.receivable-grid span { color: var(--muted); font-size: 10px; }
.receivable-grid strong { margin-top: 2px; color: var(--red); font-size: 14px; }
.production-grid { grid-template-columns: 1fr 1fr; }
.production-total { display: flex; align-items: baseline; gap: 11px; }
.production-total > strong { color: var(--blue); font-size: 34px; line-height: 1; }
.production-total > span { color: var(--muted); font-size: 12px; }
.production-total b { color: var(--blue-ink); }
.compact-empty { padding: 12px; color: var(--muted); text-align: center; background: #fafcfd; border: 1px dashed #cfdee6; border-radius: 8px; font-size: 11px; }
.api-limitation { margin: 12px 0 0; padding: 9px 10px; color: #825125; background: var(--orange-soft); border-radius: 7px; font-size: 11px; }
.compact-efficiency .eff-card { min-height: 125px; }
.compact-efficiency .eff-value { margin-top: 24px; }
.direction-zone { grid-template-columns: minmax(340px, .85fr) minmax(0, 1.4fr); }
.direction-alerts { display: grid; gap: 8px; margin-top: 14px; }
.direction-alert { display: grid; grid-template-columns: 9px 1fr; gap: 10px; padding: 11px 12px; background: #f8fafb; border: 1px solid #e4ecf0; border-radius: 8px; }
.direction-alert > span { width: 9px; height: 9px; margin-top: 4px; background: var(--orange); border-radius: 50%; }
.direction-alert.alert-critical > span { background: var(--red); }
.direction-alert strong { display: block; font-size: 12px; }
.direction-alert p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.pipeline-table { display: grid; }
.pipeline-row { display: grid; grid-template-columns: minmax(180px, 1.6fr) minmax(130px, 1fr) 110px 120px; gap: 14px; align-items: center; padding: 12px 10px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
a.pipeline-row:hover { background: var(--blue-soft); }
.pipeline-row > :last-child { text-align: right; font-weight: 800; }
.pipeline-heading { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }

@media (max-width: 1200px) {
    :root { --sidebar: 210px; }
    .dashboard { padding: 28px 25px 42px; }
    .eff-grid { grid-template-columns: 1fr 1fr; }
    .crm-grid { grid-template-columns: 1fr 1fr; }
    .crm-grid > :last-child { grid-column: 1 / -1; }
    .month-grid { grid-template-columns: minmax(320px, .9fr) minmax(430px, 1.3fr); }
    .finance-zone { grid-template-columns: 1fr 1fr; }
    .receivables-card { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; }
    .goal-card { min-height: 0; }
    .finance-main { grid-template-columns: 1fr 1fr; }
    .finance-main > :last-child { grid-column: 1 / -1; }
    .page-header { flex-direction: column; }
    .sync-panel { width: 100%; min-width: 0; }
    .sync-copy { flex: 1; }
    .month-grid, .direction-zone { grid-template-columns: 1fr; }
    .month-scorecard, .revenue-chart-card { min-height: 0; }
    .dashboard-header-actions { width: 100%; }
}

@media (max-width: 767px) {
    body.no-scroll { overflow: hidden; }
    .sidebar { width: min(82vw, 290px); transform: translateX(-102%); transition: transform .25s ease; box-shadow: 20px 0 45px rgba(8,35,52,.24); }
    .nav-open .sidebar { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .mobile-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; height: 62px; padding: 0 17px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
    .mobile-brand { display: flex; align-items: center; gap: 9px; color: var(--blue-dark); text-decoration: none; }
    .mobile-brand img { border-radius: 8px; }
    .menu-toggle { display: grid; gap: 4px; width: 40px; height: 40px; padding: 10px; background: transparent; border: 0; border-radius: 8px; }
    .menu-toggle span:not(.sr-only) { display: block; width: 20px; height: 2px; background: var(--blue-dark); border-radius: 2px; }
    .nav-backdrop { position: fixed; inset: 0; z-index: 25; width: 100%; height: 100%; padding: 0; background: rgba(8,31,45,.48); border: 0; opacity: 0; pointer-events: none; transition: opacity .2s; }
    .nav-open .nav-backdrop { display: block; opacity: 1; pointer-events: auto; }
    .dashboard { padding: 22px 15px 35px; }
    .page-header { gap: 17px; margin-bottom: 20px; }
    .page-intro { font-size: 13px; }
    .sync-panel { flex-wrap: wrap; }
    .sync-copy { min-width: 160px; }
    .card-pad, .crm-stage { padding: 17px; }
    .section-head { display: block; margin-top: 25px; }
    .section-head h2 { font-size: 18px; }
    .section-head span { display: block; margin-top: 3px; text-align: left; }
    .crm-grid, .sales-summary, .eff-grid, .finance-main { grid-template-columns: 1fr; }
    .crm-grid > :last-child, .finance-main > :last-child { grid-column: auto; }
    .chart-top { display: block; }
    .chart-top .chip { margin-top: 10px; }
    .chart-value { font-size: 27px; }
    .goal-bottom { grid-template-columns: 1fr; }
    .project { grid-template-columns: minmax(0,1fr) auto; }
    .project .p-data { display: none; }
    .long-wait { align-items: flex-start; }
    .quote-text { font-size: 21px; }
    .dashboard-header-actions { display: grid; }
    .dashboard-header-actions .secondary-button { min-height: 42px; }
    .finance-zone, .production-grid { grid-template-columns: 1fr; }
    .receivables-card { grid-column: auto; }
    .month-metrics { grid-template-columns: 1fr; }
    .dynamic-chart { height: 230px; overflow-x: auto; }
    .chart-legend { margin-left: 0; }
    .pipeline-heading { display: none; }
    .pipeline-row { grid-template-columns: 1fr auto; }
    .pipeline-row > :last-child { text-align: left; }
}

@media (max-width: 420px) {
    .sync-badge { order: 3; }
    .old { grid-template-columns: minmax(0,1fr) auto; }
    .old .amt { grid-column: 1 / -1; color: var(--muted); }
}

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

.logout-link, .button-link { padding: 0; color: inherit; font: inherit; text-decoration: underline; background: none; border: 0; cursor: pointer; }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, #edf7fc, #f7fafc 55%, #fff4e9); }
.auth-shell { width: min(100%, 450px); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; color: var(--blue-dark); text-decoration: none; }
.auth-brand img { border-radius: 12px; }
.auth-brand span, .auth-brand small { display: block; }
.auth-brand strong { font-size: 22px; }
.auth-brand small { color: var(--muted); }
.auth-card { padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 55px rgba(23,61,90,.13); }
.auth-card h1, .settings-page h2, .settings-page h3 { color: var(--blue-ink); }
.auth-card h1 { margin: 4px 0 8px; font-size: 27px; }
.auth-intro { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.form-stack { display: grid; gap: 15px; }
.form-stack.compact { margin-top: 18px; }
.form-stack label { display: grid; gap: 6px; color: #354e5d; font-size: 12px; font-weight: 800; }
.form-stack input, .form-stack select { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--blue-ink); background: #fff; border: 1px solid #cbdbe4; border-radius: 8px; font: inherit; }
.form-stack input:focus, .form-stack select:focus { outline: 3px solid rgba(75,163,219,.2); border-color: var(--blue); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 15px; font-weight: 850; border-radius: 8px; cursor: pointer; }
.primary-button { color: #fff; background: var(--blue); border: 1px solid var(--blue); }
.secondary-button { color: var(--blue-ink); background: #eef7fc; border: 1px solid #bcdced; }
.primary-button:disabled, .secondary-button:disabled { opacity: .6; cursor: wait; }
.auth-link { display: inline-block; margin-top: 16px; color: #2377a8; }
.inline-form { margin-top: 12px; text-align: center; }
.inline-form .secondary-button { width: 100%; }
.auth-separator { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); }
.auth-separator::before, .auth-separator::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.notice { margin-bottom: 18px; padding: 11px 13px; border-radius: 8px; font-size: 13px; }
.notice.success { color: #176647; background: #eaf8f2; border: 1px solid #bfe4d3; }
.notice.error { color: #9b3232; background: #fff0f0; border: 1px solid #edcaca; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.settings-page h2 { margin: 0 0 14px; font-size: 19px; }
.settings-page h3 { margin: 22px 0 10px; font-size: 15px; }
.details { display: grid; grid-template-columns: minmax(110px,.45fr) 1fr; gap: 9px 14px; margin: 0; }
.details dt { color: var(--muted); font-size: 12px; }
.details dd { margin: 0; font-weight: 750; overflow-wrap: anywhere; }
.credential-list, .user-list { display: grid; gap: 8px; }
.credential-list > div, .user-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; background: #f7fafc; border: 1px solid var(--line); border-radius: 8px; }
.credential-list span, .credential-list small, .user-list span, .user-list small { display: block; min-width: 0; overflow-wrap: anywhere; }
.credential-list small, .user-list small, .field-help { color: var(--muted); font-size: 11px; }
.danger-link { color: #a63737; background: none; border: 0; text-decoration: underline; cursor: pointer; }
.link-button { text-decoration: none; }
.text-ellipsis { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.old > *, .stage-item, .project > *, .p-data { min-width: 0; }
.tooltip-popup { position: fixed; z-index: 100; max-width: min(420px, 80vw); padding: 7px 9px; color: #fff; background: #173d5a; border-radius: 6px; box-shadow: 0 8px 22px rgba(8,35,52,.25); font-size: 12px; font-weight: 600; line-height: 1.35; pointer-events: none; }
.empty-data { display: grid; min-height: 138px; place-items: center; color: var(--muted); text-align: center; }

@media (max-width: 767px) {
    .settings-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 22px; }
}
