:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #172033;
    --muted: #687387;
    --line: #e3e8f0;
    --navy: #14233d;
    --blue: #246bfe;
    --blue-dark: #1556d8;
    --green: #16a673;
    --red: #d74848;
    --orange: #b76b14;
    --shadow: 0 18px 50px rgba(21, 32, 52, 0.10);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

.wrap {
    width: min(1160px, calc(100% - 40px));
    margin: 0 auto;
}

.site-header {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-inner nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-weight: 700;
}

.brand {
    font-size: 23px;
    font-weight: 850;
    letter-spacing: -0.7px;
}

.brand span {
    color: var(--blue);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    background: var(--blue);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}

.button:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(36, 107, 254, .2);
}

.button-small {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 10px;
}

.button-full {
    width: 100%;
}

.button-secondary {
    background: #eef2f7;
    color: var(--text);
}

.button-secondary:hover {
    background: #e2e7ef;
    box-shadow: none;
}

.button-danger {
    background: #fbecec;
    color: #b53636;
}

.button-danger:hover {
    background: #f5dada;
    color: #9e2d2d;
    box-shadow: none;
}

.hero {
    min-height: 650px;
    display: grid;
    grid-template-columns: 1.04fr .96fr;
    align-items: center;
    gap: 70px;
}

.eyebrow {
    display: inline-block;
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.8px;
}

.hero h1,
.auth-card h1,
.app-top h1 {
    margin: 14px 0 16px;
    font-size: clamp(38px, 5vw, 64px);
    line-height: 1.03;
    letter-spacing: -2.4px;
}

.hero p {
    max-width: 650px;
    margin: 0;
    color: var(--muted);
    font-size: 20px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-top: 30px;
}

.text-link {
    color: var(--blue);
    font-weight: 800;
}

.hero-note {
    margin-top: 18px;
    color: var(--muted);
    font-size: 13px;
}

.mock-card {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.mock-top,
.mock-row,
.recovered {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mock-top {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.mock-top span,
.mock-row small,
.recovered span {
    color: var(--muted);
}

.mock-row {
    padding: 21px 0;
    border-bottom: 1px solid var(--line);
}

.mock-row div {
    display: grid;
    gap: 6px;
}

.recovered {
    margin-top: 22px;
    padding: 20px;
    border-radius: 15px;
    background: #effaf6;
}

.recovered strong {
    color: var(--green);
    font-size: 24px;
}

.how {
    padding: 90px 0;
    background: #fff;
}

.section-heading {
    text-align: center;
}

.section-heading span {
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.8px;
}

.section-heading h2 {
    margin: 12px 0 38px;
    font-size: 38px;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.steps article {
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.steps article > b {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #edf3ff;
    color: var(--blue);
}

.steps h3 {
    margin: 18px 0 8px;
}

.steps p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.site-footer {
    padding: 54px 0 22px;
    background: #101d33;
    color: #fff;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr .7fr .7fr;
    gap: 40px;
}

.footer-grid > div {
    display: grid;
    align-content: start;
    gap: 11px;
}

.footer-grid p,
.footer-grid a {
    color: rgba(255,255,255,.68);
}

.footer-grid a:hover {
    color: #fff;
}

.footer-brand span {
    color: #73a2ff;
}

.footer-bottom {
    margin-top: 42px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.10);
    color: rgba(255,255,255,.54);
    font-size: 13px;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 36px 20px;
    background:
        radial-gradient(circle at top left, rgba(36, 107, 254, .10), transparent 34%),
        var(--bg);
}

.auth-shell {
    width: min(500px, 100%);
}

.auth-brand {
    display: block;
    margin-bottom: 22px;
    text-align: center;
}

.auth-card {
    padding: 36px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    font-size: 38px;
    letter-spacing: -1.3px;
}

.muted {
    color: var(--muted);
}

.form-grid {
    display: grid;
    gap: 18px;
    margin-top: 28px;
}

.form-grid label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
}

.form-grid label small {
    color: var(--muted);
    font-weight: 600;
}

.form-grid input,
.form-grid textarea {
    width: 100%;
    border: 1px solid #ccd4e0;
    border-radius: 11px;
    background: #fff;
    color: var(--text);
    outline: none;
}

.form-grid input {
    height: 48px;
    padding: 0 14px;
}

.form-grid textarea {
    padding: 13px 14px;
    resize: vertical;
}

.form-grid input:focus,
.form-grid textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(36, 107, 254, .11);
}

.auth-foot {
    margin-top: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.auth-foot a {
    color: var(--blue);
    font-weight: 800;
}

.alert {
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 11px;
    font-size: 14px;
}

.alert-error {
    background: #fff0f0;
    color: #9e2d2d;
    border: 1px solid #f2caca;
}

.alert-success {
    background: #eaf8f2;
    color: #147252;
    border: 1px solid #c8ebde;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 28px 20px;
    background: var(--navy);
    color: #fff;
}

.brand-light span {
    color: #73a2ff;
}

.business-pill {
    margin: 30px 0 22px;
    padding: 12px 13px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    color: rgba(255,255,255,.78);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-nav {
    display: grid;
    gap: 6px;
}

.side-nav a,
.logout-link {
    padding: 12px 13px;
    border-radius: 10px;
    color: rgba(255,255,255,.72);
    font-weight: 700;
}

.side-nav a:hover,
.side-nav a.active {
    background: rgba(255,255,255,.09);
    color: #fff;
}

.logout-link {
    margin-top: auto;
}

.app-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    min-height: 100vh;
    padding: 42px;
}

.app-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 30px;
}

.app-top h1 {
    margin: 8px 0 6px;
    font-size: 36px;
    letter-spacing: -1.3px;
}

.app-top p {
    margin: 0;
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.stat-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin-top: 10px;
    font-size: 31px;
}

.stat-accent {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

.stat-accent span {
    color: rgba(255,255,255,.7);
}

.panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.panel-head h2 {
    margin: 0 0 5px;
    font-size: 20px;
}

.panel-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.panel-head > a {
    color: var(--blue);
    font-weight: 800;
    font-size: 14px;
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    border: 1px dashed #ccd4e0;
    border-radius: 14px;
}

.compact-empty {
    padding: 34px 18px;
}

.empty-state h3 {
    margin-top: 0;
}

.empty-state p {
    color: var(--muted);
}

.quote-list {
    display: grid;
}

.quote-row {
    display: grid;
    grid-template-columns: 1fr 120px 120px;
    align-items: center;
    gap: 18px;
    padding: 17px 4px;
    border-top: 1px solid var(--line);
}

.quote-row:first-child {
    border-top: 0;
}

.quote-row > div {
    display: grid;
    gap: 5px;
}

.quote-row small {
    color: var(--muted);
}

.quote-row > b {
    text-align: right;
}

.quote-row-link {
    border-radius: 10px;
}

.quote-row-link:hover {
    background: #f8faff;
}

.status {
    justify-self: start;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 850;
}

.status-waiting {
    background: #fff4df;
    color: var(--orange);
}

.status-interested {
    background: #edf3ff;
    color: var(--blue);
}

.status-won {
    background: #eaf8f2;
    color: var(--green);
}

.status-lost {
    background: #f2f3f6;
    color: #687387;
}

.form-panel {
    max-width: 760px;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.money-field {
    position: relative;
}

.money-field > span {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.money-field input {
    padding-left: 28px;
}

.form-actions,
.status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 6px;
}

.form-actions {
    justify-content: flex-end;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 22px;
}

.detail-list {
    margin: 0;
}

.detail-list > div {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 18px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.detail-list > div:first-child {
    border-top: 0;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
}

.timeline {
    display: grid;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 12px;
    padding: 0 0 22px;
}

.timeline-item:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 13px;
    left: 5px;
    width: 2px;
    height: calc(100% - 1px);
    background: var(--line);
}

.timeline-dot {
    position: relative;
    z-index: 1;
    width: 12px;
    height: 12px;
    margin-top: 4px;
    border: 3px solid #cfe0ff;
    border-radius: 50%;
    background: var(--blue);
}

.timeline-item > div:last-child {
    display: grid;
    gap: 5px;
}

.timeline-item small {
    color: var(--muted);
}

.app-footer {
    margin-top: auto;
    padding: 34px 4px 4px;
    color: var(--muted);
    font-size: 12px;
}

.app-footer a:hover {
    color: var(--blue);
}

.legal-page {
    background: #fff;
}

.legal-wrap {
    max-width: 820px;
    padding-top: 60px;
    padding-bottom: 80px;
}

.legal-wrap h1 {
    font-size: 44px;
    letter-spacing: -1.5px;
}

.legal-wrap h2 {
    margin-top: 34px;
}

.legal-wrap p {
    color: #4e5a6f;
    line-height: 1.8;
}

.legal-wrap a {
    color: var(--blue);
    font-weight: 700;
}

@media (max-width: 900px) {
    .hero,
    .detail-grid {
        grid-template-columns: 1fr;
        padding-top: 80px;
        padding-bottom: 80px;
        min-height: auto;
    }

    .steps,
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .footer-grid > div:first-child {
        grid-column: 1 / -1;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .side-nav {
        grid-template-columns: 1fr 1fr;
    }

    .logout-link {
        margin-top: 12px;
    }
}

@media (max-width: 620px) {
    .wrap {
        width: min(100% - 26px, 1160px);
    }

    .header-inner nav > a:first-child {
        display: none;
    }

    .hero h1 {
        font-size: 42px;
    }

    .steps,
    .stats-grid,
    .two-col,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid > div:first-child {
        grid-column: auto;
    }

    .app-main {
        padding: 26px 16px;
    }

    .app-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .quote-row {
        grid-template-columns: 1fr auto;
    }

    .quote-row .status {
        grid-column: 1;
    }

    .quote-row > b {
        grid-column: 2;
        grid-row: 1;
    }

    .auth-card {
        padding: 28px 22px;
    }

    .detail-list > div {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}


.auth-public-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-main {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 56px 20px;
    background:
        radial-gradient(circle at top left, rgba(36, 107, 254, .10), transparent 34%),
        var(--bg);
}

.auth-public-page .site-footer {
    margin-top: auto;
}

@media (max-width: 760px) {
    .header-inner {
        align-items: flex-start;
        gap: 18px;
        padding-top: 18px;
        padding-bottom: 18px;
    }

    .header-inner nav {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 12px 16px;
    }

    .header-inner nav a {
        font-size: 14px;
    }
}


.settings-layout {
    display: grid;
    gap: 22px;
}

.settings-form {
    margin-top: 0;
}

.logo-preview {
    display: flex;
    align-items: center;
    min-height: 90px;
    width: fit-content;
    max-width: 260px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8faff;
}

.logo-preview img {
    display: block;
    max-width: 220px;
    max-height: 72px;
    object-fit: contain;
}

.color-field {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
}

.color-field input[type="color"] {
    width: 58px;
    height: 44px;
    padding: 3px;
    cursor: pointer;
}

.color-field span {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
}

.placeholder-note {
    margin-bottom: 22px;
    padding: 13px 15px;
    border: 1px solid #d8e4ff;
    border-radius: 11px;
    background: #f3f7ff;
    color: #44516a;
    font-size: 13px;
}

.placeholder-note code {
    display: inline-block;
    margin: 3px 4px 3px 0;
    padding: 4px 7px;
    border-radius: 6px;
    background: #ffffff;
    color: var(--blue);
    font-weight: 800;
}

.settings-save {
    position: sticky;
    bottom: 16px;
    display: flex;
    justify-content: flex-end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 12px 30px rgba(21, 32, 52, .08);
    backdrop-filter: blur(8px);
}


.file-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 8px;
    border: 1px solid #ccd4e0;
    border-radius: 12px;
    background: #ffffff;
}

.file-picker-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.file-picker-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    background: var(--blue);
    color: #ffffff;
    font-size: 13px !important;
    font-weight: 850 !important;
    cursor: pointer;
    transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
}

.file-picker-button:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(36, 107, 254, .18);
}

.file-picker-name {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 620px) {
    .file-picker {
        align-items: stretch;
        flex-direction: column;
    }

    .file-picker-button {
        width: 100%;
    }

    .file-picker-name {
        padding: 2px 4px 4px;
    }
}


.color-field {
    display: grid;
    grid-template-columns: 58px minmax(150px, 220px);
    align-items: center;
    gap: 12px;
}

.color-picker-input {
    width: 58px !important;
    height: 48px !important;
    padding: 3px !important;
    border: 1px solid #ccd4e0 !important;
    border-radius: 10px !important;
    background: #ffffff;
    cursor: pointer;
}

.color-hex-input {
    height: 48px !important;
    padding: 0 14px !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
    text-transform: lowercase;
}

.color-hex-input.input-invalid {
    border-color: #d74848 !important;
    box-shadow: 0 0 0 3px rgba(215, 72, 72, .10) !important;
}

@media (max-width: 620px) {
    .color-field {
        grid-template-columns: 58px 1fr;
    }
}


.settings-save {
    gap: 12px;
}

.preview-open {
    overflow: hidden;
}

.email-preview-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: none;
}

.email-preview-modal.is-open {
    display: block;
}

.email-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 24, 43, .62);
    backdrop-filter: blur(5px);
}

.email-preview-dialog {
    position: relative;
    z-index: 1;
    width: min(860px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    margin: 24px auto;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 30px 80px rgba(12, 24, 43, .28);
}

.email-preview-head {
    position: sticky;
    z-index: 2;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(8px);
}

.email-preview-head h2 {
    margin: 5px 0 0;
}

.email-preview-close {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 10px;
    background: #eef2f7;
    color: var(--text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.email-preview-toolbar {
    padding: 18px 24px;
    border-bottom: 1px solid var(--line);
    background: #f8faff;
}

.email-preview-toolbar label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 800;
}

.email-preview-toolbar select {
    min-height: 40px;
    padding: 0 34px 0 12px;
    border: 1px solid #ccd4e0;
    border-radius: 9px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

.email-preview-stage {
    padding: 34px;
    background: #f3f6fa;
}

.email-preview-card {
    max-width: 620px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid #e3e8f0;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 14px 38px rgba(21, 32, 52, .08);
}

.email-preview-accent {
    height: 7px;
    background: var(--blue);
}

.email-preview-brand {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 30px 30px 16px;
    text-align: center;
}

.email-preview-brand img {
    display: block;
    max-width: 190px;
    max-height: 72px;
    object-fit: contain;
}

.email-preview-brand strong {
    font-size: 20px;
}

.email-preview-message {
    padding: 22px 34px 10px;
    color: #2f3a4c;
    font-size: 16px;
    line-height: 1.75;
}

.email-preview-signature {
    margin: 16px 34px 34px;
    padding-top: 20px;
    border-top: 1px solid #e7eaf0;
    color: #4d586a;
    font-size: 14px;
    line-height: 1.65;
}

.email-preview-muted {
    color: #8a94a5;
}

.email-preview-note {
    margin-top: 14px;
    text-align: center;
    color: #8a94a5;
    font-size: 12px;
}

@media (max-width: 620px) {
    .settings-save {
        flex-direction: column-reverse;
    }

    .settings-save .button {
        width: 100%;
    }

    .email-preview-dialog {
        width: calc(100% - 16px);
        margin: 8px auto;
        max-height: calc(100vh - 16px);
    }

    .email-preview-stage {
        padding: 16px;
    }

    .email-preview-message {
        padding-left: 22px;
        padding-right: 22px;
    }

    .email-preview-signature {
        margin-left: 22px;
        margin-right: 22px;
    }

    .email-preview-toolbar label {
        align-items: stretch;
        flex-direction: column;
    }

    .email-preview-toolbar select {
        width: 100%;
    }
}
