/* ==========================================================================
   Recipe & Costing Hub — Modern Culinary R&D Workspace Stylesheet
   ========================================================================== */

:root {
  --bg-app: #f4f5f7;
  --bg-sidebar: #14171f;
  --bg-sidebar-hover: #1e2330;
  --bg-sidebar-active: #2563eb;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-accent-soft: #eff6ff;
  --bg-amber-soft: #fffbeb;
  --bg-emerald-soft: #ecfdf5;
  
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-sidebar: #e2e8f0;
  --text-sidebar-muted: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --amber: #d97706;
  --emerald: #059669;
  --danger: #dc2626;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12);
  
  --sidebar-width: 380px;
  --font-sans: 'Prompt', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Main Split Layout: Compact Left Sidebar + Wide Right Content
   ========================================================================== */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Left Sidebar (Compact width + Auto-Hide Peek to Left Screen Edge) */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 40;
  user-select: none;
  position: relative;
  margin-left: calc(-1 * (var(--sidebar-width) - 18px));
  transition: margin-left 0.32s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.32s ease;
}

.sidebar:hover,
.sidebar:focus-within,
.sidebar.pinned {
  margin-left: 0;
  box-shadow: 8px 0 28px rgba(15, 23, 42, 0.25);
}

/* Peek Handle visible along the exposed right edge when sidebar is tucked away */
.sidebar-peek-handle {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  width: 24px;
  height: 96px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border-radius: 0 8px 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 3px 0 12px rgba(37, 99, 235, 0.45);
  cursor: pointer;
  z-index: 45;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.peek-arrow {
  font-size: 11px;
  line-height: 1;
}

.peek-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.sidebar:hover .sidebar-peek-handle,
.sidebar:focus-within .sidebar-peek-handle,
.sidebar.pinned .sidebar-peek-handle {
  opacity: 0;
  pointer-events: none;
}

.sidebar-pin-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sidebar-pin-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar-pin-btn.active {
  background: rgba(37, 99, 235, 0.35);
  border-color: #3b82f6;
  color: #fff;
}

.sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6 0%, #f59e0b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.brand-text p {
  font-size: 11px;
  color: var(--text-sidebar-muted);
}

/* Main 3 Topics Navigation */
.sidebar-section-label {
  padding: 14px 16px 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sidebar-muted);
  font-weight: 600;
}

.main-topics-nav {
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topic-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sidebar);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}

.topic-btn-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topic-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.topic-btn:hover {
  background-color: var(--bg-sidebar-hover);
  color: #fff;
}

.topic-btn.active {
  background-color: var(--bg-sidebar-active);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.topic-btn.active .topic-icon {
  background: rgba(255, 255, 255, 0.22);
}

.topic-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-weight: 600;
}

.topic-btn.active .topic-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Recipe Sub-navigation list inside Sidebar */
.sidebar-recipes-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-search-box {
  padding: 10px 12px 6px;
}

.sidebar-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.sidebar-search-input::placeholder {
  color: #64748b;
}

.sidebar-search-input:focus {
  border-color: #3b82f6;
  background: rgba(255, 255, 255, 0.11);
}

.sidebar-group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 12px 8px;
}

.group-chip {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.15s;
}

.group-chip:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.group-chip.active {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border-color: #3b82f6;
  font-weight: 600;
}

.recipe-sublist {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recipe-sublist::-webkit-scrollbar {
  width: 5px;
}

.recipe-sublist::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.recipe-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  gap: 6px;
}

.recipe-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.recipe-nav-item.active {
  background: rgba(37, 99, 235, 0.22);
  color: #60a5fa;
  font-weight: 600;
  border-left: 3px solid #3b82f6;
  padding-left: 7px;
}

.recipe-nav-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-size: 13px;
}

.recipe-nav-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  flex-shrink: 0;
}

.recipe-nav-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.recipe-nav-delete {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
}

.recipe-nav-item:hover .recipe-nav-delete {
  opacity: 1;
}

.recipe-nav-delete:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* Multi-select Bulk Delete Bar & Checkboxes */
.sidebar-bulk-bar {
  margin: 4px 12px 6px;
  padding: 7px 10px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
}

.bulk-select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #f8fafc;
  cursor: pointer;
  font-weight: 500;
}

.bulk-delete-confirm-btn {
  background: #dc2626;
  color: #ffffff;
  border: none;
  border-radius: 5px;
  padding: 4px 9px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.bulk-delete-confirm-btn:hover {
  background: #b91c1c;
}

.bulk-delete-confirm-btn:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: #64748b;
  cursor: not-allowed;
}

.recipe-select-checkbox {
  width: 15px;
  height: 15px;
  accent-color: #ef4444;
  cursor: pointer;
  flex-shrink: 0;
}

.recipe-nav-item.selected-for-delete {
  background: rgba(239, 68, 68, 0.16);
  border-left: 3px solid #ef4444;
  padding-left: 7px;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
}

.sidebar-footer-links {
  display: flex;
  gap: 6px;
}

.sidebar-link-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  font-size: 11px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: #cbd5e1;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.sidebar-link-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* ==========================================================================
   Right Content Area (Wide Workspace + Smooth Fade Motion)
   ========================================================================== */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

/* Top Action Bar */
.topbar {
  height: 58px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.breadcrumb-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--bg-accent-soft);
  color: var(--primary);
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.edit-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--emerald);
  background: var(--bg-emerald-soft);
  padding: 3px 10px;
  border-radius: 99px;
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Edit Lock Toggle Switch Widget */
.edit-lock-widget {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.edit-lock-widget:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}

.edit-lock-widget.unlocked {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.edit-lock-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.edit-lock-widget.unlocked .edit-lock-label {
  color: #047857;
}

.toggle-switch {
  width: 36px;
  height: 20px;
  border-radius: 99px;
  background: #94a3b8;
  position: relative;
  transition: background 0.22s ease;
}

.edit-lock-widget.unlocked .toggle-switch {
  background: #10b981;
}

.toggle-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.edit-lock-widget.unlocked .toggle-knob {
  transform: translateX(16px);
}

/* Read-Only State when Edit Toggle is OFF */
body.editing-locked .content-stage input,
body.editing-locked .content-stage textarea,
body.editing-locked .content-stage select {
  pointer-events: none;
  background-color: transparent !important;
}

body.editing-locked #nav-add-new,
body.editing-locked #btn-bulk-mode,
body.editing-locked .recipe-nav-delete,
body.editing-locked .gallery-delete-btn {
  display: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  transition: all 0.16s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

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

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

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

.btn-emerald:hover {
  background: #047857;
}

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

.btn-danger-ghost {
  color: var(--danger);
  border-color: transparent;
  background: transparent;
  padding: 5px 8px;
}

.btn-danger-ghost:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

/* Main Scrollable Content Stage with Fade Animation */
.content-stage {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 60px;
}

/* FADE MOTION ANIMATION WHEN SWITCHING TOPICS */
.fade-view {
  animation: topicFadeIn 0.36s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes topicFadeIn {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Cards & Section Containers
   ========================================================================== */
.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  overflow: hidden;
}

.section-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(to right, #ffffff, #f8fafc);
}

.section-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header-title h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.section-step-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.badge-report {
  background: #fef3c7;
  color: #b45309;
}

.badge-costing {
  background: #dbeafe;
  color: #1d4ed8;
}

.section-body {
  padding: 22px 24px;
}

/* ==========================================================================
   Editable Inputs & Contenteditable Styling
   ========================================================================== */
.editable-field,
[contenteditable="true"] {
  border-radius: 5px;
  transition: background-color 0.15s, box-shadow 0.15s;
  outline: none;
}

[contenteditable="true"]:hover {
  background-color: #f8fafc;
  box-shadow: 0 0 0 1px #cbd5e1;
}

[contenteditable="true"]:focus {
  background-color: #fffbeb;
  box-shadow: 0 0 0 2px #3b82f6;
  padding: 2px 4px;
}

.input-clean {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  padding: 5px 7px;
  border-radius: 5px;
  transition: all 0.15s;
}

.input-clean:hover {
  border-color: var(--border-strong);
  background: #f8fafc;
}

.input-clean:focus {
  outline: none;
  border-color: var(--primary);
  background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.input-bordered {
  width: 100%;
  border: 1px solid var(--border-color);
  background: #fff;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-main);
  padding: 7px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}

.input-bordered:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea.input-bordered {
  resize: vertical;
  min-height: 76px;
  line-height: 1.55;
}

/* ==========================================================================
   TOP SECTION: Report (Google Doc Style on top of Cost&Recipe)
   ========================================================================== */
.report-banner {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 2.6fr;
  gap: 18px;
  align-items: stretch;
}

.report-banner-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-banner-right {
  display: flex;
  flex-direction: column;
}

.report-banner-right textarea.input-bordered {
  flex: 1;
}

.report-meta-item label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.report-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.report-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.report-box h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.method-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.method-step-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

/* Photo Gallery in Report */
.report-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.gallery-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gallery-img-wrap {
  width: 100%;
  height: 155px;
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.gallery-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-step-num {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
}

.gallery-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.15s;
}

.gallery-card:hover .gallery-delete-btn {
  opacity: 1;
}

.gallery-caption {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  border-top: 1px solid var(--border-color);
  flex: 1;
}

/* ==========================================================================
   BOTTOM SECTION: Cost & Recipe Spreadsheet Table
   ========================================================================== */
.costing-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
  background: var(--bg-subtle);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 18px;
}

.meta-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 3px;
}

/* KPI Summary Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.kpi-card.highlight-blue {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #bfdbfe;
}

.kpi-card.highlight-emerald {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #a7f3d0;
}

.kpi-card.highlight-amber {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fde68a;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}

.sheet-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px 10px;
  border-bottom: 2px solid var(--border-strong);
  border-right: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}

.sheet-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  vertical-align: middle;
}

.sheet-table tr:hover td {
  background-color: #f8fafc;
}

.sheet-table .num-col {
  text-align: right;
  font-family: var(--font-mono);
}

.sheet-table .center-col {
  text-align: center;
}

.sheet-table .calc-cell {
  background-color: #f8fafc;
  color: #334155;
  font-weight: 600;
}

.sheet-table tfoot td {
  background: #f1f5f9;
  font-weight: 700;
  padding: 10px;
  border-top: 2px solid var(--border-strong);
}

/* Pricing & Allergen Footer Grid */
.costing-bottom-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.pricing-box, .allergen-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.pricing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border-color);
}

.pricing-row:last-child {
  border-bottom: none;
}

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 99px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.check-pill input:checked + span {
  font-weight: 700;
  color: var(--primary);
}

/* Lightbox & Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 1080px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: topicFadeIn 0.25s ease forwards;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .report-banner,
  .report-grid-2col,
  .costing-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .sidebar, .topbar, .no-print {
    display: none !important;
  }
  .workspace, .content-stage {
    height: auto;
    overflow: visible;
    padding: 0;
  }
  .section-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
}
