/* Panel tweaks.
   FilePond previews sit on a dark backdrop, which is invisible for normal
   photos but turns transparent PNGs (AI logos) into a black box. */
.filepond--image-preview,
.filepond--image-preview-wrapper {
    background: #ffffff !important;
}

.filepond--image-preview-overlay-idle {
    color: rgba(15, 23, 42, 0.06);
}

/* Bulk photo selection in the listing Media step. */
.aaps-bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:8px}
.aaps-tools{display:inline-flex;align-items:center;gap:8px;flex-wrap:wrap}
.aaps-btn{padding:5px 12px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;font-size:12px;font-weight:600;color:#334155;cursor:pointer}
.aaps-btn:hover{background:#f8fafc}
.aaps-btn:disabled{opacity:.45;cursor:default}
.aaps-danger{border-color:#fca5a5;color:#b91c1c}
.aaps-danger:hover:not(:disabled){background:#fef2f2}
.aaps-count{font-size:12px;color:#64748b}
.aaps-on .filepond--item{cursor:pointer}
.aaps-check{position:absolute;top:6px;left:6px;width:20px;height:20px;border-radius:5px;border:2px solid #fff;background:rgba(15,23,42,.35);box-shadow:0 1px 3px rgba(0,0,0,.35);z-index:5;display:none}
.aaps-on .aaps-check{display:block}
.aaps-on .aaps-sel .aaps-check{background:#2563eb}
.aaps-on .aaps-sel .aaps-check::after{content:"";position:absolute;left:5px;top:1px;width:5px;height:10px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}
.aaps-on .aaps-sel{outline:3px solid #2563eb;outline-offset:-3px;border-radius:8px}

/* Hide FilePond's own item labels while selecting, so only the tick shows. */
.aaps-on .filepond--file-info,.aaps-on .filepond--file-status{display:none!important}
.aaps-check{font-size:0;line-height:0;color:transparent}
.aaps-on .aaps-sel .aaps-check::after{content:"";display:block;position:absolute;left:6px;top:2px;width:5px;height:10px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}

/* Confirm dialog, matching the media library's modal. */
.aa-modal-overlay{position:fixed;inset:0;background:rgba(15,23,42,.55);z-index:1000;display:flex;align-items:center;justify-content:center;padding:20px;backdrop-filter:blur(2px)}
.aa-modal{background:#fff;border-radius:18px;padding:24px;max-width:520px;width:100%;box-shadow:0 20px 60px rgba(0,0,0,.3);max-height:88vh;overflow-y:auto}
.aa-modal-title{font-size:17px;font-weight:900;color:#111827;margin:0 0 4px}
.aa-modal-sub{font-size:12px;color:#9ca3af;margin:0 0 18px}
.aa-modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}
.aaps-solid{background:#dc2626;border-color:#dc2626;color:#fff}
.aaps-solid:hover:not(:disabled){background:#b91c1c}

/* A field's validation message clears as soon as it is changed. */
.aa-err-hidden .fi-fo-field-wrp-error-message,
.aa-err-hidden .fi-fo-field-wrp-error-list { display: none !important; }
.aa-err-hidden .fi-invalid { --tw-ring-color: rgb(212 216 222 / 1) !important; border-color: rgb(212 216 222) !important; }

/* Wide tables: the row actions were only reachable by scrolling to the far
   right, and the horizontal scrollbar only by scrolling to the last row.
   Pin the actions to the right edge and keep the table inside the window. */
.fi-ta-content-ctn td:has(> .fi-ta-actions),
.fi-ta-content-ctn th.fi-ta-actions-header-cell {
    position: sticky;
    right: 0;
    z-index: 3;
    background: #fff;
    box-shadow: -7px 0 9px -7px rgba(15, 23, 42, .22);
}

@media (min-width: 1024px) {
    .fi-ta-content-ctn {
        max-height: calc(100vh - 300px);
        overflow: auto;
    }

    .fi-ta-content-ctn thead th {
        position: sticky;
        top: 0;
        z-index: 4;
        background: #fff;
    }

    .fi-ta-content-ctn th.fi-ta-actions-header-cell {
        z-index: 5;
    }
}

.dark .fi-ta-content-ctn td:has(> .fi-ta-actions),
.dark .fi-ta-content-ctn th.fi-ta-actions-header-cell,
.dark .fi-ta-content-ctn thead th { background: #1f2937; }

/* The pinned actions cells each sit in the stacking order, so a menu opened
   on one row was covered by the rows beneath it. Lift the active one. */
.fi-ta-content-ctn td:has(> .fi-ta-actions):focus-within { z-index: 30; }
.fi-dropdown-panel { z-index: 40; }

/* QuickBooks connection status in business settings. */
.qbo-row{display:flex;align-items:center;gap:8px;font-size:13px;color:#334155}
.qbo-dot{width:8px;height:8px;border-radius:50%;flex:none}
.qbo-on .qbo-dot{background:#16a34a}
.qbo-off .qbo-dot{background:#94a3b8}
.qbo-meta{font-size:11px;color:#64748b;margin-top:4px;margin-left:16px}
.dark .qbo-row{color:#cbd5e1}

/* Business settings > Coming Soon image: every module tab visible, wrapping
   onto a second line rather than hiding behind a scrollbar. */
.aa-cs-tabs .fi-tabs { flex-wrap: wrap; overflow-x: visible; row-gap: 4px; }
.aa-cs-tabs .fi-tabs-item { flex: 0 0 auto; }
/* The upload's file name sat over its own thumbnail; the name is shown,
   truncated, beside "Shown now" instead. */
.aa-cs-upload .filepond--file-info,
.aa-cs-upload .filepond--file-status { display: none; }

/* ---------------------------------------------------------------------------
   Phones (Part 70d). Every portal screen has to work at 360px wide. Filament
   clips the layout sideways, so anything wider than the screen is not scrolled
   to - it is simply cut off. These rules keep content inside the screen.
   --------------------------------------------------------------------------- */

/* Inbox: the conversation list and the open thread take turns on a phone. */
.aa-inbox-back { display: none; }
@media (max-width: 767px) {
    .aa-inbox { height: calc(100dvh - 220px) !important; min-height: 420px !important; flex-wrap: nowrap !important; }
    .aa-inbox-list, .aa-inbox-thread { min-height: 0; }
    .aa-inbox-list { width: 100% !important; border-right: 0 !important; }
    .aa-inbox[data-pane="list"] .aa-inbox-thread,
    .aa-inbox[data-pane="thread"] .aa-inbox-list { display: none !important; }
    .aa-inbox-back { display: block; align-self: flex-start; margin: 8px 10px 0; padding: 8px 12px; min-height: 36px; border: 0; border-radius: 8px; background: #f1f5f9; color: #0f172a; font-size: 13px; font-weight: 600; cursor: pointer; }
    .aa-inbox-head { flex-wrap: wrap; gap: 8px; padding: 10px 12px !important; }
    .aa-inbox-list button { min-height: 34px; }
    .aa-inbox-composer input { min-width: 0; font-size: 16px !important; }
}

/* Topbar: a business with no logo shows its name, which pushed the account
   menu off the screen. The name gives way first. */
@media (max-width: 767px) {
    .fi-topbar-end { min-width: 0; }
    .aa-topbar-biz { min-width: 0; flex-shrink: 1; margin-right: 4px !important; padding: 0 4px !important; }
    .aa-topbar-biz img { max-width: 72px !important; }
    .aa-topbar-biz-name { display: block !important; line-height: 2rem; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; padding: 0 8px !important; }
}

/* Marketplace syndication: one marketplace card per row. */
@media (max-width: 767px) { .aa-ms-grid { grid-template-columns: minmax(0, 1fr) !important; } }

/* A field or section given columnSpan(2) in a form that is one column on a
   phone made the grid grow a second, implicit column: everything after it was
   squeezed into a 44px strip (customer form). Below Filament's sm breakpoint
   a one-column grid stays one column. */
@media (max-width: 639px) {
    .fi-grid[style*="--cols-default: repeat(1,"] > .fi-grid-col { grid-column: 1 / -1 !important; }
}

/* Dashboard greeting banner. */
@media (max-width: 639px) {
    .aa-ai-summary { padding: 1rem 1.1rem !important; }
    .aa-ai-summary > div:first-child { min-width: 0; flex: 1 1 220px; gap: .75rem !important; }
    .aa-ai-summary > div:last-child { gap: .5rem !important; }
    .aa-ai-summary > div:last-child > div { padding: 8px 10px !important; }
    /* 2026-10-28: the avatar stays beside the greeting (the shared phone rule below let this row wrap, leaving the
       avatar alone on its own line), the text may shrink instead of pushing it out, and the three numbers are three
       equal columns instead of tiles sized by their labels. */
    .aa-ai-summary > div:first-child { flex-wrap: nowrap !important; align-items: flex-start !important; }
    .aa-ai-summary > div:first-child > div:last-child { min-width: 0; flex: 1 1 auto; }
    .aa-ai-summary > div:first-child > div:first-child { width: 42px !important; height: 42px !important; border-radius: 12px !important; }
    .aa-ai-summary > div:first-child > div:first-child :is(img, svg) { width: 100% !important; height: 100% !important; }
    .aa-ai-summary > div:last-child { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
    .aa-ai-summary > div:last-child > div { padding: 8px 6px !important; min-width: 0; }
}

/* Shared phone patterns for the hand-built screens. */
@media (max-width: 767px) {
    /* Label-on-the-left, action-on-the-right rows: the action drops below
       instead of being pushed off the screen. */
    .fi-main [style*="justify-content:space-between"],
    .fi-main [style*="justify-content: space-between"] { flex-wrap: wrap; row-gap: 6px; }
    /* Hand-built (inline-styled) flex rows of badges, buttons and chips wrap
       rather than run off the edge. Class-styled rows are handled per view. */
    .fi-page-content [style*="display:flex"]:not([style*="flex-direction:column"]):not([style*="nowrap"]),
    .fi-page-content [style*="display: flex"]:not([style*="flex-direction: column"]):not([style*="nowrap"]) { flex-wrap: wrap; }

    /* Long unbroken text (addresses, URLs, ids) breaks instead of widening the
       page. break-word, not anywhere: anywhere also shrinks min-content, and
       Filament's fieldsets then collapsed to one letter wide. Inside the
       two-ended rows above, the parts may shrink, so there it is anywhere. */
    .fi-page-content :where(div, span, p, a, li, dd, td, label, h1, h2, h3, h4) { overflow-wrap: break-word; }
    .fi-main [style*="justify-content:space-between"] > *,
    .fi-main [style*="justify-content: space-between"] > * { min-width: 0; overflow-wrap: anywhere; }
    .fi-page-content [style*="display:flex"] > span,
    .fi-page-content [style*="display: flex"] > span { min-width: 0; overflow-wrap: anywhere; }

    .fi-header-heading, .fi-header-subheading { overflow-wrap: anywhere; min-width: 0; }

    /* Hand-written tables scroll inside themselves; Filament's tables already
       do (.fi-ta-content-ctn) and the calendar draws its own grid. */
    .fi-page-content table:not(.fi-ta-table):not(.fc table) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Fields never wider than their card. */
    .fi-page-content :where(select, input, textarea) { max-width: 100%; }
    .fi-input-wrp-content-ctn, .fi-input-wrp-content-ctn > .fi-input { min-width: 0; }

    /* Toolbars, header actions and filter rows wrap. */
    .fi-header-actions-ctn, .fi-ac, .fi-ta-header-toolbar { flex-wrap: wrap; }

    /* Small action buttons get a finger-sized height. */
    .fi-main .fi-btn.fi-size-sm, .fi-main .fi-btn.fi-size-xs { min-height: 36px; }

    /* Room under the last card for the round Ask AI button. */
    .fi-main { padding-bottom: 72px; }

    /* Modals and slide-overs use the whole screen width. */
    .fi-modal-window { max-width: 100vw !important; }
}
