.ff14-mode-choice {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(39, 41, 39, .64);
  backdrop-filter: blur(8px);
}

.ff14-mode-dialog {
  width: min(880px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px;
  background: var(--paper);
  box-shadow: 0 30px 100px rgba(20, 15, 10, .35);
}

.ff14-mode-dialog h1 { margin: 4px 0 8px; font-size: 27px; }
.ff14-mode-dialog > p { margin: 0; color: var(--muted); font-size: 13px; }
.ff14-mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.ff14-mode-card {
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  text-align: left;
  background: #fff;
  transition: .15s ease;
}
.ff14-mode-card:hover { border-color: #e9a498; transform: translateY(-2px); box-shadow: var(--shadow); }
.ff14-mode-card .mode-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; color: #fff; background: var(--coral); font-size: 22px; }
.ff14-mode-card.leve .mode-icon { background: var(--green); }
.ff14-mode-card strong { display: block; margin: 18px 0 7px; font-size: 20px; }
.ff14-mode-card span { color: var(--muted); font-size: 13px; line-height: 1.75; }

.ff14-mode-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 3px 10px rgba(60,48,36,.05);
}
.ff14-mode-tab {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.ff14-mode-tab.active { color: #fff; background: var(--green); }
.ff14-mode-tab:not(.active):hover { color: var(--green); background: var(--green-pale); }
.ff14-leve-shell[hidden] { display: none !important; }
.app-shell.ff14-showing-leve { min-height: auto; }
.ff14-showing-leve > .workspace { display: none !important; }
.ff14-leve-shell { width: 100%; min-height: calc(100vh - 72px); }
.leve-workspace { max-width: 1480px; margin: 0 auto; padding: 22px clamp(18px, 3vw, 48px) 64px; }
.leve-tabs { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; }
.leve-tabs button { flex: 0 0 auto; padding: 10px 14px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; font-weight: 700; }
.leve-tabs button.active { border-color: var(--coral); color: var(--coral-dark); }
.leve-intro { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 24px; border: 1px solid #c9dfd1; border-radius: 18px; background: linear-gradient(120deg, #eef7f0, #fffdfa); }
.leve-intro h1 { margin: 4px 0 7px; font-size: 23px; }
.leve-intro p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.leve-summary { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.leve-metric { min-height: 112px; padding: 19px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.82); }
.leve-metric span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.leve-metric strong { display: block; margin-top: 9px; color: var(--green); font-size: 31px; }
.leve-filter { display: grid; grid-template-columns: 150px 170px minmax(220px, 1fr); gap: 10px; margin-top: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.78); }
.leve-filter select, .leve-filter input { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12px; outline: none; }
.leve-filter input:focus { border-color: var(--coral); }
.leve-table { min-width: 940px; }
.leve-table td { vertical-align: middle; }
.leve-check { width: 18px; height: 18px; accent-color: var(--green); }
.leve-name strong { display: block; font-size: 14px; }
.leve-name small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.leve-delivery { line-height: 1.7; }
.leve-delivery span { display: block; }
.leve-location { color: var(--muted); font-size: 11px; line-height: 1.65; }
.leve-complete td { background: #f1f8f3; }
.leve-plan-button { min-height: 36px; padding: 0 13px; border: 1px solid #bedcc9; border-radius: 9px; color: var(--green); background: var(--green-pale); font-size: 11px; font-weight: 800; white-space: nowrap; }
.leve-plan-button.selected { color: #fff; background: var(--green); border-color: var(--green); }
.leve-page-actions { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.leve-page-actions button { min-width: 36px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.leve-page-actions button:disabled { cursor: default; }

.leve-plan-grid { display: grid; gap: 10px; padding: 0 24px 22px; }
.leve-plan-row { display: grid; grid-template-columns: minmax(260px, 1fr) 170px auto; gap: 14px; align-items: center; padding: 15px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.leve-plan-row h3 { margin: 0; font-size: 14px; }
.leve-plan-row p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.leve-plan-row label { color: var(--muted); font-size: 11px; }
.leve-plan-row input { width: 88px; margin-left: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; text-align: right; }
.leve-remove { min-height: 36px; padding: 0 12px; border: 1px solid #f0c3bc; border-radius: 9px; color: #b34b40; background: #fff5f3; font-size: 11px; }
.leve-calc-bar { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 24px; border-top: 1px solid var(--line); background: #fffaf6; }
.leve-calc-bar p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.leve-calc-bar button { min-height: 44px; padding: 0 22px; border-radius: 11px; color: #fff; background: var(--coral); font-size: 13px; font-weight: 800; }
.leve-result-note { margin-top: 14px; padding: 14px 16px; border: 1px solid #c9dfd1; border-radius: 12px; color: var(--green); background: var(--green-pale); font-size: 12px; line-height: 1.7; }
.leve-results table { min-width: 1050px; }
.leve-inventory-input { width: 84px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; text-align: right; }
.leve-route-select { min-width: 100px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 11px; }
.leve-sources { max-width: 360px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.leve-sources summary { cursor: pointer; color: var(--green); font-weight: 800; }
.leve-source-card { margin-top: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.leve-source-card strong { display: block; color: var(--ink); font-size: 11px; }
.leve-source-card span { display: block; margin-top: 3px; }
.recipe-tree { margin-top: 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.recipe-tree > summary { cursor: pointer; color: var(--green); font-size: 13px; font-weight: 800; }
.recipe-tree ul { margin: 10px 0 0 15px; padding-left: 14px; border-left: 1px solid #d8e6dc; }
.recipe-tree li { margin: 7px 0; font-size: 11px; line-height: 1.55; }
.recipe-tree li > span { font-weight: 700; }
.leve-empty { padding: 42px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.leve-status { margin-top: 12px; color: var(--muted); font-size: 11px; }

@media (max-width: 800px) {
  .topbar { grid-template-columns: 1fr; gap: 9px; display: grid; }
  .top-actions { width: 100%; justify-content: flex-end; overflow-x: auto; }
  .ff14-mode-tabs { flex: 0 0 auto; }
  .ff14-mode-tab { padding: 0 9px; }
  .ff14-mode-dialog { padding: 22px 18px; }
  .ff14-mode-cards { grid-template-columns: 1fr; }
  .ff14-mode-card { min-height: 160px; padding: 20px; }
  .leve-workspace { padding: 14px 12px 44px; }
  .leve-intro { align-items: stretch; flex-direction: column; }
  .leve-summary { grid-template-columns: 1fr 1fr; }
  .leve-metric { min-height: 92px; padding: 15px; }
  .leve-metric strong { font-size: 26px; }
  .leve-filter { grid-template-columns: 1fr 1fr; }
  .leve-filter input { grid-column: 1 / -1; }
  .leve-plan-grid { padding: 0 14px 16px; }
  .leve-plan-row { grid-template-columns: 1fr; gap: 10px; }
  .leve-plan-row label { display: flex; justify-content: space-between; align-items: center; }
  .leve-calc-bar { align-items: stretch; flex-direction: column; padding: 16px 14px; }
}
