/* ============================================================
   QuoteStation — Mobile Redesign (≤767px)
   Native iOS/Android feel. Not a shrunk desktop.
   ============================================================ */

/* ─── Desktop-hidden: mobile-only elements default to none ─── */
.station-actions-bar,
.station-viewer-info,
.station-viewer-dots,
.summary-back-btn { display: none; }


/* ════════════════════════════════════════════════════════════
   MOBILE BREAKPOINT
   ════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ─── Global base ─── */
  html, body {
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    overscroll-behavior-y: none;
  }

  /* Hide all keyboard hint chrome */
  .kbd,
  .inbox-keyboard-bar,
  .station-keyboard-bar,
  .summary-keyboard-bar,
  .inbox-search-kbd,
  .inbox-tab-kbd,
  .palette-kbd,
  .keyboard-hint,
  .keyboard-hint-warning {
    display: none !important;
  }

  /* No hover states on touch devices */
  @media (hover: none) {
    .rfq-row:hover,
    .inbox-tab:hover,
    .station-breadcrumb:hover,
    .station-view-toggle:hover,
    .viewer-nav:hover,
    .action-btn:hover {
      background: revert;
      color: revert;
      border-color: revert;
    }
  }


  /* ══════════════════════════════════════════════════════════
     INBOX
  ══════════════════════════════════════════════════════════ */

  .inbox {
    padding: 0;
    align-items: stretch;
  }

  .inbox-container {
    max-width: none;
    padding: 0;
    padding-top: env(safe-area-inset-top);
    height: 100%;
  }

  /* ─── Header ─── */
  .inbox-header {
    padding: var(--space-4) var(--space-4) 0;
    margin-bottom: var(--space-3);
  }

  .inbox-title {
    font-size: 22px;
    letter-spacing: -0.03em;
  }

  /* ─── Search: sticky, 44px, full bleed ─── */
  .inbox-search {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-bg);
    padding: 0 var(--space-4) var(--space-3);
    margin-bottom: 0;
    box-shadow: 0 1px 0 var(--color-border-subtle);
  }

  .inbox-search-icon {
    left: calc(var(--space-4) + var(--space-3));
    width: 16px;
    height: 16px;
  }

  .inbox-search-input {
    height: 44px;
    border-radius: 12px;
    font-size: 16px; /* prevents iOS auto-zoom */
    padding: 0 var(--space-4) 0 44px;
  }

  /* ─── Tabs: pill buttons centered ─── */
  .inbox-tabs {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4) var(--space-3);
    margin-bottom: 0;
  }

  .inbox-tab {
    flex: 1;
    max-width: 96px;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    border-radius: 20px;
    text-align: center;
    border: 1.5px solid var(--color-border);
    transition: none;
  }

  .inbox-tab.active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
    box-shadow: none;
  }

  /* ─── List ─── */
  .inbox-list {
    flex: 1;
    padding: var(--space-2) var(--space-4) var(--space-6);
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
  }

  /* ─── RFQ rows: cards ─── */
  .rfq-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    min-height: 68px;
    touch-action: manipulation;
    transition: transform 0.1s var(--ease-out), box-shadow 0.1s var(--ease-out);
    /* Reset desktop grid */
    grid-template-columns: unset;
  }

  .rfq-row:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  }

  .rfq-row.selected,
  .rfq-row.selected:hover {
    background: var(--color-accent-subtle);
    border: 1.5px solid var(--color-accent);
    box-shadow: 0 2px 10px rgba(99,102,241,0.12);
  }

  .rfq-status {
    margin-top: 5px;
    width: 10px;
    height: 10px;
    flex-shrink: 0;
  }

  .rfq-row-content {
    flex: 1;
    min-width: 0;
  }

  .rfq-customer {
    font-size: 16px;
    font-weight: var(--weight-semibold);
    margin-bottom: 3px;
  }

  .rfq-meta {
    font-size: 13px;
    gap: var(--space-2);
    flex-wrap: wrap;
  }

  .rfq-parts-count {
    font-size: 14px;
    font-weight: var(--weight-medium);
    color: var(--color-text-secondary);
    align-self: center;
  }


  /* ══════════════════════════════════════════════════════════
     STATION
  ══════════════════════════════════════════════════════════ */

  /* ─── Top bar: 44px minimal chrome ─── */
  .station-topbar {
    height: calc(44px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) var(--space-3) 0;
  }

  .station-breadcrumb {
    font-size: 17px;
    font-weight: var(--weight-medium);
    color: var(--color-accent);
    padding: var(--space-2) var(--space-2);
    margin: 0;
  }

  .station-breadcrumb-text { display: none; }

  .station-breadcrumb-arrow {
    font-size: 20px;
  }

  /* Center: part counter */
  .station-progress {
    gap: var(--space-1);
  }

  .station-progress-label {
    font-size: 15px;
    font-weight: var(--weight-semibold);
    color: var(--color-text);
  }

  /* Hide dot track from topbar (shown in viewer on mobile) */
  .station-progress-dots { display: none; }
  .station-progress-compact { display: none; }

  /* View toggle: right */
  .station-view-toggle {
    font-size: 13px;
    padding: var(--space-1) var(--space-2);
    height: 32px;
    min-width: 44px;
    touch-action: manipulation;
  }

  /* ─── Main layout: single column ─── */
  .station-main {
    grid-template-columns: 1fr;
    grid-template-rows: 35vh 1fr;
  }

  /* ─── Viewer: top 35% ─── */
  .station-viewer {
    height: 35vh;
    border-right: none;
    border-bottom: 1px solid var(--color-border-subtle);
    overflow: hidden;
  }

  /* Hide desktop nav arrows (swipe to navigate) */
  .viewer-nav { display: none; }

  /* Hide desktop action buttons */
  .station-actions { display: none; }

  /* ─── Part name + geo overlay at bottom of viewer ─── */
  .station-viewer-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: absolute;
    bottom: 36px; /* above dots */
    left: 0;
    right: 0;
    pointer-events: none;
    padding: 0 var(--space-4);
  }

  .station-viewer-part-name {
    font-size: 14px;
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    text-shadow: 0 1px 4px rgba(255,255,255,0.95);
    text-align: center;
  }

  .station-viewer-geo {
    font-size: 11px;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    text-shadow: 0 1px 3px rgba(255,255,255,0.9);
  }

  /* ─── Part dots indicator at bottom of viewer ─── */
  .station-viewer-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    bottom: var(--space-2);
    left: 0;
    right: 0;
  }

  .station-viewer-dots-track {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    background: rgba(255,255,255,0.7);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .station-viewer-dots-track .progress-dot {
    width: 7px;
    height: 7px;
  }

  /* ─── Brief panel: scrollable cards ─── */
  .station-brief {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-3) var(--space-4);
    /* Clear: palette (~48px) + gap (16px) + action bar (~80px) + safe area */
    padding-bottom: calc(160px + env(safe-area-inset-bottom));
    background: var(--color-bg);
    gap: var(--space-3);
  }

  .brief-header {
    margin-bottom: var(--space-2);
  }

  .brief-part-name {
    font-size: 18px;
  }

  .brief-completeness {
    padding: var(--space-3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }

  .completeness-bar { height: 6px; border-radius: 3px; }
  .completeness-fill { border-radius: 3px; }
  .completeness-label { font-size: var(--text-sm); font-weight: var(--weight-medium); }

  .brief-section { margin-bottom: var(--space-2); }

  .brief-section-title {
    font-size: 11px;
    margin-top: var(--space-3);
    margin-bottom: var(--space-2);
    padding-left: var(--space-1);
  }

  /* ─── Fields as tappable cards ─── */
  .brief-field {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    min-height: 52px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
    border-left: 3px solid transparent;
    margin-bottom: var(--space-2);
    box-shadow: var(--shadow-sm);
    touch-action: manipulation;
  }

  /* Required + empty → red left border + subtle red bg */
  .brief-field:has(.brief-field-dot.required.empty) {
    border-left-color: var(--color-danger);
    background: var(--color-danger-subtle);
  }

  /* Required + filled → green left border */
  .brief-field:has(.brief-field-dot.required.filled) {
    border-left-color: var(--color-success);
  }

  .brief-field-label {
    font-size: 13px;
    min-width: 80px;
    color: var(--color-text-secondary);
  }

  .brief-field-value { font-size: 15px; flex: 1; }

  .brief-source {
    font-size: 11px;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
  }

  /* Cost and risk sections: keep compact */
  .brief-cost-table th,
  .brief-cost-table td { font-size: var(--text-sm); padding: var(--space-2) 0; }

  .brief-risk-item,
  .brief-action-item { font-size: var(--text-sm); padding: var(--space-2) 0; }


  /* ══════════════════════════════════════════════════════════
     FLOATING COMMAND BAR — iOS Spotlight / Raycast mobile
     Star of the show.
  ══════════════════════════════════════════════════════════ */

  .station-palette {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    /* Sit above the action bar: bar height ~82px (50+16+16) + safe area + gap */
    bottom: calc(82px + env(safe-area-inset-bottom) + var(--space-3));
    width: 90%;
    max-width: 420px;
    z-index: var(--z-palette);
  }

  .palette-container {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 22px;
    box-shadow:
      0 8px 32px rgba(0, 0, 0, 0.14),
      0 2px 8px  rgba(0, 0, 0, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.6);
    overflow: hidden;
    transition: box-shadow 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  }

  .palette-container.focused {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow:
      0 12px 44px rgba(99, 102, 241, 0.18),
      0 4px 14px  rgba(0, 0, 0, 0.10),
      inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transform: translateY(-3px);
  }

  .palette-input-row {
    padding: 12px var(--space-4);
    gap: var(--space-3);
  }

  .palette-slash {
    font-size: 19px;
    font-weight: var(--weight-semibold);
    color: var(--color-accent);
  }

  .palette-input {
    font-size: 16px; /* no iOS zoom */
    font-weight: var(--weight-medium);
    caret-color: var(--color-accent);
  }

  .palette-input::placeholder { color: var(--color-text-tertiary); font-weight: var(--weight-normal); }

  .palette-hints {
    padding: var(--space-1) var(--space-4) var(--space-3);
    gap: var(--space-2);
    flex-wrap: wrap;
    border-top: 1px solid rgba(0,0,0,0.06);
  }

  .palette-hint-tag {
    font-size: 12px;
    font-weight: var(--weight-medium);
    padding: 5px var(--space-3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--color-text-secondary);
    transition: none;
  }

  .palette-hint-tag.matched {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.40);
  }

  .palette-hint-tag.has-value {
    background: var(--color-success-subtle);
    color: var(--color-success);
  }

  .palette-feedback {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
  }


  /* ══════════════════════════════════════════════════════════
     MOBILE ACTION BAR — fixed bottom, full width
  ══════════════════════════════════════════════════════════ */

  .station-actions-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-3) var(--space-4);
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
    gap: var(--space-3);
    background: rgba(247, 247, 248, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--color-border-subtle);
    z-index: var(--z-keyboard);
  }

  /* Swipe-gesture color feedback */
  .station-actions-bar.swipe-skip  { background: rgba(254, 242, 242, 0.97); }
  .station-actions-bar.swipe-quote { background: rgba(240, 253, 244, 0.97); }

  .action-btn-mobile {
    flex: 1;
    height: 50px;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: transform 0.08s var(--ease-out), opacity 0.08s;
    -webkit-tap-highlight-color: transparent;
  }

  .action-btn-mobile:active {
    transform: scale(0.96);
    opacity: 0.88;
  }

  .action-btn-mobile-skip {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1.5px solid var(--color-border);
  }

  .action-btn-mobile-skip:active {
    background: var(--color-danger-subtle);
    color: var(--color-danger);
    border-color: var(--color-danger);
  }

  .action-btn-mobile-quote {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  }

  .action-btn-mobile-quote:active {
    background: var(--color-accent-hover);
    box-shadow: none;
  }

  .action-btn-mobile-quote.blocked {
    background: var(--color-border);
    color: var(--color-text-tertiary);
    box-shadow: none;
    pointer-events: none;
  }


  /* ══════════════════════════════════════════════════════════
     SUMMARY
  ══════════════════════════════════════════════════════════ */

  .summary {
    align-items: stretch;
  }

  .summary-container {
    max-width: none;
    padding: 0;
    padding-top: env(safe-area-inset-top);
    height: 100%;
  }

  /* ─── Header ─── */
  .summary-header {
    padding: var(--space-5) var(--space-4) var(--space-4);
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .summary-title {
    font-size: 22px;
    letter-spacing: -0.03em;
  }

  .summary-customer {
    font-size: 14px;
    margin-top: 2px;
  }

  /* ─── Stats ─── */
  .summary-stats {
    padding: 0 var(--space-4);
    margin-bottom: var(--space-4);
    gap: var(--space-3);
    flex-shrink: 0;
  }

  .summary-stat {
    padding: var(--space-3);
    border-radius: var(--radius-md);
    text-align: center;
  }

  .summary-stat-value { font-size: 22px; }
  .summary-stat-label { font-size: 12px; }

  /* ─── Hide desktop table, show cards ─── */
  .summary-table-wrap { display: none; }

  .summary-cards-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 var(--space-4);
    /* Clear fixed back button */
    padding-bottom: calc(var(--space-8) + var(--space-5) + env(safe-area-inset-bottom));
  }

  /* ─── Decision card ─── */
  .summary-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: 0 2px 10px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    border-left: 3px solid transparent;
  }

  .summary-card.quoted  { border-left-color: var(--color-success); }
  .summary-card.skipped { border-left-color: var(--color-danger); }

  .summary-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
  }

  .summary-card-name {
    font-size: 15px;
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .summary-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
  }

  .summary-card-total {
    font-size: 15px;
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
  }

  .summary-card-overrides {
    font-size: 12px;
    color: var(--color-accent);
  }

  /* ─── Fixed back-to-inbox button ─── */
  .summary-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    margin: var(--space-4);
    margin-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    background: var(--color-accent);
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    font-weight: var(--weight-semibold);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
    transition: transform 0.08s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    z-index: var(--z-keyboard);
  }

  .summary-back-btn:active { transform: scale(0.97); }


  /* ══════════════════════════════════════════════════════════
     SCREEN TRANSITIONS — slide like a native app
  ══════════════════════════════════════════════════════════ */

  .screen.slide-in-right  { animation: mob-slide-in-right  0.28s var(--ease-out) forwards; }
  .screen.slide-out-left  { animation: mob-slide-out-left  0.28s var(--ease-out) forwards; }
  .screen.slide-in-left   { animation: mob-slide-in-left   0.28s var(--ease-out) forwards; }
  .screen.slide-out-right { animation: mob-slide-out-right 0.28s var(--ease-out) forwards; }

  @keyframes mob-slide-in-right  { from { transform: translateX(100%); } to { transform: translateX(0); } }
  @keyframes mob-slide-out-left  { from { transform: translateX(0); }    to { transform: translateX(-30%); } }
  @keyframes mob-slide-in-left   { from { transform: translateX(-30%); } to { transform: translateX(0); } }
  @keyframes mob-slide-out-right { from { transform: translateX(0); }    to { transform: translateX(100%); } }

} /* end @media (max-width: 767px) */
