/* ==========================================================================
   Toolbar overflow + tile rows (2026-11-11). RES_DESIGN_SPEC components 13
   (overflow menu) and 14 (tile row). Built by static/js/acwise_overflow.js
   and static/js/acwise_tile_row.js; used by the My deals toolbar, the
   Properties header, the map layer chips, the CRM list and the Schedule.
   Skin tokens only: the res kit's 32px control, 8px radius, 13px text, the
   popover look of the CRM menus, the primary fill for a pressed control.
   ========================================================================== */

/* ---- The More control ----------------------------------------------------- */
.acw-ovf { position: relative; display: inline-flex; flex: none; }
.acw-ovf[hidden] { display: none !important; }
.acw-ovf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 32px; min-width: 32px; padding: 0; box-sizing: border-box; cursor: pointer;
    border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card);
    color: var(--text-muted); font-family: var(--font-body); font-size: 13px; line-height: 1;
    transition: var(--transition-fast); white-space: nowrap; }
.acw-ovf-btn svg { width: 16px; height: 16px; }
.acw-ovf-btn.has-label { padding: 0 12px; color: var(--text-primary); font-weight: 600; }
.acw-ovf-btn:hover, .acw-ovf.is-open > .acw-ovf-btn { border-color: var(--primary-color); color: var(--primary-color); }
.acw-ovf-btn:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 1px; }

/* ---- The menu (fixed, so no toolbar clips it) ----------------------------- */
.acw-ovf-menu { position: fixed; z-index: 1000; min-width: 230px; max-width: 320px; max-height: 70vh;
    overflow-y: auto; padding: 4px; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px;
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-card, 10px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12); font-family: var(--font-body); }
.acw-ovf-menu[hidden] { display: none !important; }
/* A folded control becomes a menu row. The toolbar buttons carry inline
   sizes in the shared markup, hence !important. */
.acw-ovf-menu > .acw-ovf-item { display: flex !important; align-items: center; gap: 8px;
    width: 100% !important; min-height: 32px; height: auto !important; box-sizing: border-box;
    margin: 0 !important; padding: 0 10px !important; border: 0 !important; border-radius: 6px !important;
    background: none !important; box-shadow: none !important; justify-content: flex-start;
    font-size: 13px !important; font-weight: 500; color: var(--text-secondary) !important; text-align: left;
    white-space: nowrap; flex: none !important; }
.acw-ovf-menu > button.acw-ovf-item:hover,
.acw-ovf-menu > a.acw-ovf-item:hover,
.acw-ovf-menu > .acw-ovf-item:focus-visible { background: var(--bg-input) !important; color: var(--text-primary) !important; outline: none; }
.acw-ovf-menu > .acw-ovf-item svg { width: 16px !important; height: 16px !important; flex: none; }
/* Icon-only controls name themselves beside the icon. */
.acw-ovf-menu [data-ovf-label]::after { content: attr(data-ovf-label); }
/* A group row (Zoom: − 100% +, Undo | Redo) keeps its parts on one line. */
.acw-ovf-menu > .acw-ovf-item[data-ovf-title]::before { content: attr(data-ovf-title); margin-right: auto;
    color: var(--text-secondary); }
.acw-ovf-menu > .acw-ovf-item[data-ovf-group] { padding-right: 4px !important; }
.acw-ovf-menu > .acw-ovf-item[data-ovf-group] > button { display: inline-flex; align-items: center; gap: 6px;
    height: 28px; padding: 0 8px !important; border: 0 !important; background: none !important;
    border-radius: 6px !important; font-size: 13px !important; color: var(--text-secondary); cursor: pointer;
    width: auto !important; }
.acw-ovf-menu > .acw-ovf-item[data-ovf-group] > button:hover { background: var(--bg-input) !important; color: var(--text-primary); }
/* Divider rules folded with their group never show in the menu. */
.acw-ovf-menu > .acw-ovf-item.acw-ovf-rule { display: none !important; }
/* A select or input folded into the menu keeps its own look. */
.acw-ovf-menu > select.acw-ovf-item, .acw-ovf-menu > input.acw-ovf-item {
    border: 1px solid var(--border-color) !important; background: var(--bg-card) !important;
    height: 32px !important; max-width: none; }

/* ---- A search box folded to an icon that expands in place ---------------- */
.acw-find { position: relative; }
.acw-find-btn { display: none; align-items: center; justify-content: center; width: 32px; height: 32px;
    padding: 0; box-sizing: border-box; border: 1px solid var(--border-color); border-radius: 8px;
    background: var(--bg-card); color: var(--text-muted); cursor: pointer; }
.acw-find-btn svg { width: 16px; height: 16px; }
.acw-find-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.acw-find.acw-find-folded > .acw-find-btn { display: inline-flex; }
.acw-find.acw-find-folded.has-value > .acw-find-btn { border-color: var(--primary-color); color: var(--primary-color); }
.acw-find.acw-find-folded > input { display: none !important; }
.acw-find.acw-find-folded.is-expanded > input { display: block !important; position: absolute; right: 0; top: 0;
    width: 260px !important; z-index: 30; }

/* ---- Tile rows ------------------------------------------------------------- */
.acw-tiles { display: flex; align-items: stretch; gap: 8px; height: 56px; margin: 0 0 8px; min-width: 0;
    flex-wrap: nowrap; }
.acw-tiles[hidden] { display: none !important; }
/* Reserved while the deals load (no layout shift): faint placeholder tiles. */
/* The placeholders ARE tiles (2026-11-13, owner: square boxes while loading,
   round ones once loaded): the tile's 56px height, 8px radius, 1px border
   in the border ink on the card fill, 8px apart. Two masked layers draw
   them (the border ring, then the fill inset 1px), so every row that sets
   is-pending (My deals phases, the card's stat row, Listings sources) gets
   them without markup. */
.acw-tiles.is-pending { position: relative; overflow: hidden; }
.acw-tiles.is-pending::before, .acw-tiles.is-pending::after {
    content: ''; position: absolute; left: 0; top: 0; height: 56px; width: min(100%, 784px);
    pointer-events: none;
    -webkit-mask-repeat: repeat-x; mask-repeat: repeat-x;
    -webkit-mask-size: 112px 56px; mask-size: 112px 56px; }
.acw-tiles.is-pending::before { background: var(--border-color);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='56'%3E%3Crect width='104' height='56' rx='8'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='56'%3E%3Crect width='104' height='56' rx='8'/%3E%3C/svg%3E"); }
.acw-tiles.is-pending::after { background: var(--bg-card, #fff);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='56'%3E%3Crect x='1' y='1' width='102' height='54' rx='7'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='56'%3E%3Crect x='1' y='1' width='102' height='54' rx='7'/%3E%3C/svg%3E"); }
.acw-tile { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    flex: none; height: 56px; min-width: 88px; padding: 0 14px; box-sizing: border-box; cursor: pointer;
    border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card);
    color: var(--text-secondary); font-family: var(--font-body); font-size: 12.5px; font-weight: 500;
    line-height: 1.2; white-space: nowrap; transition: var(--transition-fast); }
.acw-tile svg { width: 18px; height: 18px; flex: none; }
/* The phase settings gear at the end of the My deals phase row (2026-11-12):
   the toolbar's quiet icon button (32px, 8px radius), centred on the row. */
.acw-tile-gear { align-self: center; flex: none; width: 32px; height: 32px; box-sizing: border-box; padding: 0;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); color: var(--text-secondary); }
.acw-tile-gear:hover { border-color: var(--primary-color); color: var(--text-primary); }
.acw-tile-gear:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.acw-tile-gear svg { width: 16px; height: 16px; }
.acw-tile:hover { border-color: var(--primary-color); color: var(--text-primary); }
.acw-tile:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.acw-tile-name { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; }
.acw-tile-label { overflow: hidden; text-overflow: ellipsis; }
.acw-tile-count { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.acw-tile-n { font-size: 15px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
/* the dot is the phase's map pin (AcwiseMap.paintPin sets fill, ring, hairline) */
.acw-tile-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-sizing: border-box; }
.acw-tile[aria-pressed="true"] { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.acw-tile[aria-pressed="true"] .acw-tile-count,
.acw-tile[aria-pressed="true"] .acw-tile-n { color: inherit; }
/* Narrower: names shorten, then icons only (the name stays in the title). */
.acw-tiles.is-compact > .acw-tile { min-width: 0; padding: 0 10px; }
.acw-tiles.is-compact > .acw-tile .acw-tile-label { max-width: 64px; }
.acw-tiles.is-icons > .acw-tile { min-width: 44px; }
.acw-tiles.is-icons > .acw-tile .acw-tile-label,
.acw-tiles.is-icons > .acw-tile .acw-tile-count { display: none; }
/* Narrowest: one button opens the row as a menu. */
.acw-tiles > .acw-ovf { height: 56px; }
.acw-ovf-btn.acw-tile-fold { height: 56px; min-width: 120px; padding: 0 16px; border-radius: 8px;
    color: var(--text-primary); font-size: 13px; font-weight: 600; }
.acw-ovf-btn.acw-tile-fold.is-on { border-color: var(--primary-color); color: var(--primary-color); }
.acw-tile-menu > .acw-tile.acw-ovf-item { flex-direction: row !important; gap: 8px; min-height: 36px;
    color: var(--text-secondary) !important; }
.acw-tile-menu > .acw-tile.acw-ovf-item .acw-tile-name { flex: 1; }
.acw-tile-menu > .acw-tile.acw-ovf-item .acw-tile-label { max-width: none; }
.acw-tile-menu > .acw-tile.acw-ovf-item .acw-tile-count,
.acw-tile-menu > .acw-tile.acw-ovf-item .acw-tile-n { margin-left: auto; order: 2; font-size: 13px; }
.acw-tile-menu > .acw-tile.acw-ovf-item[aria-pressed="true"] { background: var(--primary-color) !important;
    color: #fff !important; }

/* ---- Map layer chips: one row; a "Layers" chip opens the rest ------------- */
.tracker-map-chips.acm-chips-fold { flex-wrap: nowrap !important; min-width: 0; overflow: hidden; }
/* Tight (the fold's first step, 2026-11-13): the chips keep their row a
   little longer before folding into Layers. */
.tracker-map-header .tracker-map-chips.acm-chips-tight, .acm-mount-head .tracker-map-chips.acm-chips-tight { gap: 4px; }
.tracker-map-header .tracker-map-chips.acm-chips-tight .tracker-map-chip,
.acm-mount-head .tracker-map-chips.acm-chips-tight .tracker-map-chip { padding-left: 7px; padding-right: 7px; }
.acm-chips-fold > .acw-ovf > .acw-ovf-btn { height: 26px; min-width: 0; padding: 0 10px; border-radius: 13px;
    font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.acm-chips-fold > .acw-ovf > .acw-ovf-btn:hover { color: var(--text-primary); }
.acm-layers-menu > .tracker-map-chip.active { color: var(--primary-color) !important; font-weight: 600; }
.acm-layers-menu > .acw-ovf-item:not(button) { padding: 0 !important; }
.acm-layers-menu > .acw-ovf-item:not(button) > button { width: 100%; justify-content: flex-start;
    border: 0 !important; background: none !important; min-height: 32px; padding: 0 10px; text-align: left;
    font-size: 13px; color: var(--text-secondary); border-radius: 6px; }
.acm-layers-menu > .acw-ovf-item:not(button) > button:hover { background: var(--bg-input) !important; }

/* ---- My deals toolbar: one row on desktop, the rest in More --------------- */
body:not(.mobile) .tracker-filters.acw-ovf-row { flex-wrap: nowrap; flex-direction: row; align-items: center; }
body:not(.mobile) .tracker-filters.acw-ovf-row > .tracker-toolbar > #tracker-search { width: 180px; }
body:not(.mobile) .tracker-filters.acw-ovf-row > .filter-group { flex: none; flex-wrap: nowrap; }
body:not(.mobile) .tracker-filters.acw-ovf-row > .tracker-toolbar { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap !important; }
body:not(.mobile) .tracker-filters.acw-ovf-row > .tracker-toolbar > * { flex-shrink: 0; }
body:not(.mobile) .tracker-filters.acw-ovf-row > .tracker-toolbar > #tracker-search { flex-shrink: 1; min-width: 96px; }
body:not(.mobile) .tracker-filters.acw-ovf-row > .tracker-toolbar > div[style*="flex:1"] { flex: 1 1 0; min-width: 0; }
/* The residential toolbar's 32px controls: the More button matches. */
.tracker-shell .tracker-toolbar > .acw-ovf > .acw-ovf-btn { width: 32px; }
.tracker-container:not(.tracker-shell) .tracker-toolbar > .acw-ovf > .acw-ovf-btn { height: 28px; width: 28px;
    min-width: 28px; border-radius: 6px; }

/* ---- My deals filters (2026-11-11, every org) -----------------------------
   The active filters as chips beside the tabs (the Properties chip look,
   RES_DESIGN_SPEC component 12), "+ filter" opens a compact form of the
   org's own columns: one labelled row per field, From / To for numbers,
   money and dates, a box of options for a dropdown column. */
.tr-filter-chips { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; min-width: 0; }
.tr-filter-chips .hunt-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; flex: none;
    border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card); white-space: nowrap;
    font-size: 12px; color: var(--text-primary); font-family: var(--font-body); cursor: pointer; line-height: 1.5; }
.tr-filter-chips .hunt-chip b { font-weight: 500; color: var(--text-muted); }
.tr-filter-chips .hunt-chip:hover { border-color: var(--primary-color); }
.tr-filter-chips .hunt-chip.is-add { border-style: dashed; color: var(--primary-color); font-weight: 600; }
/* The filter control (2026-11-13): a funnel and "Filter", a plain chip. */
.hunt-chip.is-add.is-filter { border-style: solid; display: inline-flex; align-items: center; gap: 5px; }
.hunt-chip.is-filter .acw-filter-ico { flex: none; display: block; }
.tr-filter-chips .hunt-chip-x { border: none; background: none; padding: 0 0 0 2px; cursor: pointer;
    color: var(--text-muted); font-size: 13px; line-height: 1; font-family: var(--font-body); }
.tr-filter-chips .hunt-chip-x:hover { color: var(--text-primary); }
.tr-filter-form { position: fixed; z-index: 1000; width: 600px; max-width: calc(100vw - 24px); max-height: 70vh;
    overflow-y: auto; box-sizing: border-box; padding: 14px 16px 12px; background: var(--bg-card);
    border: 1px solid var(--border-color); border-radius: var(--radius-card, 10px); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    font-family: var(--font-body); }
.tr-filter-form[hidden] { display: none !important; }
.tf-group + .tf-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-color); }
.tf-row { display: grid; grid-template-columns: 132px minmax(0, 1fr) 16px minmax(0, 1fr); align-items: center;
    gap: 6px; margin: 0 0 8px; }
.tf-row.tf-choice { grid-template-columns: 132px minmax(0, 1fr); align-items: start; }
.tf-l { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); padding-top: 2px; }
.tf-to { font-size: 12px; color: var(--text-muted); text-align: center; }
.tf-row input[type="text"], .tf-row input[type="date"] { width: 100%; height: 32px; box-sizing: border-box;
    padding: 0 8px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input);
    font-size: 13px; color: var(--text-primary); font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.tf-row input:focus { outline: none; border-color: var(--border-focus); background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.08); }
.tf-row input.tf-wide { grid-column: 2 / -1; }
.tf-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.tf-opt { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 6px; cursor: pointer;
    border: 1px solid var(--border-color); border-radius: 12px; font-size: 12px; color: var(--text-secondary); }
.tf-opt input { margin: 0; }
.tf-opt:has(input:checked) { border-color: var(--primary-color); color: var(--primary-color); background: var(--bg-input); }
.tf-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.tf-clear { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; color: var(--text-muted); cursor: pointer; }
.tf-clear:hover { color: var(--text-primary); text-decoration: underline; }
.tf-done { height: 32px; padding: 0 16px; border: 1px solid var(--primary-color); border-radius: 8px;
    background: var(--primary-color); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tf-empty { font-size: 12.5px; color: var(--text-muted); }
body.mobile .tr-filter-chips { flex-wrap: wrap; }
.tr-filter-form label.tf-l, .tr-filter-form span.tf-l { display: block; margin: 0; font-size: 12.5px; font-weight: 500;
    color: var(--text-secondary); text-transform: none; letter-spacing: 0; }
.tr-filter-form label.tf-opt { margin: 0; font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; }
/* A layer that is on keeps the folded Layers chip in its active look. */
.acm-chips-fold > .acw-ovf:has(.tracker-map-chip.active) > .acw-ovf-btn,
.acm-chips-fold > .acw-ovf:has(.acm-bnd-chip.active) > .acw-ovf-btn { border-color: var(--primary-color);
    color: var(--primary-color); background: var(--bg-input); }

/* While a deal card is open (owner, 11/13) the toolbar keeps only what still
   applies: the My deals / Listings tabs, the map toggle and fullscreen. Table
   actions (views, filters, search, New, Quick Analyze, bulk, Stats, undo /
   redo, zoom, Export, table settings) come back with Back. */
body.acw-card-open #tracker-view-tabs,
body.acw-card-open #tr-filter-chips,
body.acw-card-open #tracker-search,
body.acw-card-open [id="add-property-btn"],
body.acw-card-open #quick-analyze-btn,
body.acw-card-open #bulk-actions-btn,
body.acw-card-open #tracker-stats-btn,
body.acw-card-open #tracker-export-btn,
body.acw-card-open .tracker-toolbar [data-ovf-title="Edit"],
body.acw-card-open .tracker-toolbar [data-ovf-title="Zoom"],
body.acw-card-open .tracker-toolbar [title="Table settings"],
body.acw-card-open .tracker-toolbar .acw-ovf-rule { display: none !important; }
