/* Keep the native cash date picker within the mobile viewport. */
.cash-date-row,.cash-days{min-width:0;max-width:100%}
#cash-day{max-width:100%;box-sizing:border-box}
@media(max-width:650px){
 .cash-days{display:flex;flex-wrap:wrap;align-items:center;gap:8px;width:100%}
 .cash-days .chip{flex:0 0 auto}
 #cash-day{-webkit-appearance:none;appearance:none;flex:0 1 160px;width:160px;min-width:0;max-width:100%;margin-left:auto;padding:13px 10px;font-size:16px;line-height:20px;text-align:left}
 #cash-day::-webkit-date-and-time-value{min-width:0;text-align:left}
 #cash-day::-webkit-datetime-edit{min-width:0;padding:0}
}

/* Keeper visual refinement. Screen-only: receipts and PDF print styles stay intact. */
@media screen {
  :root {
    --ink: #17263c;
    --muted: #667891;
    --line: #e3e9f2;
    --radius: 16px;
  }
  body { background: #f4f6fa; }
  .page-head { min-height: 48px; margin-bottom: 24px; gap: 20px; }
  .page-head h1, .orders-heading h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.7px; }
  .card, .orders-card, .catalog-folders { border-radius: 16px; box-shadow: 0 2px 8px #17263c03; }
  .btn { border-radius: 10px; line-height: 1.4; font-weight: 600; }
  .btn.primary { box-shadow: 0 2px 5px #2861ed18; }
  .btn.tiny { min-height: 36px; }
  .icon-btn { border-radius: 10px; }
  .btn:active:not(:disabled), .icon-btn:active:not(:disabled) { box-shadow: inset 0 1px 3px #142d4915; }
  .top-right .team-label { max-width: 160px; white-space: nowrap; text-overflow: ellipsis; }
  .top-right > [data-action="team"] { min-height: 38px; }
  .nav button { border-radius: 10px; }
  .nav button.active { box-shadow: none; }

  /* The same rhythm and focus treatment for filters and entry fields. */
  .field input:not([type="checkbox"]), .field select, .field textarea,
  .search input, .status-picker > summary, .order-sort, .list-search-row > select {
    border-color: #dce3ed;
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
  }
  .field input:not([type="checkbox"]):focus, .field select:focus, .field textarea:focus,
  .search input:focus, .order-sort:focus, .list-search-row > select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px #2861ed14;
  }
  .field > label { color: #34455d; font-size: 13px; font-weight: 600; }
  .form-grid { gap: 20px; }
  .form-hint:empty { margin: 0; padding: 0; }
  .list-controls { padding: 20px; }
  .catalog-main .list-controls { padding: 20px; }
  .catalog-main .list-controls > .tabs, .agent-mode-tabs {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px;
    border: 1px solid #e6ebf3; border-radius: 12px; background: #f5f7fb;
  }
  .catalog-main .list-controls > .tabs { margin-bottom: 16px; }
  .catalog-main .list-controls > .tabs .tab, .agent-mode-tabs .btn {
    border: 0; border-radius: 8px; min-height: 36px; background: transparent; color: #667891; box-shadow: none;
  }
  .catalog-main .list-controls > .tabs .tab.active, .agent-mode-tabs .btn.primary {
    background: white; color: #2457d6; box-shadow: 0 1px 4px #17263c12;
  }
  .agent-mode-tabs { margin-bottom: 16px; }

  /* Readable tables; monetary values never break between digits. */
  .data-table th, .orders-table th {
    background: #f8fafc; color: #697a92; font-size: 12px; font-weight: 600;
    line-height: 1.45; letter-spacing: 0; text-transform: none;
    overflow-wrap: normal; word-break: normal;
  }
  .data-table td { padding-top: 20px; padding-bottom: 20px; }
  .orders-table .order-link { white-space: nowrap; }
  .table-foot { align-items: center; }
  .numeric, .price, .detail-amount, .cash-amount, .inline-metric strong, .balance-current strong { font-variant-numeric: tabular-nums; }
  .catalog-layout { grid-template-columns: 216px minmax(0, 1fr); gap: 20px; }
  .catalog-main .product-table { min-width: 740px; }
  .catalog-main .product-table th { white-space: normal; overflow-wrap: normal; word-break: normal; }
  .catalog-main .product-table th:first-child { width: auto; }
  .catalog-main .product-table th:nth-child(2) { width: 170px; }
  .catalog-main .product-table th:nth-child(3), .catalog-main .product-table th:nth-child(4) { width: 114px; }
  .catalog-main .product-table th:nth-child(5) { width: 160px; }
  .catalog-main .product-table th, .catalog-main .product-table td { padding-left: 14px; padding-right: 14px; }
  .catalog-main .product-table .numeric { white-space: nowrap; overflow-wrap: normal; }
  .catalog-main [data-action="catalog-price"] { white-space: nowrap; padding: 7px 10px; font-size: 12px; }
  .catalog-main td > strong.numeric > div { margin-top: 8px; }
  .product-stock > .cell-secondary { line-height: 1.5; text-wrap: balance; }

  /* Order and intake forms share spacing without changing their controls. */
  .modal { border: 1px solid #e5eaf2; box-shadow: 0 24px 80px #0f20383d; }
  .modal-header { padding: 22px 24px; }
  .modal-header h2 { font-size: 22px; line-height: 1.35; }
  .modal-header .icon-btn { flex-shrink: 0; }
  .modal-body { padding: 24px; scrollbar-gutter: stable; }
  .modal-header, .modal-footer { flex-shrink: 0; }
  .modal-footer { padding: 16px 24px; background: #fbfcfe; align-items: center; }
  .modal .detail-tabs { gap: 6px; margin-bottom: 24px; padding-bottom: 16px; }
  .modal .detail-tabs .tab { min-height: 40px; padding: 10px 14px; font-weight: 500; }
  .modal .detail-tabs .tab.active { font-weight: 650; }
  .modal-body > .notice.service-note + form[data-form="repair"] { margin-top: 20px; }
  .order-detail-actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
  .order-detail-actions > .order-status-summary { margin-right: auto; }
  .order-password-bar { background: #f7f9fc; border-color: #e6ebf3; }
  .order-password-bar [data-device-password] {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 15px; line-height: 1.5; font-weight: 500;
  }
  .details-panel { padding: 20px; background: #f7f9fc; border-radius: 14px; }
  .line-list { border-radius: 12px; }
  .line-item { padding: 16px; }
  .notice { border-radius: 12px; }
  .new-order-wrap { max-width: 1000px; }
  .new-order-wrap .card-body { padding: 24px; }
  .new-order-wrap form[data-native-order] > .section-title { margin-top: 0; }
  .new-order-wrap form[data-native-order] > .section-title ~ .section-title { margin-top: 28px; }
  .new-order-wrap .native-schema-hint { margin-top: -4px; margin-bottom: 18px; }
  .new-order-wrap .modal-footer { border-radius: 0 0 16px 16px; }
  .cash-count-empty { padding-top: 12px; padding-bottom: 12px; }
  .cash-main-row .balance-current strong { font-size: 36px; letter-spacing: -.9px; }
  .status-picker-panel { border-radius: 14px; padding: 14px; box-shadow: 0 12px 36px #17263c1a; }
  .auth-card { border-radius: 20px; box-shadow: 0 12px 40px #17263c08; }
}

/* Use a full-width catalog before the pricing columns become cramped. */
@media screen and (min-width: 761px) and (max-width: 1180px) {
  .catalog-layout { display: block; }
  .catalog-folders { padding: 0; margin-bottom: 16px; }
  .catalog-folders h2 { display: none; }
  .folder-mobile-toggle { display: flex; width: 100%; border: 0; justify-content: space-between; text-align: left; padding: 12px 16px; }
  .folder-mobile-toggle span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .folder-mobile-toggle > svg:last-child { width: 15px; transform: rotate(90deg); }
  .folder-mobile-toggle[aria-expanded="true"] > svg:last-child { transform: rotate(-90deg); }
  .folder-navigation { display: none; max-height: 55vh; padding: 0 12px 12px; }
  .folder-navigation.expanded { display: block; }
}

@media screen and (max-width: 800px) {
  .catalog-main .product-table { min-width: 0; }
  .catalog-main .product-table td { padding-left: 0; padding-right: 0; }
  .catalog-main .product-table .numeric { white-space: normal; overflow-wrap: anywhere; }
  .catalog-main .product-table .product-price { grid-column: 3; }
}

@media screen and (max-width: 650px) {
  .page-head, .orders-heading { min-height: 44px; gap: 12px; margin-bottom: 20px; }
  .page-head h1, .orders-heading h1 { font-size: 25px; letter-spacing: -.65px; }
  .page-head:has(.page-actions) { flex-direction: column; align-items: stretch; gap: 16px; }
  .page-head > .page-actions { width: 100%; gap: 8px; }
  .page-head > .page-actions > .btn { flex: 1; min-height: 44px; font-size: 13px; }
  .page-head > .page-actions > .btn svg { display: block; width: 18px; height: 18px; }
  .field input:not([type="checkbox"]), .field select, .field textarea,
  .search input, .list-search-row > select { font-size: 16px; }
  .modal-body .btn.tiny, .agent-mode-tabs .btn, .catalog-main [data-action="catalog-price"],
  .catalog-main .tab, .folder-link, .folder-toggle { min-height: 44px; }
  .modal-body .line-item > .icon-btn { min-width: 44px; min-height: 44px; }
  .modal .detail-tabs { gap: 4px; padding-bottom: 12px; margin-bottom: 20px; }
  .modal .detail-tabs .tab { flex: 0 0 auto; min-width: auto; min-height: 44px; padding: 10px; font-size: 12px; }
  .modal-header { padding: 16px; }
  .modal-header h2 { font-size: 19px; }
  .modal-body { padding: 16px; scrollbar-gutter: auto; }
  .modal-footer { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); gap: 8px; }
  .modal-footer:has(#order-draft-footer) { flex-wrap: wrap; }
  #order-draft-footer > .btn { flex: 1 1 auto; min-height: 44px; }
  #order-draft-footer > .btn.primary { flex-basis: 100%; }
  #order-draft-footer > span.grow:empty { display: none; }
  .order-detail-actions > .order-status-summary { flex: 1 1 100%; margin-right: 0; }
  .order-detail-actions > .btn { flex: 1; }
  .modal-body > .notice.service-note + form[data-form="repair"] { margin-top: 16px; }
  .modal .form-grid, .form-card .form-grid { gap: 18px; }
  .new-order-wrap .card-body { padding: 20px 16px; }
  .new-order-wrap .section-title { font-size: 12px; }
  .new-order-wrap .modal-footer { padding: 14px 16px; }
  .details-panel { padding: 16px; }
  .line-item { padding: 14px; }
  .catalog-main .list-controls { padding: 16px; }
  .catalog-main [data-action="catalog-price"] { white-space: normal; line-height: 1.35; }
  .cash-main-row .balance-current strong { font-size: 32px; }
}

@media screen and (prefers-reduced-motion: reduce) {
  .btn, .field input, .field select, .field textarea, .search input, .status-picker > summary, .order-sort, .list-search-row > select { transition: none; }
}

/* Personal stock filter in the catalog. */
@media screen {
 .catalog-stock-filter { display:flex; align-items:center; gap:9px; flex-shrink:0; min-height:44px; color:var(--ink); font-size:13px; line-height:1.4; cursor:pointer; white-space:nowrap; }
 .catalog-stock-filter input { width:18px; height:18px; margin:0; accent-color:var(--blue); cursor:pointer; flex-shrink:0; }
 .catalog-stock-filter input:focus-visible { outline:2px solid var(--blue); outline-offset:3px; }
}

/* Contact status styles */
/* Customer contact marks and the seven-column order list. Screen-only. */
@media screen {
  #order-results .orders-table .order-contact-control { min-width: 0; max-width: 160px; }
  #order-results .orders-table .order-contact-label { display: none; }
  #order-results .orders-table .order-contact-select {
    display: block; width: 100%; min-width: 0; max-width: 160px; min-height: 36px;
    padding: 7px 24px 7px 10px; border: 1px solid transparent; border-radius: 8px;
    font: inherit; font-size: 12px; font-weight: 600; line-height: 1.4;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2364748b' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 7px center; background-size: 10px;
    cursor: pointer; color: #64748b; background-color: #f0f3f8;
  }
  #order-results .orders-table .order-contact-select.contact-notified { color: #26724e; background-color: #e9f7ef; }
  #order-results .orders-table .order-contact-select.contact-no_answer { color: #9a5700; background-color: #fff3df; }
  #order-results .orders-table .order-contact-select:focus-visible { outline: 2px solid #2d61e9; outline-offset: 2px; }
  #order-results .orders-table .order-contact-select:disabled { cursor: default; opacity: 1; }
  #order-results .orders-table .order-contact-control[aria-busy="true"] .order-contact-select { opacity: .65; }
  #order-results .orders-table .order-contact-error { display: block; margin-top: 6px; color: #b53945; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }

  #order-results .orders-table .order-link { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  #order-results .orders-table .client-name { white-space: normal; overflow-wrap: break-word; }
  #order-results .orders-table .order-client .client-phone {
    font-size: 14px; font-weight: 700; color: #334155;
    white-space: nowrap; overflow-wrap: normal; word-break: normal;
    font-variant-numeric: tabular-nums;
  }
  #order-results .orders-table .order-client .client-phone:hover { color: var(--blue); }
  #order-results .orders-table .order-status-summary { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; max-width: 100%; }
  #order-results .orders-table .order-status .badge { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: break-word; word-break: normal; }
  #order-results .orders-table .order-outcome { display: block; max-width: 100%; color: var(--muted); font-size: 11px; line-height: 1.4; overflow-wrap: break-word; }
}

/* Keep useful cell widths; only the table scrolls if the desktop pane is narrow. */
@media screen and (min-width: 1301px) {
  #order-results .table-scroll { max-width: 100%; overflow-x: auto; }
  #order-results .orders-table { width: 100%; min-width: 1000px; table-layout: fixed; }
  #order-results .orders-table th:nth-child(1) { width: 144px; }
  #order-results .orders-table th:nth-child(2) { width: auto; }
  #order-results .orders-table th:nth-child(3) { width: 160px; }
  #order-results .orders-table th:nth-child(4) { width: 180px; }
  #order-results .orders-table th:nth-child(5) { width: 170px; }
  #order-results .orders-table th:nth-child(6) { width: 160px; }
  #order-results .orders-table th:nth-child(7) { width: 36px; }
  #order-results .orders-table .order-contact { padding-left: 10px; padding-right: 10px; }
  #order-results .orders-table .order-amount { white-space: normal; overflow-wrap: break-word; }
  #order-results .orders-table .order-amount strong { white-space: nowrap; }
}

/* One complete card layout covers mobile and tablet widths, with no 651–760px gap. */
@media screen and (max-width: 1300px) {
  #order-results .table-scroll { overflow: visible; }
  #order-results .orders-table { display: block; width: 100%; min-width: 0 !important; }
  #order-results .orders-table thead { display: none; }
  #order-results .orders-table tbody { display: grid; gap: 10px; }
  #order-results .orders-table tr, #order-results .orders-table tr:last-child {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 42%); gap: 10px 12px;
    width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: white;
  }
  #order-results .orders-table td, #order-results .orders-table td:first-child,
  #order-results .orders-table td:last-child, #order-results .orders-table td.order-contact {
    display: block; min-width: 0; padding: 0; border: 0;
  }
  #order-results .orders-table td.order-identity { grid-column: 1; grid-row: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 9px; }
  #order-results .orders-table .order-link { margin: 0; font-size: 13px; }
  #order-results .orders-table .order-date { font-size: 11px; }
  #order-results .orders-table .order-device { grid-column: 1 / -1; grid-row: 2; }
  #order-results .orders-table .order-fault { font-size: 13px; line-height: 1.5; }
  #order-results .orders-table .order-contact { grid-column: 1 / -1; grid-row: 3; }
  #order-results .orders-table .order-contact-control { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; max-width: none; }
  #order-results .orders-table .order-contact-label { display: block; color: #7a899d; font-size: 12px; }
  #order-results .orders-table .order-contact-select { width: 145px; min-height: 38px; font-size: 12px; flex-shrink: 0; }
  #order-results .orders-table .order-contact-error { flex-basis: 100%; margin-top: 0; }
  #order-results .orders-table .order-client { grid-column: 1; grid-row: 4; }
  #order-results .orders-table .client-name { font-size: 13px; margin-bottom: 2px; }
  #order-results .orders-table .client-phone { padding: 4px 0; }
  #order-results .orders-table .order-status { grid-column: 2; grid-row: 1; justify-self: end; max-width: 100%; }
  #order-results .orders-table .order-status-summary { align-items: flex-end; }
  #order-results .orders-table .order-status .badge { font-size: 11px; padding: 4px 6px; }
  #order-results .orders-table .order-outcome { text-align: right; }
  #order-results .orders-table .order-amount { grid-column: 2; grid-row: 4; align-self: center; justify-self: end; max-width: 100%; white-space: normal; overflow-wrap: break-word; }
  #order-results .orders-table td.amount strong { font-size: 15px; }
  #order-results .orders-table td.order-arrow { display: none; }
  #order-results .orders-table tr.clickable:hover td { background: none; }
  #order-results .orders-table tr.clickable:hover { background: #f7faff; }
}

/* A phone number and a large amount each get an unbroken line on narrow phones. */
@media screen and (max-width: 480px) {
  #order-results .orders-table .order-client { grid-column: 1 / -1; }
  #order-results .orders-table .order-amount { grid-column: 1 / -1; grid-row: 5; }
}

/* Keep the intake date and time together. */
#order-results .orders-table .order-identity .order-date { white-space: nowrap; }
