:root {
  --bg: #eef3f8;
  --bg-accent: #dbe7f3;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --text: #243447;
  --muted: #6f7f90;
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --success: #198754;
  --line: rgba(36, 52, 71, 0.08);
  --shadow: 0 22px 55px rgba(45, 76, 112, 0.12);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(13, 110, 253, 0.14), transparent 30%),
    linear-gradient(180deg, var(--bg-accent), var(--bg));
  min-height: 100vh;
}

body.modal-open {
  padding-right: 0 !important;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 1rem;
}

.app-topbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.app-topbar-layout {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.app-brand-block {
  flex-shrink: 0;
}

.app-topbar-actions {
  margin-left: auto;
  flex-shrink: 0;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d6efd, #72a7ff);
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 12px 28px rgba(13, 110, 253, 0.28);
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.92rem;
}

.app-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}



.section-copy,
.detail-meta,
.status-label {
  color: var(--muted);
}

.status-grid {
  display: grid;
  gap: 0.9rem;
}

.status-tile {
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.status-tile strong {
  display: block;
  font-size: 1.35rem;
  margin-top: 0.2rem;
}



.section-switcher {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  justify-content: center;
}

.section-link {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.2rem;
  font-weight: 800;
  transition: color 180ms ease, border-color 180ms ease;
}

.section-link:hover {
  color: var(--text);
}

.section-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.app-section {
  display: none;
}

.app-section.active {
  display: block;
}

.app-card {
  padding: 1.35rem;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.45rem;
  font-weight: 800;
}

.form-control,
.form-select,
.ts-control {
  border-radius: 16px !important;
  border-color: rgba(36, 52, 71, 0.12) !important;
  min-height: 48px;
  box-shadow: none !important;
}

.ts-control,
.ts-dropdown {
  border: 1px solid rgba(36, 52, 71, 0.12) !important;
}

.recipe-card {
  height: 100%;
  cursor: pointer;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

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

.recipe-card.active {
  outline: 2px solid rgba(13, 110, 253, 0.35);
}

.recipe-card .card-img-top {
  height: 220px;
  object-fit: cover;
  background: linear-gradient(135deg, #cbdcf2, #f5f9ff);
}

.recipe-card .placeholder-cover,
.detail-cover img[src=''] {
  background: linear-gradient(135deg, #d6e2f2, #f9fbff);
}

.recipe-card .card-body {
  padding: 1.1rem 1.1rem 1.2rem;
}

.recipe-title {
  font-size: 1.12rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.recipe-snippet {
  color: var(--muted);
  min-height: 3rem;
}

.chip-list,
.tag-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.08);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.92rem;
}

.chip-action {
  border: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.chip-action:hover {
  background: rgba(13, 110, 253, 0.14);
  transform: translateY(-1px);
}

.chip-action:active {
  transform: translateY(0);
}

.detail-card {
  position: sticky;
  top: 96px;
}

.empty-panel {
  min-height: 420px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  gap: 0.75rem;
}

.empty-panel i {
  font-size: 2.2rem;
}

.detail-cover {
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(135deg, #d6e2f2, #f9fbff);
}

.detail-cover img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 800;
}

.detail-block {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.detail-block h4 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
}

.detail-notes {
  position: relative;
  min-height: 2.5rem;
  padding: 0.35rem 2.15rem 0.35rem 0.5rem;
  border-radius: 8px;
  white-space: pre-wrap;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath fill='%23212529' d='M5 20.5V24h3.5L20.06 12.44l-3.5-3.5L5 20.5Zm17.77-10.77c.37-.37.37-.96 0-1.33L20.6 6.23a.94.94 0 0 0-1.33 0l-1.7 1.7 3.5 3.5 1.7-1.7Z'/%3E%3C/svg%3E") 4 24, pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.detail-notes:hover,
.detail-notes:focus {
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--line);
}

.detail-notes::after {
  position: absolute;
  right: 0.65rem;
  top: 0.45rem;
  color: var(--muted);
  font-family: "bootstrap-icons";
  font-size: 1rem;
  line-height: 1;
  content: "\F4CA";
  opacity: 0;
  transition: opacity 0.15s ease;
}

.detail-notes:hover::after,
.detail-notes:focus::after {
  opacity: 1;
}

.ingredient-list,
.stack-list {
  display: grid;
  gap: 0.8rem;
}

.ingredient-item,
.stack-item {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0.95rem 1rem;
}

.ingredient-item strong,
.stack-item strong {
  display: block;
}

.ingredient-edit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.ingredient-edit-row__name {
  flex: 1 1 140px;
  min-width: 0;
}

.ingredient-edit-row__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 0 1 auto;
}

.ingredient-edit-row .ingredient-qty {
  width: 6.5rem;
  min-width: 5rem;
}

.ingredient-edit-row .ingredient-misura {
  width: 7.5rem;
  min-width: 5.5rem;
}

.stack-item .meta-line,
.ingredient-item .meta-line {
  color: var(--muted);
  font-size: 0.92rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.photo-grid img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 18px;
  background: linear-gradient(135deg, #d6e2f2, #f9fbff);
}

.photo-upload-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.status-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sync-tip {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: rgba(13, 110, 253, 0.08);
  color: var(--primary-dark);
}

.sync-tip i {
  font-size: 1.2rem;
}

.modal-content {
  box-shadow: 0 28px 60px rgba(36, 52, 71, 0.22);
}

@media (max-width: 1199.98px) {
  .app-topbar-layout {
    gap: 0.75rem;
  }

  .section-switcher {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 0.2rem;
    scrollbar-width: thin;
  }

  .section-link {
    flex: 0 0 auto;
  }

  .detail-card {
    position: static;
  }
  
  #recipesMasterDetail:not(.viewing-detail) #recipesDetailView {
    display: none;
  }

  #recipesMasterDetail.viewing-detail #recipesMasterView {
    display: none;
  }
}

@media (max-width: 767.98px) {
  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-topbar-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .photo-grid {
    grid-template-columns: 1fr 1fr;
  }

  .brand-subtitle {
    display: none;
  }
}

/* ── Home / Landing ─────────────────────────────────────────────── */

.home-hero {
  display: flex;
  justify-content: center;
  padding: 3.5rem 1rem 3rem;
}

.home-hero-body {
  max-width: 640px;
  text-align: center;
}

.home-hero-icon {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d6efd, #72a7ff);
  color: #fff;
  font-size: 2.4rem;
  box-shadow: 0 16px 40px rgba(13, 110, 253, 0.3);
  margin-bottom: 1.5rem;
}

.home-hero-title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.home-hero-lead {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 0;
}

.home-feature-card {
  text-align: center;
}

.home-feature-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.home-feature-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.home-feature-copy {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0;
}

.home-step-num {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.65rem;
}

.home-step-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.home-download-card {
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.06), rgba(114, 167, 255, 0.08));
}
