/* ==========================================================================
   Recipe Citadel — design tokens
   Values ported from the Claude Design source (Recipe Citadel.dc.html).
   ========================================================================== */

:root {
    --bg: oklch(97% 0.008 250);
    --surface: oklch(99% 0.004 250);
    --surface-sunken: oklch(97% 0.006 250);
    --surface-hover: oklch(96% 0.006 250);
    --row-hover: oklch(98% 0.008 250);

    --border: oklch(90% 0.008 250);
    --border-strong: oklch(88% 0.008 250);
    --border-faint: oklch(93% 0.006 250);

    --text: oklch(22% 0.02 60);
    --text-body: oklch(26% 0.02 60);
    --text-soft: oklch(32% 0.02 60);
    --muted: oklch(50% 0.02 60);
    --muted-strong: oklch(55% 0.02 60);
    --muted-faint: oklch(65% 0.02 60);
    --sep: oklch(75% 0.01 60);

    --accent: #6366f1;
    --accent-dark: #4f46e5;
    --accent-deep: #4338ca;
    --accent-tint: #e0e7ff;
    --accent-tint-strong: #c7d2fe;
    --accent-soft: #818cf8;
    --danger: #b91c1c;

    --shadow-card: 0 10px 24px oklch(20% 0.02 60 / 12%);
    --shadow-panel: 0 10px 30px oklch(20% 0.02 60 / 18%);
    --shadow-toast: 0 6px 20px oklch(20% 0.02 60 / 25%);
    --focus-ring: 3px solid oklch(70% 0.14 275 / 25%);

    --radius-card: 14px;
    --radius-ctl: 8px;
    --radius-sm: 6px;

    --maxw-list: 1180px;
    --maxw-view: 900px;
    --maxw-editor: 820px;
    --pad-x: 32px;

    --font-ui: 'Work Sans', system-ui, -apple-system, sans-serif;
    --font-display: 'Spectral', Georgia, serif;

    --ease-logo: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent-dark);
    text-decoration: none;
}

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

::selection {
    background: var(--accent-soft);
    color: #fff;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    margin: 0;
}

main {
    flex: 1;
    width: 100%;
    max-width: var(--maxw-list);
    margin: 0 auto;
    padding: 28px var(--pad-x) 80px;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
}

input,
select,
textarea,
button {
    font-family: inherit;
}

input[type="text"],
input[type="number"],
textarea,
select {
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-ctl);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    border-color: var(--accent);
    outline: var(--focus-ring);
}

.icon {
    flex-shrink: 0;
}

[data-scroll-row] {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

[data-scroll-row]::-webkit-scrollbar {
    display: none;
}

/* `revert` restores each element's own default display (block for div,
   inline for span) rather than forcing everything inline. */
.desktop-only { display: revert; }
.mobile-only { display: none; }

/* Explicit display rules below would otherwise defeat the hidden attribute. */
[hidden] { display: none !important; }

/* ==========================================================================
   Header
   ========================================================================== */

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

.header-content {
    max-width: var(--maxw-list);
    margin: 0 auto;
    padding: 0 var(--pad-x);
    display: flex;
    align-items: stretch;
    gap: 30px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 3px 0;
    color: var(--text);
    transition: padding 0.35s var(--ease-logo);
}

.site-logo:hover {
    color: var(--text);
}

.site-logo img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 3px 5px oklch(20% 0.02 260 / 15%));
    transition:
        width 0.35s var(--ease-logo),
        height 0.35s var(--ease-logo),
        filter 0.35s ease;
}

.site-header.scrolled .site-logo {
    padding: 11px 0;
}

.site-header.scrolled .site-logo img {
    width: 36px;
    height: 36px;
    filter: none;
}

.site-logo h1 {
    font-size: 20px;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    margin: 0;
}

/* Course tabs */

.course-tabs {
    display: flex;
    gap: 22px;
    flex-shrink: 0;
}

.course-tab {
    display: flex;
    align-items: center;
    padding: 16px 0;
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 500;
    color: oklch(46% 0.02 60);
    cursor: pointer;
    white-space: nowrap;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

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

.course-tab.is-active {
    font-weight: 600;
    color: var(--accent-dark);
}

/* Header right cluster */

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-search {
    position: relative;
}

.search-input-wrapper {
    position: relative;
    width: 210px;
    min-width: 130px;
}

.search-input-wrapper .icon-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-strong);
    pointer-events: none;
}

#search {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border-radius: var(--radius-ctl);
    border: 1px solid var(--border);
    background: var(--surface-sunken);
    font-size: 14.5px;
}

#search:focus {
    background: #fff;
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-ctl);
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.header-icon-btn:hover {
    background: var(--surface-hover);
    color: var(--text-soft);
}

.header-icon-btn-accent {
    border: none;
    background: var(--accent);
    color: #fff;
}

.header-icon-btn-accent:hover {
    background: var(--accent-dark);
    color: #fff;
}

.search-toggle-btn,
.search-close-btn {
    display: none;
}

/* Search dropdown */

.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-ctl);
    box-shadow: var(--shadow-panel);
    max-height: 320px;
    overflow-y: auto;
    z-index: 30;
}

.search-dropdown.open {
    display: block;
}

.search-dropdown li {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
}

.search-dropdown li a {
    color: inherit;
    display: block;
}

.search-dropdown li:hover,
.search-dropdown li.highlighted {
    background: var(--accent-tint);
    color: var(--accent-deep);
}

/* ==========================================================================
   List view — filters
   ========================================================================== */

.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.filter-row-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    margin-top: -2px;
    flex-shrink: 0;
    color: var(--muted-strong);
}

.filter-chips {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    scroll-behavior: smooth;
    flex: 1;
    min-width: 0;
}

.filter-row[data-filter-key="effort"] .filter-chips {
    flex: 0 1 auto;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 0 0 4px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 400;
    color: oklch(48% 0.02 60);
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    text-transform: lowercase;
}

.filter-chip:hover {
    color: var(--text);
}

.filter-chip.is-active {
    font-weight: 600;
    color: var(--accent-dark);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.clear-filters-btn {
    margin-left: auto;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: var(--muted-strong);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.clear-filters-btn:hover {
    color: var(--text);
}

.result-count {
    font-size: 13px;
    font-style: italic;
    color: var(--muted-strong);
    margin: 8px 0 20px;
}

.empty-state {
    color: var(--muted);
    padding: 40px 0;
    text-align: center;
}

/* ==========================================================================
   List view — recipe cards
   ========================================================================== */

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
}

.recipe-card {
    position: relative;
    border-radius: var(--radius-card);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid oklch(91% 0.008 250);
    transition: transform 0.15s, box-shadow 0.15s;
}

.recipe-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

.recipe-card-link {
    display: block;
    color: inherit;
}

.recipe-card-link:hover {
    color: inherit;
}

.recipe-card-body {
    padding: 14px 16px 16px;
}

.recipe-card-title {
    display: block;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}

.recipe-card-meta {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--muted);
    text-transform: lowercase;
}

.recipe-card-meta .meta-sep {
    margin: 0 3px;
    color: var(--sep);
}

.recipe-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
}

.recipe-card-actions form {
    margin: 0;
    display: flex;
}

.card-action-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: none;
    background: oklch(99% 0.004 250 / 92%);
    color: var(--text-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.card-action-btn:hover {
    background: #fff;
    color: var(--accent-dark);
}

/* Photo placeholders — stand-ins until Recipe gains an image field.
   Sizes match the design's image-slot dimensions exactly. */

.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-sunken);
    border: 1px dashed var(--border-strong);
    color: var(--muted-faint);
    font-size: 12px;
    text-align: center;
    overflow: hidden;
    flex-shrink: 0;
}

.photo-card {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-width: 0 0 1px 0;
    border-radius: 0;
}

.photo-view {
    width: 120px;
    height: 120px;
    border-radius: 12px;
}

.photo-editor {
    width: 130px;
    height: 130px;
    border-radius: 12px;
}

/* Pagination */

.pagination-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination-label {
    font-size: 12.5px;
    font-style: italic;
    color: var(--muted-strong);
    margin-right: 4px;
}

.pagination-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: oklch(35% 0.02 60);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--surface-hover);
}

.pagination-btn:disabled {
    cursor: default;
    opacity: 0.35;
}

/* ==========================================================================
   Recipe view
   ========================================================================== */

main:has(.recipe) {
    max-width: var(--maxw-view);
    padding-top: 32px;
    padding-bottom: 100px;
}

.recipe-header {
    display: flex;
    gap: 22px;
    align-items: flex-end;
}

.recipe-header-main {
    flex: 1;
    min-width: 0;
}

.recipe-title {
    font-size: 30px;
    line-height: 1.15;
    margin: 0 0 10px;
}

.recipe-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.recipe-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    font-size: 13.5px;
    color: var(--muted);
    text-transform: lowercase;
}

.recipe-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.recipe-meta .meta-sep {
    font-size: 16px;
    line-height: 1;
    color: var(--sep);
}

.recipe-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: oklch(35% 0.02 60);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.action-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.action-btn.active {
    background: var(--accent-tint);
    border-color: var(--accent-tint-strong);
    color: var(--accent-deep);
}

.recipe-divider {
    margin: 22px 0 26px;
}

.recipe-columns {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 44px;
}

.recipe-columns > section {
    min-width: 0;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted-strong);
    margin: 18px 0 8px;
}

.ingredients .section-label:first-of-type,
.instructions .section-label {
    margin-top: 0;
}

.instructions .section-label {
    margin-bottom: 12px;
}

.servings-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: 13.5px;
    color: oklch(40% 0.02 60);
}

.servings-control strong {
    color: var(--text);
    font-weight: 600;
}

.servings-btn {
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: oklch(35% 0.02 60);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 0;
}

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

.ingredients ul {
    margin: 0;
    padding-left: 18px;
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-body);
}

.ingredients li.done {
    text-decoration: line-through;
    color: var(--muted-faint);
}

.instructions ol {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.instructions li {
    font-size: 15px;
    line-height: 1.65;
    color: oklch(24% 0.02 60);
}

.instructions li.done {
    text-decoration: line-through;
    color: var(--muted-faint);
}

/* Per-step ingredient sub-lists (injected by step-ingredients.js) */

.step-ingredients {
    list-style: none;
    padding-left: 4px;
    margin: 6px 0 0;
    font-size: 12.5px;
    color: var(--muted-strong);
}

.step-ingredients li {
    padding: 1px 0;
    font-size: inherit;
    line-height: 1.4;
    color: inherit;
}

.step-ingredients li::before {
    content: "●";
    margin-right: 6px;
    font-size: 8px;
    vertical-align: middle;
}

/* Notes */

.notes {
    margin-top: 34px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.notes-content {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-soft);
}

.notes-content p {
    margin: 0 0 10px;
}

.notes-content ul,
.notes-content ol {
    margin: 0 0 10px;
    padding-left: 20px;
}

.notes-content table {
    border-collapse: collapse;
    font-size: 13px;
    margin: 0 0 10px;
}

.notes-content th {
    text-align: left;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-strong);
    color: oklch(45% 0.02 60);
    font-weight: 600;
}

.notes-content td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-faint);
    color: oklch(30% 0.02 60);
}

/* Mobile actions dropdown */

.actions-dropdown {
    position: relative;
    margin-left: auto;
}

.actions-toggle {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.actions-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 190px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-ctl);
    box-shadow: var(--shadow-panel);
    padding: 4px;
    z-index: 30;
}

.actions-dropdown.open .actions-dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-soft);
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* ==========================================================================
   Editor
   ========================================================================== */

main:has(.editor-title) {
    max-width: var(--maxw-editor);
    padding-top: 32px;
    padding-bottom: 100px;
}

.editor-title {
    font-size: 30px;
    margin: 0 0 20px;
}

.editor-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 22px 24px;
    margin-bottom: 20px;
    background: var(--surface);
}

.editor-section-label {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted-strong);
    margin-bottom: 14px;
}

.editor-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.editor-section-head .editor-section-label {
    margin-bottom: 0;
}

.basics-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.basics-fields {
    flex: 1;
    min-width: 0;
}

.title-input {
    width: 100%;
    font-family: var(--font-display);
    font-size: 25px;
    font-weight: 600;
    border: none;
    border-bottom: 2px solid var(--border);
    border-radius: 0;
    padding: 4px 0 10px;
    background: transparent;
    margin-bottom: 14px;
}

.title-input:focus-visible {
    outline: none;
    border-bottom-color: var(--accent);
}

.field-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.field-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12.5px;
    color: var(--muted);
}

.field-label-grow {
    flex: 1;
    min-width: 160px;
}

.field-select,
.field-input {
    font: inherit;
    font-size: 14px;
    padding: 7px 10px;
    border-radius: var(--radius-ctl);
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

.field-input-xs { width: 70px; }
.field-input-sm { width: 80px; }
.field-label-grow .field-input { width: 100%; }

/* Ingredient / instruction rows */

.ingredients-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
}

.ingredient-section {
    min-width: 0;
}

.subsection-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.subsection-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

.subsection-tools {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-btn {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--accent-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.tool-btn:hover {
    background: var(--accent-tint);
}

.tool-btn.is-open {
    background: var(--accent-tint);
    border-color: var(--accent-tint-strong);
}

.info-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--border);
    color: var(--muted-strong);
    font-size: 10px;
    font-weight: 600;
    cursor: help;
    position: relative;
}

.info-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: 220px;
    padding: 8px 10px;
    background: #1e293b;
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
    z-index: 40;
}

.bulk-editor {
    margin-bottom: 10px;
}

.bulk-editor textarea {
    width: 100%;
    font: inherit;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: var(--radius-ctl);
    border: 1px solid var(--border);
    resize: vertical;
}

.ingredient-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}

.instruction-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.ingredient-row.dragging,
.instruction-row.dragging {
    opacity: 0.4;
}

.ingredient-row.drag-over,
.instruction-row.drag-over {
    box-shadow: inset 0 2px 0 var(--accent);
}

.drag-handle {
    cursor: grab;
    touch-action: none;
    color: var(--muted-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 22px;
    flex-shrink: 0;
    user-select: none;
}

.instruction-row .drag-handle {
    height: 26px;
    margin-top: 4px;
}

.ing-qty,
.ing-unit,
.ing-name {
    font: inherit;
    font-size: 13px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.ing-qty { width: 46px; }
.ing-unit { width: 58px; padding: 6px 4px; background: #fff; }
.ing-name { flex: 1; min-width: 0; }

.step-num {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: var(--accent-tint);
    color: var(--accent-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 4px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.instruction-input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 14px;
    padding: 8px 10px;
    border-radius: var(--radius-ctl);
    border: 1px solid var(--border);
    resize: vertical;
}

.row-remove-btn {
    background: none;
    border: none;
    color: var(--muted-faint);
    cursor: pointer;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instruction-row .row-remove-btn {
    align-self: flex-start;
    padding: 6px 2px;
    margin-top: 8px;
}

.row-remove-btn:hover {
    color: var(--danger);
}

#notes {
    width: 100%;
    font: inherit;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-ctl);
    border: 1px solid var(--border);
    resize: vertical;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 20px;
    border-radius: 10px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.btn-sm {
    padding: 6px 14px;
    border-radius: var(--radius-ctl);
    font-size: 12.5px;
}

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

.btn-primary:hover {
    background: var(--accent-dark);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: oklch(45% 0.02 60);
}

.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-danger {
    background: transparent;
    border-color: var(--border);
    color: var(--danger);
    margin-right: auto;
}

.btn-danger:hover {
    background: oklch(95% 0.03 25);
    color: var(--danger);
}

.editor-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

/* EasyMDE, restyled to the token palette */

.EasyMDEContainer .CodeMirror {
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-ctl) var(--radius-ctl);
    background: #fff;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
}

.editor-toolbar {
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-ctl) var(--radius-ctl) 0 0;
    background: var(--surface-sunken);
    opacity: 1;
}

.editor-toolbar button {
    color: var(--text-soft) !important;
    border: none !important;
}

.editor-toolbar button:hover,
.editor-toolbar button.active {
    background: var(--accent-tint) !important;
    color: var(--accent-deep) !important;
}

.editor-statusbar {
    color: var(--muted);
    font-size: 11.5px;
}

.EasyMDEContainer .CodeMirror-cursor {
    border-color: var(--accent);
}

/* ==========================================================================
   Timers (timers.js)
   ========================================================================== */

.timer-link {
    text-decoration: underline;
    text-decoration-style: dashed;
    text-decoration-color: var(--accent-soft);
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    cursor: pointer;
    border-radius: 3px;
    padding: 0 2px;
    color: var(--accent-deep);
    background: var(--accent-tint);
}

.timer-link.timer-active {
    text-decoration-style: solid;
    text-decoration-color: var(--accent);
    background: var(--accent-tint-strong);
    font-weight: 600;
}

#timer-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-panel);
    z-index: 40;
    overflow: hidden;
    font-size: 13px;
}

.timer-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: var(--accent-tint);
    color: var(--accent-deep);
    cursor: grab;
    user-select: none;
}

.timer-panel-header.dragging {
    cursor: grabbing;
}

.timer-panel-list {
    max-height: 210px;
    overflow-y: auto;
}

.timer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
}

.timer-row.timer-warning { background: oklch(96% 0.04 100); }
.timer-row.timer-critical { background: oklch(94% 0.06 85); }
.timer-row.timer-urgent { background: oklch(92% 0.07 45); }
.timer-row.timer-done { background: oklch(90% 0.09 25); }

.timer-row-context {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px;
}

.timer-row-countdown {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 48px;
    text-align: right;
}

.timer-panel-close,
.timer-row-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 0 2px;
    line-height: 1;
    font-size: 15px;
}

/* ==========================================================================
   Toast
   ========================================================================== */

.sync-toast {
    display: none;
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-ctl);
    font-size: 13.5px;
    z-index: 50;
    box-shadow: var(--shadow-toast);
}

.sync-toast.show {
    display: block;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    :root {
        --pad-x: 18px;
    }

    .desktop-only { display: none !important; }
    .mobile-only { display: revert; }

    .header-content {
        gap: 14px;
        flex-wrap: wrap;
    }

    .course-tabs {
        order: 3;
        width: 100%;
        gap: 16px;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .course-tabs::-webkit-scrollbar { display: none; }

    .course-tab { padding: 8px 0; }

    .site-logo img { width: 40px; height: 40px; }
    .site-header.scrolled .site-logo img { width: 32px; height: 32px; }

    /* Search collapses behind a toggle button */
    .search-toggle-btn { display: flex; }

    .header-search {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: 10px var(--pad-x);
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border);
        gap: 8px;
        align-items: center;
    }

    .header-search.open { display: flex; }

    .search-input-wrapper { width: auto; flex: 1; }

    .search-close-btn { display: flex; }

    .recipe-columns {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .recipe-header {
        gap: 16px;
    }

    .photo-view { width: 84px; height: 84px; }

    .basics-layout { flex-direction: column; }

    .ingredients-columns { grid-template-columns: 1fr; gap: 22px; }

    #timer-panel {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
    }
}

@media (max-width: 560px) {
    .recipe-grid {
        grid-template-columns: 1fr;
    }

    .recipe-title { font-size: 24px; }

    .editor-title { font-size: 24px; }

    .filter-row[data-filter-key="effort"] .filter-chips { flex: 1; }

    .editor-section { padding: 18px 16px; }

    .field-grid { gap: 10px; }

    .field-label-grow { min-width: 100%; }

    .editor-actions { flex-wrap: wrap; }
}

.time-unit-short { display: none; }

@media (max-width: 560px) {
    .time-unit-full { display: none; }
    .time-unit-short { display: inline; }
}
