/* QC Toolbox — FoodLab Phase E shared operational UI. Visual-only overrides. */
@media screen {
  body.foodlab-orders-page,
  body.foodlab-checklist-page,
  body.foodlab-backup-page {
    background: radial-gradient(ellipse at 76% -12%, rgba(22,183,196,.12), transparent 34%), var(--fl-bg, #f1f8fb) !important;
    color: var(--fl-ink, #17354b) !important;
    font-family: Vazirmatn, Tahoma, sans-serif !important;
  }

  /* Orders / export statistics */
  body.foodlab-orders-page { padding: 0 18px 110px !important; }
  body.foodlab-orders-page .frame {
    display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:18px;
    width:min(100%,1180px); max-width:1180px; margin:0 auto; padding:24px 0 120px;
  }
  body.foodlab-orders-page .top-title { grid-column:1/-1; margin:0; color:var(--fl-primary); font-size:clamp(22px,2.5vw,29px); font-weight:900; line-height:1.5; }
  body.foodlab-orders-page .hero-panel {
    grid-column:1/-1; margin:0; padding:clamp(20px,3vw,30px); overflow:hidden;
    background:linear-gradient(120deg,#087e8b 0%,#16b7c4 64%,#5bcfd2 100%) !important;
    border:1px solid rgba(255,255,255,.45)!important; border-radius:26px!important; box-shadow:var(--fl-shadow)!important;
  }
  body.foodlab-orders-page .hero-top { margin-bottom:22px; }
  body.foodlab-orders-page .hero-avatar { border:1px solid rgba(255,255,255,.7); box-shadow:none; background:rgba(255,255,255,.18); color:#fff; }
  body.foodlab-orders-page .hero-greet { color:#fff; font-size:clamp(18px,2vw,22px); }
  body.foodlab-orders-page .hero-sub { color:rgba(255,255,255,.88); }
  body.foodlab-orders-page .stat-pills { gap:12px; }
  body.foodlab-orders-page .stat-pill { background:rgba(255,255,255,.96); border:1px solid rgba(255,255,255,.6); border-radius:17px; box-shadow:none; }
  body.foodlab-orders-page .pill-chip { background:var(--fl-teal-soft); border:0; }
  body.foodlab-orders-page .section-title { grid-column:1/-1; margin:0 0 -8px; color:var(--fl-primary); font-size:18px; font-weight:900; }
  body.foodlab-orders-page .settings-list { grid-column:1/-1; margin:0; overflow:hidden; background:var(--fl-surface); border:1px solid var(--fl-line)!important; border-radius:20px!important; box-shadow:var(--fl-shadow)!important; }
  body.foodlab-orders-page .settings-row { border-color:var(--fl-line)!important; }
  body.foodlab-orders-page .row-chip { background:var(--fl-teal-soft); color:var(--fl-teal-deep); border:0; }
  body.foodlab-orders-page .settings-row.danger .row-chip { background:var(--fl-red-soft); color:#a63c4c; }
  body.foodlab-orders-page .settings-row.danger .row-title { color:#a63c4c; }
  body.foodlab-orders-page .params-body { padding-top:2px; }
  body.foodlab-orders-page .config-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.foodlab-orders-page .field input,
  body.foodlab-orders-page .order-fields input,
  body.foodlab-orders-page .order-fields select,
  body.foodlab-orders-page .pallet-override-input {
    min-height:44px; width:100%; min-width:0; padding:10px 12px;
    border:1px solid #cbdfe7!important; border-radius:12px!important;
    background:var(--fl-surface-soft)!important; color:var(--fl-ink)!important;
    font:500 14px/1.5 Vazirmatn,Tahoma,sans-serif!important; box-shadow:none!important;
  }
  body.foodlab-orders-page .field input:focus,
  body.foodlab-orders-page .order-fields input:focus,
  body.foodlab-orders-page .order-fields select:focus { outline:2px solid var(--fl-teal)!important; outline-offset:1px; }
  body.foodlab-orders-page #ordersSection { grid-column:span 7; }
  body.foodlab-orders-page #resultsSection { grid-column:span 5; }
  body.foodlab-orders-page #historySection,
  body.foodlab-orders-page footer.note { grid-column:1/-1; }
  body.foodlab-orders-page .panel-card { min-width:0; margin:0; padding:clamp(16px,2vw,24px); background:var(--fl-surface)!important; border:1px solid var(--fl-line)!important; border-radius:22px!important; box-shadow:var(--fl-shadow)!important; }
  body.foodlab-orders-page .panel-card h2 { color:var(--fl-primary); font-size:17px; font-weight:900; margin-bottom:16px; }
  body.foodlab-orders-page .order-card { min-width:0; padding:15px; background:var(--fl-surface-soft)!important; border:1px solid var(--fl-line)!important; border-radius:17px!important; }
  body.foodlab-orders-page .order-index { background:var(--fl-teal-soft); color:var(--fl-teal-deep); border:0; }
  body.foodlab-orders-page .order-fields { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  body.foodlab-orders-page .order-fields label,
  body.foodlab-orders-page .field label { color:var(--fl-muted); font-size:12px; font-weight:700; }
  body.foodlab-orders-page .row-del { width:36px;height:36px; border:1px solid var(--fl-line)!important; border-radius:11px!important; background:var(--fl-red-soft)!important; color:#a63c4c!important; }
  body.foodlab-orders-page .qc-details { border-top:1px solid var(--fl-line); }
  body.foodlab-orders-page .check-label { background:#fff; border:1px solid var(--fl-line); border-radius:12px; }
  body.foodlab-orders-page .toolbar { gap:9px; }
  body.foodlab-orders-page button.primary,
  body.foodlab-orders-page button.ghost { min-height:44px; border-radius:12px!important; box-shadow:none!important; font:700 13px/1.4 Vazirmatn,Tahoma,sans-serif!important; padding:11px 14px; }
  body.foodlab-orders-page button.primary { background:var(--fl-teal)!important; border:1px solid var(--fl-teal)!important; color:#fff!important; }
  body.foodlab-orders-page button.ghost { background:var(--fl-surface-soft)!important; border:1px solid var(--fl-line)!important; color:var(--fl-ink)!important; }
  body.foodlab-orders-page .stat { background:var(--fl-surface-soft); border:1px solid var(--fl-line); border-radius:14px; }
  body.foodlab-orders-page .stat.highlight { background:var(--fl-green-soft); border-color:#cceee0; }
  body.foodlab-orders-page .stat .k { color:var(--fl-muted); }
  body.foodlab-orders-page .stat .v { color:var(--fl-primary); font-family:Vazirmatn,Tahoma,sans-serif; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
  body.foodlab-orders-page .stat.highlight .v { color:#16875f; }
  body.foodlab-orders-page .group { background:var(--fl-surface-soft); border:1px solid var(--fl-line); border-radius:15px; }
  body.foodlab-orders-page .pallet-bar { border:0; background:var(--fl-bg-soft); height:9px; }
  body.foodlab-orders-page .pallet-bar-fill { border-radius:99px; background:linear-gradient(90deg,var(--fl-teal),#60d2d0); }
  body.foodlab-orders-page .history-entry { background:var(--fl-surface-soft); border:1px solid var(--fl-line); border-radius:15px; }
  body.foodlab-orders-page .history-actions button { min-height:36px; border:1px solid var(--fl-line); border-radius:9px; background:#fff; color:var(--fl-muted); }
  body.foodlab-orders-page .bottom-nav { width:min(92vw,480px); bottom:12px; padding:8px; border:1px solid var(--fl-line)!important; border-radius:20px!important; background:rgba(255,255,255,.94)!important; box-shadow:0 8px 28px rgba(20,70,90,.15)!important; backdrop-filter:blur(12px); }
  body.foodlab-orders-page .nav-item { border:0!important; box-shadow:none!important; }
  body.foodlab-orders-page .nav-item.active { background:var(--fl-teal)!important; color:#fff!important; }
  body.foodlab-orders-page footer.note { color:var(--fl-muted); line-height:1.9; }

  /* Checklists / inspection records */
  body.foodlab-checklist-page { padding:0 16px 36px!important; }
  body.foodlab-checklist-page .shell { width:min(100%,1000px); max-width:1000px!important; padding:clamp(16px,3vw,30px) 0 60px!important; }
  body.foodlab-checklist-page .topbar { padding:16px 18px; border:1px solid var(--fl-line)!important; border-radius:21px!important; box-shadow:var(--fl-shadow)!important; margin-bottom:22px; }
  body.foodlab-checklist-page .icon-badge { background:var(--fl-teal-soft)!important; color:var(--fl-teal-deep)!important; border:0!important; box-shadow:none!important; border-radius:15px!important; }
  body.foodlab-checklist-page .brand-title h1 { color:var(--fl-primary); font-size:22px; font-weight:900; }
  body.foodlab-checklist-page .brand-title p { color:var(--fl-muted); }
  body.foodlab-checklist-page #homeScreen:not(.hidden) { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
  body.foodlab-checklist-page #homeScreen > .topbar { grid-column:1/-1; }
  body.foodlab-checklist-page .entry-card,
  body.foodlab-checklist-page .tpl-card { min-width:0; padding:18px; margin:0 0 12px; background:var(--fl-surface)!important; border:1px solid var(--fl-line)!important; border-radius:20px!important; box-shadow:var(--fl-shadow)!important; }
  body.foodlab-checklist-page .entry-icon,
  body.foodlab-checklist-page .tpl-chip { background:var(--fl-teal-soft)!important; color:var(--fl-teal-deep)!important; border:0!important; border-radius:15px!important; }
  body.foodlab-checklist-page .entry-title,
  body.foodlab-checklist-page .tpl-name { color:var(--fl-primary); font-size:15px; font-weight:900; }
  body.foodlab-checklist-page .entry-sub,
  body.foodlab-checklist-page .tpl-sub { color:var(--fl-muted); line-height:1.8; }
  body.foodlab-checklist-page .entry-count { background:var(--fl-blue-soft); color:#287eaf; border:0; }
  body.foodlab-checklist-page .entry-arrow { background:var(--fl-teal-soft); color:var(--fl-teal-deep); border:0; }
  body.foodlab-checklist-page .card { min-height:0!important; margin-bottom:15px!important; padding:clamp(16px,2.5vw,24px)!important; background:var(--fl-surface)!important; border:1px solid var(--fl-line)!important; border-radius:20px!important; box-shadow:var(--fl-shadow)!important; }
  body.foodlab-checklist-page .card-label { color:var(--fl-muted); font-size:12px; font-weight:800; }
  body.foodlab-checklist-page .add-row input,
  body.foodlab-checklist-page .editor-name-input,
  body.foodlab-checklist-page .editor-item-row input { min-width:0; width:100%; min-height:44px; background:var(--fl-surface-soft)!important; border:1px solid #cbdfe7!important; border-radius:12px!important; color:var(--fl-ink)!important; font:500 14px/1.5 Vazirmatn,Tahoma,sans-serif!important; box-shadow:none!important; }
  body.foodlab-checklist-page .add-row button { min-width:46px; min-height:44px; width:auto; border:0!important; border-radius:12px!important; background:var(--fl-teal)!important; color:#fff!important; box-shadow:none!important; }
  body.foodlab-checklist-page .progress-bar { height:8px; border:0; background:var(--fl-bg-soft)!important; }
  body.foodlab-checklist-page .progress-fill { border-radius:99px; background:linear-gradient(90deg,var(--fl-teal),#5ccfce)!important; }
  body.foodlab-checklist-page .progress-text { color:var(--fl-muted); }
  body.foodlab-checklist-page .progress-text.done { color:#16875f; }
  body.foodlab-checklist-page .check-item { padding:13px 3px; gap:10px; }
  body.foodlab-checklist-page .check-item + .check-item { border-top:1px solid var(--fl-line)!important; }
  body.foodlab-checklist-page .check-box { width:28px;height:28px; border:1.5px solid #a9c6d1; border-radius:9px; background:var(--fl-surface-soft); }
  body.foodlab-checklist-page .check-input:checked + .check-box { background:var(--fl-teal)!important; border-color:var(--fl-teal)!important; }
  body.foodlab-checklist-page .check-text { color:var(--fl-ink); font-size:14px; line-height:1.8; }
  body.foodlab-checklist-page .order-btn { min-height:26px; border:1px solid var(--fl-line)!important; border-radius:7px!important; background:var(--fl-surface-soft)!important; color:var(--fl-muted)!important; }
  body.foodlab-checklist-page .toolbar { gap:9px; }
  body.foodlab-checklist-page button.primary,
  body.foodlab-checklist-page button.ghost,
  body.foodlab-checklist-page button.danger-ghost { min-height:44px; border-radius:12px!important; box-shadow:none!important; font:700 13px/1.5 Vazirmatn,Tahoma,sans-serif!important; padding:11px 14px; }
  body.foodlab-checklist-page button.primary { background:var(--fl-teal)!important; border:1px solid var(--fl-teal)!important; color:#fff!important; }
  body.foodlab-checklist-page button.ghost { background:var(--fl-surface-soft)!important; border:1px solid var(--fl-line)!important; color:var(--fl-ink)!important; }
  body.foodlab-checklist-page button.danger-ghost { background:var(--fl-red-soft)!important; border:1px solid #f3cbd0!important; color:#a63c4c!important; }
  body.foodlab-checklist-page .new-tpl-btn { min-height:48px; border:1px dashed #9dcfd7!important; border-radius:16px!important; background:var(--fl-teal-soft)!important; color:var(--fl-teal-deep)!important; }
  body.foodlab-checklist-page .empty-note { color:var(--fl-muted); }
  body.foodlab-checklist-page .confirm-box { padding:22px!important; border:1px solid var(--fl-line)!important; border-radius:20px!important; box-shadow:var(--fl-shadow)!important; }

  /* Backup and restore */
  body.foodlab-backup-page { min-height:100vh; padding:clamp(14px,4vw,38px)!important; }
  body.foodlab-backup-page main { width:min(100%,780px)!important; max-width:780px!important; margin:0 auto!important; padding:clamp(20px,4vw,34px)!important; background:var(--fl-surface)!important; border:1px solid var(--fl-line)!important; border-radius:25px!important; box-shadow:var(--fl-shadow)!important; }
  body.foodlab-backup-page main h1 { display:flex; align-items:center; gap:12px; color:var(--fl-primary); font-size:clamp(21px,3vw,28px); line-height:1.5; margin:0 0 10px; }
  body.foodlab-backup-page main h1::before { content:'↕'; display:grid; place-items:center; width:48px;height:48px; flex:none; border-radius:15px; background:var(--fl-teal-soft); color:var(--fl-teal-deep); font-size:25px; }
  body.foodlab-backup-page main p { color:var(--fl-muted); line-height:1.9; }
  body.foodlab-backup-page main hr { border:0; border-top:1px solid var(--fl-line); margin:22px 0; }
  body.foodlab-backup-page main button { min-height:46px; padding:11px 16px!important; margin:6px 6px 6px 0; border:1px solid var(--fl-teal)!important; border-radius:12px!important; background:var(--fl-teal)!important; color:#fff!important; font:700 13px/1.5 Vazirmatn,Tahoma,sans-serif!important; box-shadow:none!important; }
  body.foodlab-backup-page main button:disabled { background:var(--fl-surface-soft)!important; color:#91a5af!important; border-color:var(--fl-line)!important; }
  body.foodlab-backup-page main a { min-height:44px; padding:11px 15px!important; margin-top:14px; border:1px solid var(--fl-line)!important; border-radius:12px!important; background:var(--fl-surface-soft)!important; color:var(--fl-ink)!important; text-decoration:none; }
  body.foodlab-backup-page main input[type=file] { display:block; width:100%; padding:12px!important; border:1px dashed #a7cbd5!important; border-radius:13px!important; background:var(--fl-surface-soft)!important; }
  body.foodlab-backup-page #status { margin-top:14px; color:var(--fl-ink); line-height:1.9; overflow-wrap:anywhere; }
  body.foodlab-backup-page #status:empty { display:none; }
  body.foodlab-backup-page #status:not(:empty) { padding:14px 16px; border:1px solid var(--fl-line); border-radius:14px; background:var(--fl-surface-soft); }
  body.foodlab-backup-page main small { display:block; padding:13px 15px; border:1px solid #f0dfb2; border-radius:13px; background:var(--fl-amber-soft); color:#795d18; line-height:1.9; }

  :root[data-theme="dark"] body.foodlab-orders-page .panel-card,
  :root[data-theme="dark"] body.foodlab-checklist-page .card,
  :root[data-theme="dark"] body.foodlab-backup-page main { background:var(--fl-surface)!important; }
}

@media screen and (min-width:850px) {
  body.foodlab-checklist-page #homeScreen:not(.hidden) > .entry-card { min-height:160px; }
}
@media screen and (max-width:760px) {
  body.foodlab-orders-page { padding:0 12px 100px!important; }
  body.foodlab-orders-page .frame { display:grid; grid-template-columns:minmax(0,1fr); gap:14px; padding:14px 0 115px; }
  body.foodlab-orders-page .top-title,
  body.foodlab-orders-page .hero-panel,
  body.foodlab-orders-page .section-title,
  body.foodlab-orders-page .settings-list,
  body.foodlab-orders-page #ordersSection,
  body.foodlab-orders-page #resultsSection,
  body.foodlab-orders-page #historySection,
  body.foodlab-orders-page footer.note { grid-column:1/-1; }
  body.foodlab-orders-page .hero-panel { padding:18px 15px; border-radius:21px!important; }
  body.foodlab-orders-page .hero-greet { font-size:17px; }
  body.foodlab-orders-page .hero-sub { font-size:12px; }
  body.foodlab-orders-page .stat-pills { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  body.foodlab-orders-page .stat-pill { padding:11px 10px; gap:8px; }
  body.foodlab-orders-page .pill-chip { width:32px;height:32px; }
  body.foodlab-orders-page .pill-num { font-size:17px; }
  body.foodlab-orders-page .pill-label { font-size:10px; }
  body.foodlab-orders-page .panel-card { padding:15px; border-radius:18px!important; }
  body.foodlab-orders-page .order-fields { grid-template-columns:minmax(0,1fr); }
  body.foodlab-orders-page .config-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.foodlab-orders-page .summary-strip { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.foodlab-orders-page .stat-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.foodlab-orders-page .bottom-nav { bottom:9px; }
  body.foodlab-checklist-page { padding:0 12px 30px!important; }
  body.foodlab-checklist-page .shell { padding:14px 0 50px!important; }
  body.foodlab-checklist-page #homeScreen { grid-template-columns:minmax(0,1fr); gap:11px; }
  body.foodlab-checklist-page #homeScreen > .topbar { margin-bottom:6px; padding:13px; }
  body.foodlab-checklist-page .entry-card { padding:15px; margin-bottom:0; }
  body.foodlab-checklist-page .card { padding:16px!important; }
  body.foodlab-checklist-page .add-row { gap:8px; }
  body.foodlab-checklist-page .add-row input { min-width:0; }
  body.foodlab-checklist-page .toolbar button { flex:1 1 100%; }
  body.foodlab-backup-page { padding:14px!important; }
  body.foodlab-backup-page main { padding:20px!important; border-radius:20px!important; }
  body.foodlab-backup-page main button { width:100%; margin:6px 0; }
  body.foodlab-backup-page main a { display:block; text-align:center; }
}
@media screen and (max-width:360px) {
  body.foodlab-orders-page .stat-pills,
  body.foodlab-orders-page .summary-strip,
  body.foodlab-orders-page .stat-grid,
  body.foodlab-orders-page .config-grid { grid-template-columns:minmax(0,1fr); }
  body.foodlab-checklist-page .add-row { flex-wrap:wrap; }
  body.foodlab-checklist-page .add-row input { flex:1 1 100%; }
}
@media (prefers-reduced-motion:reduce) {
  body.foodlab-orders-page *, body.foodlab-checklist-page *, body.foodlab-backup-page * { scroll-behavior:auto!important; transition:none!important; animation:none!important; }
}


/* QC Toolbox — Phase F: screenshot-driven mobile corrections. */
@media screen {
  /* Export/order screen: preserve readable contrast in the teal hero. */
  body.foodlab-orders-page .hero-panel .hero-greet {
    color: #ffffff !important;
    text-shadow: 0 1px 1px rgba(0, 48, 62, .12);
  }
  body.foodlab-orders-page .hero-panel .hero-sub {
    color: rgba(255,255,255,.96) !important;
  }
  body.foodlab-orders-page .hero-panel .hero-avatar {
    color: #ffffff !important;
  }

  /* A details element is a block/accordion; only its summary should be flex. */
  body.foodlab-orders-page details.settings-row {
    display: block !important;
    padding: 0 !important;
  }
  body.foodlab-orders-page details.settings-row > summary {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 16px !important;
    width: 100%;
  }
  body.foodlab-orders-page details.settings-row > .params-body {
    display: block !important;
    width: 100%;
    padding: 0 16px 18px !important;
  }
  body.foodlab-orders-page .config-grid { min-width: 0; }

  /* Keep fixed navigation clear of the Netlify badge; reserve scroll space below. */
  body.foodlab-orders-page .frame { padding-bottom: 205px !important; }
  body.foodlab-orders-page .bottom-nav {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 30 !important;
  }

  /* Backup page: custom Persian file chooser, with the native input still accessible. */
  body.foodlab-backup-page .backup-file-picker {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    margin: 12px 0 16px;
    padding: 12px;
    border: 1px dashed #a7cbd5;
    border-radius: 15px;
    background: var(--fl-surface-soft);
  }
  body.foodlab-backup-page .backup-file-picker label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 15px;
    border-radius: 11px;
    background: var(--fl-teal) !important;
    color: #fff !important;
    font: 700 13px/1.5 Vazirmatn,Tahoma,sans-serif;
    cursor: pointer;
    flex: 0 0 auto;
  }
  body.foodlab-backup-page .backup-file-picker #fileName {
    flex: 1 1 150px;
    min-width: 0;
    color: var(--fl-muted);
    font: 600 12px/1.8 Vazirmatn,Tahoma,sans-serif;
    overflow-wrap: anywhere;
  }
  body.foodlab-backup-page .backup-file-picker input[type="file"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
  body.foodlab-backup-page .backup-file-picker:focus-within {
    outline: 3px solid rgba(22,183,196,.25);
    outline-offset: 2px;
  }
  body.foodlab-backup-page #status { overflow-wrap: anywhere; }
}

@media screen and (max-width: 760px) {
  /* Specificity intentionally beats #homeScreen:not(.hidden) desktop grid. */
  body.foodlab-checklist-page #homeScreen:not(.hidden) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 11px !important;
  }
  body.foodlab-checklist-page #homeScreen:not(.hidden) > .entry-card {
    grid-column: 1 / -1 !important;
    width: 100%;
    min-width: 0;
    align-items: center;
  }
  body.foodlab-checklist-page .entry-body { min-width: 0; }
  body.foodlab-checklist-page .entry-title { font-size: 16px !important; line-height: 1.6 !important; overflow-wrap: normal; word-break: normal; }
  body.foodlab-checklist-page .entry-sub { font-size: 12.5px !important; line-height: 1.75 !important; overflow-wrap: break-word; word-break: normal; }
  body.foodlab-checklist-page { padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important; }
  body.foodlab-checklist-page .shell { padding-bottom: 130px !important; }

  body.foodlab-orders-page .hero-panel { background: linear-gradient(120deg,#087e8b 0%,#16aab6 64%,#3abfc5 100%) !important; }
  body.foodlab-orders-page .hero-panel .hero-sub { font-size: 13px !important; line-height: 1.7; }
  body.foodlab-orders-page .config-grid { grid-template-columns: minmax(0,1fr) !important; gap: 12px !important; }
  body.foodlab-orders-page .field label { line-height: 1.7; }
  body.foodlab-orders-page .field input { min-height: 46px; }
  body.foodlab-orders-page .bottom-nav { width: min(92vw, 480px); }

  body.foodlab-backup-page { padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important; }
  body.foodlab-backup-page main { padding: 18px !important; }
  body.foodlab-backup-page .backup-file-picker { align-items: stretch; flex-direction: column; }
  body.foodlab-backup-page .backup-file-picker label { width: 100%; }
  body.foodlab-backup-page .backup-file-picker #fileName { width: 100%; flex-basis: auto; text-align: center; }
}

@media screen and (min-width: 761px) {
  body.foodlab-backup-page .backup-file-picker { flex-wrap: nowrap; }
}


/* QC Toolbox — Phase G: final mobile footer clearance and keyboard focus. */
@media screen {
  /* Keep the last backup-page action scrollable above the floating hosting badge. */
  body.foodlab-backup-page main > p:last-child {
    margin-bottom: 104px !important;
  }
  body.foodlab-backup-page main > p:last-child a {
    width: 100%;
    text-align: center;
  }
  /* Visible keyboard focus without changing click/touch behavior. */
  body.foodlab-backup-page main button:focus-visible,
  body.foodlab-backup-page main a:focus-visible,
  body.foodlab-backup-page .backup-file-picker label:focus-visible,
  body.foodlab-orders-page .bottom-nav a:focus-visible,
  body.foodlab-checklist-page button:focus-visible,
  body.foodlab-checklist-page a:focus-visible {
    outline: 3px solid rgba(8,126,139,.48) !important;
    outline-offset: 3px !important;
  }
}

@media screen and (max-width: 760px) {
  body.foodlab-backup-page { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)) !important; }
  body.foodlab-backup-page main { margin-bottom: 18px !important; }
  body.foodlab-backup-page main > p:last-child { margin-bottom: 112px !important; }
}
