/* Narrow-screen / App overlays. Desktop layout stays in shell.html + app.css. */

.qc-serial-cards,
.qc-device-cards,
.qc-status-cards,
.qc-factory-cards,
.qc-catalog-cards,
.qc-health-cards,
.qc-inspect-cards { display: none; }

.qc-scan-fab {
  display: none;
}

@media (max-width: 800px) {
  .qc-page .qc-cards.qc-cards-overview:not(.is-2) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.9rem;
  }
  .qc-page .qc-cards-overview .qc-card.is-wide-only { display: none; }
  .qc-page .qc-cards-overview .qc-card {
    padding: 0.7rem 0.75rem;
    min-width: 0;
  }
  .qc-page .qc-cards-overview .qc-card .label { font-size: 0.75rem; }
  .qc-page .qc-cards-overview .qc-card .value {
    font-size: 1.35rem;
    margin-top: 0.2rem;
    word-break: break-all;
  }
  .qc-page .qc-cards-overview .qc-card .sub {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.45rem;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    line-height: 1.35;
  }
  .qc-page .qc-cards-overview .qc-card .sub .sep { display: none; }
  .qc-page .qc-cards-overview .qc-card .sub a {
    padding: 0.12rem 0;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
  }
  .qc-page .qc-page-head,
  .qc-page .overview-panel-head {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.55rem;
  }
  .qc-page .qc-page-head h2,
  .qc-page .overview-panel-head h2 { font-size: 1.15rem; }
  .qc-page .prod-filters {
    padding: 0.7rem 0.75rem 0.8rem;
  }
  .qc-page .prod-filters-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    overflow: visible;
    gap: 0.3rem;
  }
  .qc-page .prod-filters-title {
    flex: 1 0 100%;
    width: auto;
    margin: 0 0 0.15rem;
    white-space: normal;
    font-size: 1.1rem;
  }
  .qc-page .prod-days,
  .qc-page .prod-filter-actions {
    display: contents;
  }
  .qc-page .prod-day-link {
    flex: 1 1 0;
    min-width: 0;
    min-height: 34px;
    height: auto;
    padding: 0.3rem 0.12rem;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .qc-page .prod-day-link.is-wide-only,
  .qc-page .prod-sort-link { display: none; }
  .qc-page .prod-filter-actions .btn {
    flex: 1.15 1 0;
    min-width: 0;
    min-height: 34px;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.2rem;
    border: 1px solid var(--line, #e7e5e4);
    border-radius: 8px;
    background: #fff;
    font-size: 0.72rem;
    white-space: nowrap;
  }
  .qc-page .prod-board-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
    margin-top: 0.65rem;
  }
  .qc-page .prod-board-link {
    min-height: 44px;
    height: auto;
    padding: 0.35rem 0.15rem;
    text-align: center;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .qc-page .prod-board-count {
    display: block;
    margin-left: 0;
    font-size: 0.92rem;
  }
  .qc-page .prod-inline-field {
    grid-column: 1 / -1;
    width: 100%;
    margin: 0.15rem 0 0;
    white-space: normal;
  }
  .qc-page .prod-inline-field select {
    flex: 1;
    min-height: 44px;
    height: auto;
  }
  .qc-page .prod-summary-desk { display: none; }
  .qc-page .prod-back a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  .qc-page .prod-advanced-fields label {
    flex-direction: column;
    align-items: stretch;
  }
  .qc-page .prod-advanced-fields input,
  .qc-page .prod-advanced-fields select {
    min-height: 44px;
    height: auto;
  }
  .qc-page .prod-advanced-actions .btn,
  .qc-page .prod-confirm-dialog-head .btn {
    min-height: 44px;
  }
  .qc-page .qc-serial-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .qc-page .qc-filter-field input[type="text"],
  .qc-page .qc-filter-field input[type="date"],
  .qc-page .qc-filter-field select { width: 100%; min-width: 0; }
  .qc-page .qc-filter-actions { grid-column: 1 / -1; }
  .qc-page .qc-filter-actions button,
  .qc-page .qc-filter-actions .btn,
  .qc-page .qc-page-head-actions .btn,
  .qc-page .qc-pager a,
  .qc-page .qc-device-actions .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .qc-page .is-desktop-table { display: none; }
  .qc-serial-cards,
  .qc-device-cards,
  .qc-status-cards,
  .qc-factory-cards,
  .qc-catalog-cards,
  .qc-health-cards,
  .qc-inspect-cards {
    display: grid;
    gap: 0.7rem;
    margin: 0.75rem 0 1rem;
  }
  .qc-page .qc-device-setup {
    padding: 0.85rem 0.9rem;
  }
  .qc-page .qc-device-setup h3 { font-size: 0.95rem; }
  .qc-page .qc-device-setup .qc-info-grid {
    grid-template-columns: 1fr 1fr;
    margin: 0;
  }
  .qc-page .qc-device-setup .qc-info-item {
    grid-template-columns: 3.6rem 1fr;
    gap: 4px;
    padding: 0.45rem 0.35rem;
    font-size: 0.78rem;
  }
  .qc-page .qc-device-setup .qc-info-wide { grid-column: 1 / -1; }
  .qc-page .qc-device-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 0.7rem;
    margin-top: 0.7rem;
    padding-top: 0.7rem;
  }
  .qc-page .qc-device-settings .qc-stage-form input[type="text"],
  .qc-page .qc-device-settings .qc-stage-form select,
  .qc-page .qc-device-settings .qc-stage-form .btn {
    min-width: 0;
    max-width: none;
    width: 100%;
    min-height: 44px;
  }
  .qc-page .qc-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }
  .qc-page .qc-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.35rem 0.4rem;
  }
  .qc-health-card,
  .qc-inspect-card {
    display: block;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line, #e7e5e4);
    border-radius: 12px;
    background: #fff;
    color: inherit;
    text-decoration: none;
  }
  .qc-inspect-card:hover { text-decoration: none; }
  .qc-health-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
  }
  .qc-health-card-top time {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
  }
  .qc-health-card-accs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    margin-top: 0.55rem;
  }
  .qc-health-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--muted, #78716c);
  }
  .qc-health-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.65rem;
  }
  .qc-health-card-foot .btn {
    min-height: 36px;
    padding: 0.3rem 0.75rem;
  }
  .qc-page .qc-health-json-dialog {
    width: calc(100vw - 1.1rem);
    max-width: none;
    padding: 1rem 0.95rem 1.1rem;
  }
  .qc-page .qc-health-json-head .btn { min-height: 44px; }
  .qc-page .qc-health-json-dialog pre {
    max-height: min(22rem, 58vh);
    font-size: 12px;
  }
  .qc-page .qc-sn-hero-id { font-size: 1.2rem; }
  .qc-page .qc-sn-hero-meta { font-size: 0.82rem; }
  .qc-page .qc-sn-track .qc-info-grid {
    grid-template-columns: 1fr 1fr;
    margin: 0;
  }
  .qc-page .qc-sn-track .qc-info-item {
    grid-template-columns: 3.4rem 1fr;
    gap: 4px;
    padding: 0.45rem 0.3rem;
    font-size: 0.78rem;
  }
  .qc-page .qc-sn-track .qc-tl-body { padding: 0.75rem 0.8rem 0.85rem; }
  .qc-page .qc-sn-track .qc-tl-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .qc-page .qc-sn-track .qc-media img,
  .qc-page .qc-sn-track .qc-media video {
    width: 100%;
    max-width: 100%;
    max-height: 240px;
    object-fit: contain;
  }
  .qc-page .qc-sn-inspects { padding: 0.85rem 0.9rem; }
  .qc-factory-card,
  .qc-catalog-card {
    display: block;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line, #e7e5e4);
    border-radius: 12px;
    background: #fff;
  }
  .qc-factory-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.85rem;
    margin-top: 0.65rem;
  }
  .qc-factory-card-actions a { min-height: 36px; display: inline-flex; align-items: center; }
  .qc-catalog-card-head {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.35rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--line, #e7e5e4);
  }
  .qc-catalog-card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.6rem;
  }
  .qc-catalog-card-order { font-weight: 700; text-decoration: none; color: inherit; word-break: break-all; }
  .qc-catalog-card-count { color: var(--muted, #78716c); font-size: 0.78rem; white-space: nowrap; }
  .qc-catalog-piece {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid #f0eeea;
    color: inherit;
    text-decoration: none;
  }
  .qc-catalog-piece:last-child { border-bottom: 0; padding-bottom: 0.15rem; }
  .qc-catalog-piece-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }
  .qc-catalog-piece-stage {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.1rem;
  }
  .qc-catalog-card.is-void { opacity: 0.82; }
  .qc-catalog-piece.is-void { opacity: 0.7; }
  .qc-serial-card,
  .qc-device-card,
  .qc-status-card {
    display: block;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line, #e7e5e4);
    border-radius: 12px;
    background: #fff;
    color: inherit;
    text-decoration: none;
  }
  .qc-serial-card:hover,
  .qc-device-card:hover { text-decoration: none; }
  .qc-serial-card-top,
  .qc-device-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.6rem;
  }
  .qc-serial-card-sn,
  .qc-device-card-sn {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 650;
  }
  .qc-serial-card-meta,
  .qc-device-card-meta {
    margin-top: 0.35rem;
    color: var(--muted, #78716c);
    font-size: 0.82rem;
  }

  .qc-scan-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 1rem;
    bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px));
    z-index: 32;
    width: 3.4rem;
    height: 3.4rem;
    border: 0;
    border-radius: 999px;
    background: var(--accent, #9a6b3f);
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 650;
    box-shadow: 0 10px 24px rgba(28, 25, 23, 0.18);
    cursor: pointer;
  }
  body.is-app .qc-scan-fab { display: none; }
}

.app-scan {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.1rem;
  padding: 0.5rem 0 1.5rem;
}
.app-scan-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 1.6rem 1rem 1.2rem;
  background: #fff;
  border: 1px solid var(--line, #e7e5e4);
  border-radius: 16px;
}
.app-scan-hero h1 { margin: 0; font-size: 1.35rem; }
.app-scan-btn {
  min-width: min(16rem, 100%);
  min-height: 3.4rem;
  padding: 0.85rem 1.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent, #9a6b3f);
  color: #fff;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}
.app-scan-btn[disabled] { opacity: 0.55; cursor: wait; }
.app-scan-status { min-height: 1.3em; margin: 0; color: var(--muted, #78716c); text-align: center; }
.app-scan-status.is-error { color: var(--danger, #9f4035); }
.app-scan-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}
.app-scan-stat {
  padding: 0.7rem 0.55rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line, #e7e5e4);
  text-align: center;
}
.app-scan-stat .label { color: var(--muted, #78716c); font-size: 0.75rem; }
.app-scan-stat .value { font-size: 1.25rem; font-weight: 700; }
.app-recent { margin: 0; padding: 0; list-style: none; }
.app-recent li { margin: 0 0 0.45rem; }
.app-recent a {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line, #e7e5e4);
  text-decoration: none;
  color: inherit;
}
.app-claim {
  max-width: 26rem;
  margin: 1.5rem auto;
  padding: 1.4rem 1.2rem;
  background: #fff;
  border: 1px solid var(--line, #e7e5e4);
  border-radius: 16px;
  text-align: center;
}
.app-claim h1 { margin: 0 0 0.4rem; font-size: 1.3rem; }
.app-claim .app-claim-actions { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 1.1rem; }
.app-claim .app-claim-actions a,
.app-claim .app-claim-actions button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  text-decoration: none;
}
.app-serial-more { margin-top: 0.85rem; }
.app-serial-more > summary {
  cursor: pointer;
  color: var(--muted, #78716c);
  padding: 0.45rem 0;
}
