:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --ink: #23201b;
  --muted: #8a8478;
  --line: #e6e2da;
  --accent: #b5502e;
  --accent-ink: #ffffff;
  --green: #4a7a4a;
  --danger: #b23a3a;
  --radius: 10px;
}

@font-face {
  font-family: "Janeiro";
  src: url("/static/fonts/janeiro.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: inherit; }

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

/* On wide screens the logo and the (much wider, variable-width) nav
   cluster don't balance, so centering the title with flex:1 alone drifts
   it left -- and a fixed absolute-center overlapped the nav once it grew
   past 4 tabs. A 3-column grid reserves exactly the nav's own width
   instead of guessing, so the title is centered in what's actually left. */
@media (min-width: 821px) {
  .topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
  }
  .topbar-title {
    position: static;
    transform: none;
    flex: none;
  }
}

.topbar-logo-btn {
  border: none;
  background: none;
  padding: 4px;
  margin: -4px;
  cursor: pointer;
  flex-shrink: 0;
  display: block;
  border-radius: 8px;
}

.topbar-logo {
  height: 38px;
  width: auto;
  display: block;
}

.topbar-title {
  font-family: "Janeiro", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 22px;
  line-height: 0.8;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink);
  margin: 0;
  flex: 1;
  min-width: 120px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Account bottom sheet, opened from the logo */
.sheet-backdrop[hidden], .bottom-sheet[hidden] { display: none; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.45);
  z-index: 45;
}
.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 46;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
  max-height: 85vh;
  overflow-y: auto;
}
.sheet-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 6px;
}
.sheet-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}
.sheet-header-row h3 { margin: 0; font-size: 16px; }
.sheet-close-btn {
  border: none;
  background: var(--bg);
  color: var(--ink);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sheet-edit-footer {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 18px;
}
.icon-btn-danger {
  border: 1.5px solid var(--danger);
  background: var(--card);
  color: var(--danger);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.sheet-edit-footer .btn.primary-save {
  flex: 1;
  padding: 12px 16px;
  font-size: 15px;
}

/* Floating action button (Items / Vendors tabs) */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 30;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 14px;
  padding: 14px 22px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill-option {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pill-option.selected {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 0 auto 16px;
}
.bottom-sheet-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin: 0 0 16px;
}

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
}

.btn.secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.small {
  padding: 5px 10px;
  font-size: 12px;
}

.btn.danger {
  background: var(--danger);
  color: white;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input, select {
  font-family: inherit;
  font-size: 16px; /* 16px prevents iOS Safari from auto-zooming on focus */
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}

/* Native select arrows land at inconsistent heights across browsers --
   drop them for a hand-drawn chevron that's always vertically centered. */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238a8478' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
}

.layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  gap: 20px;
  padding: 20px;
  align-items: flex-start;
}

@media (max-width: 820px) {
  .layout { flex-direction: column; padding: 14px 14px 0; }
}

/* Comfortable touch targets on phones */
@media (max-width: 600px) {
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn.small { min-height: 36px; padding: 7px 12px; }
  input, select { min-height: 44px; }
  .item-add-row input { min-height: 44px; }
}

/* Section nav (Proteins / Fruits & Veggies / Breads / Dairy & Syrups / Dry Store).
   Only this bar stays fixed on scroll -- the topbar and search scroll away
   normally above it. */
.section-nav[hidden] { display: none; }
.section-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 22px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 9;
}
.section-tab {
  flex-shrink: 0;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-tab .emoji { font-size: 17px; line-height: 1; }
.section-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* Search bar: rounded, with a leading icon and a clear (x) button -- made
   deliberately prominent since this audience leans on icons over text.
   Same max-width + side padding as .catalog-wrap so it lines up exactly
   with the width of the ingredient cards below it. */
.search-wrap {
  padding: 18px 16px 14px;
  max-width: 900px;
  margin: 0 auto;
  box-sizing: border-box;
}
.search-inner {
  position: relative;
  width: 100%;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
}
.search {
  width: 100%;
  margin: 0;
  padding: 11px 40px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  font-size: 15px;
  background: var(--card);
}
.search:focus { border-color: var(--accent); outline: none; }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-clear[hidden] { display: none; }

.catalog-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 4px 16px 100px;
  box-sizing: border-box;
}

.section-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--ink);
  margin: 12px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Fixed "View cart" bar at the bottom of the browsing screen */
.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
}
.cart-bar-count {
  flex: 1 1 50%;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.cart-bar .btn {
  flex: 1 1 50%;
  width: 50%;
  min-width: 0;
}

/* Full-screen pages (cart review, submission history) */
.fullpage[hidden] { display: none; }
.fullpage {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.fullpage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.fullpage-header h2 { font-size: 16px; margin: 0; }
.fullpage-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
}
.history-date-row { margin-bottom: 14px; }
.fullpage-footer {
  padding: 12px 16px 16px;
  background: var(--card);
  border-top: 1px solid var(--line);
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
}
.fullpage-footer-buttons {
  display: flex;
  gap: 10px;
}

/* Order-submitted success state: a drawn checkmark + message, overlaid on
   the cart page. Animations only run while .play is present, so re-adding
   that class (after a reflow) restarts them each time. */
.fullpage-success[hidden] { display: none; }
.fullpage-success {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 5;
}
.success-check svg { width: 84px; height: 84px; display: block; }
.success-check-circle {
  stroke: var(--green);
  stroke-width: 3;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
}
.success-check-mark {
  stroke: var(--green);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
}
.fullpage-success.play .success-check-circle {
  animation: success-draw 0.5s ease forwards;
}
.fullpage-success.play .success-check-mark {
  animation: success-draw 0.35s ease forwards 0.45s;
}
@keyframes success-draw {
  to { stroke-dashoffset: 0; }
}
.success-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  padding: 0 24px;
  opacity: 0;
}
.fullpage-success.play .success-text {
  animation: success-fade-in 0.3s ease forwards 0.75s;
}
@keyframes success-fade-in {
  to { opacity: 1; }
}
.fullpage-footer-buttons .btn {
  flex: 1;
  width: auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.admin-item-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--card);
}
.admin-item-box.inactive { opacity: 0.55; }
.admin-item-box .info { min-width: 0; }
.admin-item-box .name { font-weight: 700; font-size: 14px; }
.admin-item-box .meta-line { font-size: 12px; color: var(--muted); margin-top: 2px; }
.admin-item-box .edit-item-btn { flex-shrink: 0; }

.admin-section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 20px 0 8px;
}
.admin-section-title:first-child { margin-top: 0; }

.items-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 40px;
  margin-bottom: 18px;
}
/* Search fills whatever space the (right-aligned) vendor-mapping controls
   don't need, with a fixed 40px gap between the two. `.search-inner`'s own
   width:100% would otherwise become its flex-basis and force it to claim
   the whole row, wrapping the vendor-mapping controls onto their own line. */
.items-toolbar .search-inner { flex: 1 1 auto; width: auto; min-width: 0; }

.bulk-upload-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}
.bulk-upload-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.bulk-upload-row .meta { font-size: 12px; }
.btn.icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn.icon-text {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Bulk upload is a web-only convenience -- keep the mobile Items page
   focused on search + the item list. */
@media (max-width: 820px) {
  .bulk-upload-row { display: none; }
}

.item-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (min-width: 700px) {
  .item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.item-name { font-weight: 600; font-size: 15px; }

.item-add-row {
  display: flex;
  align-items: center;
}
.item-add-row .qty-input {
  flex: 1 1 50%;
  width: 50%;
  min-width: 0;
  margin-right: 8px;
}
.item-add-row .qty-input.committed {
  background: var(--bg);
  color: var(--muted);
}
.uom-suffix {
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
  margin-right: 16px;
}
.item-add-row .add-btn {
  flex: 1 1 50%;
  width: 50%;
  min-width: 0;
  /* Outlined, not filled -- distinct from the solid "View Cart" bar button
     so a screen full of buttons doesn't read as one same-colored row. */
  background: var(--card);
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.item-add-row .add-btn:disabled {
  background: var(--green);
  color: white;
  border-color: var(--green);
  opacity: 1;
}

.cart-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.cart-line:last-child { border-bottom: none; }
.cart-line .name { flex: 1; font-size: 13px; }
.cart-line input { width: 60px; }
.cart-line .remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge.submitted { background: #fbe6d4; color: #92531c; }
.badge.ordered { background: #dbe9d9; color: #2f5a2f; }
.badge.completed { background: #dcdcdc; color: #4b4b4b; }

.tabs {
  display: flex;
  gap: 6px;
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Desktop: tabs + logout inline in the topbar, top right */
.admin-nav-desktop {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.admin-nav-desktop .tab-trigger {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.admin-nav-desktop .tab-trigger.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.admin-nav-desktop .topbar-meta { margin-left: 10px; }

/* Mobile: hamburger + side drawer instead */
.hamburger-btn {
  display: none;
  border: none;
  background: none;
  color: var(--ink);
  padding: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.side-drawer[hidden] { display: none; }
.side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 46;
  width: 76vw;
  max-width: 300px;
  background: var(--card);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
  padding: calc(20px + env(safe-area-inset-top)) 0 20px;
  display: flex;
  flex-direction: column;
}
.drawer-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.drawer-item.active { color: var(--accent); }
.drawer-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}

@media (max-width: 820px) {
  .admin-nav-desktop { display: none; }
  .hamburger-btn { display: flex; }
}

/* New-item / new-vendor sheets: a centered modal on desktop instead of a
   bottom sheet (edit sheets stay bottom sheets everywhere). */
@media (min-width: 821px) {
  .bottom-sheet.modal-on-desktop {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 440px;
    max-width: 90vw;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  }
  .bottom-sheet.modal-on-desktop .bottom-sheet-handle { display: none; }
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.card .table-scroll {
  margin: 0 -16px;
  padding: 0 16px;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

/* Consolidated Purchase Orders tables: fixed column widths (set via
   <colgroup> in the markup) so every box's Qty/Chef columns land at the
   same x-position regardless of item-name length, on any screen size.
   Only the item name wraps -- the other columns stay single-line. */
.consolidated-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}
.consolidated-table th,
.consolidated-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.consolidated-table th:first-child,
.consolidated-table td:first-child {
  white-space: normal;
  overflow-wrap: break-word;
  text-overflow: clip;
}

/* When the same item was ordered by more than one chef, the whole qty cell
   becomes a button (not just a small icon) that expands a per-chef
   breakdown instead of a dedicated column. */
.qty-breakdown-toggle {
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 4px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  max-width: 100%;
}
.qty-breakdown-toggle svg {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.qty-breakdown-toggle.open svg { transform: rotate(180deg); }
/* Each breakdown entry is its own <tr> using the same 75/25 <colgroup> as
   the item rows above it, so the sub-item qty lands in exactly the same
   column -- not just "close" via an inner flex row spanning both columns. */
.breakdown-row td {
  background: var(--bg);
  font-size: 12px;
  color: var(--muted);
  padding-top: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.breakdown-row td:first-child {
  padding-left: 20px;
  border-left: 2px solid var(--line);
}
.breakdown-row.last td { padding-bottom: 8px; border-bottom: none; }

/* Users table: Active checkbox leads (first column); Name/Role save
   themselves on change; New PIN gets its own contextual Save button. */
.users-table th.active-col,
.users-table td.active-col {
  width: 1%;
  text-align: center;
}
.users-table .f-active {
  width: 18px;
  height: 18px;
  margin: 0;
}
.users-table .f-name {
  width: 100%;
  min-width: 120px;
}
.users-table .f-role {
  min-width: 130px;
}
.pin-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pin-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 60px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.pin-save-btn[hidden] { display: none; }
.pin-save-btn.success {
  background: var(--green);
  color: #fff;
}

/* Shared loading spinner for any button (PIN save, Place Order, ...). */
.btn-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  vertical-align: -2px;
}
.btn.secondary .btn-spinner {
  border-color: rgba(35, 32, 27, 0.25);
  border-top-color: var(--ink);
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}

@media (max-width: 600px) {
  .form-row { flex-direction: column; align-items: stretch; }
  .form-row input, .form-row select, .form-row .btn { width: 100%; }
}

/* Purchase Orders view toggle: always side by side, even on a phone. */
.view-toggle-row { gap: 6px; }
@media (max-width: 600px) {
  .view-toggle-row.form-row { flex-direction: row; }
  .view-toggle-row.form-row .btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    padding: 10px 4px;
    font-size: 12px;
    white-space: normal;
  }
}

/* Purchase Request toolbar (date filter left, "Download all" right) and
   History's toolbar (view pills left, date filter right) share this row. */
.orders-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.orders-toolbar .view-toggle-row { margin-bottom: 0; }

/* Today/Yesterday pills + a single-day date input, used by both Purchase
   Request and History. */
.date-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.date-filter input[type="date"] { flex-shrink: 0; }
/* Today/Yesterday pills use .btn.small (smaller padding/font) while the
   date input uses the base input padding -- pin both to the same height
   explicitly rather than relying on padding+font-size to happen to match. */
.date-filter .btn,
.date-filter input[type="date"] {
  height: 38px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}
.date-filter .btn {
  display: inline-flex;
  align-items: center;
}

/* Below this, a toolbar's pills/date-filter no longer fit on one line
   without squeezing button labels onto two -- stack instead. */
@media (max-width: 480px) {
  .orders-toolbar { flex-direction: column; align-items: stretch; }
  .orders-toolbar .date-filter,
  .orders-toolbar input[type="date"] { width: 100%; }
}

.empty { color: var(--muted); font-size: 14px; padding: 20px 0; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.login-card h1 {
  font-size: 20px;
  margin: 0 0 4px;
}
.login-card p {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 20px;
}
.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  margin-top: 14px;
}
.login-card select, .login-card input {
  width: 100%;
}
.login-card .btn {
  width: 100%;
  margin-top: 20px;
}
.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  display: none;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.order-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.order-card-head .meta { font-size: 12px; color: var(--muted); }
.order-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}
.order-line:last-child { border-bottom: none; }

/* Small inline icon button -- the edit pencil on an order card, lighter
   weight than .btn.icon-only (no border/box), for use inline with text. */
.icon-btn {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg); }

/* Edit-submission bottom sheet: one row per line item, quantity editable
   unless it's already been approved (locked, shown for context only). */
.edit-order-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.edit-order-line:last-child { border-bottom: none; }
.edit-order-line .name { flex: 1; font-size: 13px; }
.edit-order-line input { width: 70px; }
.edit-order-line.locked .meta { font-size: 12px; color: var(--muted); }

/* Admin History -- By Chef: one card per chef, one block per individual
   submission (not merged into a running total) so each has its own
   timestamp. */
.chef-history-card {
  margin-bottom: 18px;
}
.chef-history-card h3 {
  font-size: 14px;
  margin: 0 0 12px;
}
.chef-submission {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.chef-submission:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.chef-submission-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.vendor-group {
  margin-bottom: 18px;
}
.vendor-group h3 {
  font-size: 14px;
  margin: 0;
}
.vendor-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.vendor-group-header .btn.icon-only {
  width: 30px;
  height: 30px;
}

/* Place Order / Revert, under each vendor card. */
.vendor-group-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.vendor-group-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 128px;
}

/* Purchase Request: Requests + Order Placed side by side on web, each its
   own collapsible dropdown on mobile. */
.kanban-board {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}
.kanban-column {
  flex: 1 1 0;
  min-width: 0;
}
.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-family: inherit;
  color: inherit;
  cursor: default;
}
.kanban-column-header h2 {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}
.kanban-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kanban-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 9px;
  min-width: 20px;
  text-align: center;
}
.kanban-toggle {
  display: none;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.kanban-toggle.open { transform: rotate(180deg); }

@media (max-width: 820px) {
  /* align-items:flex-start (needed on web so unequal-height columns don't
     stretch to match each other) makes each column shrink to its own
     content width once flex-direction flips to column -- override back to
     a full-width stack here. */
  .kanban-board { flex-direction: column; align-items: stretch; gap: 0; }
  .kanban-column { margin-bottom: 14px; }
  .kanban-column-header { cursor: pointer; }
  .kanban-toggle { display: inline-flex; }
  .kanban-column-content.collapsed { display: none; }
}
