/* app/assets/stylesheets/application.css */

/* Import a clean, geometric sans-serif font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ------------------------------------------------------------
   Global: make the HTML `hidden` attribute win over author-level
   display rules (e.g. `.chip-grid { display: flex }`). Bootstrap
   ships this too, but keeping it here is harmless and explicit.
   ------------------------------------------------------------ */
[hidden] { display: none !important; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background-color: #fafafa !important;
  color: #000;
}

/* Typography & Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.5px;
}

.tracking-wide {
  letter-spacing: 2px !important;
}

/* Sharp, Premium Buttons */
.btn {
  border-radius: 0 !important;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 0.8rem;
  padding: 12px 24px;
  transition: all 0.2s ease-in-out;
}

.btn-dark, .btn-primary {
  background-color: #000 !important;
  border-color: #000 !important;
  color: #fff !important;
}

.btn-dark:hover, .btn-primary:hover {
  background-color: #333 !important;
}

.btn-outline-dark {
  border-color: #000 !important;
  color: #000 !important;
}

.btn-outline-dark:hover {
  background-color: #000 !important;
  color: #fff !important;
}

/* Clean Cards & Forms */
.card {
  border-radius: 0 !important;
  border: 1px solid #e0e0e0;
  box-shadow: none !important;
}

.form-control, .form-select {
  border-radius: 0 !important;
  border: 1px solid #ccc;
  padding: 10px 15px;
}

.form-control:focus, .form-select:focus {
  border-color: #000;
  box-shadow: none;
}

/* Badges for Statuses */
.badge {
  border-radius: 0 !important;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.5px;
  padding: 6px 10px;
}

/* ============================================================
   REQUEST FORM: Product Type Toggle · Chip Pickers · Colour Autocomplete
   ============================================================ */

.product-type-toggle {
  display: flex;
  gap: 0;
  border: 1px solid #000;
  background: #fff;
  overflow: hidden;
}
.pt-btn {
  flex: 1;
  border: 0;
  border-right: 1px solid #000;
  background: #fff;
  color: #000;
  padding: 12px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  line-height: 1.3;
  min-height: 52px;
}
.pt-btn:last-child { border-right: 0; }
.pt-btn:hover      { background: #f5f5f5; }
.pt-btn.active     { background: #000; color: #fff; }
.pt-btn span {
  display: block;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 1px;
  opacity: 0.7;
  margin-top: 3px;
}
.pt-btn.active span { opacity: 0.85; }

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-btn {
  border: 1px solid #ccc;
  background: #fff;
  color: #000;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  min-height: 38px;
  white-space: nowrap;
}
.chip-btn:hover {
  background: #f5f5f5;
  border-color: #000;
}
.chip-btn.active {
  background: #000;
  color: #fff;
  border-color: #000;
}

[data-product-type-target="shoeSizes"] .chip-btn {
  font-size: 0.7rem;
  padding: 8px 10px;
}

.chip-btn.color-chip {
  padding-left: 30px;
  position: relative;
}
.chip-btn.color-chip::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--swatch, #ddd);
  border: 1px solid rgba(0, 0, 0, 0.25);
}
.chip-btn.color-chip.active::before {
  border-color: rgba(255, 255, 255, 0.6);
}

.color-input-wrap {
  position: relative;
}

.color-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 20;
  background: #fff;
  border: 1px solid #000;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.color-suggestion {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #eee;
  background: #fff;
  color: #000;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.color-suggestion:last-child { border-bottom: 0; }
.color-suggestion:hover,
.color-suggestion:focus {
  background: #f5f5f5;
  outline: none;
}

/* ============================================================
   VM (Visual Manager) REQUEST — purple accent
   ============================================================ */
:root {
  --vm-accent:        #6d28d9;
  --vm-accent-dark:   #5b21b6;
  --vm-accent-soft:   #f3e8ff;
  --vm-accent-border: #a78bfa;
}

.vm-request-row {
  border-left: 5px solid var(--vm-accent) !important;
  background: linear-gradient(to right, var(--vm-accent-soft) 0%, #ffffff 22%) !important;
}

.vm-badge {
  background: var(--vm-accent) !important;
  color: #fff !important;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 3px 8px;
  box-shadow: 0 0 0 1px var(--vm-accent-dark) inset;
}

.chip-btn--vm {
  border: 2px solid var(--vm-accent) !important;
  color: var(--vm-accent) !important;
  background: #fff !important;
  font-weight: 700;
  letter-spacing: 1px;
}
.chip-btn--vm:hover,
.chip-btn--vm.active {
  background: var(--vm-accent) !important;
  color: #fff !important;
}

.vm-toggle-wrap {
  border: 2px solid var(--vm-accent) !important;
  background: var(--vm-accent-soft) !important;
}
.vm-toggle-wrap .form-check-input {
  border-color: var(--vm-accent);
  width: 1.25em;
  height: 1.25em;
  cursor: pointer;
}
.vm-toggle-wrap .form-check-input:checked {
  background-color: var(--vm-accent);
  border-color: var(--vm-accent);
}
.vm-toggle-wrap .form-check-label {
  cursor: pointer;
}

.vm-done-badge {
  background: var(--vm-accent) !important;
  color: #fff !important;
  letter-spacing: 1px;
}

.btn-vm-done {
  background: var(--vm-accent) !important;
  border-color: var(--vm-accent) !important;
  color: #fff !important;
  font-weight: 600;
}
.btn-vm-done:hover {
  background: var(--vm-accent-dark) !important;
  border-color: var(--vm-accent-dark) !important;
}

/* ============================================================
   URGENT REQUEST — red accent
   ============================================================ */
:root {
  --urgent-accent:        #dc3545;
  --urgent-accent-dark:   #b02a37;
  --urgent-accent-soft:   #fdecec;
  --urgent-accent-border: #f5a3ac;
}

.urgent-request-row {
  border-left: 5px solid var(--urgent-accent) !important;
  background: linear-gradient(to right, var(--urgent-accent-soft) 0%, #ffffff 22%) !important;
}

.badge.bg-danger {
  letter-spacing: 1.5px;
  font-weight: 700;
}

.urgent-toggle-wrap {
  border: 2px solid var(--urgent-accent) !important;
  background: var(--urgent-accent-soft) !important;
}
.urgent-toggle-wrap .form-check-input {
  border-color: var(--urgent-accent);
  width: 1.25em;
  height: 1.25em;
  cursor: pointer;
}
.urgent-toggle-wrap .form-check-input:checked {
  background-color: var(--urgent-accent);
  border-color: var(--urgent-accent);
}
.urgent-toggle-wrap .form-check-label {
  cursor: pointer;
}

.urgent-request-row.vm-request-row {
  border-left-color: var(--urgent-accent) !important;
  background:
    linear-gradient(to right,
      var(--urgent-accent-soft) 0%,
      var(--vm-accent-soft) 22%,
      #ffffff 40%) !important;
}

/* ============================================================
   REQUEST FORM — numbered sections + sticky submit on mobile
   ============================================================ */

.sc-form .sc-section {
  background: #fff;
  border: 1px solid #e0e0e0;
  padding: 1.25rem 1.25rem 1rem;
  margin-bottom: 1rem;
}

.sc-section__header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid #eee;
}

.sc-section__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: #000;
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  flex: 0 0 auto;
}

.sc-section__title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin: 0;
  color: #000;
}

.sc-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: #666;
  margin-bottom: 0.375rem;
}

.sc-hint {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.375rem;
  line-height: 1.3;
}

/* ============================================================
   DESKTOP: Size Check table — fixed column proportions
   ============================================================ */
@media (min-width: 768px) {

  .size-check-wrapper {
    overflow: visible !important;
  }

  .size-check-table {
    width: 100% !important;
    table-layout: fixed;
    border-collapse: collapse;
  }

  .size-check-table > thead > tr > th,
  .size-check-table > tbody > tr > td {
    padding: 0.55rem 0.6rem;
    font-size: 0.82rem;
    vertical-align: middle;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
  }

  .size-check-table > thead > tr > th:nth-child(1) { width: 8%  !important; }
  .size-check-table > thead > tr > th:nth-child(2) { width: 10% !important; }
  .size-check-table > thead > tr > th:nth-child(3) { width: 24% !important; }
  .size-check-table > thead > tr > th:nth-child(4) { width: 11% !important; }
  .size-check-table > thead > tr > th:nth-child(5) { width: 8%  !important; }
  .size-check-table > thead > tr > th:nth-child(6) { width: 11% !important; }
  .size-check-table > thead > tr > th:nth-child(7) { width: 28% !important; }

  .size-check-table td.cell-product .fw-bold {
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.25;
    font-size: 0.85rem;
  }

  .size-check-table td.cell-submitted .timer-badge {
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .size-check-table td.cell-employee small[style] {
    max-width: 100% !important;
    display: block;
  }

  .size-check-table td.cell-actions .d-flex {
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    gap: 0.25rem !important;
  }

  .size-check-table td.cell-actions .btn {
    padding: 0.35rem 0.55rem;
    font-size: 0.68rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex: 0 0 auto;
  }
}

/* ============================================================
   MOBILE: Size Check Live Feed
   ============================================================ */
@media (max-width: 767.98px) {

  .size-check-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.75rem;
  }
  .size-check-header .btn {
    width: 100%;
    padding: 12px 16px;
  }

  .size-check-wrapper {
    overflow: visible !important;
  }

  .size-check-table {
    display: block;
    border: 0 !important;
    background: transparent !important;
  }
  .size-check-table thead { display: none; }
  .size-check-table tbody { display: block; }

  .size-check-table tr.section-header {
    display: block;
    border: 1px solid #000;
    background: #f8f9fa;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
  }
  .size-check-table tr.section-header td {
    display: block;
    border: 0;
    padding: 0;
    text-align: left;
    width: auto !important;
  }

  .size-check-table tr.empty-state {
    display: block;
    border: 1px dashed #adb5bd;
    padding: 2rem 1rem;
    margin-bottom: 0.75rem;
    text-align: center;
  }
  .size-check-table tr.empty-state td {
    display: block;
    border: 0;
    padding: 0;
    width: auto !important;
  }

  .size-check-table tr.request-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "submitted status"
      "employee  employee"
      "product   product"
      "size      zone"
      "actions   actions";
    gap: 0.6rem 0.75rem;
    border: 1px solid #000;
    background: #fff;
    padding: 0.85rem;
    margin-bottom: 0.75rem;
  }

  .size-check-table tr.request-row > td {
    display: block;
    border: 0 !important;
    padding: 0 !important;
    width: auto !important;
    text-align: left;
  }

  .size-check-table td.cell-submitted { grid-area: submitted; }
  .size-check-table td.cell-employee  { grid-area: employee;  }
  .size-check-table td.cell-product   { grid-area: product;   }
  .size-check-table td.cell-size      { grid-area: size;      }
  .size-check-table td.cell-zone      { grid-area: zone;      text-align: right; }
  .size-check-table td.cell-status    { grid-area: status;    text-align: right; }
  .size-check-table td.cell-actions   { grid-area: actions;   }

  .size-check-table td.cell-product .fw-bold {
    font-size: 1rem;
  }

  .size-check-table td.cell-actions .d-flex {
    justify-content: flex-start !important;
    gap: 0.4rem !important;
  }
  .size-check-table td.cell-actions .btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.75rem;
    flex: 0 0 auto;
  }

  .size-check-table td.cell-employee small[style] {
    max-width: 100% !important;
  }

  .chip-grid[hidden] { display: none !important; }

  .size-check-table tr.request-row.vm-request-row {
    border-left: 5px solid var(--vm-accent) !important;
    background: linear-gradient(to right, var(--vm-accent-soft) 0%, #ffffff 30%) !important;
  }

  .size-check-table tr.request-row.urgent-request-row {
    border-left: 5px solid var(--urgent-accent) !important;
    background: linear-gradient(to right, var(--urgent-accent-soft) 0%, #ffffff 30%) !important;
  }

  .sc-form .form-control,
  .sc-form .form-select {
    font-size: 16px;
    min-height: 48px;
  }

  .sc-form .sc-section {
    padding: 1rem;
    margin-bottom: 0.75rem;
  }

  .sc-form-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom, 0px));
    margin: 0;
    border-top: 1px solid #000;
    z-index: 1100;
    box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.06);
  }
  .sc-form-actions .btn {
    min-height: 48px;
  }

  .chip-btn {
    min-height: 40px;
    padding: 8px 12px;
  }
}

/* ============================================================
   BOH <-> OFFSITE CHAT DRAWER
   ============================================================ */

.chat-widget {
  position: fixed;
  bottom: 0;
  right: 24px;
  z-index: 1050;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;

  display: flex;
  flex-direction: column;
  align-items: flex-end;

  transform: translateY(calc(100% - 54px));
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;

  pointer-events: none;
}

.chat-widget--open {
  transform: translateY(0);
}

.chat-widget__toggle,
.chat-widget__panel {
  pointer-events: auto;
}

.chat-widget__toggle {
  position: relative;
  width: auto;
  min-width: 84px;
  max-width: 340px;
  padding: 0 20px;
  height: 54px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.22);
  transition: background 0.15s ease-in-out;
  flex-shrink: 0;
}

.chat-widget__toggle:hover {
  background: #1a1a1a;
}

@media (min-width: 481px) {
  .chat-widget--open .chat-widget__toggle {
    width: 340px;
  }
}

.chat-widget__toggle-grip {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  pointer-events: none;
}

.chat-widget__toggle-content {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.chat-widget__toggle-icon {
  font-size: 16px;
  line-height: 1;
}

.chat-widget__toggle-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.chat-widget__toggle-chevron {
  font-size: 9px;
  opacity: 0.65;
  margin-left: 2px;
  transform-origin: center;
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.chat-widget--open .chat-widget__toggle-chevron {
  transform: rotate(180deg);
}

.chat-widget__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #dc3545;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  min-width: 22px;
  height: 22px;
  border-radius: 0;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  line-height: 1;
  box-shadow: 0 0 0 1px var(--urgent-accent-dark);
  animation: chat-badge-pop 0.25s ease;
}

.chat-widget__badge[hidden] { display: none; }

@keyframes chat-badge-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

.chat-widget__panel {
  width: 340px;
  height: 480px;
  background: #fff;
  border: 1px solid #000;
  border-top: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-widget__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #fafafa;
  scroll-behavior: smooth;
}

.chat-message {
  margin-bottom: 10px;
  max-width: 85%;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.chat-message--mine {
  margin-left: auto;
  background: #000;
  color: #fff;
  border-color: #000;
}

.chat-message__meta {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.65;
  margin-bottom: 3px;
}

.chat-message__author { font-weight: 700; margin-right: 6px; }

.chat-message__body { word-wrap: break-word; overflow-wrap: anywhere; }

.chat-widget__empty {
  text-align: center;
  color: #888;
  font-size: 11px;
  padding: 60px 20px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.chat-widget__form {
  display: flex;
  border-top: 1px solid #000;
  flex-shrink: 0;
  background: #fff;
}

.chat-widget__input {
  flex: 1;
  border: none;
  border-radius: 0;
  padding: 12px 14px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: transparent;
}

.chat-widget__input::placeholder { color: #aaa; }

.chat-widget__send {
  background: #000;
  color: #fff;
  border: none;
  border-radius: 0;
  padding: 0 20px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.chat-widget__send:hover { background: #333; }

@media (max-width: 480px) {
  .chat-widget {
    right: 0;
    left: 0;
    align-items: stretch;
  }

  .chat-widget__toggle,
  .chat-widget--open .chat-widget__toggle,
  .chat-widget__panel {
    width: 100%;
    max-width: none;
  }

  .chat-widget__panel {
    height: calc(100vh - 140px);
  }
}

/* =============================================================
   Partial recovery stepper (mobile-first)
   ============================================================= */

.size-stepper-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed #e5e5e5;
}
.size-stepper-row:last-child { border-bottom: 0; }

.size-stepper-row__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 11px 10px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.size-stepper-row__controls {
  display: inline-flex;
  align-items: stretch;
  height: 44px;
  border: 1px solid #111;
  background: #fff;
}

.stepper__btn {
  width: 44px;
  background: #fff;
  border: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: #111;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.stepper__btn:first-of-type { border-right: 1px solid #111; }
.stepper__btn:last-of-type  { border-left:  1px solid #111; }
.stepper__btn:hover:not(:disabled)  { background: #f4f4f4; }
.stepper__btn:active:not(:disabled) { background: #e4e4e4; }
.stepper__btn:disabled { opacity: 0.25; cursor: not-allowed; }

.stepper__value {
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  background: #fff;
}

.size-stepper-row__need {
  color: #888;
  font-size: 13px;
  margin-left: auto;
}

/* =============================================================
   Recovery show page — layout, filter, mobile
   ============================================================= */

.recovery-progress-slot {
  flex-shrink: 0;
}
.recovery-progress-widget {
  transition: opacity 0.15s ease;
}

/* -------- Category filter pill bar (two levels) -------- */
.category-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.category-filter-bar[hidden] { display: none !important; }

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #111;
  color: #111;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  white-space: nowrap;
}
.category-pill[hidden] { display: none !important; }
.category-pill:hover  { background: #f4f4f4; }
.category-pill.active {
  background: #111;
  color: #fff;
}

.category-pill__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 0 6px;
  height: 20px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}
.category-pill.active .category-pill__count {
  background: rgba(255, 255, 255, 0.2);
}

/* Subcategory pills are visually lighter than department pills */
.category-pill--sub {
  padding: 6px 12px;
  font-size: 12px;
  border-color: #ccc;
  color: #555;
}
.category-pill--sub.active {
  background: #333;
  border-color: #333;
  color: #fff;
}

.category-group[hidden] { display: none !important; }

/* -------- Actions bar inside each row (desktop) -------- */
.recovery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

/* =============================================================
   Mobile — turn each recovery table row into a card
   ============================================================= */
@media (max-width: 768px) {

  .recovery-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 14px;
  }
  .recovery-progress-slot { width: 100%; }
  .recovery-progress-widget { width: 100%; }
  .recovery-progress-widget .progress {
    flex: 1;
    width: auto !important;
  }

  /* Both filter bars become horizontally scrollable strips */
  .category-filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .category-filter-bar::-webkit-scrollbar { height: 4px; }
  .category-filter-bar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
  }

  /* Table → card list */
  .recovery-table {
    display: block;
    border: 0 !important;
    background: transparent !important;
  }
  .recovery-table thead { display: none; }
  .recovery-table tbody { display: block; }

  .recovery-table tr.recovery-item-row {
    display: block;
    background: #fff;
    border: 1px solid #111;
    margin-bottom: 14px;
    padding: 0;
  }
  .recovery-table tr.recovery-item-row > td {
    display: block;
    border: 0 !important;
    padding: 12px 14px;
    width: auto !important;
    min-width: 0 !important;
  }
  .recovery-table tr.recovery-item-row > td:not(:last-child) {
    border-bottom: 1px solid #eee !important;
  }

  .recovery-table .cell-style {
    background: #fafafa;
    border-bottom: 1px solid #111 !important;
    padding-top: 14px !important;
  }

  .recovery-table .cell-color,
  .recovery-table .cell-fixture {
    display: inline-block !important;
    width: 50% !important;
    box-sizing: border-box;
  }
  .recovery-table .cell-color { border-bottom: 1px solid #eee !important; }
  .recovery-table .cell-fixture { border-bottom: 1px solid #eee !important; }

  .recovery-table .cell-sizes  { line-height: 1.9; }
  .recovery-table .cell-status { padding-top: 10px !important; }

  .recovery-table .cell-actions {
    text-align: left !important;
    background: #f8f8f8;
    padding: 12px 14px 14px !important;
  }
  .recovery-actions {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    justify-content: stretch;
  }
  .recovery-actions > * {
    width: 100%;
    padding: 10px 8px;
    font-size: 13px;
  }
}

/* =============================================================
   Modal — full-width on small screens (recovery + size check)
   ============================================================= */
@media (max-width: 576px) {
  .modal-dialog-mobile {
    max-width: calc(100vw - 16px);
    margin: 8px auto;
  }
  .modal-footer {
    flex-direction: column;
    gap: 8px;
  }
  .modal-footer > * {
    width: 100%;
    margin: 0 !important;
  }
  .size-stepper-row__badge {
    min-width: 52px;
    padding: 12px 8px;
  }
}

/* =============================================================
   Status filter dropdown (third level of the recovery filter)
   ============================================================= */

.status-filter-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-filter__label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin: 0;
}

.status-filter__select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding: 9px 34px 9px 14px;
  border: 1px solid #111;
  background-color: #fff;
  color: #111;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-radius: 0;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23111' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 7px;
  transition: background-color 0.1s ease, border-color 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 40px;
}
.status-filter__select:hover  { background-color: #f4f4f4; }
.status-filter__select:focus  {
  outline: none;
  border-color: #000;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12);
}

@media (max-width: 768px) {
  /* Let the dropdown stretch to a comfortable tap target */
  .status-filter-wrap {
    gap: 8px;
  }
  .status-filter__select {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    padding: 12px 34px 12px 14px;
    min-height: 46px;
  }
}

/* =============================================================
   SAFETY NET — recovery table wrapper
   -------------------------------------------------------------
   The primary fix for the "modal dark and unfocused on mobile"
   bug is architectural: modals are now rendered as siblings of
   the table (see recovery_reports/show.html.erb), not inside
   <tr> cells. That's what Bootstrap recommends and what keeps
   `position: fixed` resolving against the viewport.

   This rule is defense-in-depth: if a future contributor ever
   drops a modal / tooltip / dropdown back inside the
   .table-responsive wrapper, this prevents the same iOS Safari
   containing-block bug from resurfacing.
   ============================================================= */
@media (max-width: 768px) {
  .table-responsive:has(.recovery-table) {
    overflow: visible !important;
  }
}

/* =============================================================
   RECOVERY SUMMARY — collapsible card + nested sizes grid
   ============================================================= */

.recovery-summary { overflow: hidden; }

/* ---- Outer toggle (whole summary) ---- */
.recovery-summary__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1.1rem;
  background: #fafafa;
  border: 0;
  border-bottom: 1px solid #000;
  color: #111;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: background 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.recovery-summary__toggle:hover  { background: #f0f0f0; }
.recovery-summary__toggle:active { background: #e8e8e8; }

/* When collapsed, nothing follows the toggle — drop the divider. */
.recovery-summary[data-collapsed="true"] .recovery-summary__toggle {
  border-bottom: 0;
}

.recovery-summary__toggle-label {
  color: #111;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.recovery-summary__toggle-stats {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.3px;
  color: #111;
  white-space: nowrap;
}
.recovery-summary__toggle-stats .text-danger { color: #dc3545 !important; }
.recovery-summary__toggle-sep { color: #bbb; font-weight: 400; }

/* ---- Nested toggle (Missing by size) — smaller, inset look ---- */
.recovery-summary__toggle--nested {
  background: #fff;
  border-top: 0;         /* parent .recovery-summary__sizes carries the top border */
  border-bottom: 0;
  min-height: 40px;
  padding: 0.55rem 1.1rem;
  font-size: 0.65rem;
  letter-spacing: 1.2px;
}
.recovery-summary__toggle--nested:hover  { background: #f5f5f5; }
.recovery-summary__toggle--nested:active { background: #ececec; }

.recovery-summary__toggle [data-collapse-target="icon"] {
  display: inline-block;
  width: 1em;
  text-align: center;
  font-size: 0.8rem;
  color: #555;
}

/* ---- Header band: "Units · X colorways · Y styles" ---- */
.recovery-summary__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1.1rem;
  background: #fff;
  border-bottom: 1px solid #eee;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  font-weight: 600;
}
.recovery-summary__header-unit {
  color: #111;
  font-weight: 700;
  letter-spacing: 1.2px;
}
.recovery-summary__header-sep { color: #ccc; font-weight: 400; }

/* ---- Metric tiles ---- */
.recovery-summary__metrics { border-bottom: 1px solid #000; }

.recovery-summary__metric {
  padding: 0.85rem 1.1rem;
  border-right: 1px solid #eee;
}
.recovery-summary__metric:last-child { border-right: 0; }

@media (max-width: 575.98px) {
  .recovery-summary__metric:nth-child(2n)   { border-right: 0; }
  .recovery-summary__metric:nth-child(-n+2) { border-bottom: 1px solid #eee; }
}

.recovery-summary__value {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: #000;
}
.recovery-summary__value.text-success { color: #198754 !important; }
.recovery-summary__value.text-danger  { color: #dc3545 !important; }

.recovery-summary__label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: #888;
  margin-top: 0.15rem;
}

/* ---- Missing split: untouched vs checked ---- */
.recovery-summary__missing-split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-bottom: 1px solid #eee;
  font-size: 0.72rem;
}

.recovery-summary__missing-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: #888;
  margin-right: 0.15rem;
}

.missing-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 0.7rem;
  line-height: 1.2;
  border-radius: 0;
  white-space: nowrap;
}
.missing-chip strong      { font-weight: 700; font-size: 0.82rem; }
.missing-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.missing-chip--untouched          { border-color: #d0d0d0; background: #f8f9fa; }
.missing-chip--untouched .missing-chip__dot { background: #adb5bd; }
.missing-chip--untouched strong   { color: #6c757d; }

.missing-chip--checked             { border-color: #f5a3ac; background: #fff5f5; }
.missing-chip--checked .missing-chip__dot   { background: #dc3545; }
.missing-chip--checked strong      { color: #dc3545; }

.missing-chip__text {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #888;
}

.missing-chip--tiny {
  padding: 0.1rem 0.3rem;
  gap: 0.25rem;
  font-size: 0.62rem;
  border: 0;
  background: transparent;
  font-weight: 700;
}
.missing-chip--tiny .missing-chip__dot { width: 6px; height: 6px; }
.missing-chip--tiny.missing-chip--untouched strong { color: #6c757d; }
.missing-chip--tiny.missing-chip--checked   strong { color: #dc3545; }

/* ---- Progress bar ---- */
.recovery-summary__progress {
  padding: 0.55rem 1.1rem;
  background: #fff;
}
.recovery-summary__progress .progress { height: 10px; }

/* ---- Nested sizes section ---- */
.recovery-summary__sizes { border-top: 1px solid #000; }
.recovery-summary__sizes-body { background: #fff; }

/* ---- Per-size tiles ---- */
.size-summary-box { background: #fff; transition: background 0.1s ease; }
.size-summary-box--done    { background: #f0fbf3; }
.size-summary-box--missing { background: #fff5f5; }

.size-summary-box__size {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: #666;
  margin-bottom: 0.15rem;
}
.size-summary-box__numbers {
  font-size: 0.85rem;
  line-height: 1.1;
}
.size-summary-box__state {
  font-size: 0.62rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 0.15rem;
  font-weight: 600;
}
.size-summary-box__split {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 0.2rem;
}

/* ---- Category header subtotals ---- */
.category-header__totals {
  white-space: nowrap;
  line-height: 1.4;
}

/* =============================================================
   MOBILE — compact toggle + tighter tiles
   ============================================================= */
@media (max-width: 575.98px) {

  /* Outer toggle */
  .recovery-summary__toggle {
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    font-size: 0.65rem;
    letter-spacing: 1.2px;
    gap: 6px;
  }
  .recovery-summary__toggle-label {
    font-size: 0.65rem;
    letter-spacing: 1.2px;
  }
  .recovery-summary__toggle-stats {
    font-size: 0.62rem;
    letter-spacing: 0.2px;
    gap: 0.25rem;
  }

  /* Nested toggle */
  .recovery-summary__toggle--nested {
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    font-size: 0.6rem;
    letter-spacing: 1px;
  }

  /* Header band */
  .recovery-summary__header {
    padding: 0.35rem 0.75rem;
    font-size: 0.58rem;
    letter-spacing: 0.8px;
    gap: 0.3rem;
  }

  /* Metric tiles */
  .recovery-summary__metric { padding: 0.55rem 0.7rem; }
  .recovery-summary__value  { font-size: 1.15rem; line-height: 1; }
  .recovery-summary__label  { font-size: 0.55rem; letter-spacing: 1px; margin-top: 0.1rem; }

  /* Missing split */
  .recovery-summary__missing-split { padding: 0.45rem 0.75rem; gap: 0.3rem; }
  .recovery-summary__missing-label { font-size: 0.55rem; letter-spacing: 1px; }
  .missing-chip          { padding: 0.18rem 0.4rem; font-size: 0.62rem; gap: 0.25rem; }
  .missing-chip strong   { font-size: 0.72rem; }
  .missing-chip__text    { font-size: 0.55rem; letter-spacing: 0.5px; }
  .missing-chip__dot     { width: 7px; height: 7px; }

  /* Progress bar */
  .recovery-summary__progress { padding: 0.45rem 0.75rem; }
  .recovery-summary__progress .progress { height: 8px; }

  /* Size grid */
  .recovery-summary__sizes-body .row { --bs-gutter-x: 0.35rem; --bs-gutter-y: 0.35rem; }
  .size-summary-box { padding: 0.4rem 0.25rem !important; }
  .size-summary-box__size    { font-size: 0.55rem; letter-spacing: 1px; margin-bottom: 0.1rem; }
  .size-summary-box__numbers { font-size: 0.72rem; }
  .size-summary-box__state   { font-size: 0.55rem; margin-top: 0.1rem; }
  .size-summary-box__split   { gap: 3px; margin-top: 0.15rem; }
  .missing-chip--tiny        { font-size: 0.58rem; padding: 0.05rem 0.2rem; }
  .missing-chip--tiny .missing-chip__dot { width: 5px; height: 5px; }
}