:root {
    --ink: #171717;
    --muted: #706b61;
    --paper: #f7f4ec;
    --surface: #ffffff;
    --gold: #b58a32;
    --gold-dark: #87651f;
    --gold-soft: #eee2c4;
    --line: #ded8ca;
    --danger: #a33131;
    --success: #246b43;
    --shadow: 0 16px 45px rgba(32, 27, 18, 0.10);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at top right, #f2e7ca 0, transparent 28rem), var(--paper);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: .85rem clamp(1rem, 4vw, 3rem);
    border-bottom: 1px solid rgba(181, 138, 50, .28);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.brand img { width: 124px; height: 62px; object-fit: contain; object-position: left center; }
.brand-copy { display: grid; gap: .15rem; }
.brand-copy strong { font-family: Georgia, serif; letter-spacing: .12em; }
.brand-copy span { color: var(--muted); font-size: .85rem; }
.user-tools { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: .9rem; }

.page-shell { width: min(1180px, calc(100% - 2rem)); margin: 2rem auto 4rem; }
.page-intro { margin-bottom: 1.35rem; }
.eyebrow { margin: 0 0 .35rem; color: var(--gold-dark); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; }
h1 { margin: 0; font-size: clamp(1.85rem, 4vw, 2.7rem); }
.intro-copy { margin: .45rem 0 0; color: var(--muted); }

.quote-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 1.35rem; align-items: start; }
.form-stack { display: grid; gap: 1.2rem; }
.card {
    padding: clamp(1.1rem, 3vw, 1.65rem);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 1.1rem; font-size: 1.28rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field { display: grid; gap: .4rem; }
.field--wide { grid-column: 1 / -1; }
label { font-size: .86rem; font-weight: 750; color: #39362f; }
input, select {
    width: 100%;
    min-height: 46px;
    padding: .7rem .8rem;
    border: 1px solid #cfc8b8;
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
}
input:focus, select:focus { outline: 3px solid rgba(181, 138, 50, .20); border-color: var(--gold); }

.result-card {
    position: sticky;
    top: 104px;
    overflow: hidden;
    color: #fff;
    border: 1px solid rgba(181, 138, 50, .48);
    background: linear-gradient(150deg, #181818, #2d2922);
}
.result-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 95% 0, rgba(181, 138, 50, .32), transparent 42%); pointer-events: none; }
.result-card > * { position: relative; }
.result-label { margin: 0; color: #d7c79f; font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.result-value { display: block; margin: .45rem 0 .2rem; color: #fff; font-family: Georgia, serif; font-size: clamp(2.2rem, 6vw, 3.1rem); }
.result-area { margin: 0 0 1.15rem; color: #c8c1b4; font-size: .9rem; }
.actions { display: grid; gap: .7rem; }
.btn {
    min-height: 44px;
    padding: .72rem 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 800;
}
.btn-primary { color: #17130b; background: linear-gradient(135deg, #d4b365, var(--gold)); }
.btn-primary:hover { background: linear-gradient(135deg, #dfc27b, #c49a42); }
.btn-secondary { color: #fff; border-color: rgba(255,255,255,.26); background: rgba(255,255,255,.08); }
.btn-ghost { min-height: 38px; padding: .5rem .8rem; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.btn:disabled { cursor: not-allowed; opacity: .48; }
.error-message { padding: .7rem; border-radius: 8px; color: #ffdede; background: rgba(163,49,49,.28); }
.privacy-note { margin: 1rem 0 0; color: #aaa397; font-size: .76rem; line-height: 1.45; }
.loading { opacity: .68; pointer-events: none; }

.login-page { display: grid; place-items: center; padding: 1.25rem; }
.login-card { width: min(430px, 100%); padding: 2rem; text-align: center; }
.login-logo { width: 190px; max-height: 95px; object-fit: contain; }
.login-card h1 { margin-top: 1rem; font-size: 1.65rem; }
.login-card form { display: grid; gap: .8rem; margin-top: 1.4rem; text-align: left; }
.login-card .btn { margin-top: .45rem; }
.login-error { padding: .75rem; border-radius: 9px; color: var(--danger); background: #fbe7e7; }

@media (max-width: 880px) {
    .quote-grid { grid-template-columns: 1fr; }
    .result-card { position: static; order: -1; }
}
@media (max-width: 620px) {
    .app-header { align-items: flex-start; flex-direction: column; }
    .brand img { width: 105px; height: 52px; }
    .user-tools { width: 100%; justify-content: space-between; }
    .page-shell { width: min(100% - 1rem, 1180px); margin-top: 1rem; }
    .fields { grid-template-columns: 1fr; }
    .field--wide { grid-column: auto; }
    .card { border-radius: 14px; }
    .result-card { top: 0; }
}

@media print {
    .app-header, .actions, .privacy-note { display: none !important; }
    body { background: #fff; }
    .page-shell { width: 100%; margin: 0; }
    .quote-grid { display: block; }
    .card { box-shadow: none; break-inside: avoid; margin-bottom: 1rem; }
    .result-card { color: #000; background: #fff; border: 2px solid #000; }
    .result-value, .result-label, .result-area { color: #000; }
}
