/* ═══════════════════════════════════════════════════════════
   Legati — Slate & Steel Theme
   Complete design system for dark + light themes
   ═══════════════════════════════════════════════════════════ */

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #10131a;
    --bg-secondary: #161b28;
    --surface: #1a1f2e;
    --surface-hover: #222840;
    --border: #2a3040;
    --text: #dce2ea;
    --text-muted: #7a8494;
    --primary: #5b8fb9;
    --primary-hover: #6da3cf;
    --secondary: #4a7a9e;
    --accent: #8badc4;
    --success: #4a9a6a;
    --success-hover: #3e8a5c;
    --danger: #c45555;
    --danger-hover: #b04444;
    --warning: #c4a24e;
    --info: #5b8fb9;
    --bg-input: rgba(16,19,26,0.6);
    --radius: 10px;
    --shadow-color: rgba(0,0,0,0.35);
    --glow-color: rgba(91,143,185,0.12);
}

[data-theme="light"] {
    --bg: #f4f6f9;
    --bg-secondary: #eaecf2;
    --surface: #ffffff;
    --surface-hover: #f0f2f8;
    --border: #d0d4de;
    --text: #1a2030;
    --text-muted: #5a6478;
    --primary: #3d7299;
    --primary-hover: #4a85b0;
    --secondary: #2e6080;
    --accent: #5590b5;
    --success: #3a8a5a;
    --danger: #a84444;
    --warning: #a88a30;
    --info: #3d7299;
    --bg-input: #ffffff;
    --shadow-color: rgba(0,0,0,0.08);
    --glow-color: rgba(61,114,153,0.10);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(180deg, #10131a 0%, #0c0e14 100%) fixed var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    flex-direction: column;
}

[data-theme="light"] body {
    background: linear-gradient(180deg, #f4f6f9 0%, #e8eaf0 100%) fixed var(--bg);
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; color: var(--primary-hover); }

.container { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; width: 100%; }

/* ─── Navbar ─── */
.navbar {
    background: linear-gradient(180deg, rgba(26,31,46,0.97) 0%, rgba(26,31,46,0.90) 100%);
    border-bottom: 1px solid rgba(42,48,64,0.5);
    padding: 0.75rem 0;
    padding-top: max(0.75rem, env(safe-area-inset-top));
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}

[data-theme="light"] .navbar {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,246,249,0.95) 100%);
    border-bottom: 1px solid rgba(208,212,222,0.8);
    box-shadow: 0 4px 30px rgba(0,0,0,0.06);
}

.nav-inner { display: flex; align-items: center; justify-content: space-between; }

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}
.logo:hover { text-decoration: none; color: var(--primary); }
.logo-icon {
    height: 22px;
    width: auto;
}
.logo-text {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.nav-links { display: flex; gap: 1.25rem; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ─── Main ─── */
main {
    flex: 1;
    padding: 2rem 0;
}

/* ─── Cards ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px var(--shadow-color);
    transition: all 0.3s ease;
    position: relative;
}

.card:hover {
    border-color: rgba(91,143,185,0.3);
    box-shadow:
        0 12px 48px var(--glow-color),
        0 8px 32px var(--shadow-color);
}

[data-theme="light"] .card {
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
[data-theme="light"] .card:hover {
    box-shadow: 0 8px 32px rgba(61,114,153,0.10);
}

.auth-page { display: flex; justify-content: center; padding: 3rem 1.25rem; }
.auth-card { max-width: 420px; width: 100%; margin: 3rem auto; }
.auth-card h1 { margin-bottom: 1.25rem; font-size: 1.5rem; }
.auth-alt { margin-top: 1.25rem; text-align: center; font-size: 0.9rem; color: var(--text-muted); }
.checkbox-group { margin-top: 1rem; }
.checkbox-group label { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; }

/* ─── Forms ─── */
.form-group { margin-bottom: 1rem; min-width: 0; }
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

select,
input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="url"],
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

input[type="date"] { color-scheme: dark; font-family: inherit; min-width: 0; }
[data-theme="light"] input[type="date"] { color-scheme: light; }

select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91,143,185,0.2);
    background: rgba(16,19,26,0.8);
}

[data-theme="light"] select:focus,
[data-theme="light"] input:focus,
[data-theme="light"] textarea:focus {
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(61,114,153,0.12);
}

input[type="checkbox"] { width: auto; accent-color: var(--primary); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    gap: 0.5rem;
}

.btn:active { transform: scale(0.98); }

.btn-primary, a.btn-primary {
    background: linear-gradient(135deg, #2e5f82 0%, #3d7299 100%);
    color: #fff;
    box-shadow: 0 6px 25px rgba(74,144,196,0.55);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #2e5f82 0%, #3d7299 100%);
    box-shadow: 0 8px 30px rgba(74,144,196,0.65);
    text-decoration: none;
    transform: translateY(-2px);
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(42,48,64,0.8) 0%, rgba(26,31,46,0.8) 100%);
    color: #dce2ea;
    border: 1px solid rgba(91,143,185,0.2);
}
.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(91,143,185,0.15) 0%, rgba(139,173,196,0.15) 100%);
    text-decoration: none;
    border-color: rgba(91,143,185,0.4);
    color: var(--text);
}
[data-theme="light"] .btn-primary {
    background: linear-gradient(135deg, #2e5f82 0%, #3d7299 100%);
    color: #fff;
}
[data-theme="light"] .btn-secondary {
    background: linear-gradient(135deg, #eaecf2 0%, #d0d4de 100%);
    color: #3a4050;
    border: 1px solid #c0c4ce;
}
[data-theme="light"] .btn-secondary:hover {
    background: linear-gradient(135deg, #dde0e8 0%, #d0d4de 100%);
    color: #1a2030;
    border-color: rgba(61,114,153,0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-hover) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(196,85,85,0.35);
}
.btn-danger:hover {
    box-shadow: 0 6px 25px rgba(196,85,85,0.5);
    text-decoration: none;
    transform: translateY(-2px);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-hover) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(74,154,106,0.35);
}
.btn-success:hover {
    box-shadow: 0 6px 25px rgba(74,154,106,0.5);
    text-decoration: none;
    transform: translateY(-2px);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--text);
    text-decoration: none;
}

.btn-accent {
    background: linear-gradient(135deg, var(--primary) 0%, #4a7a9e 100%);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(91,143,185,0.4);
}
.btn-accent:hover {
    box-shadow: 0 6px 25px rgba(91,143,185,0.6);
    text-decoration: none;
    transform: translateY(-2px);
    color: #fff;
}

.btn-info {
    background: linear-gradient(135deg, var(--info) 0%, #4a7a9e 100%);
    color: #fff;
    border: none;
}
.btn-info:hover { opacity: 0.9; text-decoration: none; color: #fff; }

.btn-block { width: 100%; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }

/* ─── Alerts ─── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-left: 4px solid;
    animation: slideDown 0.3s ease;
}

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

.alert-error {
    background: linear-gradient(135deg, rgba(196,85,85,0.15) 0%, rgba(176,68,68,0.1) 100%);
    color: #e8a0a0;
    border: 1px solid rgba(196,85,85,0.3);
    border-left: 4px solid var(--danger);
}
[data-theme="light"] .alert-error {
    background: linear-gradient(135deg, rgba(196,85,85,0.1) 0%, rgba(176,68,68,0.06) 100%);
    color: #8a3030;
}

.alert-success {
    background: linear-gradient(135deg, rgba(74,154,106,0.18) 0%, rgba(62,138,92,0.12) 100%);
    color: #8ece8e;
    border: 1px solid rgba(74,154,106,0.4);
    border-left: 4px solid var(--success);
}
[data-theme="light"] .alert-success {
    background: linear-gradient(135deg, rgba(74,154,106,0.12) 0%, rgba(62,138,92,0.08) 100%);
    color: #2a6a3a;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(196,162,78,0.18) 0%, rgba(170,140,60,0.12) 100%);
    color: #dcc06e;
    border: 1px solid rgba(196,162,78,0.4);
    border-left: 4px solid var(--warning);
}
[data-theme="light"] .alert-warning {
    background: linear-gradient(135deg, rgba(196,162,78,0.12) 0%, rgba(170,140,60,0.08) 100%);
    color: #6a5a20;
}

.alert-info {
    background: linear-gradient(135deg, rgba(91,143,185,0.15) 0%, rgba(74,122,158,0.1) 100%);
    color: #8cb8d8;
    border: 1px solid rgba(91,143,185,0.3);
    border-left: 4px solid var(--info);
}
[data-theme="light"] .alert-info {
    background: linear-gradient(135deg, rgba(61,114,153,0.1) 0%, rgba(61,114,153,0.06) 100%);
    color: #2a5a7a;
}

/* ─── Dashboard ─── */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.dashboard-header h1 { font-size: 1.5rem; }

.storage-info {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: rgba(42,48,64,0.6);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(91,143,185,0.4);
}

/* ─── Upload ─── */
.upload-card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }

.upload-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

input[type="file"] {
    flex: 1;
    min-width: 200px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    margin-right: 0.75rem;
    font-size: 0.85rem;
}

/* ─── Notepad ─── */
.notepad-card h2 { font-size: 1.1rem; }

.notepad-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.notepad-status {
    font-size: 0.8rem;
    color: var(--success);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.notepad-textarea {
    width: 100%;
    min-height: 160px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    transition: all 0.3s ease;
}

.notepad-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91,143,185,0.2);
}

.notepad-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
}

/* ─── Files Table ─── */
.files-card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.files-table-wrapper { overflow-x: auto; }

.files-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.files-table th {
    text-align: left;
    padding: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: rgba(16,19,26,0.5);
}
[data-theme="light"] .files-table th {
    background: rgba(208,212,222,0.3);
}

.files-table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(42,48,64,0.3);
    vertical-align: middle;
}

.files-table tbody tr { transition: all 0.2s ease; }
.files-table tbody tr:hover {
    background: rgba(91,143,185,0.08);
    border-bottom-color: rgba(91,143,185,0.2);
}

.file-name {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size { white-space: nowrap; color: var(--text-muted); }
.actions { white-space: nowrap; display: flex; gap: 0.4rem; }

/* ─── Badges ─── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-pending {
    background: rgba(196,162,78,0.15);
    color: var(--warning);
    border: 1px solid rgba(196,162,78,0.3);
}

.badge-uploaded {
    background: rgba(91,143,185,0.15);
    color: var(--primary-hover);
    border: 1px solid rgba(91,143,185,0.3);
}

.badge-vaulted {
    background: rgba(74,154,106,0.2);
    color: var(--success);
    border: 1px solid rgba(74,154,106,0.4);
}

.badge-active {
    background: rgba(74,154,106,0.15);
    color: #8ece8e;
    border: 1px solid rgba(74,154,106,0.3);
}
[data-theme="light"] .badge-active { color: var(--success); }

.badge-inactive {
    background: rgba(196,85,85,0.15);
    color: #e8a0a0;
    border: 1px solid rgba(196,85,85,0.3);
}
[data-theme="light"] .badge-inactive { color: var(--danger); }

.badge-success {
    background: rgba(74,154,106,0.15);
    color: var(--success);
}
.badge-warning {
    background: rgba(196,162,78,0.15);
    color: var(--warning);
}
.badge-video {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.badge-popular {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ─── Subscribe / Plan Cards ─── */
.subscribe-card { max-width: 480px; text-align: center; }
.subscribe-card p { color: var(--text-muted); margin-bottom: 1.5rem; }

.plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.plan-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}
.plan-card:hover {
    border-color: rgba(91,143,185,0.4);
    transform: translateY(-4px);
    box-shadow: 0 12px 48px var(--glow-color);
}
.plan-card.featured {
    border: 2px solid var(--primary);
    transform: scale(1.02);
}
.plan-card.featured:hover {
    transform: scale(1.02) translateY(-4px);
}

.plan-card h2 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.plan-card .btn { margin-top: auto; }
.plan-price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    margin: 0.5rem 0;
}
.plan-price span { font-size: 0.9rem; font-weight: 400; color: var(--text-muted); }

.plan-features {
    list-style: none;
    margin: 1.25rem 0;
    text-align: left;
}
.plan-features li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.plan-features li::before {
    content: '\2713';
    color: var(--success);
    margin-right: 0.5rem;
    font-weight: 700;
}

/* ─── Footer ─── */
.footer {
    padding: 2rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: none;
    background: linear-gradient(180deg, transparent 0%, rgba(16,19,26,0.3) 100%);
    margin-top: auto;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--primary); }

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    text-align: left;
    max-width: 960px;
    margin: 0 auto 1.5rem;
    padding: 0 1.25rem;
}
.footer-grid h4 {
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.footer-grid ul { list-style: none; }
.footer-grid ul li { margin-bottom: 0.4rem; }
.footer-grid ul li a { font-size: 0.85rem; }

.compliance-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.compliance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─── Theme Toggle ─── */
.theme-toggle {
    background: linear-gradient(135deg, rgba(42,48,64,0.6) 0%, rgba(26,31,46,0.6) 100%);
    border: 1px solid rgba(91,143,185,0.2);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.5rem 0.7rem;
    line-height: 1;
    transition: all 0.3s ease;
}
.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--glow-color);
    transform: scale(1.05);
}
[data-theme="light"] .theme-toggle {
    background: linear-gradient(135deg, #eaecf2 0%, #d0d4de 100%);
    border-color: rgba(61,114,153,0.2);
}

/* ─── Cookie Banner ─── */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26,31,46,0.95);
    color: var(--text-muted);
    text-align: center;
    padding: 12px 20px;
    font-size: 0.85rem;
    z-index: 9999;
    backdrop-filter: blur(8px);
    transition: opacity 0.5s;
}
.cookie-btn {
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    border: none;
}
.cookie-btn-accept { background: var(--primary); color: #fff; }
.cookie-btn-decline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }

/* ─── Will Generator ─── */
.will-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 1.5rem 0 0.5rem;
}
.will-progress-step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
    flex-shrink: 0;
}
.will-progress-step.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.will-progress-step.completed {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.will-progress-line {
    width: 24px;
    height: 2px;
    background: var(--border);
    flex-shrink: 0;
}
.will-progress-line.completed { background: var(--success); }

.will-state-info {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1rem;
}
.will-state-info h3 { margin-bottom: 0.75rem; font-size: 1rem; }
.will-state-info p { margin-bottom: 0.35rem; font-size: 0.9rem; }

.will-dynamic-row {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.will-beneficiary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}
.will-bequest-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}
@media (max-width: 767px) {
    .will-beneficiary-grid,
    .will-bequest-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .will-beneficiary-grid > button,
    .will-bequest-grid > button {
        justify-self: end;
    }
}

.will-disclaimer {
    background: var(--surface);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.will-disclaimer strong { color: var(--warning); }

.will-review-section {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.will-review-section:last-of-type { border-bottom: none; }
.will-review-section h3 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--primary); }
.will-review-section p { margin-bottom: 0.25rem; font-size: 0.9rem; }

/* ─── Video Message ─── */
.video-message-card h2 { margin-bottom: 0.75rem; }
.video-player-wrapper video {
    width: 100%;
    max-height: 400px;
    border-radius: 8px;
    background: #000;
}

.video-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.video-overlay-inner {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}
.video-overlay-inner video {
    width: 100%;
    max-height: 60vh;
    border-radius: 10px;
    background: #000;
}
.video-overlay-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}
.video-record-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}
.video-record-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--danger);
    transform: translate(-50%, -50%);
    transition: border-radius 0.2s, width 0.2s, height 0.2s;
}
.video-record-btn.recording::after {
    border-radius: 4px;
    width: 20px;
    height: 20px;
    animation: video-pulse 1s infinite;
}

@keyframes video-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.video-timer {
    font-family: monospace;
    font-size: 1.25rem;
    color: #fff;
    min-width: 5ch;
    text-align: center;
}
.video-flip-btn, .video-cancel-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    font-size: 0.9rem;
}
.video-flip-btn:hover, .video-cancel-btn:hover { background: rgba(255,255,255,0.25); }

/* ─── Checklist ─── */
.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.checklist-item:last-child { border-bottom: none; }

.checklist-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 2px;
}
.checklist-icon.done {
    background: rgba(74,154,106,0.2);
    color: var(--success);
    border: 1px solid rgba(74,154,106,0.4);
}
.checklist-icon.pending {
    background: rgba(91,143,185,0.15);
    color: var(--primary);
    border: 1px solid rgba(91,143,185,0.3);
}
.checklist-icon.skipped {
    background: rgba(122,132,148,0.15);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.checklist-content h3 { font-size: 0.95rem; margin-bottom: 0.25rem; }
.checklist-content p { font-size: 0.85rem; color: var(--text-muted); }
.checklist-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* ─── Status Indicators ─── */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.status-online { background: var(--success); }
.status-offline { background: var(--danger); }

.status-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ─── Error Page ─── */
.error-page {
    text-align: center;
    padding: 4rem 1.25rem;
    max-width: 520px;
    margin: 0 auto;
}
.error-code {
    font-size: 8rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 50%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.04em;
    opacity: 0.9;
}
.error-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.75rem; }
.error-message { color: var(--text-muted); font-size: 1rem; line-height: 1.6; margin-bottom: 2rem; }
.error-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   HOME PAGE — Marketing Sections
   ═══════════════════════════════════════════════════════════ */

/* Hero */
.hero {
    padding: 5rem 0 4rem;
}
.hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}
.hero-text h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}
.hero-text h1 span {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-text p {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 2rem;
    max-width: 480px;
}
.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.hero-graphic {
    display: flex;
    justify-content: center;
    align-items: center;
}
.hero-graphic img {
    width: 260px;
    height: auto;
    filter: drop-shadow(0 20px 40px rgba(91,143,185,0.25));
    animation: heroFloat 6s ease-in-out infinite;
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* Trust Bar */
.trust-bar {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.trust-badges {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}
.trust-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.trust-badge-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(91,143,185,0.1);
    border: 1px solid rgba(91,143,185,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* Features Grid */
.features-section {
    padding: 5rem 0;
}
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}
.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.section-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}
.feature-card:hover {
    border-color: rgba(91,143,185,0.3);
    transform: translateY(-4px);
    box-shadow: 0 12px 36px var(--glow-color);
}
.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(91,143,185,0.15), rgba(139,173,196,0.1));
    border: 1px solid rgba(91,143,185,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
}
.feature-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

/* How It Works */
.how-section {
    padding: 5rem 0;
}
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    position: relative;
}
.step-card {
    text-align: center;
    padding: 1.5rem;
}
.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}
.step-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.step-card p { font-size: 0.9rem; color: var(--text-muted); }

/* Security Section */
.security-section {
    padding: 5rem 0;
}
.security-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}
.security-points { list-style: none; }
.security-points li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.security-points li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}

/* CTA Section */
.cta-section {
    padding: 5rem 0;
    text-align: center;
    background: linear-gradient(180deg, transparent, rgba(91,143,185,0.04));
    border-top: 1px solid var(--border);
}
.cta-section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.cta-section p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 2rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Profile Sections ─── */
.profile-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.profile-nav a {
    padding: 0.6rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    transition: all 0.2s;
}
.profile-nav a:hover {
    border-color: var(--primary);
    color: var(--text);
    text-decoration: none;
}

.profile-section {
    margin-bottom: 2rem;
    padding-top: 1rem;
}
.profile-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* ─── Delegate Cards ─── */
.delegate-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.delegate-card h3 { margin-bottom: 1rem; font-size: 1.1rem; }

/* ─── Help Page ─── */
.help-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.help-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}
.help-card:hover {
    border-color: rgba(91,143,185,0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--glow-color);
    text-decoration: none;
}
.help-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.help-card p { font-size: 0.85rem; color: var(--text-muted); }

/* ─── Secure Items ─── */
.secure-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.secure-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(16,19,26,0.3);
    cursor: pointer;
    transition: background 0.2s;
}
[data-theme="light"] .secure-section-header { background: rgba(208,212,222,0.2); }
.secure-section-header:hover { background: rgba(91,143,185,0.1); }
.secure-section-header h3 { font-size: 0.95rem; font-weight: 600; }
.secure-section-body {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

/* ─── Utility ─── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 1rem; }

/* Password visibility toggle */
.password-wrapper {
    position: relative;
}
.password-wrapper input { padding-right: 2.5rem; }
.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .hero-text h1 { font-size: 2.5rem; }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .plans-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .hero-inner { grid-template-columns: 1fr; text-align: center; }
    .hero-text p { margin-left: auto; margin-right: auto; }
    .hero-actions { justify-content: center; }
    .hero-graphic { order: -1; }
    .hero-graphic img { width: 180px; }
    .security-inner { grid-template-columns: 1fr; }
    .steps-grid { grid-template-columns: 1fr; gap: 1rem; }
    .help-cards { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .hero { padding: 3rem 0 2rem; }
    .hero-text h1 { font-size: 2rem; }
    .features-grid { grid-template-columns: 1fr; }
    .plans-grid { grid-template-columns: 1fr; max-width: 360px; margin-left: auto; margin-right: auto; }
    .plan-card.featured { transform: none; }
    .plan-card.featured:hover { transform: translateY(-4px); }
    .dashboard-header { flex-direction: column; align-items: flex-start; }
    .storage-info { text-align: left; }
    .progress-bar { width: 100%; }
    .files-table { font-size: 0.8rem; }
    .actions { flex-direction: column; }
    .btn-sm { width: 100%; }
    .checklist-btns .btn-sm { width: auto; }
    .grid-2 { grid-template-columns: 1fr; }
    .will-progress-step { width: 26px; height: 26px; font-size: 0.7rem; }
    .will-progress-line { width: 12px; }
    .video-record-btn { width: 52px; height: 52px; }
    .video-record-btn::after { width: 18px; height: 18px; }
    .video-timer { font-size: 1rem; }
    .video-overlay-controls { gap: 0.5rem; }
    .profile-nav { grid-template-columns: 1fr; }
    .trust-badges { gap: 1rem; }
    .footer-grid { grid-template-columns: 1fr; text-align: center; }
    .compliance-badges { gap: 0.5rem; }
    .section-header h2 { font-size: 1.5rem; }
    .error-code { font-size: 5rem; }
    .error-page { padding: 2rem 1rem; }
    .error-actions { flex-direction: column; }
    .error-actions .btn { width: 100%; }
    .nav-links { gap: 0.75rem; }
    .nav-links a { font-size: 0.8rem; }
}

/* ─── Form Row (responsive 2-col grid) ─── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
    min-width: 0;
}

/* ─── Hamburger Button ─── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text-muted);
    gap: 5px;
    flex-shrink: 0;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: all 0.25s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Mobile Menu ─── */
.mobile-menu {
    display: none;
    flex-direction: column;
    border-top: 1px solid var(--border);
    padding: 0.25rem 1.25rem 1rem;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
    display: flex;
    align-items: center;
    padding: 0 0;
    min-height: 52px;
    border-bottom: 1px solid rgba(42,48,64,0.4);
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover { color: var(--text); text-decoration: none; }
.mobile-menu-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    min-height: 52px;
}
[data-theme="light"] .mobile-menu { border-top-color: var(--border); }
[data-theme="light"] .mobile-menu a { border-bottom-color: rgba(208,212,222,0.6); }

/* ─── 768px: Hamburger active, hide desktop nav ─── */
@media (max-width: 767px) {
    .nav-about { display: none; }
    .nav-links { display: none !important; }
    .nav-toggle { display: flex; }
    .form-row { grid-template-columns: 1fr; }
    .btn-sm { min-height: 44px; padding: 0.6rem 1rem; width: 100%; justify-content: center; }
    .checklist-btns .btn-sm { min-height: 0; padding: 0.25rem 0.6rem; width: auto; font-size: 0.75rem; }
    /* Prevent iOS font-size zoom on input focus */
    input, select, textarea { font-size: 16px; }
    .form-group label { font-size: 0.875rem; }
}

/* ─── 480px: Small phones ─── */
@media (max-width: 480px) {
    .container { padding: 0 1rem; }
    .card { padding: 1.25rem; }
    .auth-card { margin: 1.5rem auto; }
    main { padding: 1.25rem 0; }
    .logo-text { font-size: 1rem; }
    .cookie-banner { flex-direction: column; align-items: flex-start; gap: 0.75rem; padding: 1rem; }
    .cookie-banner > span:last-child { margin-left: 0; width: 100%; }
    .cookie-btn { flex: 1; text-align: center; }
}

/* ─── App Mode (Capacitor) ─── */
body.is-app { -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
body.is-app input, body.is-app textarea, body.is-app [contenteditable] { -webkit-user-select: text; user-select: text; }
body.is-app .navbar { display: none; }
body.is-app .footer { display: none; }
body.is-app .cookie-banner { display: none !important; }
body.is-app main { padding-top: calc(env(safe-area-inset-top) + 0.75rem); }

/* App Tab Bar */
.app-tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
body.is-app .app-tab-bar { display: flex; }
.app-tab-bar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 500;
    padding: 4px 0;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.app-tab-bar a.active { color: #5b8fb9; }
.app-tab-bar a svg { width: 24px; height: 24px; stroke-width: 1.75; }
body.is-app main { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }

/* App top bar */
.app-top-bar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: env(safe-area-inset-top) 1rem 0.5rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
body.is-app .app-top-bar { display: block; position: relative; }
.app-top-bar .app-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e3a5f;
    margin: 0;
    padding: 0.5rem 0;
}
.app-menu-toggle {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    z-index: 102;
}
body.is-app .app-menu-toggle { top: calc(env(safe-area-inset-top) + 50%); transform: translateY(calc(-50% + env(safe-area-inset-top) / 2)); }
.app-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #1e3a5f;
    border-radius: 1px;
    transition: transform 0.3s, opacity 0.3s;
}
.app-menu-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.app-menu-toggle.open span:nth-child(2) { opacity: 0; }
.app-menu-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.app-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 101;
    padding: 0.75rem 0 0.5rem;
    text-align: left;
}
.app-menu.open { display: block; }
.app-menu a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: #1e3a5f;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.app-menu a:hover, .app-menu a:active { background: #f0f4f8; }
.app-menu-langs {
    display: flex;
    gap: 0.25rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 0.25rem;
}
.app-menu-langs button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    padding: 0.25rem;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

/* ─── Checklist layout ─── */
.checklist-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.checklist-btns {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}
.checklist-text {
    min-width: 0;
}

/* ─── 1. Touch feedback / Active states ─── */
body.is-app .btn,
body.is-app .app-tab-bar a,
body.is-app .app-menu a,
body.is-app .card {
    -webkit-tap-highlight-color: transparent;
}
body.is-app .btn:active { transform: scale(0.96); opacity: 0.85; }
body.is-app .app-tab-bar a:active { transform: scale(0.9); }
body.is-app .app-menu a:active { background: #e8edf2; }
body.is-app .app-more-menu a:active { background: #f0f4f8; }
body.is-app .card:active { transform: scale(0.99); }

/* ─── 2. Page transition ─── */
@keyframes appFadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
body.is-app main { animation: appFadeSlideIn 0.25s ease-out; }
body.is-app.app-navigating main { opacity: 0.4; transition: opacity 0.15s ease; }

/* ─── 3. Pull-to-refresh ─── */
.app-ptr {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 150;
    text-align: center;
    padding: calc(env(safe-area-inset-top) + 8px) 0 8px;
    pointer-events: none;
}
.app-ptr-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2.5px solid #e5e7eb;
    border-top-color: #5b8fb9;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}
.app-ptr-spinner.pulling { opacity: 1; }
.app-ptr-spinner.refreshing { opacity: 1; animation: appPtrSpin 0.7s linear infinite; }
@keyframes appPtrSpin { to { transform: rotate(360deg); } }
body.is-app .app-ptr { display: block; }

/* ─── 4. Offline banner ─── */
.app-offline-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: #ef4444;
    color: white;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    padding: calc(env(safe-area-inset-top) + 4px) 1rem 6px;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}
.app-offline-banner.visible { transform: translateY(0); }

/* ─── 5. Skeleton loading ─── */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 6px;
}
.skeleton-card {
    height: 80px;
    margin-bottom: 0.75rem;
    border-radius: 8px;
}
.skeleton-line {
    height: 14px;
    margin-bottom: 0.5rem;
    width: 70%;
}
.skeleton-line-short { width: 40%; }
.app-skeleton-wrap {
    display: none;
    padding: 1rem;
}
body.is-app.app-loading .app-skeleton-wrap { display: block; }
body.is-app.app-loading main > *:not(.app-skeleton-wrap) { display: none; }
