/* ── Navbar ── */
.calc-nav {
    background: #fff;
    border-bottom: 1px solid var(--rd-border, #e2e8f0);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.calc-nav .rd-brand { font-size: 20px; }
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-link {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    transition: color .2s;
}
.nav-link:hover { color: #1e293b; }
.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all .2s;
}
.nav-btn-outline {
    background: transparent;
    color: #5c94eb;
    border: 1.5px solid #5c94eb;
}
.nav-btn-outline:hover { background: rgba(92,148,235,.06); }
.nav-btn-fill { background: #5c94eb; color: #fff; }
.nav-btn-fill:hover { background: #4a7fd4; }

/* ── Header ── */
.calc-header {
    background: linear-gradient(135deg, #5b8fd9 0%, #7b8cc8 30%, #b09abd 55%, #d4956e 80%, #e0a265 100%);
    color: #fff;
    padding: 48px 24px 56px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.calc-header::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 70%, rgba(255,255,255,.06) 0%, transparent 50%);
}
.calc-header h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    position: relative;
}
.calc-header p {
    font-size: 16px;
    opacity: .85;
    position: relative;
    max-width: 520px;
    margin: 0 auto;
}
.calc-badge {
    display: inline-block;
    background: rgba(255,255,255,.2);
    backdrop-filter: blur(8px);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    position: relative;
}

/* ── Layout ── */
.calc-wrap {
    max-width: 960px;
    margin: -32px auto 48px;
    padding: 0 16px;
    position: relative;
    z-index: 1;
}
.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── Cards ── */
.calc-card {
    background: var(--rd-surface, #fff);
    border: 1px solid var(--rd-border, #e2e8f0);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,.04);
}
.calc-card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.calc-card-title .icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.calc-card-title .icon svg { width: 18px; height: 18px; color: #fff; }
.icon-blue { background: #5c94eb; }
.icon-orange { background: #fa943d; }
.icon-green { background: #059669; }
.icon-purple { background: #8b5cf6; }

/* ── Fields ── */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 6px;
}
.field label .hint {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 400;
}
.field-row { display: flex; gap: 8px; }
.field-row .field { flex: 1; margin-bottom: 0; }

.input-wrap { position: relative; }
.input-wrap input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #1e293b;
    background: #f6f7fb;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.input-wrap input:focus {
    border-color: #5c94eb;
    box-shadow: 0 0 0 3px rgba(92,148,235,.12);
}
.input-wrap .suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
    pointer-events: none;
}
.input-wrap input.has-suffix { padding-right: 36px; }

select.calc-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: #1e293b;
    background: #f6f7fb;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color .2s;
}
select.calc-select:focus { border-color: #5c94eb; }

/* ── Results ── */
.results-card {
    grid-column: 1 / -1;
    background: var(--rd-surface, #fff);
    border: 1px solid var(--rd-border, #e2e8f0);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,.04);
}
.results-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.result-item {
    background: #f6f7fb;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: transform .2s, box-shadow .2s;
}
.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.result-label { font-size: 12px; color: #64748b; font-weight: 500; margin-bottom: 4px; }
.result-value { font-size: 22px; font-weight: 800; line-height: 1.2; }
.result-value.positive { color: #059669; }
.result-value.negative { color: #ef4444; }
.result-value.neutral { color: #5c94eb; }

/* ── Breakdown ── */
.breakdown-title {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.breakdown-table { width: 100%; border-collapse: collapse; }
.breakdown-table td { padding: 8px 0; font-size: 14px; border-bottom: 1px solid #e2e8f0; }
.breakdown-table tr:last-child td { border-bottom: none; }
.breakdown-table .bt-label { color: #64748b; }
.breakdown-table .bt-value { text-align: right; font-weight: 600; }
.breakdown-table .bt-bar { width: 100px; padding-left: 16px; }
.bar-track { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; transition: width .6s ease; }
.bar-fill.blue { background: #5c94eb; }
.bar-fill.red { background: #ef4444; }
.bar-fill.orange { background: #fa943d; }
.bar-fill.green { background: #059669; }

/* ── Indicator ── */
.margin-indicator {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
}
.margin-indicator.good { background: rgba(5,150,105,.08); color: #059669; border: 1px solid rgba(5,150,105,.15); }
.margin-indicator.warning { background: rgba(250,148,61,.08); color: #d97706; border: 1px solid rgba(250,148,61,.15); }
.margin-indicator.bad { background: rgba(239,68,68,.08); color: #ef4444; border: 1px solid rgba(239,68,68,.15); }
.margin-indicator svg { flex-shrink: 0; }

/* ── Reset button ── */
.reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s;
}
.reset-btn:hover { border-color: #ef4444; color: #ef4444; }

/* ── CTA Promo Banner ── */
.promo-banner {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 16px;
    padding: 32px;
    display: flex;
    align-items: center;
    gap: 32px;
    overflow: hidden;
    position: relative;
}
.promo-banner::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(92,148,235,.12);
}
.promo-banner::after {
    content: '';
    position: absolute;
    bottom: -60px; left: 30%;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: rgba(250,148,61,.08);
}
.promo-content { flex: 1; position: relative; z-index: 1; }
.promo-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.promo-logo .rd-logo-icon { width: 20px; height: 20px; }
.promo-logo .rd-logo-circle { width: 12px; height: 12px; }
.promo-logo-text {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.3px;
}
.promo-logo-text .rd-logo-dot { color: #fa943d; }
.promo-title {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.3;
}
.promo-desc {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.5;
    max-width: 480px;
}
.promo-features {
    display: flex;
    gap: 20px;
    margin-top: 16px;
}
.promo-feat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,.7);
}
.promo-feat svg { flex-shrink: 0; color: #059669; }
.promo-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.promo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.promo-btn-primary { background: #5c94eb; color: #fff; }
.promo-btn-primary:hover { background: #4a7fd4; transform: translateY(-1px); }
.promo-btn-ghost {
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.8);
    border: 1px solid rgba(255,255,255,.12);
}
.promo-btn-ghost:hover { background: rgba(255,255,255,.12); }

/* ── Powered badge ── */
.powered-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 0;
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: .3px;
}
.powered-badge .rd-logo-icon { width: 14px; height: 14px; }
.powered-badge .rd-logo-circle { width: 8px; height: 8px; }
.powered-brand {
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
}
.powered-brand:hover { color: #5c94eb; }

/* ── Footer ── */
.calc-footer {
    text-align: center;
    padding: 32px 24px;
    color: #64748b;
    font-size: 13px;
}
.calc-footer a {
    color: #5c94eb;
    text-decoration: none;
    font-weight: 600;
}
.calc-footer a:hover { text-decoration: underline; }
.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
}
.footer-links a {
    font-size: 12px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
}
.footer-links a:hover { color: #5c94eb; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .calc-nav { padding: 0 10px; height: 48px; }
    .calc-nav .rd-brand { font-size: 17px; gap: 6px; }
    .nav-link { display: none; }
    .nav-right { gap: 6px; }
    .nav-btn { padding: 5px 10px; font-size: 11px; border-radius: 6px; }

    .calc-header { padding: 32px 16px 44px; }
    .calc-header h1 { font-size: 22px; }
    .calc-header p { font-size: 13px; }
    .calc-badge { font-size: 12px; padding: 5px 14px; }

    .calc-wrap { margin: -28px auto 32px; padding: 0 10px; }
    .calc-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

    .calc-card { padding: 14px 12px; border-radius: 12px; }
    .calc-card-title { font-size: 13px; margin-bottom: 10px; gap: 6px; }
    .calc-card-title .icon { width: 24px; height: 24px; border-radius: 6px; }
    .calc-card-title .icon svg { width: 14px; height: 14px; }

    .field { margin-bottom: 8px; }
    .field label { font-size: 11px; margin-bottom: 3px; }
    .field label .hint { font-size: 9px; }
    .input-wrap input { padding: 7px 10px; font-size: 13px; border-radius: 7px; }
    .input-wrap .suffix { font-size: 11px; right: 8px; }
    .input-wrap input.has-suffix { padding-right: 30px; }
    select.calc-select { padding: 7px 10px; font-size: 12px; border-radius: 7px; }
    .field-row { flex-direction: column; gap: 8px; }

    .results-card { padding: 16px 14px; border-radius: 14px; }
    .results-title { font-size: 14px; margin-bottom: 12px; }
    .result-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
    .result-item { padding: 10px 8px; border-radius: 8px; }
    .result-label { font-size: 10px; margin-bottom: 2px; }
    .result-value { font-size: 16px; }

    .breakdown-title { font-size: 12px; margin-bottom: 8px; }
    .breakdown-table td { padding: 5px 0; font-size: 12px; }
    .breakdown-table .bt-bar { display: none; }

    .margin-indicator { padding: 10px 14px; font-size: 12px; border-radius: 8px; gap: 8px; margin-top: 14px; }

    .reset-btn { font-size: 12px; padding: 7px 14px; }

    .promo-banner { flex-direction: column; gap: 16px; padding: 20px 16px; border-radius: 14px; }
    .promo-title { font-size: 18px; }
    .promo-desc { font-size: 13px; }
    .promo-features { flex-wrap: wrap; gap: 10px; }
    .promo-feat { font-size: 11px; }
    .promo-actions { width: 100%; gap: 8px; }
    .promo-btn { width: 100%; justify-content: center; padding: 10px 20px; font-size: 13px; }

    .powered-badge { font-size: 10px; padding: 8px 0; }

    .calc-footer { padding: 24px 16px; font-size: 12px; }
    .footer-links { flex-wrap: wrap; gap: 12px; margin-top: 8px; }
    .footer-links a { font-size: 11px; }
}
@media (max-width: 400px) {
    .result-grid { grid-template-columns: 1fr; gap: 8px; }
    .result-value { font-size: 20px; }
    .calc-header h1 { font-size: 20px; }
    .promo-title { font-size: 16px; }
}
