:root {
  --ink: #292524;
  --muted: #78716c;
  --line: #e7e5e4;
  --bg: #f3efe6;
  --bg-wash: radial-gradient(1200px 600px at 10% -10%, #fde8d0 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #dcefe8 0%, transparent 50%),
    #f3efe6;
  --accent: #c2410c;
  --accent-deep: #9a3412;
  --blue-dot: #2563eb;
  --card-anchor: #fff8ef;
  --card-summary: #eef7f2;
  --card-timeline: #fffdf8;
  --oven: #ffedd5;
  --skip: #f5f5f4;
  --branch: #1c1917;
  --leaf-a: #fff1e6;
  --leaf-b: #e8f3ee;
  --leaf-center: #fff8ef;
}

html, body {
  background: var(--bg-wash);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

h1, h2, .brand, .node-title .name {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

input, button, select, textarea {
  font-size: 16px;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.top-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.35rem 0.45rem;
  max-width: min(22rem, 52vw);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.15;
  color: var(--accent-deep);
  text-decoration: none;
  white-space: nowrap;
}

.brand-platform {
  font-style: italic;
  letter-spacing: -0.01em;
}

.brand-plus {
  font-style: normal;
  font-weight: 700;
}

.brand-product {
  font-style: normal;
  font-weight: 650;
  color: var(--ink);
}

.brand-ai {
  display: inline-block;
  margin-left: 0.05rem;
  font-size: 0.62em;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.02em;
  color: var(--accent);
  transform: translateY(-0.55em);
  line-height: 1;
}

.brand--hero {
  max-width: none;
  font-size: clamp(1.35rem, 3.4vw, 1.85rem);
  color: #fffdf8;
  gap: 0.4rem 0.55rem;
}

.brand--hero .brand-product {
  color: #fffdf8;
}

.brand--hero .brand-ai {
  color: #fdba74;
  font-size: 0.58em;
  transform: translateY(-0.62em);
}

.top-nav {
  gap: 0.45rem;
  margin-left: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
}

.top-nav .nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 0.3rem 0.4rem;
  font-size: 0.92rem;
  white-space: nowrap;
}

.top-nav .nav-link.active {
  color: var(--accent);
  font-weight: 600;
}

.badge-soon {
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  margin-left: 0.25rem;
}

.top-auth {
  margin-left: auto;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.4rem;
}

.lang-picker {
  display: inline-flex;
  align-items: center;
}

.lang-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.lang-picker-btn:hover {
  border-color: #d6d3d1;
  color: var(--accent-deep);
}

.lang-picker-icon {
  display: inline-flex;
  color: var(--accent);
}

.top-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  line-height: 0;
}

.top-icon-btn:hover {
  border-color: #d6d3d1;
  color: var(--accent-deep);
}

.site-dialog {
  max-width: 26rem;
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--ink);
}

.site-dialog::backdrop {
  background: rgba(41, 37, 36, 0.45);
}

.lang-dialog {
  max-width: min(22rem, calc(100vw - 2rem));
  width: 100%;
  overflow: hidden;
}

.lang-dialog-form {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.lang-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.lang-dialog-title {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink);
}

.lang-dialog-close {
  margin: 0;
  padding: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.lang-dialog-close:hover {
  color: var(--ink);
  background: rgba(41, 37, 36, 0.06);
}

.lang-dialog-list {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
  max-height: min(22rem, 60vh);
  overflow-y: auto;
}

.lang-dialog-option {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  width: 100%;
  margin: 0;
  padding: 0.75rem 1.1rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: start;
  font: inherit;
  cursor: pointer;
}

.lang-dialog-option:hover:not(:disabled) {
  background: rgba(194, 65, 12, 0.08);
}

.lang-dialog-option.is-active {
  background: rgba(194, 65, 12, 0.12);
}

.lang-dialog-option:disabled {
  cursor: default;
}

.lang-dialog-native {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.lang-dialog-english {
  font-size: 0.78rem;
  color: var(--muted);
}

.lang-dialog-badge {
  margin-inline-start: auto;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-deep);
}



.main-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
  min-height: 0;
}

.main-content--home {
  max-width: none;
  padding: 0 0 1.5rem;
}

/* Full-bleed recipe designer (page scrolls like Planner; board is not a nested scroller). */
.main-content:has(.td-shell) {
  max-width: none;
  padding: 0;
  flex: 0 0 auto;
}

/* Full-bleed AI Chef landing so ai_chef.png can span the main column. */
.main-content:has(.ai-chef-page) {
  max-width: none;
  padding: 0;
}

/* ── Site ad / partner banner ─────────────────────────────────────────────── */

.site-ad-banner {
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(194, 65, 12, 0.10), transparent 52%),
    linear-gradient(180deg, #fff8ef 0%, #fde8d0 100%);
  color: var(--ink);
}

.site-ad-banner-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem 1.5rem;
  width: 100%;
  margin: 0;
  padding: 0.85rem 1.25rem 0.85rem max(1rem, calc((100% - 1080px) / 2));
  min-height: 6.5rem;
  box-sizing: border-box;
}

.site-ad-banner-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 1.25rem;
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 0.5rem;
}

.site-ad-banner-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.site-ad-banner-text {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}

.site-ad-banner-mail {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.site-ad-banner-mail:hover,
.site-ad-banner-mail:focus-visible {
  color: var(--ink);
}

.site-ad-banner-image {
  display: block;
  flex: 0 0 auto;
  align-self: center;
  height: 5.75rem;
  width: auto;
  max-width: min(280px, 48vw);
  object-fit: contain;
  object-position: right center;
  margin-left: auto;
  margin-right: 0;
  border-radius: 0.45rem;
  opacity: 1;
}

@media (max-width: 640px) {
  .site-ad-banner-inner {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.75rem;
    min-height: 0;
  }

  .site-ad-banner-copy {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem 0.55rem;
    min-width: 0;
  }

  .site-ad-banner-kicker {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
  }

  .site-ad-banner-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.72rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .site-ad-banner-image {
    flex: 0 0 auto;
    height: 2.6rem;
    max-width: 4.75rem;
    margin-left: 0;
  }
}

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: transparent;
  padding: 1.35rem 1.25rem 1.5rem;
  color: var(--muted);
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.footer-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.footer-top-row .footer-links {
  margin: 0;
}

.site-footer .pwa-install-button {
  flex-shrink: 0;
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.footer-links a {
  color: var(--accent-deep);
  text-decoration: none;
  border-bottom: 1px solid rgba(154, 52, 18, 0.28);
}

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

.footer-copyright {
  margin-top: 0.55rem !important;
  font-size: 0.82rem !important;
  color: rgba(120, 113, 108, 0.9);
}

.pwa-install-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(194, 65, 12, 0.28);
  border-radius: 999px;
  background: #fff7ed;
  color: var(--accent-deep);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}

.pwa-install-button:hover {
  background: #ffedd5;
}

.pwa-install-glyph {
  font-size: 0.95rem;
  line-height: 1;
}

.pwa-help-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(41, 37, 36, 0.45);
}

.pwa-help-card {
  width: min(100%, 26rem);
  background: #fffdf8;
  border-radius: 16px 16px 12px 12px;
  padding: 1rem 1rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.pwa-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.pwa-help-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--accent-deep);
}

.pwa-help-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: #f5f5f4;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.pwa-help-steps {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.pwa-help-steps li + li {
  margin-top: 0.45rem;
}

.pwa-help-text {
  margin: 0 0 1rem;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.pwa-help-done {
  width: 100%;
}

@media (min-width: 480px) {
  .pwa-help-backdrop {
    align-items: center;
  }

  .pwa-help-card {
    border-radius: 16px;
  }
}

.mobile-tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 253, 248, 0.96);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 40;
  /* Keep taps on the tab bar from falling through to page content underneath. */
  pointer-events: auto;
  touch-action: manipulation;
  /* Own compositor layer — reduces iOS “dead first tap after scroll” on fixed bars. */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.mobile-tab-bar a {
  text-align: center;
  padding: 0.75rem 0.25rem;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* Larger hit target without changing visual size much. */
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-tab-bar a.active {
  color: var(--accent);
  font-weight: 600;
}

.planner-header {
  margin-bottom: 1rem;
}

.planner-header-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.planner-header-title-row h1 {
  margin: 0;
}

.planner-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  padding: 0.2rem;
  border-radius: 0.75rem;
  background: rgba(255, 253, 248, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.planner-tab {
  flex: 1 1 0;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.planner-tab.is-active {
  background: #fff;
  color: var(--accent-deep);
  box-shadow: 0 1px 4px rgba(41, 37, 36, 0.08);
}

.planner-tab-panel {
  display: grid;
  gap: 1rem;
}

.planner-top--schedule {
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .planner-top--schedule {
    grid-template-columns: 1fr 1fr;
  }
}

.save-meta-name-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.save-meta-name-field {
  flex: 1 1 auto;
  min-width: 0;
}

.save-meta-notes-toggle {
  flex-shrink: 0;
  margin-bottom: 0.05rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.anchor-field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
}

.anchor-field-label {
  margin: 0;
  flex: 0 0 auto;
}

.anchor-field-wrap {
  position: relative;
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 100%;
}

.anchor-field-display {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid #ced4da;
  border-radius: 0.5rem;
  background: #fff;
  color: var(--ink, #1c1917);
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-sizing: border-box;
}

.anchor-field-wrap:focus-within .anchor-field-display {
  border-color: var(--accent, #c2410c);
  box-shadow: 0 0 0 1px rgba(194, 65, 12, 0.2);
}

.anchor-field-input {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  margin: 0;
  opacity: 0.01;
  color: transparent;
  background: transparent;
  border-color: transparent;
  caret-color: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* Hide the native value paint; our .anchor-field-display is the visible clock. */
.anchor-field-input::-webkit-datetime-edit,
.anchor-field-input::-webkit-calendar-picker-indicator {
  opacity: 0;
}

.duration-hm-skipped-note {
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #78716c;
  white-space: nowrap;
  align-self: center;
}

.page-help-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(41, 37, 36, 0.45);
}

.page-help-card {
  width: min(100%, 28rem);
  background: #fffdf8;
  border-radius: 16px 16px 12px 12px;
  padding: 1rem 1rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.page-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.page-help-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--accent-deep);
}

.page-help-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: #f5f5f4;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.page-help-body {
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
}

.page-help-body p {
  margin: 0 0 0.75rem;
}

.page-help-more {
  margin-top: 0.5rem !important;
}

.page-help-done {
  width: 100%;
  margin-top: 0.35rem;
}

@media (min-width: 480px) {
  .page-help-backdrop {
    align-items: center;
  }

  .page-help-card {
    border-radius: 16px;
  }
}

.clock-format-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.clock-format-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: #fffdf8;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.clock-format-option.is-active {
  border-color: rgba(194, 65, 12, 0.45);
  color: var(--accent-deep);
  background: #fff7ed;
}

.clock-format-option input {
  margin: 0;
}

.td-shell-header-actions {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.15rem;
}

.record-status {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.records-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.35rem;
  flex-shrink: 0;
  align-items: center;
}

.records-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

.records-icon-btn {
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border-radius: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
}

.records-icon-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.records-icon-btn--primary {
  background: var(--accent, #c2410c);
  border-color: transparent;
  color: #fff;
}

.records-icon-btn--primary:hover:not(:disabled) {
  filter: brightness(1.05);
  color: #fff;
  border-color: transparent;
}

.records-icon-btn--danger:hover:not(:disabled) {
  border-color: #dc2626;
  color: #dc2626;
}

.records-icon-btn:disabled {
  opacity: 0.45;
}

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

.records-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.records-empty {
  padding: 1.25rem 0;
}

.records-table {
  background: #fffdf8;
  border-radius: 0.75rem;
  overflow: hidden;
}

.records-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.records-page .simple-page,
.records-page {
  max-width: 56rem;
}

.planner-header h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin-bottom: 0.35rem;
  font-style: italic;
  color: var(--accent-deep);
}

.lede {
  color: var(--muted);
  max-width: 38rem;
  margin: 0;
  line-height: 1.45;
}

.planner-layout-tree {
  display: grid;
  gap: 1rem;
}

.planner-top {
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .planner-top {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .app-shell { padding-bottom: 1.5rem; }
}

/* —— Cards —— */
.card-block,
.timeline-tree-card {
  border-radius: 1rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.anchor-controls.card-block {
  background: var(--card-anchor);
  box-shadow: 0 10px 28px rgba(154, 52, 18, 0.06);
}

.summary-panel.card-block {
  background: var(--card-summary);
  box-shadow: 0 10px 28px rgba(22, 101, 52, 0.06);
}

.timeline-tree-card {
  position: relative;
  isolation: isolate;
  /* visible so .tree-rail can stick inside the viewport while the tall card scrolls */
  overflow: visible;
  background: var(--card-timeline);
  box-shadow: 0 14px 40px rgba(41, 37, 36, 0.07);
}

/*
  Real <img> fills the tall card (CSS backgrounds fail to paint edge-to-edge).
  object-position left keeps the food side when the tall card crops horizontally.
*/
.timeline-tree-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left top;
  opacity: 0.78;
  pointer-events: none;
  user-select: none;
  z-index: -1;
  border-radius: inherit;
}

/* Keep content above the photo; rail sticks separately. */
.timeline-tree-card > .tree-body {
  position: relative;
  z-index: 1;
}

.anchor-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--accent-deep, #9a3412);
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.mode-toggle .mode-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  margin: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 0.65rem;
  cursor: pointer;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.25;
}

.mode-toggle .mode-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.mode-toggle .mode-option.active {
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(194, 65, 12, 0.12);
}

.helper, .tz-note, .form-text {
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin: 0;
}

.summary-grid dt {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary-grid dd {
  margin: 0.1rem 0 0;
  font-weight: 650;
}

.summary-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.summary-head h2 {
  font-size: 1.15rem;
  margin: 0;
  font-style: italic;
}

.dimmed { opacity: 0.55; }

.warnings {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  color: var(--accent-deep);
}

.sticky-oven {
  /* Not sticky: frees vertical space so the timeline toolbar can sit under the top-bar
     and keep the fold (up-arrow) button on-screen on phones. */
  position: static;
  z-index: 8;
  background: var(--oven);
  border: 1px solid #fdba74;
  border-radius: 0.75rem;
  padding: 0.55rem 0.8rem;
  margin: 0.65rem 0 0.85rem;
}

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

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

/* —— Tree timeline —— */
.tree-rail {
  --rail-gap: 0.55rem;
  --rail-top-chrome: 4.25rem; /* site top-bar */
  --rail-bottom-chrome: 1.25rem; /* desktop footer breathing room */
  position: sticky;
  /* Gap under the top menu so the rail does not touch it. */
  top: calc(var(--rail-top-chrome) + var(--rail-gap));
  float: right;
  /* Pull toward the card’s right edge (card padding is 1.15rem). */
  margin: 0.85rem -0.7rem 1rem 0.35rem;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  /* Keep rail inside the viewport with top + bottom gaps. */
  max-height: calc(
    100dvh - var(--rail-top-chrome) - var(--rail-bottom-chrome)
      - (2 * var(--rail-gap)) - env(safe-area-inset-bottom, 0px)
  );
  overflow: hidden;
  padding: 0.35rem 0.2rem;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 8px 24px rgba(41, 37, 36, 0.12);
  backdrop-filter: blur(6px);
  transition: padding 0.22s ease, gap 0.22s ease;
  /* Only the buttons capture taps — empty rail chrome must not steal tab-bar taps. */
  pointer-events: none;
}

.tree-rail-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 auto;
  min-height: 0; /* allow this flex child to shrink and scroll */
  width: 100%;
  pointer-events: auto;
  /* Leave room for the fold button + rail padding inside max-height. */
  max-height: calc(
    100dvh - var(--rail-top-chrome) - var(--rail-bottom-chrome)
      - (2 * var(--rail-gap)) - 3.25rem - env(safe-area-inset-bottom, 0px)
  );
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 0.28s ease,
    opacity 0.2s ease,
    transform 0.28s ease,
    margin 0.28s ease;
}

.tree-rail.is-collapsed {
  gap: 0;
  padding: 0.25rem 0.2rem;
  overflow: visible;
  max-height: none;
}

.tree-rail.is-collapsed .tree-rail-tools {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  transform: translateY(-0.35rem);
  pointer-events: none;
}

.tree-rail-fold {
  flex-shrink: 0;
  pointer-events: auto;
}

/* Mobile: clear top menu + bottom tab bar with a visible gap on both ends. */
@media (max-width: 991.98px) {
  .tree-rail {
    --rail-gap: 0.6rem;
    --rail-top-chrome: calc(3.5rem + env(safe-area-inset-top, 0px));
    /* Matches .app-shell bottom padding for the fixed mobile tab bar (~64px). */
    --rail-bottom-chrome: calc(4.25rem + env(safe-area-inset-bottom, 0px));
    top: calc(var(--rail-top-chrome) + var(--rail-gap));
    max-height: calc(
      100dvh - var(--rail-top-chrome) - var(--rail-bottom-chrome)
        - (2 * var(--rail-gap))
    );
  }

  .tree-rail-tools {
    max-height: calc(
      100dvh - var(--rail-top-chrome) - var(--rail-bottom-chrome)
        - (2 * var(--rail-gap)) - 3.25rem
    );
  }
}

.tree-body {
  /* Matches floated .tree-rail width after tighter right inset. */
  padding-right: 2.7rem;
}

.tree-title {
  margin: 0 0 1.25rem;
  font-size: 1.35rem;
  font-style: italic;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.tree-icon-sep {
  width: 1.6rem;
  height: 1px;
  margin: 0.1rem 0;
  background: rgba(0, 0, 0, 0.12);
}

.node-duration-simple {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  margin-top: 0.35rem;
  font-size: 0.92rem;
}

.node-duration-simple-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.node-duration-simple-value {
  font-weight: 700;
  color: var(--ink);
}

.timeline-tree-card.is-simple .node-times {
  margin-bottom: 0.15rem;
}

.timeline-tree-card.is-simple .node-duration {
  margin-top: 0.15rem;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn.is-armed {
  border-color: var(--accent, #c2410c);
  background: #fff7ed;
  color: var(--accent-deep, #9a3412);
  box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.18);
}

.icon-btn.accent {
  background: #fff7ed;
  color: var(--accent-deep);
  border-color: #fdba74;
}

.icon-btn.danger:hover:not(:disabled) {
  border-color: #dc2626;
  color: #dc2626;
}

.tree-cook-status {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--accent-deep, #9a3412);
  font-weight: 600;
}

.tree-node.is-alerting .node-card,
.tree-node.is-alerting-js .node-card {
  outline: 2px solid #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18);
  animation: cook-alert-pulse 1.4s ease-in-out infinite;
  overflow: visible;
  z-index: 3;
}

.tree-node.is-cook-acked .node-card {
  opacity: 0.82;
}

.day-pill--alert {
  background: #fee2e2;
  color: #b91c1c;
}

/* Own row under start→end so left cards don’t shove start time past the edge. */
.cook-countdown-row {
  display: flex;
  margin: -0.15rem 0 0.35rem;
}

.tree-node.side-left .cook-countdown-row {
  justify-content: flex-end;
}

.tree-node.side-right .cook-countdown-row {
  justify-content: flex-start;
}

.tree-node.side-center .cook-countdown-row {
  justify-content: center;
}

.cook-countdown {
  display: inline-flex;
  align-items: center;
  font-variant-numeric: tabular-nums;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.2;
  max-width: 100%;
}

.cook-countdown--left {
  color: #7c2d12;
  background: rgba(251, 146, 60, 0.22);
  border-color: rgba(124, 45, 18, 0.28);
}

.cook-countdown--left::before {
  content: "⏱ ";
  font-weight: 600;
}

.day-pill--acked {
  background: #dcfce7;
  color: #166534;
}

.cook-bell {
  display: inline-flex;
  color: #fff;
  animation: cook-bell-ring 0.7s ease-in-out infinite;
  transform-origin: top center;
}

.cook-bell--lg {
  color: #fff;
}

.node-actions--alerting {
  right: 0.35rem;
  left: auto;
  gap: 0.35rem;
}

.node-ring-bell-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #b91c1c;
  background: #dc2626;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

.node-ring-bell-btn--corner {
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.45);
}

.node-ring-bell-btn:hover {
  background: #b91c1c;
}

@keyframes cook-alert-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(220, 38, 38, 0.28);
  }
}

@keyframes cook-bell-ring {
  0%,
  100% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(14deg);
  }
  40% {
    transform: rotate(-12deg);
  }
  60% {
    transform: rotate(10deg);
  }
  80% {
    transform: rotate(-6deg);
  }
}

.icon-btn:disabled {
  opacity: 0.45;
}

.tree-spine {
  position: relative;
  padding: 0.35rem 0 0.75rem;
  /* Room for opposite-side accum clocks outside the card column */
  max-width: 48rem;
  margin: 0 auto;
}

/* Thick trunk — inset so end dots stay on the stem */
.tree-spine::before {
  content: "";
  position: absolute;
  top: 0.55rem;
  bottom: 0.55rem;
  left: 50%;
  width: 7px;
  margin-left: -3.5px;
  background: #1c1917;
  border-radius: 999px;
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.35);
}

.tree-section-label {
  text-align: center;
  margin: 1.25rem 0 0.85rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.icon-btn--drag {
  cursor: grab;
}

.icon-btn--drag:active {
  cursor: grabbing;
}

.icon-btn-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* Lock page scroll while dragging a delay onto gaps (see js/delay-drag.js). */
html.glb-delay-dragging,
html.glb-delay-dragging body,
body.glb-delay-dragging {
  overscroll-behavior: none;
  touch-action: none;
}

html.glb-delay-dragging .tree-delay,
body.glb-delay-dragging .tree-delay {
  transition: none !important;
}

/* Schedule-only gaps — reserve a stable hit strip so drag highlight does not grow the page. */
.tree-delay {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.1rem 0 0.45rem;
  min-height: 0.85rem;
  position: relative;
  z-index: 2;
  border-radius: 999px;
  border: 1px dashed transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.tree-delay.is-active {
  margin: -0.15rem 0 0.85rem;
  min-height: 1.6rem;
}

.tree-delay-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  max-width: min(18rem, 90vw);
}

.tree-delay-note-input {
  width: min(16rem, 85vw);
  font-size: 0.78rem;
}

.tree-delay-note {
  max-width: min(16rem, 85vw);
  margin: 0;
  padding: 0.1rem 0.45rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.9);
  color: #57534e;
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-delay-note:hover:not(:disabled),
.tree-delay-note:focus-visible {
  color: #1c1917;
  outline: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.timeline-tree-card.is-delay-dragging .tree-delay.is-drop {
  /* Keep the same reserved size — only paint the drop affordance. */
  min-height: 0.85rem;
  margin: 0.1rem 0 0.45rem;
  border-color: rgba(28, 25, 23, 0.18);
  background: rgba(255, 253, 248, 0.72);
}

.timeline-tree-card.is-delay-dragging .tree-delay.is-hot,
.tree-delay.is-hot {
  min-height: 0.85rem;
  margin: 0.1rem 0 0.45rem;
  border-color: #b45309;
  background: rgba(180, 83, 9, 0.14);
}

.timeline-tree-card.is-pin-dragging .tree-node.is-pin-drop .node-card {
  outline: 1px dashed rgba(28, 25, 23, 0.22);
  outline-offset: 2px;
}

.timeline-tree-card.is-pin-dragging .tree-node.is-pin-hot .node-card {
  outline-color: var(--accent, #c2410c);
  box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.18);
}

.node-time-pin {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  margin: 0 0 0.55rem;
  /* Room for the absolutely positioned close control. */
  padding: 0.35rem 2.35rem 0.35rem 0.45rem;
  border-radius: 0.65rem;
  background: rgba(255, 247, 237, 0.95);
  border: 1px solid rgba(180, 83, 9, 0.28);
}

.node-time-pin-img {
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  object-fit: contain;
}

.node-time-pin-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #9a3412;
}

.node-time-pin-value {
  margin: 0;
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.45rem;
  background: #fff;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink, #1c1917);
  cursor: pointer;
}

.node-time-pin-input {
  width: min(14rem, 100%);
  font-size: 16px;
}

.node-time-pin-remove {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  z-index: 1;
  margin: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #78716c;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.node-time-pin-remove:hover:not(:disabled) {
  background: rgba(220, 53, 69, 0.12);
  color: #b91c1c;
}

.node-time-pin-drop-hint {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #9a3412;
}

.tree-node.is-photo-drop-target.is-photo-drag-over .node-card {
  outline: 2px solid rgba(45, 106, 79, 0.55);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.12);
}

.tree-node.is-time-pinned .node-card {
  border-color: rgba(180, 83, 9, 0.35);
}

.timeline-tree-card.is-delay-dragging .tree-delay.is-active.is-hot {
  min-height: 1.6rem;
  margin: -0.15rem 0 0.85rem;
}

.tree-delay-drop-hint {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #78716c;
  pointer-events: none;
}

.tree-delay.is-hot .tree-delay-drop-hint {
  color: #9a3412;
}

.tree-delay-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #d6d3d1;
  background: #f5f5f4;
  color: #44403c;
  border-radius: 999px;
  padding: 0.15rem 0.35rem 0.15rem 0.5rem;
  box-shadow: 0 1px 0 rgba(28, 25, 23, 0.04);
}

.tree-delay.is-active .tree-delay-chip {
  border-color: #a8a29e;
  background: #eeeee9;
}

.tree-delay-icon {
  display: inline-flex;
  color: #78716c;
  flex-shrink: 0;
}

.tree-delay-value {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 0.1rem 0.15rem;
  cursor: pointer;
  line-height: 1.2;
}

.tree-delay-value:hover:not(:disabled),
.tree-delay-value:focus-visible {
  color: #1c1917;
  outline: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tree-delay-chip .duration-hm {
  gap: 0.25rem;
}

.tree-delay-chip .duration-edit {
  width: 2.4rem;
  min-height: 1.55rem;
  font-size: 0.78rem;
  padding: 0.1rem 0.2rem;
}

.tree-delay-chip .duration-hm-unit {
  font-size: 0.68rem;
}

.tree-delay-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #78716c;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.tree-delay-remove:hover:not(:disabled),
.tree-delay-remove:focus-visible {
  background: rgba(28, 25, 23, 0.08);
  color: #1c1917;
  outline: none;
}

.tree-delay-remove:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tree-node {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 36px 1fr;
  grid-template-rows: auto auto;
  column-gap: 0;
  align-items: start;
  margin: 0 0 1.35rem;
  z-index: 1;
  overflow: visible;
}

.node-rail {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 30px;
  position: relative;
  z-index: 2;
}

.node-dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--blue-dot);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px var(--card-timeline);
}

/* Branch arms from the trunk toward each leaf */
.tree-node.side-left::before,
.tree-node.side-right::before {
  content: "";
  position: absolute;
  top: 0.8rem;
  height: 4px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
}

.tree-node.side-left::before {
  right: calc(50% + 14px);
  width: min(22%, 4.5rem);
  background: linear-gradient(270deg, #1c1917 0%, #78716c 92%);
}

.tree-node.side-right::before {
  left: calc(50% + 14px);
  width: min(22%, 4.5rem);
  background: linear-gradient(90deg, #1c1917 0%, #78716c 92%);
}

.node-pair {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  min-width: 0;
}

.tree-node.side-left .node-pair {
  grid-column: 1;
  grid-row: 1 / span 2;
  flex-direction: row-reverse;
  justify-self: end;
  /* Keep card corner clear of the stem number badge */
  margin-right: 0.7rem;
}

.tree-node.side-right .node-pair {
  grid-column: 3;
  grid-row: 1 / span 2;
  flex-direction: row;
  justify-self: start;
  margin-left: 0.7rem;
}

.tree-node.side-center .node-pair {
  position: relative;
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  /* Space under the stem badge so the card top does not kiss the dot */
  margin: 0.85rem auto 0;
  width: 100%;
}

.tree-node.side-center .node-card {
  justify-self: center;
}

/* Accumulated time clock — opposite the step card, vertically mid-card. */
.tree-accum {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  width: 5.75rem;
  padding: 0.2rem 0.25rem;
  z-index: 3;
  pointer-events: none;
  user-select: none;
  box-sizing: border-box;
}

/* Left/right branches: park clock across the stem, vertically centered on the node/card */
.tree-node.side-left .tree-accum,
.tree-node.side-right .tree-accum {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.tree-node.side-left .tree-accum {
  left: calc(50% + 1.35rem);
  right: auto;
}

.tree-node.side-right .tree-accum {
  right: calc(50% + 1.35rem);
  left: auto;
}

/* Start/end: absolute to .node-pair so mid-card even when the card is tall */
.tree-node.side-center .tree-accum {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

/* Start → right of card; end → left of card (card is 12.5rem wide) */
.tree-node.side-center.is-starter .tree-accum {
  left: calc(50% + 6.25rem + 0.5rem);
  right: auto;
}

.tree-node.side-center.is-oven .tree-accum,
.tree-node.side-center:not(.is-starter) .tree-accum {
  right: calc(50% + 6.25rem + 0.5rem);
  left: auto;
}

.tree-accum-img {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.tree-accum-time {
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  text-align: center;
  color: #1c1917;
  letter-spacing: -0.01em;
  text-shadow: 0 0 4px rgba(255, 253, 248, 0.9);
}

.node-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 0.7rem;
  padding: 1.7rem 0.65rem 0.55rem;
  cursor: pointer;
  width: 12.5rem;
  max-width: 12.5rem;
  flex: 0 0 12.5rem;
  box-sizing: border-box;
}

/* Chef-hat watermark behind step content (Planner + Recipes share .node-card). */
.node-card::before {
  content: "";
  position: absolute;
  inset: 0.35rem;
  background: url("/pictures/chef_hat.png") center / contain no-repeat;
  opacity: 0.3;
  pointer-events: none;
  z-index: -1;
}

.tree-node.side-left .node-card {
  text-align: right;
}

.tree-node.side-right .node-card {
  text-align: left;
}

.tree-node.side-center .node-card {
  text-align: center;
}

.tree-node.tint-a .node-card {
  background: var(--leaf-a);
}

.tree-node.tint-b .node-card {
  background: var(--leaf-b);
}

.tree-node.tint-center .node-card {
  background: var(--leaf-center);
}

/* Center milestones stay on the stem — rail in flow, card below */
.tree-node.side-center {
  margin-bottom: 1.5rem;
  row-gap: 0.15rem;
}

.tree-node.side-center .node-rail {
  grid-column: 2;
  grid-row: 1;
  position: static;
  transform: none;
}

.tree-node.is-oven .node-card {
  background: var(--oven);
  border-color: #fdba74;
}

.node-actions {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  z-index: 2;
}

.node-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #fdba74;
  background: #ffedd5;
  color: #9a3412;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 0;
}

.node-icon-btn.has-content {
  background: #fed7aa;
  border-color: #fb923c;
}

.node-icon-btn:disabled,
.node-icon-btn.is-disabled,
.node-icon-btn.is-busy {
  opacity: 0.45;
  cursor: default;
}

.node-icon-btn.is-busy {
  pointer-events: none;
}

.node-icon-btn.is-disabled:not(:disabled) {
  pointer-events: auto;
}

.node-icon-glyph {
  font-size: 0.72rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
}

.node-icon-upload {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1e3a5f;
}

.node-icon-upload.has-photos {
  border-color: #60a5fa;
  background: #bfdbfe;
}

.photo-count-badge {
  position: absolute;
  right: -0.28rem;
  top: -0.28rem;
  min-width: 0.95rem;
  height: 0.95rem;
  padding: 0 0.18rem;
  border-radius: 999px;
  background: #1d4ed8;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 0.95rem;
  text-align: center;
  box-shadow: 0 0 0 1.5px #fff;
}

/* Photo strip beside the step card: height follows 1 or 2 thumbnail rows
   (not the step card). Scroll only when more than four cells. */
.node-photo-slot {
  --photo-pad: 0.35rem;
  --photo-gap: 0.3rem;
  --photo-slot-w: 12.5rem;
  /* One square cell: (slot width − horizontal padding − column gap) / 2 */
  --photo-cell: calc((var(--photo-slot-w) - (2 * var(--photo-pad)) - var(--photo-gap)) / 2);
  position: relative;
  flex: 0 0 var(--photo-slot-w);
  width: var(--photo-slot-w);
  max-width: var(--photo-slot-w);
  min-width: 0;
  align-self: center;
  z-index: 1;
}

/*
 * Keep photos on the side opposite the accum clock.
 * - Left/right branches: photos stay on the outer side; clock parks across the stem.
 * - Center starter: clock is normally right of card — put photos on the left instead,
 *   and shift the clock further right so it clears the wider [photo|card] pair.
 * - Center end/oven: clock left of card; photos stay on the right.
 */
.tree-node.side-center.is-starter .node-photo-slot {
  order: -1;
}

.tree-node.side-center.is-starter.has-photos .tree-accum {
  /* Pair ≈ photo + gap + card (12.5 + 0.4 + 12.5); clear the right edge of the card. */
  left: calc(50% + 12.7rem + 0.5rem);
  right: auto;
}

.tree-node.side-center.is-oven.has-photos .tree-accum,
.tree-node.side-center:not(.is-starter).has-photos .tree-accum {
  right: calc(50% + 12.7rem + 0.5rem);
  left: auto;
}

.node-photo-card {
  position: relative;
  overflow-x: hidden;
  overflow-y: hidden;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.7rem;
  padding: var(--photo-pad);
  box-sizing: border-box;
}

/* >4 cells: lock viewport to two rows, scroll the rest. */
.node-photo-slot.is-scrollable .node-photo-card {
  max-height: calc((2 * var(--photo-cell)) + var(--photo-gap) + (2 * var(--photo-pad)));
  overflow-y: auto;
  overscroll-behavior: contain;
}

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

.photo-cell {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #d6d3d1;
  border-radius: 0.3rem;
  overflow: hidden;
  background: rgba(245, 245, 244, 0.75);
  cursor: pointer;
  line-height: 0;
}

.photo-cell--empty {
  visibility: hidden;
  pointer-events: none;
  border: none;
  background: transparent;
  cursor: default;
}

.photo-cell:disabled {
  opacity: 0.6;
  cursor: default;
}

.photo-cell img,
.photo-thumb-ph {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb-ph {
  background: linear-gradient(135deg, #e7e5e4, #d6d3d1);
}

.photo-thumb-ph.is-loading,
.photo-cell.is-loading .photo-thumb-ph {
  background: linear-gradient(110deg, #e7e5e4 25%, #f5f5f4 40%, #e7e5e4 55%);
  background-size: 200% 100%;
  animation: photo-shimmer 1.1s linear infinite;
}

.photo-cell.is-uploading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.55);
}

@keyframes photo-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.photo-seq {
  position: absolute;
  left: 0.2rem;
  top: 0.2rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.22rem;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.72);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1rem;
  text-align: center;
}

.tree-node.is-oven .node-dot {
  background: var(--accent);
}

.tree-node.is-starter .node-dot {
  background: #0d9488;
}

.tree-node.is-skipped .node-card {
  opacity: 0.78;
}

.tree-node.is-skipped .node-dot {
  background: #a8a29e;
}

.node-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.tree-node.side-left .node-title {
  justify-content: flex-end;
}

.tree-node.side-right .node-title {
  justify-content: flex-start;
}

.tree-node.side-center .node-title {
  justify-content: center;
}

.node-title .name {
  font-style: italic;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
}

.day-pill {
  font-size: 0.68rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-style: normal;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  background: rgba(255, 255, 255, 0.65);
}

.node-times {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  margin-bottom: 0.4rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  max-width: 100%;
  min-width: 0;
}

.node-times.is-point {
  margin-bottom: 0;
}

.tree-node.side-left .node-times {
  justify-content: flex-end;
}

.tree-node.side-right .node-times {
  justify-content: flex-start;
}

.tree-node.side-center .node-times {
  justify-content: center;
}

.time-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
  flex: 0 1 auto;
}

.tree-node.side-left .time-stack {
  align-items: flex-end;
}

.tree-node.side-right .time-stack {
  align-items: flex-start;
}

.tree-node.side-center .time-stack {
  align-items: center;
}

.time-date {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.time-dow {
  margin-left: 0.28em;
  font-size: 0.82em;
  font-weight: 500;
  opacity: 0.85;
}

.time-clock {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.22em;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.time-hm {
  font-variant-numeric: tabular-nums;
}

.time-period {
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--muted);
  opacity: 1;
}

.node-time-pin-value .time-date {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}

.node-time-pin-value .time-dow {
  font-size: 0.78em;
  font-weight: 500;
  opacity: 0.8;
}

.node-time-pin-value .time-pin-clock {
  margin-left: 0.35em;
}

.time-sep {
  color: var(--muted);
  font-size: 0.9rem;
  padding-top: 0.45rem;
}

.node-duration {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tree-node.side-left .node-duration {
  justify-content: flex-end;
}

.tree-node.side-right .node-duration {
  justify-content: flex-start;
}

.tree-node.side-center .node-duration {
  justify-content: center;
}

.duration-hm {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.duration-hm-field {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
}

.duration-hm-unit {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted, #78716c);
  min-width: 0.85rem;
}

.duration-edit {
  width: 3.35rem;
  min-height: 38px;
  border: 1.5px solid #e11d48;
  border-radius: 0.35rem;
  padding: 0.2rem 0.25rem;
  background: #fff;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.08);
}

/* Skipped = empty but still editable; note sits beside the fields. */
.duration-hm.is-skipped .duration-edit {
  background: #fff;
  color: var(--ink);
}

.duration-edit::placeholder {
  color: #a8a29e;
  font-size: 0.72rem;
  opacity: 1;
}

.duration-edit:disabled,
.duration-hm.is-disabled .duration-edit {
  opacity: 0.75;
  border-color: #d6d3d1;
}

.td-float-field .duration-hm {
  margin-top: 0.25rem;
}

.td-float-field .duration-edit {
  width: 4rem;
  min-height: 2.25rem;
}

.dur-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(28, 25, 23, 0.72);
}

.photo-lightbox-panel {
  max-width: min(920px, 100%);
  max-height: min(90vh, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.75rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.photo-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 5rem);
  object-fit: contain;
  border-radius: 0.25rem;
  background: #f5f5f4;
}

.photo-lightbox-loading {
  min-width: 12rem;
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #78716c;
}

.photo-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.photo-lightbox-name {
  font-size: 0.85rem;
  color: #57534e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.photo-lightbox-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .tree-spine {
    max-width: none;
  }

  .tree-spine::before {
    left: 1.05rem;
    margin-left: 0;
    width: 5px;
    top: 0.4rem;
    bottom: 0.4rem;
  }

  .tree-node {
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto;
    margin-bottom: 1rem;
  }

  .node-rail {
    grid-column: 1;
    grid-row: 1;
  }

  .tree-node.side-left::before,
  .tree-node.side-right::before {
    left: 1.05rem;
    right: auto;
    width: 0.85rem;
    background: #1c1917;
  }

  /* Keep every step number on the stem column (including start/end). */
  .tree-node.side-center .node-rail {
    grid-column: 1;
    grid-row: 1;
  }

  .tree-node.side-left .node-pair,
  .tree-node.side-right .node-pair,
  .tree-node.side-center .node-pair {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-self: stretch;
    width: 100%;
    max-width: 100%;
    margin: 0;
    min-width: 0;
  }

  .tree-node.side-left .node-card,
  .tree-node.side-right .node-card,
  .tree-node.side-center .node-card {
    order: 1;
  }

  .tree-node.side-left .tree-accum,
  .tree-node.side-right .tree-accum,
  .tree-node.side-center .tree-accum,
  .tree-node.side-center.is-starter .tree-accum,
  .tree-node.side-center.is-oven .tree-accum,
  .tree-node.side-center:not(.is-starter) .tree-accum {
    position: static;
    transform: none;
    left: auto;
    right: auto;
    order: 2;
    justify-self: start;
    align-self: start;
    width: auto;
    max-width: 100%;
    flex-direction: row;
    gap: 0.35rem;
    margin: 0.2rem 0 0.55rem;
    padding: 0;
  }

  .tree-accum-img {
    width: 1.75rem;
    height: 1.75rem;
  }

  .tree-accum-time {
    font-size: 0.72rem;
    text-align: left;
  }

  .tree-node.side-left .node-card,
  .tree-node.side-right .node-card,
  .tree-node.side-center .node-card {
    max-width: 100%;
    width: 100%;
    flex: 1 1 auto;
    text-align: left;
    box-sizing: border-box;
  }

  .node-time-pin {
    width: 100%;
    box-sizing: border-box;
    gap: 0.4rem;
    padding: 0.4rem 2.85rem 0.45rem 0.5rem;
  }

  .node-time-pin-value,
  .node-time-pin-input {
    flex: 1 1 100%;
    width: 100%;
    min-height: 2.75rem;
    font-size: 16px;
  }

  .node-time-pin-remove {
    top: 0.25rem;
    right: 0.25rem;
    width: 2.35rem;
    height: 2.35rem;
    font-size: 1.35rem;
  }

  .node-time-pin-drop-hint {
    font-size: 0.85rem;
    padding: 0.35rem 0;
  }

  .node-photo-slot {
    --photo-slot-w: min(100%, 16rem);
    position: relative;
    flex: 0 0 auto;
    width: var(--photo-slot-w);
    max-width: none;
    height: auto;
    align-self: stretch;
  }

  .tree-node.side-left .node-title,
  .tree-node.side-right .node-title,
  .tree-node.side-center .node-title,
  .tree-node.side-left .node-times,
  .tree-node.side-right .node-times,
  .tree-node.side-center .node-times,
  .tree-node.side-left .node-duration,
  .tree-node.side-right .node-duration,
  .tree-node.side-center .node-duration {
    justify-content: flex-start;
  }

  .tree-node.side-left .time-stack,
  .tree-node.side-right .time-stack,
  .tree-node.side-center .time-stack {
    align-items: flex-start;
  }

  .tree-node.tint-a .node-card {
    background: var(--leaf-a);
  }

  .tree-node.tint-b .node-card {
    background: var(--leaf-b);
  }

  .tree-node.tint-center .node-card {
    background: var(--leaf-center);
  }

  .tree-node.is-oven .node-card {
    background: var(--oven);
  }
}

.simple-page { max-width: 40rem; }

.auth-page .form-control { max-width: 24rem; }

.save-meta {
  background: #f7f3ea;
  box-shadow: 0 10px 28px rgba(154, 52, 18, 0.05);
}

@media (min-width: 900px) {
  .planner-top {
    grid-template-columns: 1fr 1fr;
  }

  .planner-top .save-meta {
    grid-column: 1 / -1;
  }
}

.auth-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-email {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .auth-email {
    max-width: 12rem;
  }
}

.toast-host {
  position: sticky;
  top: 3.5rem;
  z-index: 25;
  margin: 0.5rem 1rem 0;
  padding: 0.65rem 0.9rem;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 0.65rem;
  color: #065f46;
}

.modal-backdrop-glb {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  z-index: 40;
}

.modal-glb {
  position: fixed;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  width: min(26rem, calc(100vw - 1.5rem));
  background: #fffdf8;
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
  padding: 1.1rem 1.15rem 1.25rem;
  z-index: 41;
}

.modal-glb-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.modal-glb-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-style: italic;
  color: var(--accent-deep);
}

.modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.modal-tabs button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0.55rem;
}

.modal-tabs button.active {
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
}

.modal-fallback {
  font-size: 0.85rem;
  color: var(--muted);
}

.records-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.records-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  background: #fffdf8;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 0.75rem;
}

.records-row-clickable {
  cursor: pointer;
}

.records-row-clickable:hover,
.records-row-clickable:focus-visible {
  background: rgba(194, 65, 12, 0.06);
}

.records-name-link {
  color: var(--accent-deep, #9a3412);
}

.records-item-clickable {
  padding: 0;
}

.records-open-hit {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.85rem 1rem;
  color: inherit;
  cursor: pointer;
  border-radius: 0.75rem;
}

.records-open-hit:hover,
.records-open-hit:focus-visible {
  background: rgba(194, 65, 12, 0.06);
}

/* Recipe designer styles live in css/recipe-designer.css */

.node-duration--with-subs {
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
  max-width: 16rem;
}

.tree-substeps {
  display: grid;
  gap: 0.35rem;
  width: 100%;
}

.tree-substep-row {
  display: grid;
  gap: 0.2rem;
}

.tree-substep-label {
  font-size: 0.72rem;
  color: var(--muted, #78716c);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-substep-main {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.25rem;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
  font-size: 0.72rem;
  color: var(--muted, #78716c);
}

.tree-substep-main-value {
  font-weight: 650;
  color: #44403c;
  white-space: nowrap;
}
