:root {
    --bg: #faf6f0;
    --surface: #ffffff;
    --surface-alt: #fbf3e7;
    --border: #ece1d2;
    --text: #2b2420;
    --text-muted: #8c7c68;
    --primary: #c1502e;
    --primary-dark: #9c3d21;
    --primary-light: #f3ded4;
    --accent: #d9a441;
    --danger: #c0392b;
    --danger-bg: #fbeae7;
    --success: #4d7c4a;
    --success-bg: #ecf3ea;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(43, 36, 28, 0.05), 0 1px 3px rgba(43, 36, 28, 0.04);
    --shadow-md: 0 4px 10px rgba(43, 36, 28, 0.06), 0 10px 28px rgba(43, 36, 28, 0.07);
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 8% 0%, rgba(193, 80, 46, 0.06), transparent 42%),
        radial-gradient(circle at 100% 0%, rgba(217, 164, 65, 0.08), transparent 40%),
        url("pattern.svg");
    background-repeat: no-repeat, no-repeat, repeat;
    background-position: 0 0, 0 0, 0 0;
    background-size: auto, auto, 64px 64px;
    background-attachment: fixed, fixed, fixed;
    color: var(--text);
    line-height: 1.55;
}

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

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

.site-header {
    background: rgba(250, 246, 240, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
}

.brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand-mark { font-size: 1.4rem; }

.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav a {
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: background 0.15s, color 0.15s;
}
.main-nav a:hover { color: var(--text); background: var(--surface-alt); }
.main-nav a.active { color: var(--primary-dark); background: var(--primary-light); }
.main-nav-cta {
    background: var(--primary) !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: var(--shadow-sm);
}
.main-nav-cta:hover { background: var(--primary-dark) !important; }

main.container { padding-top: 32px; padding-bottom: 70px; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
}

.page-head h1 { margin: 0; font-size: 2rem; color: var(--text); }
.page-head-actions { display: flex; gap: 10px; flex-shrink: 0; }

.hero-banner {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    padding: 44px 36px;
    margin-bottom: 28px;
    color: #fff;
    box-shadow: var(--shadow-md);
}
.hero-decor { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-decor span { position: absolute; font-size: 3.6rem; opacity: 0.16; }
.hero-decor span:nth-child(1) { top: -14px; right: 30px; transform: rotate(-12deg); }
.hero-decor span:nth-child(2) { bottom: -16px; right: 150px; font-size: 2.6rem; transform: rotate(10deg); opacity: 0.14; }
.hero-decor span:nth-child(3) { top: 30px; right: -16px; font-size: 4.4rem; transform: rotate(16deg); opacity: 0.14; }
.hero-decor span:nth-child(4) { bottom: 14px; left: 58%; font-size: 2rem; opacity: 0.12; }
.hero-decor span:nth-child(5) { top: 55%; right: 230px; font-size: 2.1rem; opacity: 0.1; }

.hero-content { position: relative; z-index: 1; max-width: 560px; }
.hero-content h1 { margin: 0 0 10px; font-size: 2.15rem; color: #fff; }
.hero-content .hero-sub { margin: 0 0 20px; color: rgba(255, 255, 255, 0.92); font-size: 1rem; }
.hero-content .btn-primary { background: #fff; color: var(--primary-dark); border-color: #fff; }
.hero-content .btn-primary:hover { background: #fff2e9; border-color: #fff2e9; }

@media (max-width: 640px) {
    .hero-banner { padding: 32px 24px; }
    .hero-decor span { display: none; }
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-alt); box-shadow: none; transform: none; }
.btn-danger { background: #fff; color: var(--danger); border-color: #f0cfc8; }
.btn-danger:hover { background: var(--danger-bg); }

.inline-form { display: inline; }

.flash {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.92rem;
}
.flash ul { margin: 0; padding-left: 18px; }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 14px;
    border-radius: var(--radius);
    margin-bottom: 22px;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.filter-bar input[type="text"],
.filter-bar select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-body);
    background: var(--bg);
}
.filter-bar input[type="text"] { flex: 1 1 220px; }
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--primary); background: var(--surface); }

.summary-bar {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.muted { color: var(--text-muted); }

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1.02rem;
}
.empty-state a { color: var(--primary); font-weight: 600; text-decoration: none; }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin-top: 28px;
    font-size: 0.9rem;
}
.pagination a { color: var(--primary); text-decoration: none; font-weight: 600; }

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

.recipe-card {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.recipe-card-link { position: absolute; inset: 0; z-index: 1; }
.recipe-card-link:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.recipe-card-media {
    position: relative;
    aspect-ratio: 4 / 3;
    background-image: url("pattern.svg"), linear-gradient(135deg, var(--primary-light), var(--surface-alt));
    background-repeat: repeat, no-repeat;
    background-size: 64px 64px, cover;
    overflow: hidden;
}
.recipe-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-card-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.6rem;
}
.recipe-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary-dark);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 4px 10px;
    border-radius: 999px;
}

.recipe-card-edit {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
    font-size: 0.9rem;
}
.recipe-card:hover .recipe-card-edit { opacity: 1; }
.recipe-card-edit:hover { background: #fff; }
@media (hover: none) { .recipe-card-edit { opacity: 1; } }

.recipe-card-body { padding: 14px 16px 16px; }
.recipe-card-body h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    line-height: 1.3;
    color: var(--text);
}
.recipe-card-meta {
    display: flex;
    gap: 14px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Forms */
.recipe-form, .recipe-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow-sm);
}
.recipe-form { max-width: 660px; }
.recipe-detail { max-width: 880px; }

.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="number"],
.form-row select,
.form-row textarea,
.form-row input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-family: var(--font-body);
    background: var(--bg);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-row textarea { resize: vertical; font-family: var(--font-body); }

.form-row-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }

.form-actions { display: flex; gap: 10px; margin-top: 24px; }

.inline-check { display: flex; align-items: center; gap: 6px; font-weight: 400; font-size: 0.85rem; margin-top: 8px; color: var(--text-muted); }

.current-file { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.thumb { max-width: 120px; max-height: 120px; border-radius: var(--radius-sm); border: 1px solid var(--border); object-fit: cover; }

.attachment-manager { display: flex; flex-wrap: wrap; gap: 14px; }
.attachment-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    width: 130px;
}
.attachment-chip .thumb { width: 100%; max-width: none; height: 90px; }
.attachment-chip-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 90px;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text);
    text-decoration: none;
    background: var(--surface-alt);
    border-radius: 6px;
    padding: 6px;
    overflow: hidden;
    word-break: break-word;
}

/* Recipe detail */
.recipe-hero-media {
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 22px;
    aspect-ratio: 16 / 7;
    background-image: url("pattern.svg"), linear-gradient(135deg, var(--primary-light), var(--surface-alt));
    background-repeat: repeat, no-repeat;
    background-size: 64px 64px, cover;
}
.recipe-hero-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-hero-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 3rem; }

.recipe-meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.recipe-meta-pill {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: 999px;
}

.recipe-tags { margin-bottom: 26px; }

.recipe-columns { display: grid; grid-template-columns: 260px 1fr; gap: 36px; margin-top: 10px; }

.recipe-section h2 { font-size: 1.1rem; margin: 0 0 14px; }

.ingredient-panel {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px;
}

.ingredient-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.ingredient-list li {
    position: relative;
    padding-left: 26px;
    font-size: 0.94rem;
}
.ingredient-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    width: 15px;
    height: 15px;
    border: 2px solid var(--primary);
    border-radius: 5px;
}

.instruction-list { list-style: none; margin: 0; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 18px; }
.instruction-list li {
    counter-increment: step;
    position: relative;
    padding-left: 44px;
    font-size: 0.98rem;
    min-height: 32px;
    display: flex;
    align-items: center;
}
.instruction-list li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: var(--font-display);
    flex-shrink: 0;
}

.notes { white-space: pre-wrap; margin: 0; color: var(--text); }

.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0 0 20px; }
.detail-grid dt { color: var(--text-muted); font-size: 0.85rem; }
.detail-grid dd { margin: 0; }

.tag-pill {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0 6px 6px 0;
}

.recipe-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin: -8px 0 22px;
}
.recipe-gallery img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: block;
}

.attachment { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }
.attachment a { text-decoration: none; }

/* Stats */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 34px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-label { display: block; color: var(--text-muted); font-size: 0.82rem; margin-bottom: 4px; }
.stat-value { display: block; font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--text); }

.report-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}
.report-section h2 { margin-top: 0; font-size: 1.15rem; }

.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 90px; align-items: center; gap: 12px; }
.bar-label { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--surface-alt); border-radius: 999px; height: 11px; overflow: hidden; }
.bar-fill { background: linear-gradient(90deg, var(--accent), var(--primary)); height: 100%; border-radius: 999px; }
.bar-value { font-size: 0.85rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

.site-footer {
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 26px 0;
    text-align: center;
}

@media (max-width: 720px) {
    .recipe-columns { grid-template-columns: 1fr; gap: 26px; }
}

@media (max-width: 640px) {
    .header-inner { flex-direction: column; gap: 10px; align-items: flex-start; }
    .page-head { flex-direction: column; }
    .form-row-split { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 100px 1fr; }
    .bar-row { grid-template-columns: 80px 1fr 70px; }
    .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
