/* Site-wide responsive pass - loaded LAST so it wins the cascade. Same
   breakpoints as the estate: 900 / 768 / 600 / 380. The nav becomes an
   off-canvas drawer at 768, or on a short landscape screen (ui.mobile-nav.js toggles body.nav-open). */
@media (max-width: 900px) {
    .form-grid > .span-3, .form-grid > .span-4, .form-grid > .span-5 { grid-column: span 6; }
    .form-grid > .span-2 { grid-column: span 4; }
    .form-grid > .m-half { grid-column: span 6; }   /* a wide cell that pairs with its left neighbour on a tablet (e.g. Simple's order No., span-8) */
    .site-main { padding: var(--net-spacing-md); }
}
/* The drawer also serves a phone on its side (wide but short), where a fixed sidebar would take a third of the screen. */
@media (max-width: 768px), (orientation: landscape) and (max-height: 500px) {
    .nav-toggle { display: inline-block; }
    .site-body { display: block; }
    .site-nav {
        position: fixed; top: var(--net-header-height); bottom: 0; left: 0; width: min(80vw, 280px);
        transform: translateX(-100%); transition: transform 0.25s ease; z-index: var(--net-z-nav);
        overflow-y: auto; box-shadow: var(--net-shadow-lg);
    }
    body.nav-open .site-nav { transform: none; }
    .nav-scrim { display: block; position: fixed; inset: var(--net-header-height) 0 0 0; background: rgba(0,0,0,0.35); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: calc(var(--net-z-nav) - 1); }
    body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
}
@media (max-width: 768px) {
    .site-claim { display: none; }
    .page-head { flex-direction: column; align-items: stretch; }
    .entity-nav-row { flex-wrap: wrap; }
    .entity-nav-row > .btn { flex: 1 1 30%; }
    .head-tools .entity-nav { margin-left: 0; width: 100%; }
    .head-tools .entity-nav-row { width: 100%; }
    .head-tools .entity-nav-row > .btn { flex: 1 1 30%; width: auto; }
    .toolbar .ctrl-wrapper, .filter-bar .ctrl-wrapper { flex: 1 1 100%; }
    .toolbar .ctrl-select .ctrl-field, .filter-bar .ctrl-select .ctrl-field { width: 100%; }
    /* From / To share ONE row, half each, with the bar's gap between them (they used to touch on an iPhone). */
    .toolbar .ctrl-wrapper.ctrl-type-date, .filter-bar .ctrl-wrapper.ctrl-type-date { flex: 1 1 calc(50% - 0.5rem); min-width: 0; }
    .stat-tiles { grid-template-columns: repeat(2, 1fr); }
    .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .thumb img, .thumb .noimg { height: 100px; }
    table.data th, table.data td { padding: 0.45rem 0.5rem; }
    .btn { min-height: 40px; }
}
@media (max-width: 600px) {
    .form-grid > .span-2, .form-grid > .span-3, .form-grid > .span-4, .form-grid > .span-5, .form-grid > .span-6, .form-grid > .span-8, .form-grid > .span-9 { grid-column: span 12; }
    .site-header { padding: 0 var(--net-spacing-md); gap: var(--net-spacing-sm); }
    .stat-tiles { grid-template-columns: 1fr 1fr; }
    .cards { grid-template-columns: 1fr; }
    .deploy-toolbar-tray { max-width: 100%; }
}
@media (max-width: 380px) {
    .stat-tiles { grid-template-columns: 1fr; }
    .thumb-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Phone polish (owner, 2026-10-07: "Mobile/REACTive mode, mostly formatting and placement") ─────────────────────
   App-wide, so every page gets it: table cards, pictures that fill the width, the drop card as two buttons, compact
   alerts, the one-row record navigator; then the pages the owner named (Pricing, Timeline, Capture's Recent Images). */
@media (max-width: 600px) {
    /* Table cards (ui.tablecards.js puts .is-cards on table.data + data-label on every cell). */
    table.data.is-cards { display: block; width: 100% !important; min-width: 0 !important; table-layout: auto; border: 0; transform: none !important; }
    table.data.is-cards thead, table.data.is-cards colgroup { display: none; }
    table.data.is-cards tbody, table.data.is-cards tfoot { display: block; }
    table.data.is-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem 0.9rem; position: relative;
        padding: 0.75rem 0.85rem; margin: 0 0 0.6rem; background: var(--net-bg-card); border: 1px solid var(--net-border); border-radius: var(--net-border-radius-md); }
    table.data.is-cards tr.has-sub { margin-bottom: 0; border-bottom: 0; border-radius: var(--net-border-radius-md) var(--net-border-radius-md) 0 0; padding-bottom: 0.35rem; }
    table.data.is-cards tr.card-sub { display: block; margin-top: 0; padding-top: 0.2rem; border-top: 0; border-radius: 0 0 var(--net-border-radius-md) var(--net-border-radius-md); }
    table.data.is-cards tr:not(.has-sub) + tr.card-sub { border-top: 1px solid var(--net-border); border-radius: var(--net-border-radius-md); margin-top: -0.3rem; }
    table.data.is-cards td { display: block; padding: 0; border: 0; width: auto !important; min-width: 0; max-width: none; text-align: left !important; white-space: normal; overflow-wrap: anywhere; background: none; }
    table.data.is-cards td::before { content: attr(data-label); display: block; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--net-text-muted); margin-bottom: 0.05rem; }
    table.data.is-cards td[data-label=""]::before { display: none; }
    table.data.is-cards td.card-empty { display: none; }
    table.data.is-cards td.card-title { grid-column: 1 / -1; order: -1; font-size: 1rem; font-weight: 600; line-height: 1.3; padding-right: 2rem; }
    table.data.is-cards td.card-title::before { display: none; }
    table.data.is-cards td.card-title small { display: block; font-weight: 400; margin-top: 0.1rem; }
    table.data.is-cards td.card-pick { position: absolute; top: 0.7rem; right: 0.75rem; }
    table.data.is-cards td.card-pick::before { display: none; }
    table.data.is-cards td.card-pick input { width: 1.25rem; height: 1.25rem; }
    table.data.is-cards tr.card-sub > td { grid-column: 1 / -1; }
    table.data.is-cards tr.card-sub > td::before { display: none; }
    table.data.is-cards td .ctrl-wrapper, table.data.is-cards td .ctrl-field { width: 100%; max-width: none; }
    table.data.is-cards tfoot tr { background: var(--net-bg-accent); }
    table.data.is-cards .item-strip { justify-content: flex-start; }
    .table-wrap:has(> table.data.is-cards) { overflow: visible; border: 0; background: none; }
    .table-wrap:has(> table.data.is-cards) + .table-hscroll { display: none !important; }
    /* The bulk-action block above a list (Items: Selected / Move / Flag / Set) scrolls away on a phone - pinned, it covered half the screen. */
    .sticky-tools { position: static !important; }

    /* Pictures fill the width ("for react, let them span the page width"); desktop keeps its sizes. */
    .cover-row > .pic-box, .cover-row > .cover-preview, .cover-side { flex: 1 1 100%; }
    .cover-preview { width: 100%; height: auto; aspect-ratio: 4 / 3; }
    .thumb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
    .thumb { padding: 0.35rem; }
    .thumb img, .thumb .noimg, .thumb .media-video { height: auto; aspect-ratio: 4 / 3; }
    .thumb .cap { font-size: 0.72rem; }

    /* The drop card on a phone = two buttons: "📷 take a photo" first, "choose ..." second. "Drop ... here" and the
       long hint mean nothing on a phone. The card's own fields (a Type select ...) stay, under the buttons. */
    .drop-card:not(.is-square) { padding: 0.65rem; }
    .drop-card:not(.is-square) .drop-card-icon { display: none; }
    .drop-card .drop-card-text > span { font-size: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
    .drop-card .drop-card-text > span > strong { display: none; }
    .drop-card .drop-card-text > span > a { font-size: var(--net-font-size-sm); display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
        flex: 1 1 8rem; min-height: 44px; padding: 0.4rem 0.75rem; border-radius: var(--net-border-radius-md); text-decoration: none; font-weight: 600;
        border: 1px solid var(--net-border); background: var(--net-bg-accent); color: var(--net-text-primary); }
    .drop-card .drop-card-text > span > a[data-role="snap"] { order: -1; background: var(--net-color-primary); border-color: var(--net-color-primary); color: #fff; }
    .drop-card .drop-card-text > small { display: none; }
    .drop-card .drop-card-main { gap: 0.5rem; }
    .drop-card .drop-card-text { flex: 1 1 100%; }
    .drop-card .drop-card-side { margin-left: 0; width: 100%; }
    /* A picture-shaped drop card on a phone: the tile goes full width (two big buttons, Filed as under them); picked
       files line up under it. Inside a photo grid it stays one cell. */
    .drop-card.is-tile:not(.is-square) { padding: 0; }
    .drop-card.is-tile .drop-card-main { width: 100%; min-height: 0; }
    .drop-card.is-tile .drop-card-text { flex: 0 0 auto; margin: 0; }
    .drop-card.is-tile .picked-thumbs { flex: 1 1 100%; }
    .thumb-grid > .drop-card.is-tile { grid-column: 1 / -1; }

    /* Alerts and help boxes: a step quieter so they do not shout over the controls. */
    .alert { padding: 0.5rem 0.7rem; font-size: var(--net-font-size-sm); line-height: 1.4; }

    /* Record navigator in its compact form (Capture's camera / one item): ONE row, never wrapping - arrows narrow, the
       two actions share the rest. */
    .entity-nav.is-compact .entity-nav-row { flex-wrap: nowrap; gap: 0.25rem; }
    .entity-nav.is-compact .entity-nav-row > .btn { flex: 1 1 0; min-width: 0; padding-left: 0.3rem; padding-right: 0.3rem; font-size: var(--net-font-size-sm); }
    .entity-nav.is-compact .entity-nav-row > .btn.is-arrow { flex: 0 0 2.1rem; }
    .entity-nav.is-compact .entity-nav-row > .btn .btn-label { overflow: hidden; text-overflow: ellipsis; }

    /* Capture > Recent Images: room + Show on one line, the item box + Find item on the next. */
    form.photo-target { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem 0.6rem; align-items: end; margin-bottom: 0.7rem; }
    form.photo-target > * { margin: 0 !important; min-width: 0; }
    form.photo-target > .ctrl-wrapper:has(select[name="proom"]) { grid-column: 1; grid-row: 1; }
    form.photo-target > .ctrl-wrapper:has(select[name="pn"]) { grid-column: 2; grid-row: 1; }
    form.photo-target > .ctrl-wrapper:has(input[name="item"]) { grid-column: 1; grid-row: 2; }
    form.photo-target > .ctrl-wrapper:has(.btn) { grid-column: 2; grid-row: 2; }
    form.photo-target > .ctrl-wrapper:has(.btn)::before { display: none; }
    form.photo-target .ctrl-field { width: 100%; }
    form.photo-target label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .photos-add-row { flex-direction: column; align-items: stretch; }
    .photos-add-row .btn { width: 100%; min-height: 46px; }
    .photos-add-row > .muted { display: none; }

    /* Pricing: the line's name is a heading, not a wall (3 lines, full name in its tooltip); the list rows fit a phone;
       the actions are thumb-sized. */
    .pricing-name { font-size: 1rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    .pricing-item-head { gap: 0.6rem; }
    .pricing-pic { width: 56px; height: 56px; }
    .pr-row { grid-template-columns: 5.4rem minmax(0, 1fr) auto 4.2rem; gap: 0.35rem; padding: 0.45rem 0.35rem; }
    .pricing-actions { flex-direction: column; align-items: stretch; }
    .pricing-actions > .btn, .pricing-actions .btn-primary { width: 100%; min-height: 46px; justify-content: center; }
    .pricing-skip { width: 100%; }
    .pricing-skip .ctrl-wrapper { flex: 1 1 auto; }
    .pricing-tabs { flex-wrap: nowrap; overflow-x: auto; }

    /* Timeline line: the "📎 N" files mark rides on the first line (beside the time), never over the title. */
    .tl-view > .le-files-mark { grid-column: 2; grid-row: 1; margin-top: 0; }
}
/* Empty date boxes (ui.time.js): the field's hint inside the box on touch screens, where browsers draw nothing. */
@media (pointer: coarse) {
    .ctrl-wrapper.is-empty-date[data-hint] { position: relative; }
    .ctrl-wrapper.is-empty-date[data-hint]:not(:focus-within)::after { content: attr(data-hint); position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
        color: var(--net-text-muted); font-size: var(--net-font-size-sm); pointer-events: none; }
}
