:root {
    --green: #16a34a;
    --green-dark: #0f7a37;
    --green-light: #dcfce7;
    --green-tint: #eafbea;
    --citrus: #f59e0b;
    --citrus-dark: #b45309;
    --citrus-light: #fef3c7;
    --coral: #ef4444;
    --coral-dark: #b91c1c;
    --coral-light: #fee2e2;
    --ink: #1f2937;
    --muted: #6b7280;
    --card-bg: #ffffff;
    --radius-lg: 26px;
    --radius-md: 16px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    margin: 0;
    background: linear-gradient(180deg, #eafbea 0%, #f4faf5 45%, #ffffff 100%);
    min-height: 100vh;
}

.page {
    padding: 48px 20px;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 24px 48px -20px rgba(22, 163, 74, 0.25), 0 4px 12px rgba(0, 0, 0, 0.04);
}

.brand {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
}

.brand-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: linear-gradient(135deg, var(--green), #22c55e);
    border-radius: 18px;
    box-shadow: 0 10px 20px -6px rgba(22, 163, 74, 0.5);
}

h1 {
    font-size: 28px;
    font-weight: 800;
    margin: 6px 0 4px;
    color: var(--green-dark);
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--muted);
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.nav-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.nav-link:hover {
    text-decoration: underline;
}

.save-list-btn {
    width: 100%;
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.save-confirm {
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--green-dark);
    font-weight: 600;
    text-align: center;
}

.save-confirm a {
    color: var(--green-dark);
    text-decoration: underline;
}

.how-it-works {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 18px 16px;
    margin-bottom: 22px;
    background: linear-gradient(135deg, var(--green-tint), var(--citrus-light));
    border-radius: var(--radius-md);
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.step-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.15);
}

.step-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.step-text strong {
    font-size: 13px;
    color: var(--ink);
}

.step-text span {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-arrow {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 16px;
    opacity: 0.6;
}

.example-preview {
    position: relative;
    margin-top: 24px;
    padding: 24px 20px 20px;
    border: 2px dashed var(--green-light);
    border-radius: var(--radius-md);
    background: #fbfffb;
}

.example-label {
    position: absolute;
    top: -11px;
    left: 20px;
    background: var(--green);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 12px;
    border-radius: 999px;
}

.example-checklist {
    opacity: 0.85;
}

.example-checklist input[type="checkbox"]:disabled {
    cursor: default;
}

.example-hint {
    margin: 14px 0 0;
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    line-height: 1.5;
}

textarea {
    width: 100%;
    padding: 14px;
    font-family: inherit;
    font-size: 14px;
    border: 2px solid var(--green-light);
    border-radius: var(--radius-md);
    resize: vertical;
    background: #fbfffb;
    transition: border-color 0.15s, box-shadow 0.15s;
}

textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15);
}

button {
    margin-top: 14px;
    padding: 12px 26px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 700;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: #fff;
    box-shadow: 0 10px 24px -8px rgba(22, 163, 74, 0.55);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -8px rgba(22, 163, 74, 0.6);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--citrus), #fbbf24);
    color: #fff;
    box-shadow: 0 10px 24px -8px rgba(245, 158, 11, 0.5);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -8px rgba(245, 158, 11, 0.55);
}

.alert {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
}

.alert-error {
    background: var(--coral-light);
    color: var(--coral-dark);
    border-left: 4px solid var(--coral);
}

.alert-warning {
    background: var(--citrus-light);
    color: var(--citrus-dark);
    border-left: 4px solid var(--citrus);
}

.alert-warning ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.manual-add {
    margin-top: 16px;
    padding: 20px;
    background: var(--green-tint);
    border-radius: var(--radius-md);
}

.section-title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
}

.section-title::before {
    font-size: 18px;
}

.icon-manual::before { content: "\270D\FE0F"; }
.icon-servings::before { content: "\2696\FE0F"; }
.icon-pantry::before { content: "\1F9C2"; }
.icon-grocery::before { content: "\1F955"; }
.icon-tools::before { content: "\1F9F0"; }

.manual-add-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

.manual-add textarea {
    width: 100%;
}

.results {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 2px dashed var(--green-light);
}

.checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.checklist > li {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}

.checklist > li:hover {
    background: rgba(22, 163, 74, 0.06);
}

.checklist label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 0;
    font-size: 15px;
}

.checklist input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--green);
    flex-shrink: 0;
}

.checklist label:has(input:checked) span {
    text-decoration: line-through;
    color: var(--muted);
    opacity: 0.6;
}

.sub-items {
    list-style: none;
    padding-left: 34px;
    margin: 4px 0 8px;
    border-left: 3px solid var(--citrus-light);
}

.cart-btn {
    margin-top: 22px;
    width: 100%;
    background: #eef1ee;
    color: #94a394;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cart-btn-icon {
    font-size: 15px;
}

.equipment-sidebar {
    margin-top: 20px;
    padding: 20px;
    background: var(--citrus-light);
    border-radius: var(--radius-md);
}

.equipment-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.equipment-sidebar li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: #fff;
    border-radius: var(--radius-sm);
    font-size: 14px;
    gap: 12px;
    box-shadow: 0 4px 10px -6px rgba(0, 0, 0, 0.15);
}

.equipment-sidebar li:last-child {
    margin-bottom: 0;
}

.tool-name {
    font-weight: 600;
}

.equipment-sidebar a {
    color: var(--citrus-dark);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.equipment-sidebar a:hover {
    text-decoration: underline;
}

.servings-row {
    padding: 14px 16px;
    margin-bottom: 10px;
    background: var(--green-tint);
    border-radius: var(--radius-md);
}

.servings-url {
    font-size: 12px;
    color: var(--muted);
    word-break: break-all;
    margin-bottom: 6px;
}

.servings-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.servings-label input[type="number"] {
    width: 68px;
    padding: 6px 10px;
    border: 2px solid var(--green-light);
    border-radius: 999px;
    text-align: center;
    font-family: inherit;
    font-weight: 700;
    color: var(--green-dark);
}

.servings-label input[type="number"]:focus {
    outline: none;
    border-color: var(--green);
}

.servings-unknown {
    font-size: 13px;
    color: var(--muted);
    font-style: italic;
}

.shopping-list-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}

.shopping-list-actions button {
    flex: 1;
    margin-top: 0;
}

/* ---------- Print ---------- */
.print-only {
    display: none;
}

@media print {
    body {
        background: #fff;
    }

    .page {
        padding: 0;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
        padding: 16px 0;
        max-width: 100%;
    }

    .no-print {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    .checklist input[type="checkbox"] {
        accent-color: #000;
    }

    .sub-items {
        border-left-color: #ccc;
    }
}

/* ---------- Responsive (mobile) ---------- */
@media (max-width: 640px) {
    .page {
        padding: 20px 12px;
    }

    .container {
        padding: 24px 18px;
        border-radius: var(--radius-md);
    }

    h1 {
        font-size: 22px;
    }

    .brand-icon {
        width: 46px;
        height: 46px;
        font-size: 22px;
        border-radius: 14px;
    }

    .subtitle {
        font-size: 13px;
    }

    .how-it-works {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .step-arrow {
        transform: rotate(90deg);
        align-self: center;
    }

    .servings-label {
        flex-wrap: wrap;
    }

    .checklist label {
        padding: 10px 0;
        font-size: 14px;
    }

    .checklist input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }

    button, .btn-primary, .btn-secondary {
        width: 100%;
    }

    .equipment-sidebar li {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

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

@media (max-width: 400px) {
    .container {
        padding: 20px 14px;
    }

    h1 {
        font-size: 20px;
    }
}
