/* === Theme Variables === */
:root {
    color-scheme: light;

    /* Brand Fonts */
    --font-display: 'Fraunces', serif;
    --font-body: 'DM Sans', sans-serif;

    /* Primary — Honey & Warmth */
    --honey-gold: #D4920B;
    --golden-amber: #F5B731;
    --warm-nectar: #FBD96B;
    --light-comb: #FDF0D0;
    --cream-wax: #FEF9EC;

    /* Neutrals — Earth & Wood */
    --dark-oak: #2C2013;
    --bark-brown: #3A2E1F;
    --warm-umber: #5C4A34;
    --soft-clay: #7A6B57;
    --driftwood: #A89A86;
    --linen: #E8DCC8;
    --parchment: #FAF6F0;
    --white-flour: #FFFDF9;

    /* Accent — Meadow Greens */
    --meadow-green: #5A8C4A;

    /* Functional */
    --success: #5A8C4A;
    --warning: #D4920B;
    --error: #C4453C;
    --info: #4A7A9E;

    /* Mapped theme variables */
    --bg: var(--parchment);
    --bg-surface: var(--white-flour);
    --bg-surface-hover: var(--cream-wax);
    --bg-nav: var(--dark-oak);
    --bg-nav-hover: var(--bark-brown);
    --bg-nav-active: var(--honey-gold);
    --text: var(--dark-oak);
    --text-secondary: var(--warm-umber);
    --text-muted: var(--soft-clay);
    --text-nav: var(--linen);
    --link: var(--honey-gold);
    --border: var(--linen);
    --border-input: var(--driftwood);
    --shadow: rgba(44, 32, 19, 0.1);
    --shadow-modal: rgba(44, 32, 19, 0.3);
    --overlay: rgba(44, 32, 19, 0.5);
    --focus: var(--honey-gold);
    --focus-ring: rgba(212, 146, 11, 0.25);
    --btn-bg: var(--white-flour);
    --btn-text: var(--bark-brown);
    --btn-hover: var(--light-comb);
    --btn-primary: var(--honey-gold);
    --btn-primary-hover: #B87D09;
    --btn-danger: var(--error);
    --btn-danger-hover: #A33A33;
    --th-bg: var(--cream-wax);
    --cost-total-bg: var(--light-comb);
    --cost-total-border: var(--driftwood);
    --error-bg: var(--error);
    --warning-bg: var(--warning);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1A1408;
    --bg-surface: #231C10;
    --bg-surface-hover: #2E2518;
    --bg-nav: #161007;
    --bg-nav-hover: #2E2518;
    --bg-nav-active: #D4920B;
    --text: #E8DCC8;
    --text-secondary: #A89A86;
    --text-muted: #7A6B57;
    --text-nav: #E8DCC8;
    --link: #F5B731;
    --border: #3A2E1F;
    --border-input: #5C4A34;
    --shadow: rgba(0, 0, 0, 0.4);
    --shadow-modal: rgba(0, 0, 0, 0.6);
    --overlay: rgba(0, 0, 0, 0.7);
    --focus: #F5B731;
    --focus-ring: rgba(245, 183, 49, 0.3);
    --btn-bg: #2E2518;
    --btn-text: #E8DCC8;
    --btn-hover: #3A2E1F;
    --btn-primary: #D4920B;
    --btn-primary-hover: #B87D09;
    --btn-danger: #C4453C;
    --btn-danger-hover: #A33A33;
    --th-bg: #2E2518;
    --cost-total-bg: #2E2518;
    --cost-total-border: #5C4A34;
    --error-bg: #A33A33;
    --warning-bg: #B87D09;
}

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

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--link);
}

/* === Navigation === */
nav {
    background: var(--bg-nav);
    padding: 0.5rem 1rem;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex-shrink: 0;
}

.nav-brand svg {
    filter: drop-shadow(0 1px 4px rgba(212, 146, 11, 0.3));
}

.nav-brand-text {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cream-wax);
    letter-spacing: -0.02em;
}

.nav-brand-text span {
    color: var(--golden-amber);
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--warm-umber);
    flex-shrink: 0;
}

/* === Section Selector Dropdown === */
.section-selector {
    position: relative;
    flex-shrink: 0;
}

.section-selector::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -10px;
    height: 10px;
}

.section-trigger {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.section-trigger:hover {
    background: var(--bg-nav-hover);
}

.section-icon {
    font-size: 1rem;
}

.section-name {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--golden-amber); /* fallback */
}

/* Section colors from Product Architecture naming map */
.section-hive .section-name { color: #5A8C4A; }
.section-meadow .section-name { color: #8B6DB0; }
.section-pollinate .section-name { color: #A89A86; }
.section-swarm .section-name { color: #D4849A; }

:root[data-theme="dark"] .section-hive .section-name { color: #7BAA6B; }
:root[data-theme="dark"] .section-meadow .section-name { color: #A88BC8; }
:root[data-theme="dark"] .section-pollinate .section-name { color: #C4B8A8; }
:root[data-theme="dark"] .section-swarm .section-name { color: #E0A0B4; }

.section-arrow {
    font-size: 0.7rem;
    color: var(--driftwood);
    transition: transform 0.2s;
}

.section-selector:hover .section-arrow {
    transform: rotate(180deg);
}

.section-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 4px 16px var(--shadow-modal);
    z-index: 3000;
    padding: 0.35rem;
    padding-top: calc(0.35rem + 10px);
    margin-top: 10px;
    flex-direction: column;
    gap: 0.15rem;
}

/* Invisible bridge between trigger and dropdown to maintain hover */
.section-dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -8px;
    right: -8px;
    height: 10px;
}

.section-selector:hover .section-dropdown {
    display: flex;
}

.section-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s;
}

.section-item:hover {
    background: var(--bg-surface-hover);
}

.section-item.active {
    color: var(--text);
    font-weight: inherit;
}

/* Active item backgrounds from Product Architecture naming map */
.section-item.active.section-hive { background: #E8F2E0; }
.section-item.active.section-meadow { background: #f0e8f6; }
.section-item.active.section-pollinate { background: var(--parchment); }
.section-item.active.section-swarm { background: #F2D6DE; }

:root[data-theme="dark"] .section-item.active.section-hive { background: #1a2a15; }
:root[data-theme="dark"] .section-item.active.section-meadow { background: #2a1f35; }
:root[data-theme="dark"] .section-item.active.section-pollinate { background: var(--bg-nav-hover); }
:root[data-theme="dark"] .section-item.active.section-swarm { background: #35202a; }

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

.section-item-text {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.section-item-name {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.3;
}

/* Dropdown item name colors match their section */
.section-item.section-hive .section-item-name { color: #5A8C4A; }
.section-item.section-meadow .section-item-name { color: #8B6DB0; }
.section-item.section-pollinate .section-item-name { color: #5C4A34; }
.section-item.section-swarm .section-item-name { color: #D4849A; }

:root[data-theme="dark"] .section-item.section-hive .section-item-name { color: #7BAA6B; }
:root[data-theme="dark"] .section-item.section-meadow .section-item-name { color: #A88BC8; }
:root[data-theme="dark"] .section-item.section-pollinate .section-item-name { color: #C4B8A8; }
:root[data-theme="dark"] .section-item.section-swarm .section-item-name { color: #E0A0B4; }

.section-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.nav-toggle {
    display: none;
}

.nav-hamburger {
    display: none;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    flex: 1;
}

nav a {
    color: var(--text-nav);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s;
}

nav a:hover {
    background: var(--bg-nav-hover);
}

nav a.active {
    background: var(--bg-nav-active);
    color: var(--white-flour);
    font-weight: 600;
}


/* === Nav Groups === */
.nav-group {
    position: relative;
}

.nav-group::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -10px;
    height: 10px;
}

.nav-group-label {
    color: var(--text-nav);
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-group-label::after {
    content: '\25be';
    font-size: 0.7em;
    opacity: 0.6;
    transition: transform 0.2s;
}

.nav-group:hover .nav-group-label::after,
.nav-group.open .nav-group-label::after {
    transform: rotate(180deg);
}

.nav-group-label:hover {
    background: var(--bg-nav-hover);
}

.nav-group.active > .nav-group-label {
    color: var(--golden-amber);
}

.nav-group-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 4px 16px var(--shadow-modal);
    z-index: 3000;
    padding: 0.35rem;
    padding-top: calc(0.35rem + 10px);
    margin-top: 10px;
    flex-direction: column;
    gap: 0.15rem;
}

/* Invisible bridge to maintain hover */
.nav-group-dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -8px;
    right: -8px;
    height: 10px;
}

.nav-group:hover .nav-group-dropdown {
    display: flex;
}

.nav-group-dropdown a {
    display: block;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
    font-family: var(--font-body);
}

.nav-group-dropdown a:hover {
    background: var(--bg-surface-hover);
}

.nav-group-dropdown a.active {
    background: var(--bg-nav-active);
    color: var(--white-flour);
    font-weight: 600;
}

/* === Landing Page === */
.landing-header {
    text-align: center;
    padding: 3rem 1rem 2rem;
}

.landing-brand {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text);
}

.landing-brand span {
    color: var(--golden-amber);
}

.landing-tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

.landing-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1.5rem;
    border-radius: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s, box-shadow 0.15s;
}

.landing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px var(--shadow-modal);
}

.landing-card-icon {
    font-size: 2.5rem;
}

.landing-card-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
}

.landing-card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* === Main Content === */
main {
    margin: 1rem auto;
    padding: 0 1rem;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

h1 {
    margin-bottom: 1rem;
    font-size: 2.25rem;
    font-weight: 700;
}

h2 {
    margin-bottom: 0.75rem;
    font-size: 1.75rem;
    font-weight: 600;
}

h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

h4 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 600;
}

/* === Tables === */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px var(--shadow);
    margin-bottom: 1rem;
}

th, td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

td input[type="text"], td input[type="number"], td select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

th {
    background: var(--th-bg);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

tr:hover {
    background: var(--bg-surface-hover);
}

.table-wide {
    table-layout: fixed;
}

.table-wide th, .table-wide td {
    padding: 0.4rem 0.35rem;
    text-align: center;
    vertical-align: middle;
}

/* Name columns (1-2) */
.table-wide th:nth-child(1), .table-wide td:nth-child(1),
.table-wide th:nth-child(2), .table-wide td:nth-child(2) {
    width: 13%;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sub-ingredient column (3) */
.table-wide th:nth-child(3), .table-wide td:nth-child(3) {
    width: 12%;
    text-align: left;
}

/* Unit/Wt column (4) */
.table-wide th:nth-child(4), .table-wide td:nth-child(4) {
    width: 8%;
}

/* Density column (5) */
.table-wide th:nth-child(5), .table-wide td:nth-child(5) {
    width: 7%;
}

/* Pref. Unit / Inv. Unit columns (6-7) */
.table-wide th:nth-child(6), .table-wide td:nth-child(6),
.table-wide th:nth-child(7), .table-wide td:nth-child(7) {
    width: 5%;
}

/* Allergen columns (8-15) — uniform minimal width */
.table-wide th:nth-child(n+8):nth-child(-n+15),
.table-wide td:nth-child(n+8):nth-child(-n+15) {
    width: 3%;
    padding: 0.4rem 0.1rem;
}

/* Actions column (16) */
.table-wide th:nth-child(16), .table-wide td:nth-child(16) {
    width: 8%;
}

/* Sub-ingredient textarea */
.sub-ingredient-input {
    width: 100%;
    min-width: 0;
    resize: vertical;
    font-size: 0.85rem;
}

/* Unit + Weight grouped in one cell */
.unit-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.unit-group input[type="number"] {
    width: 100%;
    min-width: 0;
}

/* === Buttons === */
button, .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-input);
    border-radius: 8px;
    background: var(--btn-bg);
    color: var(--btn-text);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-body);
    letter-spacing: 0.02em;
    transition: background 0.15s;
}

button:hover, .btn:hover {
    background: var(--btn-hover);
}

.btn-primary {
    background: var(--btn-primary);
    color: #fff;
    border-color: var(--btn-primary);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
}

.btn-danger {
    background: var(--btn-danger);
    color: #fff;
    border-color: var(--btn-danger);
}

.btn-danger:hover {
    background: var(--btn-danger-hover);
}

.btn-small {
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
}

/* === Forms === */
input, select, textarea {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-input);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: var(--font-body);
    background: var(--bg-surface);
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 2px var(--focus-ring);
}

label {
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* === Form Rows === */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    margin-top: 0.5rem;
}

.detail-edit-form .form-row {
    margin-top: 1.25rem;
}

.detail-edit-form h2,
.detail-edit-form h3 {
    margin-top: 1.75rem;
}

/* === Checkbox Inline Labels === */
.checkbox-inline {
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
}

/* === Name with Copy Button === */
.name-with-copy {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.name-with-copy input {
    flex: 1;
    min-width: 0;
}

.btn-copy {
    flex-shrink: 0;
    padding: 0.1rem 0.3rem;
    font-size: 0.85rem;
    line-height: 1;
}

/* === Density Cell === */
.density-cell {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.density-cell input[type="number"] {
    flex: 1;
    min-width: 0;
}

.btn-convert {
    flex-shrink: 0;
    padding: 0.2rem 0.4rem;
    font-size: 0.9rem;
    line-height: 1;
}

/* === Amount + Convert Button === */
.amount-with-convert {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.amount-with-convert input[type="number"] {
    flex: 1 1 auto;
    min-width: 4em;
    width: auto !important;
}

td .amount-with-convert select,
.amount-with-convert select {
    flex: 0 0 4.5em;
    width: 4.5em !important;
    min-width: 4.5em;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: 14px;
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 24px var(--shadow-modal);
}

.modal-content h2 {
    margin-bottom: 0.5rem;
}

.modal-instructions {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.conv-preview {
    font-weight: 600;
    color: var(--text);
    min-height: 1.5rem;
    margin: 0.75rem 0;
}

/* === Actions (inline button groups) === */
.actions {
    display: flex;
    gap: 0.25rem;
}

/* === Error Toast === */
#error-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.error-toast {
    background: var(--error-bg);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    box-shadow: 0 2px 12px var(--shadow);
    max-width: 400px;
    animation: slide-in 0.3s ease-out;
}

.error-toast.fade-out,
.success-toast.fade-out {
    animation: fade-out 0.5s ease-out forwards;
}

.success-toast {
    background: var(--success-bg, #2e7d32);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    box-shadow: 0 2px 12px var(--shadow);
    max-width: 400px;
    animation: slide-in 0.3s ease-out;
}

@keyframes slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* === Cost Display === */
.cost-cell {
    text-align: right;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 0.85rem;
    white-space: nowrap;
}

.cost-total {
    font-weight: 700;
}

.cost-total-row {
    background: var(--cost-total-bg);
    border-top: 2px solid var(--cost-total-border);
}

.cost-total-row:hover {
    background: var(--cost-total-bg);
}

.warning-badge {
    display: inline-block;
    background: var(--warning-bg);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    width: 1.2em;
    height: 1.2em;
    line-height: 1.2em;
    text-align: center;
    border-radius: 50%;
    margin-right: 0.25rem;
    cursor: help;
}

.badge-muted {
    display: inline-block;
    background: var(--border-input);
    color: var(--text);
    font-size: 0.75rem;
    padding: 0.1em 0.5em;
    border-radius: 4px;
    vertical-align: middle;
    opacity: 0.7;
}

.archived-row {
    opacity: 0.6;
}

/* === Ingredient Label === */
.ingredients-label-box {
    border: 1px solid var(--border-input);
    border-radius: 10px;
    padding: 1rem;
    max-width: 600px;
    background: var(--bg-surface);
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* === Inventory Tabs === */
.inventory-tabs {
    position: relative;
}

.tab-input {
    display: none;
}

.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}

.tab-label {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
}

.tab-label:hover {
    color: var(--text);
}

#inv-tab-ing:checked ~ .tab-bar label[for="inv-tab-ing"],
#inv-tab-pkg:checked ~ .tab-bar label[for="inv-tab-pkg"] {
    color: var(--honey-gold);
    border-bottom-color: var(--honey-gold);
}

.tab-panel {
    display: none;
}

#inv-tab-ing:checked ~ #panel-ingredients {
    display: block;
}

#inv-tab-pkg:checked ~ #panel-packaging {
    display: block;
}

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

.tab-actions .btn {
    text-decoration: none;
}

/* === Production Recipe View === */
.production-controls {
    margin-bottom: 1.5rem;
}

.production-controls .form-row {
    align-items: flex-end;
}

.production-placeholder {
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem 0;
}

.production-recipe-header {
    margin-bottom: 1rem;
}

.production-recipe-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.production-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 700px;
}

.production-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, opacity 0.2s;
}

.production-step:hover {
    background: var(--bg-surface-hover);
}

.production-step:active {
    transform: scale(0.99);
}

.production-step.variant-step {
    border-left: 3px solid var(--honey-gold);
}

/* Checkbox circle */
.step-check {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--border-input);
    border-radius: 50%;
    margin-top: 0.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}

.step-check::after {
    content: '';
    display: none;
    width: 0.4rem;
    height: 0.7rem;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
    margin-top: -0.15rem;
}

.production-step.checked .step-check {
    background: var(--success);
    border-color: var(--success);
}

.production-step.checked .step-check::after {
    display: block;
}

.production-step.checked .step-body {
    opacity: 0.45;
}

.production-step.checked .step-ingredient,
.production-step.checked .step-amount {
    text-decoration: line-through;
}

/* Step content */
.step-body {
    flex: 1;
    min-width: 0;
    transition: opacity 0.15s;
}

.step-main {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.step-number {
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 1.5rem;
}

.step-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
}

.step-ingredient {
    font-weight: 600;
    flex: 1;
    min-width: 0;
}

.step-amount {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-weight: 600;
    color: var(--honey-gold);
    min-width: 6rem;
    text-align: right;
    flex-shrink: 0;
}

.step-note {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
    padding-left: 2rem;
}

.production-variant-divider {
    margin: 0.75rem 0 0.25rem;
    padding-top: 0.5rem;
    border-top: 2px dashed var(--border);
}

/* Step note button */
.step-note-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.3;
    transition: opacity 0.15s;
    padding: 0 0.25rem;
    margin-left: auto;
    flex-shrink: 0;
}

.step-note-btn:hover {
    opacity: 1;
}

.step-note-btn.has-note {
    opacity: 0.7;
}

.step-note-btn.has-note:hover {
    opacity: 1;
}

/* Global production note */
.production-global-note {
    max-width: 700px;
    margin-top: 1.5rem;
}

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

.production-global-note label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.production-global-note textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-input);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--bg-surface);
    color: var(--text);
    resize: vertical;
}

.production-global-note textarea:focus {
    outline: none;
    border-color: var(--honey-gold);
    box-shadow: 0 0 0 2px rgba(212, 146, 11, 0.15);
}

/* Step note modal */
#step-note-modal .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

#step-note-textarea {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    min-height: 200px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-input);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--bg-surface);
    color: var(--text);
    resize: vertical;
    margin-bottom: 1rem;
}

#step-note-textarea:focus {
    outline: none;
    border-color: var(--honey-gold);
    box-shadow: 0 0 0 2px rgba(212, 146, 11, 0.15);
}

/* Setup page production notes */
.setup-prod-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}

.setup-prod-note-label {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.setup-prod-note-text {
    flex: 1;
    min-width: 0;
}

.setup-prod-note .btn {
    flex-shrink: 0;
}

.prod-note-row td {
    background: var(--bg-surface-hover);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Note save status */
.note-save-status {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    min-height: 1.2em;
}

/* === Auth Pages (Login / Register) === */
.auth-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.login-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-form {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input {
    width: 100%;
}

.auth-submit {
    margin-top: 0.5rem;
}

.auth-error {
    background: var(--error-bg);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    text-align: center;
    max-width: 360px;
    width: 100%;
    margin-bottom: 0.5rem;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.oauth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 360px;
    width: 100%;
    margin: 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.oauth-divider::before,
.oauth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
    width: 100%;
}

.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-input);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-oauth:hover {
    background: var(--bg-surface-hover, var(--bg-hover));
}

.oauth-icon {
    flex-shrink: 0;
}

/* === Responsive === */
@media (max-width: 768px) {
    nav {
        flex-wrap: wrap;
    }

    .nav-hamburger {
        display: flex;
        flex-direction: column;
        gap: 4px;
        cursor: pointer;
        padding: 0.4rem 0;
    }

    .nav-hamburger span {
        display: block;
        width: 24px;
        height: 2px;
        background: var(--text-nav);
        border-radius: 2px;
        transition: transform 0.2s, opacity 0.2s;
    }

    .nav-toggle:checked ~ .nav-hamburger span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .nav-toggle:checked ~ .nav-hamburger span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle:checked ~ .nav-hamburger span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    .nav-links {
        display: none;
        flex-direction: column;
        padding-top: 0.5rem;
        width: 100%;
        order: 3;
    }

    .nav-toggle:checked ~ .nav-links {
        display: flex;
    }

    nav a {
        padding: 0.5rem 0.75rem;
    }

    .nav-group-dropdown {
        position: static;
        display: none;
        border: none;
        box-shadow: none;
        background: transparent;
        padding: 0;
        padding-left: 1rem;
        margin-top: 0;
        min-width: 0;
    }

    .nav-group-dropdown::before {
        display: none;
    }

    .nav-group:hover .nav-group-dropdown {
        display: none;
    }

    .nav-group.open .nav-group-dropdown {
        display: flex;
    }

    .nav-group-dropdown a {
        color: var(--text-nav);
        padding: 0.35rem 0.75rem;
    }

    .nav-group-dropdown a:hover {
        background: var(--bg-nav-hover);
    }

    .nav-group-dropdown a.active {
        background: var(--bg-nav-active);
        color: var(--white-flour);
    }

    main {
        padding: 0 0.5rem;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.4rem 0.5rem;
    }
}

/* === Recipe Compare === */

.compare-controls {
    margin-bottom: 1.5rem;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px var(--shadow);
    margin-bottom: 1rem;
}

.compare-table th {
    background: var(--th-bg);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.compare-table td {
    vertical-align: top;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
}

.compare-cell-empty {
    color: var(--text-muted);
    text-align: center;
}

.compare-step .step-number {
    font-weight: 600;
}

.compare-step .step-note {
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.compare-row-same {
    background: rgba(90, 140, 74, 0.08);
}

.compare-row-changed {
    background: rgba(196, 69, 60, 0.10);
}

.compare-diff {
    color: var(--error);
    font-style: italic;
}
