/* Light SaaS admin — neutral slate + indigo accent (no navy blue) */
:root {
  --page: #f1f5f9;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-soft: #eef2ff;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --sidebar-w: 15.5rem;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-brand .logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), #818cf8);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.sidebar-brand .brand-text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sidebar-nav {
  padding: 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-item svg {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-user {
  padding: 1rem;
  border-top: 1px solid var(--border-light);
  background: var(--surface-muted);
}

.sidebar-user .user-email {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.65rem;
  word-break: break-all;
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.breadcrumb strong {
  color: var(--text);
  font-weight: 600;
  font-size: 1.125rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-body {
  padding: 1.5rem;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.stat-card .stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card .stat-icon.recipes { background: #ede9fe; color: #7c3aed; }
.stat-card .stat-icon.categories { background: #dbeafe; color: #2563eb; }

.stat-card .label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.stat-card .value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}

.quick-actions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.quick-actions h2 {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.quick-actions .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Panel / table */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  background: var(--surface);
}

.panel-header .spacer { flex: 1; min-width: 0.5rem; }

.panel-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface-muted);
}

.search-wrap {
  position: relative;
  min-width: 12rem;
  max-width: 18rem;
  flex: 1;
}

.search-wrap svg {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap input,
.filter-select,
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin: 0;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-wrap input {
  padding-left: 2.35rem;
}

.search-wrap input:focus,
.filter-select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.filter-select {
  width: auto;
  min-width: 11rem;
  padding-right: 2rem;
}

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th {
  text-align: left;
  padding: 0.7rem 1rem;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: #fafbfc; }

.data-table .cell-title {
  font-weight: 500;
  color: var(--text);
}

.data-table .cell-muted { color: var(--text-muted); font-size: 0.8rem; }

.data-table .cell-actions { text-align: right; white-space: nowrap; }

.thumb {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: block;
}

.thumb-placeholder {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.65rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--surface-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding: 0.4rem;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-muted);
  color: var(--text);
}

.btn-icon { width: 2rem; height: 2rem; padding: 0; }

.btn-sm { padding: 0.38rem 0.7rem; font-size: 0.75rem; }

.action-group { display: inline-flex; gap: 0.15rem; }

/* Forms */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.form-section h3 {
  margin: 0 0 1.15rem;
  font-size: 0.95rem;
  font-weight: 600;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 1.25rem;
}

.form-grid .span-2 { grid-column: 1 / -1; }

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.field textarea { min-height: 5rem; resize: vertical; }

.field-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.media-preview {
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
}

.media-preview[hidden] { display: none !important; }

.media-preview img {
  max-width: 12rem;
  max-height: 8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--surface);
}

.media-preview .media-meta {
  flex: 1;
  min-width: 10rem;
}

.media-preview .media-url {
  font-size: 0.7rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-top: 0.35rem;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, #f8fafc 0%, #e2e8f0 100%);
}

.login-card {
  width: 100%;
  max-width: 26rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
  font-weight: 700;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.alert-error {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-success {
  background: var(--success-soft);
  border: 1px solid #a7f3d0;
  color: #047857;
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.loading-bar {
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
}

.loading-bar::after {
  content: '';
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  margin-left: 0.5rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-root[hidden] { display: none !important; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.modal-dialog.wide { max-width: 36rem; }

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 { margin: 0; font-size: 1rem; font-weight: 600; }

.modal-body { padding: 1.25rem; }

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: var(--surface-muted);
}

.muted { color: var(--text-muted); }
.text-right { text-align: right; }

.page-back { margin-bottom: 1rem; }

/* Page enter animation */
.page-body.page-enter { opacity: 0; transform: translateY(8px); }
.page-body.page-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in {
  animation: fadeInUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.page-intro { margin-bottom: 1.25rem; }
.page-intro h2 { margin: 0 0 0.35rem; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.page-intro p { margin: 0; color: var(--text-muted); font-size: 0.875rem; max-width: 42rem; }

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.mini-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.65rem 1rem;
  min-width: 7rem;
  box-shadow: var(--shadow-sm);
}
.mini-stat-label { display: block; font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }
.mini-stat-value { font-size: 1.15rem; font-weight: 700; color: var(--text); }

.view-toggle {
  display: inline-flex;
  padding: 0.2rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  gap: 0.15rem;
}
.view-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}
.view-toggle-btn:hover { color: var(--text); }
.view-toggle-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.view-toggle-btn:active { transform: scale(0.97); }

.panel-body-flush { padding: 0; }

.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: rgba(99, 102, 241, 0.2); }
.badge-muted { background: var(--surface-muted); color: var(--text-muted); }

/* Recipe grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  padding: 1rem;
}
.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.recipe-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.recipe-card-media {
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--surface-muted);
  overflow: hidden;
}
.recipe-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.recipe-card:hover .recipe-card-media img { transform: scale(1.04); }
.recipe-card-noimg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.recipe-card-body { padding: 0.85rem 1rem 1rem; }
.recipe-card-title {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.35;
  text-decoration: none;
}
.recipe-card-title:hover { color: var(--primary); }
.recipe-card-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-bottom: 0.65rem; }
.recipe-card-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* Categories split */
.split-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 17rem) 1fr;
  min-height: 20rem;
}
.tree-panel {
  border-right: 1px solid var(--border-light);
  background: var(--surface-muted);
  padding: 0.75rem;
  max-height: 32rem;
  overflow-y: auto;
}
.tree-panel-head {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.35rem 0.5rem 0.65rem;
}
.tree-node {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.15rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
  font: inherit;
}
.tree-node:hover { background: var(--surface); }
.tree-node.active {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}
.tree-node-name { font-weight: 500; font-size: 0.8125rem; color: var(--text); }
.tree-node-slug { font-size: 0.65rem; color: var(--text-muted); }
.split-main { min-width: 0; }
.context-banner {
  padding: 0.75rem 1rem;
  background: var(--primary-soft);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}

/* Ingredient groups */
.ing-groups-wrap { padding: 1rem; }
.ing-root-group {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.ing-root-title {
  margin: 0;
  padding: 0.85rem 1.15rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-light);
}
.ing-root-body { padding: 0.75rem 1rem 1rem; }
.ing-group-block {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 0.65rem;
  background: var(--surface-muted);
  overflow: hidden;
}
.ing-group-block summary {
  cursor: pointer;
  padding: 0.65rem 0.85rem;
  font-weight: 600;
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  list-style: none;
  transition: background 0.15s;
}
.ing-group-block summary::-webkit-details-marker { display: none; }
.ing-group-block summary:hover { background: var(--surface); }
.ing-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem 0.35rem;
}
.ing-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.ing-tag:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}
.ing-tag-del {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.15rem;
  font-size: 1rem;
  line-height: 1;
  border-radius: 4px;
}
.ing-tag-del:hover { color: var(--danger); background: var(--danger-soft); }
.ing-inline-add {
  display: flex;
  gap: 0.35rem;
  padding: 0 0.85rem 0.75rem;
}
.ing-inline-add input {
  flex: 1;
  margin: 0;
  padding: 0.4rem 0.65rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Modal animation */
.modal-root .modal-backdrop {
  opacity: 0;
  transition: opacity 0.22s ease;
}
.modal-root .modal-dialog {
  opacity: 0;
  transform: scale(0.96) translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-root.is-open .modal-backdrop { opacity: 1; }
.modal-root.is-open .modal-dialog {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.nav-item { transition: background 0.15s, color 0.15s, transform 0.12s; }
.nav-item:active { transform: scale(0.98); }

@media (prefers-reduced-motion: reduce) {
  .fade-in, .page-body.page-enter-active, .recipe-card, .recipe-card-media img,
  .modal-root .modal-dialog, .modal-root .modal-backdrop { animation: none; transition: none; }
}

/* Recipe composition editor (ingredients + steps, site-like preview) */
.recipe-compose-section .compose-hint { margin: 0 0 1rem; }
.recipe-compose-layout {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 340px);
  gap: 1.25rem;
  align-items: start;
}
.recipe-compose-edit { display: flex; flex-direction: column; gap: 1.25rem; }
.compose-block {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.compose-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.compose-block-head h4 { margin: 0; font-size: 0.9375rem; font-weight: 600; }
.ing-editor-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.ing-editor-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.ing-editor-table thead { background: var(--primary-soft); }
.ing-editor-table th {
  padding: 0.5rem 0.65rem;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
}
.ing-editor-table td { padding: 0.35rem 0.4rem; vertical-align: middle; border-top: 1px solid var(--border-light); }
.ing-editor-table input {
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.5rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.ing-editor-table .ing-amount { max-width: 5.5rem; }
.ing-editor-table .ing-unit { max-width: 6.5rem; }
.ing-row-actions { width: 2.5rem; text-align: center; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
}
.btn-danger-soft:hover { background: var(--danger-soft); color: var(--danger); }
.steps-editor { display: flex; flex-direction: column; gap: 0.85rem; }
.step-editor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
}
.step-editor-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.35rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
}
.step-editor-title { font-weight: 600; flex: 1; }
.step-editor-actions { display: flex; gap: 0.35rem; margin-left: auto; }
.step-tiptap-wrap {
  margin-bottom: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.step-tiptap-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0.45rem;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}
.ttp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  line-height: 1;
}
.ttp-btn:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.ttp-btn.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.ttp-sep {
  width: 1px;
  height: 1.25rem;
  background: var(--border);
  margin: 0 0.15rem;
}
.step-tiptap-editor .ProseMirror {
  min-height: 6.5rem;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.6;
  outline: none;
}
.step-tiptap-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--text-muted);
  pointer-events: none;
  height: 0;
}
.step-tiptap-editor .ProseMirror p { margin: 0.35em 0; }
.step-tiptap-editor .ProseMirror h2 { font-size: 1.05rem; font-weight: 700; margin: 0.5em 0 0.25em; }
.step-tiptap-editor .ProseMirror h3 { font-size: 0.95rem; font-weight: 600; margin: 0.45em 0 0.2em; }
.step-tiptap-editor .ProseMirror ul,
.step-tiptap-editor .ProseMirror ol { padding-left: 1.35rem; margin: 0.35em 0; }
.step-tiptap-editor .ProseMirror blockquote {
  margin: 0.35em 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--primary);
  color: var(--text-secondary);
}
.step-tiptap-editor .ProseMirror a { color: var(--primary); text-decoration: underline; }
.step-prose p { margin: 0.35em 0; }
.step-prose ul, .step-prose ol { padding-left: 1.35rem; margin: 0.35em 0; }
.step-prose h2 { font-size: 0.95rem; font-weight: 700; margin: 0.4em 0 0.2em; }
.step-prose h3 { font-size: 0.875rem; font-weight: 600; }
.step-prose blockquote {
  margin: 0.35em 0;
  padding-left: 0.65rem;
  border-left: 2px solid var(--primary);
  color: var(--text-secondary);
}
.step-prose a { color: var(--primary); }
.step-image-field label { font-size: 0.75rem; color: var(--text-secondary); }
.step-image-field input { margin-top: 0.25rem; }
.step-image-preview {
  margin-top: 0.5rem;
  max-width: 12rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.step-image-preview img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.recipe-compose-preview { position: sticky; top: 1rem; }
.preview-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.preview-panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  font-weight: 700;
}
.preview-accent {
  display: block;
  width: 2rem;
  height: 0.25rem;
  border-radius: 999px;
  background: var(--primary);
}
.preview-section { margin-bottom: 1.25rem; }
.preview-section:last-child { margin-bottom: 0; }
.preview-section h5 {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.preview-empty {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.preview-ing-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.preview-ing-table thead { background: var(--primary-soft); }
.preview-ing-table th, .preview-ing-table td { padding: 0.4rem 0.5rem; text-align: left; }
.preview-ing-table .preview-row-odd { background: var(--surface-muted); }
.preview-steps-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.preview-step-item { margin: 0; }
.preview-step-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; font-size: 0.8125rem; font-weight: 600; }
.preview-step-image {
  max-width: 100%;
  margin: 0.35rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.preview-step-image img { display: block; width: 100%; max-height: 8rem; object-fit: cover; }
.preview-step-text { margin: 0; font-size: 0.8125rem; line-height: 1.65; color: var(--text); white-space: pre-wrap; }

@media (max-width: 900px) {
  .app-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .form-grid { grid-template-columns: 1fr; }
  .split-layout { grid-template-columns: 1fr; }
  .tree-panel { max-height: 12rem; border-right: none; border-bottom: 1px solid var(--border); }
  .recipe-grid { grid-template-columns: 1fr; }
  .recipe-compose-layout { grid-template-columns: 1fr; }
  .recipe-compose-preview { position: static; }
}
