:root {
    /* Brand & Accent: Coastal Cyan */
    --accent: #0ea5e9;       /* Sky 500 */
    --accent-hover: #0284c7; /* Sky 600 */
    --accent-soft: #e0f2fe;  /* Sky 100 */
    --accent-fg: #ffffff;

    /* Surface & Background */
    --bg: #f0f9ff;           /* Sky 50 */
    --panel-bg: #ffffff;
    --backdrop: rgba(255, 255, 255, 0.85);

    /* Borders & Dividers */
    --border: #e2e8f0;       /* Slate 200 */
    --border-hover: #cbd5e1; /* Slate 300 */

    /* Text & Content */
    --text: #292524;         /* Stone 900 (Warm Grey/Black) */
    --muted: #57534e;        /* Stone 600 (Warm Grey) */
    --text-light: #78716c;   /* Stone 500 */

    /* Status */
    --success: #16a34a;      /* Green 600 */
    --success-soft: #dcfce7;
    --warning: #d97706;      /* Amber 600 */
    --warning-soft: #fef3c7;
    --danger: #dc2626;       /* Red 600 */
    --danger-soft: #fef2f2;

    /* UI Primitives */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --pill: 9999px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    /* Smooth scrolling */
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.layout {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.site-header {
    background: var(--backdrop);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.site-footer {
    background: var(--panel-bg);
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    padding: 2rem 0;
    font-size: 0.875rem;
    color: var(--muted);
}

.site-header .layout,
.site-footer .layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.logo {
    font-weight: 700;
    text-transform: lowercase;
    text-decoration: none;
    color: var(--text);
    font-size: 1.5rem;
    letter-spacing: -0.03em;
}

.links a {
    color: var(--muted);
    margin-left: 1.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
    font-size: 0.95rem;
}

.links a:hover {
    color: var(--accent);
}

main.page {
    padding: 2.5rem 0 5rem;
}

.hero {
    background: linear-gradient(to bottom right, #ffffff, #f8fafc);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
}

.hero-actions {
    margin-top: 1.5rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin: 0 0 0.5rem;
}

.lede {
    max-width: 600px;
    color: var(--muted);
    font-size: 1.125rem;
    margin-top: 0.75rem;
    line-height: 1.6;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.menu-card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s var(--ease-out);
    position: relative;
}

.menu-card:hover {
    border-color: var(--accent-soft);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.menu-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.menu-card__header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.pill {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.25rem 0.85rem;
    border-radius: var(--pill);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Lists & Previews */
.entry-preview,
.entries-list {
    list-style: none;
    margin: 1.5rem 0;
    padding: 0;
}

.entry-preview li,
.entries-list li {
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping for small screens */
    align-items: baseline;
    gap: 0.5rem;
}

.entry-preview li:last-child,
.entries-list li:last-child {
    border-bottom: none;
}

.entry-date {
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
    min-width: 100px;
}

.entries-list.compact li,
.entry-preview.compact li {
    padding: 0.5rem 0;
}

.entries-list.compact .entry-date,
.entry-preview.compact .entry-date {
     font-size: 0.8125rem;
}

/* Typography & Links */
.tags-inline {
    color: var(--muted);
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.dish-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
}

.dish-link:hover {
    color: var(--accent);
}

.tagline {
    font-size: 0.8125rem;
    color: var(--text-light);
    margin: 0.25rem 0 0;
    font-weight: 500;
    width: 100%; /* Force new line */
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: #fff;
    background: var(--accent);
    padding: 0.625rem 1.25rem;
    border-radius: var(--pill);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    font-size: 0.9375rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.button:active {
    transform: translateY(0);
}

.button.secondary {
    background: #f1f5f9;
    color: var(--text);
    box-shadow: none;
}

.button.secondary:hover {
    background: var(--border);
    color: var(--text);
}

.button.tertiary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    box-shadow: none;
}

.button.tertiary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.button.mini {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    box-shadow: none;
}

.button.mini.danger {
    background: var(--danger);
    color: #fff;
}

.button.mini.danger:hover {
    background: #b91c1c;
}

/* Empty State */
.empty-state {
    background: var(--panel-bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    color: var(--muted);
}

.empty-state a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

/* Page Headers */
.page-header {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.page-header.compact {
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
    letter-spacing: -0.02em;
}

.page-header.compact h1 {
    font-size: 1.25rem;
}

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

/* Menu navigation */
.menu-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.menu-nav h1 {
    margin: 0;
}

.nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.nav-arrow:hover {
    background: var(--accent);
    color: white;
}

.nav-arrow.disabled {
    background: var(--border);
    color: var(--muted);
    cursor: default;
    opacity: 0.5;
}

.button.disabled {
    background: var(--border);
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Editable date */
.date-edit-wrapper {
    position: relative;
}

.editable-date {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
    border-bottom: 1px dashed var(--muted);
}

.editable-date:hover {
    background: var(--accent-soft);
    border-bottom-color: var(--accent);
}

.editable-date::after {
    content: " \270E";  /* pencil icon */
    font-size: 0.7em;
    opacity: 0.5;
    margin-left: 0.25rem;
}

.editable-date:hover::after {
    opacity: 1;
}

.date-edit-input {
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
}

.date-cell.editable {
    cursor: pointer;
    transition: all 0.15s ease;
}

.date-cell.editable:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

/* Layouts & Panels */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.panel-header h2,
.panel-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

/* Tags */
.entries-list .tag-row {
    margin-top: 0.35rem;
    width: 100%;
}

.tag {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.4rem;
    display: inline-block;
}

/* Shopping Lists */
.shopping-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    background: #fff;
    transition: all 0.2s var(--ease-out);
}

.shopping-section:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-hover);
}

.shopping-section h3 {
    margin-top: 0;
    font-size: 1rem;
    color: var(--text);
    border-bottom: 2px solid var(--accent-soft);
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

.shopping-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shopping-section li {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.shopping-section li:last-child {
    border-bottom: none;
}

.shopping-section li span {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

.shopping-section.compact {
    padding: 1rem;
    margin-bottom: 1rem;
}

.shopping-section.compact h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    border-bottom: none;
    padding-bottom: 0;
    color: var(--accent);
    font-weight: 600;
}

.shopping-section.compact li {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.9rem;
}

.shopping-section.compact li strong {
    font-weight: 500;
    color: var(--text);
}

.shopping-item.has-contrib {
    cursor: pointer;
    position: relative;
}

.shopping-item.has-contrib strong::after {
    content: " •";
    color: var(--accent);
    font-size: 0.85em;
}

.shopping-popover {
    position: absolute;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.85rem;
    width: min(260px, 90vw);
    z-index: 1500;
}

.shopping-popover.hidden {
    display: none;
}

.shopping-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.shopping-popover-close {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}

.shopping-popover-close:hover {
    color: var(--danger);
}

.shopping-popover-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.shopping-popover-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.shopping-popover-list .dish {
    font-weight: 500;
    color: var(--text);
}

.shopping-popover-list .qty {
    color: var(--muted);
}

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

/* Alerts & Notices */
.flash {
    min-height: 1rem;
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.flash.error {
    color: var(--danger);
}

.save-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.save-status.saving {
    color: var(--muted);
}

.save-status.saved {
    color: var(--success);
    background: var(--success-soft);
}

.save-status.error {
    color: var(--danger);
    background: var(--danger-soft);
}

.notice {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-weight: 500;
}

.notice.error {
    background: var(--danger-soft);
    color: var(--danger);
}

.notice.warning {
    background: #fff3cd;
    color: #856404;
}

/* Forms & Editors */
.shopping-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.shopping-editor {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 1rem;
    background: var(--bg);
}

.shopping-editor:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: #fff;
}

.form-panel {
    margin-top: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    gap: 0.5rem;
}

.form-grid input,
.form-grid select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
    color: var(--text);
}

.form-grid input:focus,
.form-grid select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

#schedule-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

#schedule-table th,
#schedule-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

#schedule-table th {
    text-align: left;
    background: #f8fafc;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}

#schedule-table input[type="text"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: all 0.2s;
}

#schedule-table input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.ing-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.ing-table th {
    text-align: left;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    text-transform: uppercase;
}

.ing-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.ing-table tr:last-child td {
    border-bottom: none;
}

.ing-select,
.ing-qty,
.ing-unit {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: #fff;
}

.del-cell {
    color: var(--muted);
    font-size: 1.25rem;
    cursor: pointer;
    text-align: center;
    transition: color 0.2s;
    user-select: none;
}

.del-cell:hover {
    color: var(--danger);
}

.add-form {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: 0.75rem;
}

.add-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.add-row .ing-select {
    flex: 1;
    min-width: 150px;
}

.dish-form .form-actions {
    margin-top: 1rem;
}

/* Menu Editor Layout */
.menu-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
}

.mobile-tabs {
    display: none;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.tab-btn {
    flex: none;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    background: var(--panel-bg);
    border-radius: var(--pill);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    min-width: 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: background 0.15s, color 0.15s, border 0.15s;
}

.tab-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.schedule-panel,
.shopping-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.shopping-panel {
    height: fit-content;
    position: sticky;
    top: 6rem; /* Account for sticky header */
}

.menu-settings {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.menu-settings label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.menu-settings input {
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 130px;
}

.menu-settings input[type="number"] {
    width: 70px;
}

/* Menu Grid */
.menu-grid-editor {
    margin-bottom: 1.5rem;
}

.grid-header {
    display: flex;
    gap: 0.5rem;
    padding: 0.65rem 0;
    border-bottom: 2px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.grid-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.grid-row:hover {
    background: #f8fafc;
}

.grid-cell {
    flex: 1;
    min-width: 0;
}

.date-cell {
    flex: 0 0 70px;
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 500;
    display: flex;
    align-items: center;
}

.dish-cell {
    padding: 0.55rem 0.85rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.dish-cell:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dish-cell.empty {
    color: var(--muted);
    background: #f8fafc;
    border: 1px dashed var(--border);
    box-shadow: none;
    justify-content: center;
    cursor: pointer;
}

.dish-cell.empty:hover {
    background: #fff;
    border-color: var(--accent);
    color: var(--accent);
}

.dish-name {
    flex: 1;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dish-name:hover {
    color: var(--accent);
}

.dish-del {
    color: var(--muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.dish-del:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

/* Dish reordering arrows */
.dish-arrows {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-left: 0.25rem;
}

.dish-arrow {
    color: var(--muted);
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    padding: 0.1rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.dish-arrow:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

/* Drag and drop */
.dish-cell[draggable="true"] {
    cursor: grab;
}

.dish-cell.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.dish-cell.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Dish Search Modal */
.dish-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    z-index: 1000;
}

.dish-modal-content {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    transform: translateY(0);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.dish-modal-content input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.dish-modal-content .modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.dish-modal-content .modal-actions .button {
    flex: 1;
}

.dish-modal-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
}

.dish-modal-content li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.1s;
    border-bottom: 1px solid #f1f5f9;
}

.dish-modal-content li:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

/* Dish Detail Modal */
.dish-detail-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 1rem;
    z-index: 1100;
    overflow-y: auto;
}

.dish-detail-content {
    background: #fff;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    width: min(760px, 100%);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.detail-subtitle {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.detail-close-btn {
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
}

.detail-close-btn:hover {
    color: var(--danger);
}

.detail-quick-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.detail-quick-tags .quick-label {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-body {
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.detail-section h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.tag-manager {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: var(--pill);
    padding: 0.25rem 0.85rem;
    font-size: 0.85rem;
}

.tag-chip-remove {
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.tag-chip-remove:hover {
    color: var(--danger);
}

.tag-add-row,
.detail-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-add-row select,
.detail-add-row select,
.detail-add-row input {
    flex: 1;
    min-width: 140px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.detail-ingredients {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.detail-ing-row {
    display: grid;
    grid-template-columns: 2fr repeat(3, minmax(80px, 1fr)) auto;
    gap: 0.5rem;
    align-items: center;
}

.detail-ing-row select,
.detail-ing-row input {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.detail-ing-row .button {
    white-space: nowrap;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 900px) {
    .menu-layout {
        grid-template-columns: 1fr;
    }

    .mobile-tabs {
        display: flex;
        position: sticky;
        top: 4rem;
        z-index: 10;
        background: var(--bg);
        padding: 0.25rem 0;
    }

    .shopping-panel {
        position: static;
        order: -1; 
    }

    .shopping-panel.hidden {
        display: none;
    }
    
    .schedule-panel.hidden {
        display: none;
    }
}

@media (max-width: 640px) {
    .layout {
        padding: 0 0.75rem;
    }

    .dish-detail-modal {
        padding: 1rem 0.75rem;
        align-items: flex-start;
    }

    .dish-detail-content {
        width: 100%;
        border-radius: var(--radius-lg);
    }

    .detail-body {
        max-height: none;
    }

    html {
        font-size: 15px; /* Scale down slightly */
    }
    
    main.page {
        padding-top: 1.25rem;
    }
    
    .hero {
        padding: 1.75rem 1.25rem;
    }
    
    .date-cell {
        flex: 0 0 55px;
        font-size: 0.8rem;
    }
    
    .dish-cell {
        padding: 0.5rem;
    }
    
    .grid-row {
        gap: 0.25rem;
    }

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

    .tag-add-row,
    .detail-add-row {
        flex-direction: column;
    }

    .schedule-panel,
    .shopping-panel {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .menu-grid-editor {
        margin-bottom: 1rem;
    }
    
    .menu-card__header,
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .actions {
        flex-direction: column;
        width: 100%;
    }

    .button {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    body {
        overflow-x: hidden;
    }

    .site-header .layout {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .links {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .links a {
        margin-left: 0;
        flex: 1 1 auto;
        text-align: left;
    }

    .menu-settings {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .menu-settings label {
        width: 100%;
        display: flex;
        flex-direction: column;
        font-size: 0.9rem;
    }

    .menu-settings input {
        width: 100%;
        margin-top: 0.25rem;
    }

    .menu-grid-editor,
    .schedule-panel,
    .shopping-panel {
        margin-left: 0;
        margin-right: 0;
    }
}
