:root {
    --primary-blue: #1e5799;
    --primary-blue-dark: #153d66;
    --accent-gold: #c9a227;
    --off-white: #f8f9fa;
    --light-gray: #e9ecef;
    --text-dark: #212529;
    --text-muted: #6c757d;
    --white: #ffffff;
    --font-display: 'Playfair Display', serif;
    --font-body: 'Open Sans', sans-serif;
    --font-hebrew: 'Frank Ruhl Libre', serif;
    --radius: 8px;
}

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

body {
    font-family: var(--font-body);
    color: var(--text-dark);
    background: var(--off-white);
    line-height: 1.6;
}

a { color: var(--primary-blue); text-decoration: none; }
a:hover { color: var(--primary-blue-dark); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; }

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, var(--primary-blue-dark), var(--primary-blue));
}

.auth-card {
    background: var(--white);
    width: 100%;
    max-width: 420px;
    padding: 40px 32px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}

.auth-card img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin-bottom: 16px;
}

.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; color: var(--primary-blue); }
.auth-card .lede { color: var(--text-muted); margin-bottom: 24px; font-size: 0.95rem; }

.form-field { text-align: left; margin-bottom: 16px; }
.form-field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--light-gray);
    border-radius: var(--radius);
    font: inherit;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
    display: inline-block;
    border: 0;
    border-radius: var(--radius);
    padding: 10px 16px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    background: var(--light-gray);
    color: var(--text-dark);
}
.btn-primary { background: var(--primary-blue); color: #fff; }
.btn-primary:hover { background: var(--primary-blue-dark); }
.btn-ghost { background: transparent; }
.btn-full { width: 100%; padding: 12px; }
.btn-sm { font-size: 0.85rem; padding: 6px 10px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.error-msg { color: #b42318; background: #fef3f2; padding: 10px; border-radius: 6px; margin-bottom: 12px; font-size: 0.9rem; }
.success-msg { color: #166534; background: #f0fdf4; padding: 10px; border-radius: 6px; margin-bottom: 12px; font-size: 0.9rem; }
.muted { color: var(--text-muted); font-size: 0.9rem; }
.back-link { display: inline-block; margin-top: 16px; font-size: 0.9rem; }

.app-header {
    background: var(--white);
    border-bottom: 3px solid var(--accent-gold);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.app-header img { width: 44px; height: 44px; border-radius: 50%; }
.app-brand { display: flex; align-items: center; gap: 12px; }
.app-brand strong { font-family: var(--font-display); color: var(--primary-blue); }
.app-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.app-nav a, .app-nav button {
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-dark);
}
.app-nav a.active, .app-nav button.active { background: #e8f0f8; color: var(--primary-blue); font-weight: 600; }

.container { max-width: 960px; margin: 0 auto; padding: 28px 20px 64px; }
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.yahrzeit-soon { color: #92400e; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--white); padding: 16px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-family: var(--font-display); font-size: 1.6rem; color: var(--primary-blue); }

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--light-gray); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; background: #e8f0f8; color: var(--primary-blue); }
.hebrew { font-family: var(--font-hebrew); }

.view { display: none; }
.view.active { display: block; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20;
}
.modal { background: #fff; width: 100%; max-width: 520px; border-radius: 12px; padding: 24px; max-height: 90vh; overflow: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close { background: none; border: 0; font-size: 1.4rem; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.tag-check { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; font-size: 0.92rem; }
.empty { color: var(--text-muted); padding: 16px 0; }

@media (max-width: 700px) {
    .form-row { grid-template-columns: 1fr; }
    .app-header { flex-direction: column; align-items: flex-start; }
}
