:root {
    --header: #dba860;
    --header-dark: #c99648;
    --bg: #f4f2ee;
    --card: #ffffff;
    --text: #2b2b2b;
    --muted: #767676;
    --accent: #c96f36;
    --border: #e7e2d8;
    --tag-bg: #efe9dd;
    --danger: #b3452c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

header.topbar {
    background: var(--header);
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 58px;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

header.topbar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: #2b2b2b;
    text-decoration: none;
}

header.topbar .logo .icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #2b2b2b;
    color: var(--header);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

nav.mainnav {
    display: flex;
    gap: 4px;
    margin-left: 32px;
    flex: 1;
}

nav.mainnav a {
    color: #3a3222;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 14.5px;
    font-weight: 600;
}

nav.mainnav a:hover, nav.mainnav a.active {
    background: rgba(255,255,255,.35);
}

.dropdown { position: relative; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,.15);
    min-width: 190px;
    padding: 6px;
    z-index: 20;
}
.dropdown:hover .dropdown-menu, .dropdown:focus-within .dropdown-menu {
    display: block;
}
.dropdown-menu a {
    display: block;
    color: var(--text) !important;
    padding: 8px 10px;
    border-radius: 4px;
    font-weight: 500 !important;
}
.dropdown-menu a:hover {
    background: var(--tag-bg) !important;
}

main {
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 20px 60px;
}

h1.page-title {
    font-size: 26px;
    margin: 0 0 4px;
}

.subtitle {
    color: var(--muted);
    font-style: italic;
    margin: 0 0 10px;
}

.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tag {
    background: var(--tag-bg);
    color: #6a5a3a;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
}

.meta-row {
    display: flex;
    gap: 36px;
    align-items: center;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.meta-item { display: flex; align-items: center; gap: 10px; }
.meta-item .meta-icon {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--tag-bg); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.meta-item .meta-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.meta-item .meta-value { font-weight: 700; font-size: 15px; }

.detail-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    align-items: start;
}
@media (max-width: 820px) { .detail-grid { grid-template-columns: 1fr; } }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 20px;
}

.card h3 { margin-top: 0; display: flex; align-items: center; gap: 8px; color: #4a3f28; }

table.ingredients { width: 100%; border-collapse: collapse; }
table.ingredients tr { border-bottom: 1px solid var(--border); }
table.ingredients tr:last-child { border-bottom: none; }
table.ingredients td { padding: 8px 4px; font-size: 14.5px; }
table.ingredients td.check { width: 22px; color: var(--accent); }
table.ingredients td.qty { width: 70px; font-weight: 700; text-align: right; padding-right: 10px; color: var(--accent); }
table.ingredients td.unit { width: 50px; color: var(--muted); }

.photo-box img { width: 100%; border-radius: 8px; display: block; }
.photo-box .placeholder {
    width: 100%; aspect-ratio: 4/3; border-radius: 8px;
    background: linear-gradient(135deg, #ecd9b8, #d9b273);
    display: flex; align-items: center; justify-content: center;
    color: #6a4b1e; font-size: 54px; font-weight: 700;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}
.recipe-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow .15s ease;
}
.recipe-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.recipe-card .thumb {
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, #ecd9b8, #d9b273);
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; font-weight: 700; color: #6a4b1e;
}
.recipe-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.recipe-card .info { padding: 10px 12px; }
.recipe-card .info .name { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.recipe-card .info .cat { font-size: 12.5px; color: var(--muted); }

.category-heading {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--accent);
    margin: 26px 0 10px;
    font-weight: 700;
}
.category-heading:first-child { margin-top: 0; }

.searchbar { display: flex; gap: 8px; margin-bottom: 20px; }
.searchbar input[type=text] {
    flex: 1; max-width: 360px; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: 6px; font-size: 14.5px;
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #a85a2a; }
.btn.secondary { background: #6a6a6a; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }

table.plain { width: 100%; border-collapse: collapse; }
table.plain th {
    text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted);
    border-bottom: 2px solid var(--border); padding: 8px 10px;
}
table.plain td { padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 14.5px; }
table.plain tr:hover td { background: #faf7f0; }

.two-col { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.sidebar-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.sidebar-list li a {
    display: block; padding: 11px 14px; text-decoration: none; color: var(--text);
    border-bottom: 1px solid var(--border); font-size: 14.5px;
}
.sidebar-list li:last-child a { border-bottom: none; }
.sidebar-list li a:hover, .sidebar-list li a.active { background: var(--tag-bg); }

form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
form.inline input, form.inline select {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
}

.flash { background: #fce8df; border: 1px solid var(--danger); color: var(--danger); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash.flash-ok { background: #eaf3e6; border-color: #4c7a3a; color: #3a5c2c; }

.result-box {
    background: #faf6ec; border: 1px solid var(--border); border-radius: 8px;
    padding: 16px 18px; font-size: 14.5px; line-height: 1.8;
}
.result-box .big { font-size: 18px; font-weight: 700; color: var(--accent); }

.ing-row-form { display: grid; grid-template-columns: 2fr 90px 90px 90px 40px; gap: 8px; margin-bottom: 6px; align-items: center; }
.ing-row-form input { padding: 7px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 13.5px; }
.ing-row-form .rm { color: var(--danger); cursor: pointer; text-align: center; font-weight: 700; }
label.small-label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 3px; }
