:root {
    --recipe-card-bg: var(--pico-card-background-color);
}

/* Header */
.site-header {
    text-align: center;
    padding: 1.5rem 0 0.5rem;
}

.site-logo {
    height: 150px;
    width: auto;
}

.site-title {
    margin: 0.5rem 0 0;
    font-size: 1.5rem;
}

.site-title a {
    text-decoration: none;
    color: inherit;
}

/* Recipe Grid */
.recipe-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.recipe-card {
    padding: 1rem;
    margin: 0;
}

.recipe-card a {
    text-decoration: none;
    color: inherit;
    display: block;
    min-height: 44px;
}

.recipe-card h3 {
    margin-bottom: 0.25rem;
}

.recipe-meta {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.recipe-category {
    font-size: 0.85rem;
    text-transform: capitalize;
    opacity: 0.6;
}

/* Recipe Thumbnails */
.recipe-thumb {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.recipe-thumb-placeholder {
    width: 100%;
    height: 4px;
    background: var(--pico-muted-border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.recipe-hero {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

/* Image Upload */
.image-upload-area {
    margin-bottom: 1rem;
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

.image-remove-btn {
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.category-tabs a {
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: capitalize;
    background: var(--pico-secondary-background);
    color: var(--pico-secondary-inverse);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.category-tabs a.active {
    background: var(--pico-primary-background);
    color: var(--pico-primary-inverse);
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 0.75rem;
    font-size: 0.8rem;
    background: var(--pico-secondary-background);
    color: var(--pico-secondary-inverse);
    text-decoration: none;
    min-height: 36px;
}

/* Home Toolbar */
.home-toolbar {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.home-toolbar .search-bar {
    flex: 1;
    margin-bottom: 0;
}

.new-recipe-btn {
    white-space: nowrap;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
}

/* Search */
.search-bar {
    margin-bottom: 1rem;
}

.search-bar input {
    font-size: 1rem;
    padding: 0.75rem;
}

/* Recipe Wizard */
.recipe-wizard fieldset {
    border: none;
    padding: 0;
}

.recipe-wizard legend {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.wizard-hint {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 0.75rem;
}

.wizard-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.wizard-nav button, .wizard-nav a {
    min-height: 48px;
}

.recipe-preview {
    background: var(--pico-card-background-color);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-size: 0.85rem;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

/* Recipe Detail */
.recipe-detail {
    margin: 1rem 0;
    font-size: 1.1rem;
    line-height: 1.7;
}

.recipe-detail h1 {
    font-size: 1.75rem;
}

.recipe-detail h2 {
    font-size: 1.35rem;
    margin-top: 1.5rem;
}

.recipe-detail li {
    padding: 0.4rem 0;
}

.recipe-detail ul li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.recipe-detail ul li .have-it-btn {
    flex-shrink: 0;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 4px;
    background: transparent;
    color: var(--pico-muted-color);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.4;
    margin-left: auto;
}

.recipe-detail ul li .have-it-btn:hover {
    border-color: var(--pico-primary);
    color: var(--pico-primary);
}

.recipe-detail ul li .have-it-btn.active {
    background: var(--pico-ins-color);
    border-color: var(--pico-ins-color);
    color: #fff;
}

.recipe-detail ul li.on-hand {
    opacity: 0.45;
    text-decoration: line-through;
}

.recipe-detail ol li {
    padding: 0.5rem 0;
}

/* Capsaicin / Not Tamlin Safe */
.tamlin-unsafe-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: #d32f2f;
    background: #ffebee;
    padding: 0.1rem 0.4rem;
    border-radius: 0.5rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tamlin-unsafe-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #ffebee;
    color: #b71c1c;
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid #d32f2f;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.tamlin-icon-danger {
    border: 2px solid #d32f2f;
    filter: saturate(0.3);
}

/* Tamlin Safe */
.tamlin-safe-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: #2e7d32;
    background: #e8f5e9;
    padding: 0.1rem 0.4rem;
    border-radius: 0.5rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tamlin-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
}

.tamlin-safe-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #e8f5e9;
    color: #1b5e20;
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid #2e7d32;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.tamlin-banner-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Servings Control */
.servings-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--pico-card-background-color);
    border-radius: 0.5rem;
    border: 1px solid var(--pico-muted-border-color);
}

.servings-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--pico-primary-background);
    background: transparent;
    color: var(--pico-primary-background);
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    line-height: 1;
}

.servings-btn:hover {
    background: var(--pico-primary-background);
    color: var(--pico-primary-inverse);
}

.servings-display {
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 100px;
    text-align: center;
}

.servings-original {
    font-size: 0.85rem;
    opacity: 0.5;
}

/* Recipe Source Attribution */
.recipe-source {
    font-size: 0.85rem;
    opacity: 0.6;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--pico-muted-border-color);
}

.recipe-source a {
    word-break: break-all;
}

/* Wake lock toggle on recipe pages */
.wake-lock-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.wake-lock-toggle input {
    width: 20px;
    height: 20px;
}

/* Meal Plan */
.mealplan-subtitle {
    opacity: 0.7;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.mealplan-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mealplan-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.mealplan-column h3 {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--pico-primary-background);
}

.mealplan-slots {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.meal-slot {
    min-height: 48px;
    position: relative;
    padding: 0.75rem;
    border: 2px dashed var(--pico-muted-border-color);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
}

.meal-slot.filled {
    border-style: solid;
    border-color: var(--pico-primary-background);
    background: var(--pico-card-background-color);
}

.meal-slot .slot-recipe {
    font-size: 1rem;
}

.meal-slot .slot-select {
    width: 100%;
    font-size: 0.95rem;
    min-height: 44px;
    border: none;
    background: transparent;
    margin: 0;
    padding: 0 0.5rem;
}

.meal-slot.filled .slot-select {
    font-weight: 600;
}

.slot-label {
    font-size: 0.75rem;
    font-weight: normal;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.slot-clear {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    background: none;
    color: var(--pico-del-color);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mealplan-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mealplan-actions button {
    min-height: 48px;
    flex: 1;
}

.mealplan-sidebar {
    border-top: 1px solid var(--pico-muted-border-color);
    padding-top: 1rem;
}

.mealplan-meal-picker {
    margin-bottom: 0.75rem;
}

.mealplan-sidebar select {
    font-size: 1rem;
    min-height: 48px;
}

.mealplan-recipe-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--pico-muted-border-color);
    font-size: 1rem;
    min-height: 48px;
    display: flex;
    align-items: center;
}

.mealplan-recipe-item:hover {
    background: var(--pico-secondary-background);
}

#mealplan-recipe-list {
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Shopping List */
.shopping-item {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.shopping-item label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 48px;
    font-size: 1.1rem;
}

.shopping-item input[type="checkbox"] {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.shopping-item input:checked + strong {
    text-decoration: line-through;
    opacity: 0.5;
}

.shopping-item ul {
    margin: 0.25rem 0 0 3rem;
    font-size: 0.9rem;
    opacity: 0.7;
}

.shopping-actions {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.shopping-actions button {
    min-height: 48px;
    flex: 1;
}

.item-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
}

.buy-unit {
    font-size: 0.8rem;
    opacity: 0.5;
    font-weight: normal;
    white-space: nowrap;
}

.item-price {
    margin-left: auto;
    font-size: 0.95rem;
    opacity: 0.7;
    font-weight: normal;
}

.shopping-item label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.shopping-total {
    margin-top: 1.5rem;
    padding: 1rem;
    border-top: 2px solid var(--pico-primary-background);
    font-size: 1.2rem;
}

.shopping-total-note {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* Shopping Trip Tabs */
.trip-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.trip-tab {
    padding: 0.6rem 1.25rem;
    border: 2px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    background: transparent;
    cursor: pointer;
    font-size: 0.95rem;
    min-height: 48px;
    flex: 1;
    text-align: center;
}

.trip-tab.active {
    border-color: var(--pico-primary-background);
    background: var(--pico-primary-background);
    color: var(--pico-primary-inverse);
    font-weight: bold;
}

.trip-desc {
    font-size: 0.9rem;
    opacity: 0.6;
    margin-bottom: 1rem;
}

/* Shopping Reminder */
.shopping-reminder {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: var(--pico-card-background-color);
    border-left: 4px solid var(--pico-primary-background);
    font-size: 0.95rem;
    font-style: italic;
}

.shopping-reminder p {
    margin: 0;
}

/* Shopping Departments */
.shopping-dept {
    margin-bottom: 1rem;
}

.dept-header {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

/* Nav links - touch friendly */
nav ul li a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem;
}

/* Tablet: 2-column grid */
@media (min-width: 576px) {
    .recipe-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mealplan-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3-column grid, larger logo */
@media (min-width: 992px) {
    .recipe-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .mealplan-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Small phones */
@media (max-width: 575px) {
    .site-logo {
        height: 100px;
    }

    .site-title {
        font-size: 1.2rem;
    }

    .recipe-detail {
        font-size: 1.05rem;
    }

    .recipe-detail h1 {
        font-size: 1.5rem;
    }

    .mealplan-actions {
        flex-direction: column;
    }

    .shopping-actions {
        flex-direction: column;
    }

    .home-toolbar {
        flex-direction: column;
    }

    .wizard-row {
        grid-template-columns: 1fr;
    }

    .pantry-add {
        flex-direction: column;
    }

    .pantry-filters {
        flex-wrap: wrap;
    }
}

/* New Recipe Tabs */
.new-recipe-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.5rem 1.25rem;
    border: 2px solid var(--pico-muted-border-color);
    border-radius: 0.5rem 0.5rem 0 0;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    min-height: 44px;
}

.tab-btn.active {
    border-color: var(--pico-primary-background);
    border-bottom-color: transparent;
    background: var(--pico-card-background-color);
    font-weight: bold;
}

/* Markdown Help */
.md-help {
    margin: 1rem 0;
}

.md-help summary {
    cursor: pointer;
    font-weight: bold;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.md-help-content {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--pico-card-background-color);
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

.md-help-content h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.md-help-content table {
    font-size: 0.85rem;
}

.md-help-content pre {
    font-size: 0.8rem;
    max-height: 300px;
    overflow-y: auto;
}

/* Import from URL */
.import-search-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.import-search-row input {
    flex: 1;
}

.import-search-row button {
    white-space: nowrap;
    min-height: 48px;
}

.import-search-results {
    margin-bottom: 1rem;
}

.search-result-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-domain {
    font-size: 0.8rem;
    opacity: 0.6;
}

.search-result-desc {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-fetch {
    white-space: nowrap;
    min-height: 36px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

.import-status {
    font-size: 0.9rem;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

/* Pantry & Fridge */
.pantry-subtitle {
    opacity: 0.7;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.pantry-add {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.pantry-add input[type="text"] {
    flex: 1;
    min-height: 48px;
}

.pantry-add select {
    min-height: 48px;
    min-width: 100px;
}

.pantry-add button {
    min-height: 48px;
    white-space: nowrap;
}

.pantry-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pantry-filter {
    padding: 0.4rem 1rem;
    border-radius: 1rem;
    border: 1px solid var(--pico-muted-border-color);
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    min-height: 40px;
}

.pantry-filter.active {
    background: var(--pico-primary-background);
    color: var(--pico-primary-inverse);
    border-color: var(--pico-primary-background);
}

.pantry-list {
    margin-bottom: 1rem;
}

.pantry-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
    min-height: 48px;
}

.pantry-item-info {
    flex: 1;
    font-size: 1.05rem;
}

.pantry-item-location {
    font-size: 0.8rem;
    text-transform: capitalize;
    opacity: 0.5;
    padding: 0.2rem 0.5rem;
    border-radius: 0.5rem;
    background: var(--pico-secondary-background);
    color: var(--pico-secondary-inverse);
}

.pantry-item-remove {
    background: none;
    border: none;
    color: var(--pico-del-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pantry Suggestions */
.suggestions-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    background: var(--pico-card-background-color);
}

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

.suggestions-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.suggestions-header button {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    min-height: 36px;
}

.suggestions-hint {
    font-size: 0.9rem;
    opacity: 0.6;
    margin-bottom: 0.75rem;
}

.suggestions-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.suggestions-group-header:first-child {
    margin-top: 0;
}

.suggestion-add-all {
    background: none;
    border: none;
    color: var(--pico-primary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    min-height: 36px;
}

.suggestions-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.suggestion-chip {
    padding: 0.35rem 0.75rem;
    border-radius: 1rem;
    border: 1px solid var(--pico-muted-border-color);
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    min-height: 36px;
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: var(--pico-primary-background);
    color: var(--pico-primary-inverse);
    border-color: var(--pico-primary-background);
}

.pantry-empty {
    opacity: 0.6;
    text-align: center;
    padding: 2rem 0;
}

.pantry-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pantry-actions button {
    min-height: 44px;
}

.pantry-count {
    font-size: 0.9rem;
    opacity: 0.6;
}

/* Shopping list: on-hand items */
.shopping-item.is-on-hand {
    opacity: 0.35;
}

.shopping-item.is-on-hand strong {
    text-decoration: line-through;
}

.shopping-item.is-on-hand .on-hand-badge {
    font-size: 0.7rem;
    opacity: 0.8;
    margin-left: 0.25rem;
    color: var(--pico-ins-color);
}

.shopping-item.hide-on-hand {
    display: none;
}

/* Print Preview */
.print-preview-frame {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    background: #fff;
    overflow: auto;
    max-height: 80vh;
}

.print-preview-page {
    font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: #222;
    max-width: 700px;
    margin: 0 auto;
}

.pp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 2px solid #333;
}

.pp-logo {
    height: 30px;
    width: auto;
}

.pp-header-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.pp-header-text strong {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.pp-header-text span {
    font-size: 11px;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.pp-list.pp-columns {
    column-count: 3;
    column-gap: 12px;
}

.pp-list.pp-trips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
}

.pp-trip-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1.5px solid #333;
    padding-bottom: 1px;
    margin-bottom: 3px;
}

.pp-dept {
    break-inside: avoid;
    margin-bottom: 4px;
}

.pp-dept-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid #aaa;
    padding-bottom: 1px;
    margin-bottom: 1px;
}

.pp-item {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 12px;
    line-height: 1.4;
}

.pp-checkbox {
    display: inline-block;
    width: 9px;
    height: 9px;
    border: 1px solid #666;
    border-radius: 1px;
    flex-shrink: 0;
}

.pp-name {
    font-weight: 500;
}

.pp-price {
    margin-left: auto;
    font-size: 11px;
    opacity: 0.5;
}

.pp-total {
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    margin-top: 4px;
    padding-top: 2px;
    border-top: 1px solid #666;
}

.pp-combined-total {
    font-size: 13px;
    border-top: 2px solid #333;
    margin-top: 6px;
    padding-top: 3px;
}

.pp-reminder {
    margin-top: 6px;
    font-size: 12px;
    font-style: italic;
    text-align: center;
}

/* Print header -- hidden on screen */
.print-header {
    display: none;
}

/* Pantry staples */
.pantry-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pantry-toggle label {
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
}

.pantry-toggle input {
    width: 20px;
    height: 20px;
}

.shopping-item.is-pantry {
    opacity: 0.45;
}

.shopping-item.is-pantry strong {
    font-style: italic;
}

.shopping-item.is-pantry .pantry-badge {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-left: 0.25rem;
}

.shopping-item.hide-pantry {
    display: none;
}

@media print {
    nav, footer, header, .shopping-actions, .mealplan-actions, .mealplan-sidebar,
    .search-bar, .category-tabs, .wake-lock-toggle, .new-recipe-tabs,
    .home-toolbar, .new-recipe-btn, .pantry-toggle, .trip-tabs, .trip-desc,
    .servings-control, #print-preview-container, h2 {
        display: none !important;
    }

    .shopping-item.is-pantry,
    .shopping-item.is-on-hand {
        display: none !important;
    }

    * {
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        color: #222 !important;
    }

    html, body {
        font-size: 13px !important;
        line-height: 1.35 !important;
        font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif !important;
    }

    .container, main, section, article {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Print branded header */
    .print-header {
        display: flex !important;
        align-items: center;
        gap: 8px;
        padding: 0 0 6px 0 !important;
        margin: 0 0 6px 0 !important;
        border-bottom: 2px solid #333 !important;
    }

    .print-logo {
        height: 36px !important;
        width: auto !important;
    }

    .print-header-text {
        display: flex;
        flex-direction: column;
        line-height: 1.2;
    }

    .print-header-text strong {
        font-size: 14px !important;
        font-weight: 700;
        letter-spacing: 0.02em;
    }

    .print-header-text span {
        font-size: 10px !important;
        opacity: 0.6;
        text-transform: uppercase;
        letter-spacing: 0.1em;
    }

    /* Single-list: 3-column item grid */
    #shopping-list:not(:has(.trip-section)) {
        column-count: 3;
        column-gap: 14px;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Trip-based: side-by-side 2-column grid */
    #shopping-list:has(.trip-section) {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0 14px;
        margin: 0 !important;
        padding: 0 !important;
    }

    .shopping-dept {
        break-inside: avoid;
        margin: 0 0 4px 0 !important;
        padding: 0 !important;
    }

    .dept-header {
        font-size: 11px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.08em !important;
        border-bottom: 1px solid #aaa !important;
        margin: 0 0 1px 0 !important;
        padding: 0 0 1px 0 !important;
    }

    .shopping-item {
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        line-height: 1.2;
    }

    .shopping-item label {
        font-size: 12px !important;
        min-height: auto !important;
        gap: 2px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: baseline !important;
    }

    .shopping-item input[type="checkbox"] {
        width: 9px !important;
        height: 9px !important;
        margin: 0 !important;
        flex-shrink: 0;
        -webkit-appearance: none;
        appearance: none;
        border: 1px solid #666 !important;
        border-radius: 1px;
    }

    .item-icon {
        display: none !important;
    }

    .buy-unit {
        display: none !important;
    }

    .shopping-item strong {
        font-size: 12px !important;
        font-weight: 500 !important;
    }

    .item-price {
        font-size: 11px !important;
        margin-left: auto !important;
        opacity: 0.5;
    }

    .shopping-item ul {
        display: none !important;
    }

    .shopping-total {
        margin: 4px 0 0 0 !important;
        padding: 2px 0 0 0 !important;
        font-size: 12px !important;
        border-top: 1px solid #666 !important;
        text-align: right;
    }

    /* Combined total spans full width */
    section > .shopping-total {
        font-size: 13px !important;
        border-top: 2px solid #333 !important;
        column-span: all;
    }

    .shopping-total strong {
        font-weight: 700 !important;
        font-size: inherit !important;
    }

    .shopping-total-note {
        font-size: 10px !important;
        opacity: 0.5;
        text-align: right;
    }

    .pantry-badge {
        display: none !important;
    }

    .trip-section {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .trip-section::before {
        content: attr(data-trip);
        display: block;
        font-size: 12px !important;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        border-bottom: 1.5px solid #333 !important;
        padding-bottom: 1px !important;
        margin-bottom: 3px !important;
    }

    .trip-section[data-trip="trip1"]::before {
        content: "Trip 1 — Early Week";
    }

    .trip-section[data-trip="trip2"]::before {
        content: "Trip 2 — Late Week";
    }

    .shopping-reminder {
        margin-top: 4px !important;
        padding: 2px 0 0 0 !important;
        font-size: 12px !important;
        font-style: italic;
        text-align: center;
        border: none !important;
        background: none !important;
    }
}
