:root {
    --bg: #ffffff;
    --bg-hover: #f7f6f3;
    --bg-secondary: #fbfbfa;
    --text: #37352f;
    --text-secondary: #787774;
    --text-muted: #b4b4b0;
    --border: #e8e8e8;
    --border-light: #f0f0ef;
    --accent: #2eaadc;
    --accent-hover: #2596be;
    --green: #4daa57;
    --green-bg: #dbeddb;
    --red: #e03e3e;
    --red-bg: #fde2e2;
    --orange: #d9730d;
    --orange-bg: #fdecc8;
    --blue: #2eaadc;
    --blue-bg: #d3e5ef;
    --radius: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Login Screen ────────────────────────── */
.login-screen {
    display: block;
    min-height: 100vh;
    background: var(--bg);
}

/* ── Landing Page ───────────────────────── */
.landing {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    padding: 80px 24px 60px;
}

.landing-hero {
    text-align: center;
    margin-bottom: 72px;
}

.landing-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    margin-bottom: 24px;
}

.landing-title {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--text);
    margin: 0 0 16px;
}

.landing-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 480px;
    margin: 0 auto 32px;
}

.landing-cta {
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    gap: 10px;
    border-radius: 8px;
}

.landing-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
}

.landing-section {
    margin-bottom: 64px;
}

.landing-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
    margin-bottom: 32px;
}

/* Steps */
.landing-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.landing-step {
    text-align: center;
}

.landing-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.landing-step h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px;
}

.landing-step p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Trust items */
.landing-trust {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.landing-trust-item {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-light);
}

.landing-trust-item:last-child {
    border-bottom: none;
}

.landing-trust-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--green-bg);
    color: var(--green);
}

.landing-trust-item h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 6px;
}

.landing-trust-item p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

/* Bottom CTA */
.landing-bottom-cta {
    text-align: center;
    padding: 48px 0;
    border-top: 1px solid var(--border-light);
    margin-bottom: 0;
}

.landing-bottom-cta h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
    margin: 0 0 12px;
}

.landing-bottom-cta p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0 0 28px;
}

.landing-bottom-cta a {
    color: var(--accent);
    text-decoration: none;
}

.landing-bottom-cta a:hover {
    text-decoration: underline;
}

/* ── Onboarding Slider (legacy, kept for reference) ── */
.onboarding-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 480px;
    width: 100%;
    overflow: hidden;
}

.onboarding-slides {
    position: relative;
    min-height: 340px;
}

.slide {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 40px 32px;
    animation: slide-in 0.3s ease;
}

.slide.active {
    display: flex;
}

@keyframes slide-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-icon {
    margin-bottom: 24px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.slide h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.slide-text {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
    max-width: 360px;
}

.slide-link {
    display: inline-block;
    margin-top: 16px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.slide-link:hover {
    color: var(--accent-hover);
}

.slide-points {
    text-align: left;
    margin: 4px 0;
    width: 100%;
    max-width: 340px;
}

.slide-point {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 6px 0;
    line-height: 1.5;
}

.point-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.point-dot.green { background: var(--green); }

/* ── Slider Navigation ─────────────────── */
.onboarding-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-light);
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-btn:hover { background: var(--bg-hover); }

.nav-btn:disabled {
    opacity: 0;
    pointer-events: none;
}

.nav-btn svg {
    width: 14px;
    height: 14px;
}

.slide-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.dot.active {
    background: var(--text);
    transform: scale(1.2);
}

.dot:hover {
    background: var(--text-muted);
}

/* Legacy login-card (kept for reference) */
.login-card {
    text-align: center;
    padding: 60px 48px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 400px;
    width: 100%;
}

.login-card h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-card .subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
}

/* ── Buttons ─────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--text);
    color: white;
    padding: 10px 24px;
}
.btn-primary:hover { background: #1a1a1a; }

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn svg {
    width: 18px;
    height: 18px;
}

/* ── Main Layout ─────────────────────────── */
.main-screen {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.header-left h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    color: var(--text-secondary);
    font-size: 13px;
}

.cache-badge {
    display: inline-block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Progress ────────────────────────────── */
.progress-section {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.progress-stages {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.stage-dot {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--border-light);
    transition: all 0.2s ease;
}

.stage-dot.active {
    background: var(--blue-bg);
    color: #2576a5;
}

.stage-dot.complete {
    background: var(--green-bg);
    color: #1e7e34;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
    animation: progress-pulse 2s ease-in-out infinite;
}

@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ── Summary Bar ─────────────────────────── */
.summary-bar {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.summary-item {
    text-align: center;
}

.summary-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.summary-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-item.clickable {
    cursor: pointer;
    border-radius: var(--radius);
    padding: 4px 10px;
    margin: -4px -10px;
    transition: background 0.15s;
}

.summary-item.clickable:hover {
    background: var(--bg-hover);
}

.summary-item.clickable .summary-label::after {
    content: ' ↗';
    font-size: 10px;
}

/* ── Premium Breakdown Modal ────────────── */
.premium-modal {
    max-width: 600px;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.premium-table thead th {
    text-align: left;
    padding: 12px 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.premium-table thead th:last-child {
    text-align: right;
}

.premium-table tbody td {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-light);
}

.premium-table .pb-name {
    font-weight: 500;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.premium-table .pb-calc {
    color: var(--text-secondary);
    font-size: 13px;
}

.premium-table .pb-amount {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.premium-table .premium-row-expired td {
    color: var(--text-muted);
    text-decoration: line-through;
}

.premium-table .premium-row-expired .pb-amount {
    text-decoration: none;
    font-weight: 400;
}

.premium-table tfoot td {
    padding: 14px 20px;
    font-weight: 700;
    font-size: 15px;
    border-top: 2px solid var(--border);
}

.premium-table tfoot .pb-amount {
    color: var(--accent);
}

/* ── Filters ─────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.filter-bar .export-btn {
    margin-left: auto;
}

.filter-chip {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-chip:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.filter-chip.active {
    background: var(--text);
    color: white;
    border-color: var(--text);
}

/* ── Policy Cards (Grid) ─────────────────── */
.policies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.policy-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-top: 3px solid var(--border);
    position: relative;
}

.policy-card:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.policy-card[data-type="health"] { border-top-color: var(--green); }
.policy-card[data-type="car"] { border-top-color: var(--blue); }
.policy-card[data-type="term_life"] { border-top-color: var(--orange); }

/* Hide/restore button on card hover */
.card-hide-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    color: var(--red);
    font-size: 18px;
    font-weight: 700;
    z-index: 1;
    background: var(--red-bg);
}
.policy-card:hover .card-hide-btn { opacity: 1; }
.card-hide-btn:hover { background: var(--red); color: #fff; }

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.type-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.type-icon.health { background: var(--green-bg); color: #1e7e34; }
.type-icon.car { background: var(--blue-bg); color: #2576a5; }
.type-icon.term_life { background: var(--orange-bg); color: #b35c08; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.badge-active { background: var(--green-bg); color: #1e7e34; }
.badge-expired { background: var(--red-bg); color: var(--red); }
.badge-unknown { background: var(--border-light); color: var(--text-secondary); }
.badge-locked { background: var(--orange-bg); color: var(--orange); }

/* Locked card */
.policy-card.locked {
    opacity: 0.85;
    border-style: dashed;
}
.card-locked-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--orange);
    margin-bottom: 8px;
}
.card-locked-detail {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 12px;
}
.modal-locked-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: var(--orange-bg);
    color: var(--orange);
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 12px;
}
.modal-locked-banner svg {
    flex-shrink: 0;
    margin-top: 1px;
}
.unlock-form {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.unlock-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.unlock-input-row {
    display: flex;
    gap: 8px;
}
.unlock-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
}
.unlock-input:focus {
    border-color: var(--accent);
}
.unlock-btn {
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.unlock-btn:hover { background: var(--accent-hover); }
.unlock-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.unlock-error {
    margin-top: 8px;
    font-size: 13px;
    color: var(--red);
}

.card-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    line-height: 1.3;
}

.card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.card-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 2px;
}

.card-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.card-stat-value.days-warning { color: var(--orange); }
.card-stat-value.days-danger { color: var(--red); }
.card-stat-value.days-ok { color: var(--green); }

.card-pn {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Modal ───────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fade-in 0.15s ease;
    padding: 24px;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg);
    border-radius: 10px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modal-in 0.2s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--bg);
    border-radius: 10px 10px 0 0;
    z-index: 1;
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-hover);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body {
    padding: 20px 24px 24px;
}

.modal-body .prop-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.modal-body .prop-row:last-child { border-bottom: none; }

.modal-body .prop-label {
    width: 140px;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.modal-body .prop-value {
    flex: 1;
    font-size: 14px;
    word-break: break-word;
}

.modal-body .prop-value.muted { color: var(--text-secondary); font-size: 13px; }
.modal-body .prop-value a { color: var(--blue); text-decoration: none; }
.modal-body .prop-value a:hover { text-decoration: underline; }

.tooltip-wrap { position: relative; }
.tooltip-text {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    background: var(--text);
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: var(--radius);
    width: 260px;
    z-index: 10;
    pointer-events: none;
}
.tooltip-wrap:hover .tooltip-text { display: block; }

/* ── Vault Key Modal ─────────────────────── */
.vault-key-modal {
    max-width: 440px;
}

.vk-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 14px;
}

.vk-warning {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--orange-bg);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
}

.vk-warning svg {
    flex-shrink: 0;
    margin-top: 1px;
    stroke: var(--orange);
}

.vk-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: var(--font);
    background: var(--bg);
    margin-bottom: 14px;
    outline: none;
}

.vk-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(46, 170, 220, 0.15);
}

.vk-submit {
    width: 100%;
    padding: 10px;
    font-size: 14px;
}

/* ── Empty State ─────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 16px;
}

/* ── Error Toast ─────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--red);
    color: white;
    border-radius: var(--radius);
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: toast-in 0.3s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Footer ──────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.site-footer a:hover {
    color: var(--text);
}

.footer-sep {
    color: var(--text-muted);
    margin: 0 4px;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 640px) {
    .header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .header-right { width: 100%; }
    .prop-label { width: 110px; }
    .summary-bar { flex-wrap: wrap; gap: 16px; }
    .main-screen { padding: 24px 16px 60px; }
    .onboarding-card { margin: 0 16px; }
    .slide { padding: 36px 24px 24px; }
    .onboarding-slides { min-height: 320px; }

    .landing { padding: 48px 20px 40px; }
    .landing-title { font-size: 32px; }
    .landing-subtitle { font-size: 16px; }
    .landing-steps { grid-template-columns: 1fr; gap: 32px; }
    .landing-step { text-align: left; display: flex; gap: 16px; align-items: flex-start; }
    .landing-step-icon { flex-shrink: 0; }
}

/* ── Mobile Menu (defaults) ──────────────── */
.mobile-menu-btn { display: none; }
.mobile-menu { display: none; }

/* ── Mobile (phones) ────────────────────── */
@media (max-width: 428px) {
    .main-screen { padding: 16px 12px 60px; }

    /* Header: overflow menu */
    .header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 20px; padding-bottom: 12px; }
    .header-left h1 { font-size: 26px; }
    .header-right { width: 100%; justify-content: flex-end; position: relative; }
    .header-right .user-name { display: none; }
    .header-actions { display: none; }
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        cursor: pointer;
    }
    .mobile-menu-btn:active { background: var(--bg-hover); }
    .mobile-menu {
        position: absolute;
        top: calc(100% + 4px);
        right: 0;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 8px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.08);
        min-width: 200px;
        z-index: 100;
        padding: 4px 0;
    }
    .mobile-menu.active { display: block; }
    .mobile-menu-item {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 12px 16px;
        border: none;
        background: none;
        font-family: var(--font);
        font-size: 14px;
        color: var(--text);
        cursor: pointer;
        text-align: left;
        min-height: 44px;
    }
    .mobile-menu-item:active { background: var(--bg-hover); }
    .mobile-menu-item svg { width: 16px; height: 16px; color: var(--text-secondary); flex-shrink: 0; }
    .mobile-menu-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

    /* Summary bar */
    .summary-bar { gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
    .summary-item { flex: 1; min-width: 70px; }
    .summary-value { font-size: 16px; }
    .summary-label { font-size: 10px; }

    /* Filter bar: horizontal scroll */
    .filter-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: 4px;
    }
    .filter-bar::-webkit-scrollbar { display: none; }
    .filter-chip { flex-shrink: 0; padding: 8px 16px; min-height: 36px; }
    .filter-bar .export-btn { flex-shrink: 0; }

    /* Progress dots */
    .progress-section { padding: 14px; }
    .progress-stages { gap: 6px; flex-wrap: wrap; }
    .stage-dot { font-size: 11px; padding: 3px 8px; }

    /* Policy cards */
    .policies-grid { gap: 12px; }
    .policy-card { padding: 16px; }
    .card-name { font-size: 14px; margin-bottom: 12px; }
    .card-stats { gap: 8px; }
    .card-stat-label { font-size: 10px; }
    .card-stat-value { font-size: 13px; }
    .card-pn { font-size: 11px; margin-top: 10px; padding-top: 8px; }
    .card-hide-btn { opacity: 0.7; width: 32px; height: 32px; font-size: 16px; }

    /* Modals → bottom sheets */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 12px 12px 0 0;
        animation: modal-slide-up 0.25s ease;
    }
    .vault-key-modal, .premium-modal { max-width: 100%; }
    @keyframes modal-slide-up {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .modal-header {
        padding: 16px;
        border-radius: 12px 12px 0 0;
        flex-direction: column;
        gap: 0;
        position: relative;
    }
    .modal-header::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin: 0 auto 12px;
        flex-shrink: 0;
    }
    .modal-header h2 { font-size: 16px; }
    .modal-close {
        position: absolute;
        right: 16px;
        top: 28px;
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    .modal-body { padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
    .modal-body .prop-label { width: 100px; font-size: 12px; }
    .modal-body .prop-value { font-size: 13px; }

    /* Premium table */
    .premium-table thead th { padding: 10px 8px; font-size: 10px; }
    .premium-table tbody td { padding: 8px 8px; font-size: 13px; }
    .premium-table .pb-name { max-width: 100px; font-size: 12px; }
    .premium-table .pb-calc { font-size: 11px; }
    .premium-table tfoot td { padding: 12px 8px; font-size: 13px; }

    /* Unlock form */
    .unlock-input-row { flex-direction: column; gap: 8px; }
    .unlock-btn { width: 100%; text-align: center; padding: 12px 16px; min-height: 44px; }
    .unlock-input { padding: 12px 10px; }

    /* Prevent iOS auto-zoom on input focus */
    input[type="text"], .unlock-input, .vk-input { font-size: 16px; }
    .vk-submit { min-height: 44px; }
    .vk-warning { font-size: 12px; padding: 10px 12px; }

    /* Toast: full width */
    .toast { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); text-align: center; }

    /* Landing page */
    .landing { padding: 32px 16px 32px; }
    .landing-title { font-size: 28px; }
    .landing-subtitle { font-size: 15px; }
    .landing-cta { width: 100%; justify-content: center; }
    .landing-hero { margin-bottom: 48px; }
    .landing-section { margin-bottom: 40px; }
    .landing-trust-item { gap: 12px; padding: 16px 0; }
    .landing-bottom-cta { padding: 32px 0; }
    .landing-bottom-cta h2 { font-size: 20px; }

    /* Footer */
    .site-footer { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }

    /* Touch feedback */
    .btn:active { transform: scale(0.97); }
    .policy-card:active { transform: scale(0.98); transition: transform 0.1s; }
    .filter-chip:active { transform: scale(0.95); }
}

/* Upload button spinner */
.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
