/* ── Design tokens ────────────────────────────────────────────────────── */
:root {
    --green-deep: #1b4d3e;
    --green-mid: #2d7a5e;
    --green-light: #d4edda;
    --cream: #fafaf7;
    --sand: #f3ede3;
    --white: #ffffff;
    --ink: #1a1a1a;
    --muted: #6b7280;
    --border: #e2e8e4;
    --gold: #c4943a;
    --red: #dc3545;

    --font-serif: "Lora", Georgia, serif;
    --font-sans: "DM Sans", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", monospace;

    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow: 0 2px 12px rgba(27, 77, 62, 0.08);
    --shadow-md: 0 4px 24px rgba(27, 77, 62, 0.12);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--cream);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 15px;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ── Navigation ───────────────────────────────────────────────────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--green-deep);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
}

.logo-icon {
    font-size: 22px;
}

.logo-text {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: var(--white);
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    line-height: 1.4;
}

.btn-primary {
    background: var(--green-deep);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--green-mid);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--green-deep);
    color: var(--green-deep);
}
.btn-outline:hover {
    background: var(--green-light);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}
.btn-ghost:hover {
    background: var(--border);
    color: var(--ink);
}

.btn-danger {
    background: var(--red);
    color: var(--white);
}
.btn-danger:hover {
    background: #b02a37;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
}

.btn-nav {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}
.btn-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ── Layout ───────────────────────────────────────────────────────────── */
.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
    margin-bottom: 6px;
}

.page-subtitle {
    color: var(--muted);
    font-size: 15px;
}

/* ── Browse layout ────────────────────────────────────────────────────── */
.browse-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 768px) {
    .browse-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Sidebar tags ─────────────────────────────────────────────────────── */
.sidebar-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: sticky;
    top: 80px;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 14px;
}

.tag-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tag-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--ink);
    transition: all 0.12s;
    width: 100%;
    text-align: left;
}

.tag-btn:hover {
    background: var(--green-light);
}

.tag-btn.active {
    background: var(--green-deep);
    color: var(--white);
}

.tag-count {
    font-size: 11px;
    background: var(--green-light);
    color: var(--green-deep);
    padding: 1px 7px;
    border-radius: 99px;
    font-weight: 600;
}

.tag-btn.active .tag-count {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

/* ── Search bar ───────────────────────────────────────────────────────── */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 24px;
    transition: border-color 0.15s;
}

.search-bar:focus-within {
    border-color: var(--green-mid);
}

.search-bar input {
    border: none;
    outline: none;
    font-family: var(--font-sans);
    font-size: 15px;
    color: var(--ink);
    background: none;
    flex: 1;
}

.search-icon {
    color: var(--muted);
    font-size: 16px;
}

/* ── Recipe grid ──────────────────────────────────────────────────────── */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ── Recipe card ──────────────────────────────────────────────────────── */
.recipe-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition:
        transform 0.15s,
        box-shadow 0.15s;
    box-shadow: var(--shadow);
    position: relative;
}

.recipe-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.card-accent {
    height: 5px;
    background: linear-gradient(90deg, var(--green-deep), var(--green-mid));
}

.card-body {
    padding: 18px 20px 20px;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 12px;
}

.card-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 8px;
    color: var(--ink);
}

.card-desc {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-bottom: 14px;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-chip {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 99px;
    background: var(--green-light);
    color: var(--green-deep);
    cursor: pointer;
}

.tag-chip:hover {
    background: var(--green-deep);
    color: var(--white);
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-author {
    font-size: 12px;
    color: var(--muted);
}

.time-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
    background: var(--sand);
    padding: 3px 10px;
    border-radius: 99px;
}

/* ── Recipe detail ────────────────────────────────────────────────────── */
.recipe-detail {
    max-width: 820px;
    margin: 0 auto;
}

.recipe-detail-header {
    margin-bottom: 32px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 20px;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font-family: var(--font-sans);
    transition: color 0.12s;
}

.back-btn:hover {
    color: var(--ink);
}

.recipe-title {
    font-family: var(--font-serif);
    font-size: 38px;
    font-weight: 600;
    line-height: 1.15;
    margin-bottom: 12px;
}

.recipe-desc {
    font-size: 16px;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 20px;
    font-style: italic;
}

.recipe-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 14px;
}

.stat-label {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stat-value {
    font-weight: 600;
}

.recipe-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 32px;
}

.recipe-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
}

@media (max-width: 640px) {
    .recipe-content {
        grid-template-columns: 1fr;
    }
    .recipe-title {
        font-size: 28px;
    }
}

/* ── Recipe image ─────────────────────────────────────────────────────── */
.recipe-image-card {
    margin-bottom: 24px;
    border-radius: var(--radius);
    overflow: hidden;
}

.recipe-hero-image {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* ── Ingredients ──────────────────────────────────────────────────────── */
.ingredients-card {
    background: var(--sand);
    border-radius: var(--radius);
    padding: 24px;
    position: sticky;
    top: 80px;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--ink);
}

.ingredient-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ingredient-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 14px;
}

.ingredient-amount {
    font-weight: 600;
    color: var(--green-deep);
    white-space: nowrap;
}
.ingredient-name {
    color: var(--ink);
}
.ingredient-notes {
    color: var(--muted);
    font-size: 12px;
    font-style: italic;
}

/* ── Steps ────────────────────────────────────────────────────────────── */
.steps-section {
}

.step-item {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
}

.step-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: var(--green-deep);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    margin-top: 2px;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 5px;
}

.step-text {
    font-size: 14px;
    color: #374151;
    line-height: 1.65;
}

.step-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--green-mid);
    background: var(--green-light);
    padding: 3px 10px;
    border-radius: 99px;
}

.step-image-container {
    margin-top: 12px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-width: 600px;
}

.step-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* ── TOML source view ─────────────────────────────────────────────────── */
.toml-source {
    background: #1a2420;
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 32px;
}

.toml-source-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.toml-source-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font-mono);
}

.toml-source pre {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #a8d8a8;
    overflow-x: auto;
    line-height: 1.6;
}

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-section {
    max-width: 680px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 480px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.field-row {
    display: flex;
    gap: 16px;
}
.field-row .field {
    flex: 1;
}

label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--ink);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green-mid);
}

textarea {
    resize: vertical;
    line-height: 1.6;
}

.hint {
    font-size: 12px;
    color: var(--muted);
}

.error-msg {
    color: var(--red);
    font-size: 13px;
    padding: 10px 14px;
    background: #fff5f5;
    border: 1px solid #fcc;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

/* ── Ingredient / Step builder ────────────────────────────────────────── */
.builder-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.builder-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

.builder-row input {
    border: none;
    padding: 0;
    background: none;
}
.builder-row input:focus {
    outline: none;
    border: none;
}

.builder-row .rm-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.12s;
}
.builder-row .rm-btn:hover {
    color: var(--red);
}

/* Step builder */
.step-builder-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    position: relative;
}

.step-builder-num {
    font-size: 11px;
    font-weight: 600;
    color: var(--green-deep);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

/* Tags input ─────────────────────────────────────────────────────────── */
.tags-input-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: text;
    min-height: 44px;
    transition: border-color 0.15s;
}

.tags-input-wrap:focus-within {
    border-color: var(--green-mid);
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--green-light);
    color: var(--green-deep);
    padding: 2px 8px 2px 10px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 500;
}

.tag-pill button {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--green-deep);
    font-size: 14px;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}
.tag-pill button:hover {
    opacity: 1;
}

.tags-text-input {
    border: none !important;
    outline: none !important;
    padding: 0 !important;
    background: none !important;
    min-width: 80px;
    font-size: 14px;
    flex: 1;
}

/* ── TOML editor ──────────────────────────────────────────────────────── */
.toml-editor {
    font-family: var(--font-mono);
    font-size: 13px;
    background: #1a2420;
    color: #a8d8a8;
    border: 1px solid #2d4438;
    border-radius: var(--radius-sm);
    padding: 16px;
    min-height: 320px;
    width: 100%;
    resize: vertical;
    outline: none;
    line-height: 1.6;
}

.toml-editor:focus {
    border-color: var(--green-mid);
}

/* ── Upload zone ──────────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--green-light);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--white);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--green-mid);
    background: var(--green-light);
}

.upload-icon {
    font-size: 36px;
    margin-bottom: 10px;
}
.upload-text {
    font-size: 15px;
    color: var(--ink);
    margin-bottom: 4px;
}
.upload-hint {
    font-size: 13px;
    color: var(--muted);
}

/* ── Dashboard ────────────────────────────────────────────────────────── */
.dashboard-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 32px;
}

@media (max-width: 768px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

.dashboard-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    text-align: left;
    transition: all 0.12s;
}

.dash-nav-btn:hover {
    background: var(--green-light);
    color: var(--ink);
}
.dash-nav-btn.active {
    background: var(--green-light);
    color: var(--green-deep);
}

.dash-content {
    min-height: 60vh;
}

/* ── My recipes table ─────────────────────────────────────────────────── */
.recipe-table {
    width: 100%;
    border-collapse: collapse;
}

.recipe-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.recipe-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

.recipe-table tr:hover td {
    background: var(--sand);
}

.recipe-table .recipe-name-cell {
    font-weight: 500;
}

.recipe-table .actions-cell {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* ── Auth pages ───────────────────────────────────────────────────────── */
.auth-page {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}

.auth-logo {
    text-align: center;
    font-size: 36px;
    margin-bottom: 8px;
}

.auth-title {
    font-family: var(--font-serif);
    font-size: 26px;
    text-align: center;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--muted);
    font-size: 14px;
    text-align: center;
    margin-bottom: 28px;
}

.auth-switch {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

.auth-switch a {
    color: var(--green-deep);
    font-weight: 500;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--muted);
    font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}
.btn-secondary:hover {
    background: var(--border);
}

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

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}
.empty-title {
    font-family: var(--font-serif);
    font-size: 20px;
    color: var(--ink);
    margin-bottom: 8px;
}
.empty-desc {
    font-size: 14px;
    margin-bottom: 24px;
}

/* ── Tab switcher ─────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    gap: 0;
}

.tab-btn {
    padding: 10px 18px;
    border: none;
    background: none;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.tab-btn:hover {
    color: var(--ink);
}
.tab-btn.active {
    color: var(--green-deep);
    border-bottom-color: var(--green-deep);
}

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.2s ease;
    cursor: pointer;
}

.toast-success {
    background: var(--green-deep);
    color: var(--white);
}
.toast-error {
    background: var(--red);
    color: var(--white);
}
.toast-info {
    background: var(--ink);
    color: var(--white);
}

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

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-title {
    font-family: var(--font-serif);
    font-size: 22px;
    margin-bottom: 10px;
}

.modal-body {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Loading ──────────────────────────────────────────────────────────── */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 30vh;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--green-deep);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Difficulty badge ─────────────────────────────────────────────────── */
.diff-easy {
    color: #16a34a;
}
.diff-medium {
    color: var(--gold);
}
.diff-hard {
    color: var(--red);
}

/* ── Divider ──────────────────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

/* ── Hero (browse top) ────────────────────────────────────────────────── */
.browse-hero {
    background: linear-gradient(135deg, var(--green-deep) 0%, #2d5e4a 100%);
    border-radius: var(--radius-lg);
    padding: 40px 48px;
    margin-bottom: 32px;
    color: var(--white);
    position: relative;
    overflow: hidden;
}

.browse-hero::before {
    content: "🌿";
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 96px;
    opacity: 0.12;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: 30px;
    font-weight: 600;
    margin-bottom: 8px;
}

.hero-sub {
    opacity: 0.8;
    font-size: 16px;
    max-width: 720px;
}

.hero-note {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.86);
    max-width: 760px;
}

.visibility-legend {
    display: grid;
    gap: 8px;
}

.visibility-legend-item {
    font-size: 13px;
    color: var(--muted);
}

/* ── Variant selector ─────────────────────────────────────────────────── */
.variant-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 16px 0 4px;
}

.variant-btn {
    padding: 6px 16px;
    border-radius: 99px;
    border: 1.5px solid var(--border);
    background: var(--white);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.12s;
}

.variant-btn:hover {
    border-color: var(--green-mid);
    color: var(--green-deep);
}

.variant-btn.active {
    background: var(--green-deep);
    border-color: var(--green-deep);
    color: var(--white);
}

.variant-notes {
    font-size: 13px;
    color: var(--muted);
    font-style: italic;
    margin: 0 0 8px;
    min-height: 0;
}

/* ── Tested badge ─────────────────────────────────────────────────────── */
.tested-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: 0.03em;
}

.tested-badge-lg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #dcfce7;
    color: #15803d;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 99px;
}

/* ── Card rating stars ────────────────────────────────────────────────── */
.card-rating {
    font-size: 13px;
    color: var(--gold);
    margin-bottom: 8px;
}

.recipe-avg-rating {
    font-size: 16px;
    color: var(--gold);
    margin-bottom: 16px;
}

/* ── Recipe source link ───────────────────────────────────────────────── */
.recipe-source {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 16px;
}
.recipe-source a {
    color: var(--green-mid);
    text-decoration: underline;
    word-break: break-all;
}

/* ── Batch selector ───────────────────────────────────────────────────── */
.batch-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.batch-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.batch-btn-group {
    display: flex;
    gap: 4px;
}

.batch-btn {
    padding: 5px 14px;
    border-radius: 99px;
    border: 1.5px solid var(--border);
    background: var(--white);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.12s;
}

.batch-btn:hover {
    border-color: var(--green-mid);
    color: var(--green-deep);
}
.batch-btn.active {
    background: var(--green-deep);
    border-color: var(--green-deep);
    color: var(--white);
}

/* ── Ingredients / Nutrition tab toggle ───────────────────────────────── */
.ing-tab-header {
    display: flex;
    border-bottom: 1.5px solid var(--border);
    margin: -24px -24px 16px;
    padding: 0 8px;
}

.ing-tab {
    flex: 1;
    padding: 10px 12px;
    border: none;
    background: none;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1.5px;
    transition:
        color 0.12s,
        border-color 0.12s;
}

.ing-tab:hover {
    color: var(--ink);
}
.ing-tab.active {
    color: var(--green-deep);
    border-bottom-color: var(--green-deep);
}

.nutrition-per-serving {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 8px;
}

/* ── Nutrition table ──────────────────────────────────────────────────── */
.nutrition-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.nutrition-table tr {
    border-bottom: 1px solid var(--border);
}
.nutrition-table tr:last-child {
    border-bottom: none;
}

.nutrition-label {
    padding: 6px 0;
    color: var(--muted);
}

.nutrition-value {
    padding: 6px 0;
    text-align: right;
    font-weight: 600;
    color: var(--ink);
}

/* ── Restaurant comparisons ───────────────────────────────────────────── */
.restaurant-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.restaurant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.restaurant-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.restaurant-img-wrap {
    aspect-ratio: 16/9;
    overflow: hidden;
}
.restaurant-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.restaurant-body {
    padding: 16px;
}

.restaurant-name {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.restaurant-location {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
}

.restaurant-ratings {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.restaurant-rating-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.restaurant-rating-label {
    color: var(--muted);
    width: 44px;
    flex-shrink: 0;
}

.restaurant-stars {
    color: var(--gold);
    letter-spacing: 1px;
}

.restaurant-review {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
    font-style: italic;
    margin-top: 8px;
}

/* ── Ratings section ──────────────────────────────────────────────────── */
.ratings-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.rating-form-card {
    background: var(--sand);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.rating-form-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
}

.star-picker {
    display: flex;
    gap: 4px;
}

.star-pick {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--border);
    padding: 0;
    line-height: 1;
    transition:
        color 0.1s,
        transform 0.1s;
}

.star-pick:hover,
.star-pick.on {
    color: var(--gold);
}
.star-pick:hover {
    transform: scale(1.1);
}

.ratings-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
}

.rating-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.rating-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.rating-username {
    font-weight: 600;
    font-size: 14px;
}

.rating-stars {
    color: var(--gold);
    font-size: 14px;
    letter-spacing: 1px;
}

.rating-date {
    color: var(--muted);
    font-size: 12px;
    margin-left: auto;
}

/* ── Visibility ───────────────────────────────────────────────────────── */

.visibility-badge {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 99px;
    background: rgba(0, 0, 0, 0.06);
    line-height: 1;
}

.visibility-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 99px;
    margin-bottom: 10px;
}

.visibility-tag-public {
    background: #dcfce7;
    color: #166534;
}
.visibility-tag-logged_in {
    background: #e0edff;
    color: #1d4ed8;
}
.visibility-tag-group {
    background: #fef3c7;
    color: #92400e;
}
.visibility-tag-private {
    background: #fee2e2;
    color: #991b1b;
}

.rating-review-text {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
}

/* ── Restaurant recipes grid (on restaurant detail page) ── */
.restaurant-recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.restaurant-recipe-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.15s;
    background: var(--white);
}
.restaurant-recipe-card:hover {
    box-shadow: var(--shadow-md);
}
.restaurant-recipe-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}
.restaurant-recipe-body {
    padding: 12px;
}
.restaurant-recipe-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}
.restaurant-variant-block {
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}
.restaurant-variant-block:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}
.restaurant-variant-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--green-mid);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

/* ── Variant ratings section ── */
.variant-ratings-section {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    margin-top: 24px;
    margin-bottom: 32px;
}

/* ── Clickable restaurant cards on recipe detail ── */
.restaurant-card.clickable {
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.restaurant-card.clickable:hover {
    box-shadow: var(--shadow-md);
}

/* ── Chain badge ── */
.chain-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 99px;
    background: var(--green-light);
    color: var(--green-deep);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
