/* =============================================================================
   Module tiles - the AM soft tile (22 Oct 2026, tokens and badge 17 Nov 2026)
   One tile look everywhere: the AM navy tint body, a soft navy edge, rounded
   to the button radius, slow hover; a chosen tile gets a navy ring. The icon
   sits in a soft navy badge on the left. No side strips. Tokens only.

     .invoice-widget       Finance, Orders, Docs, Bookings, Tasks, Tickets,
                           Projects, record panels (the shared counter tile)
     .hr-widget            HR dashboard, Attendance, Employees
     .overview-tile        record tab overview rows
     .domain-tile          Domains accounts, domain and email package panels
     .agency-sites__tile   Websites overview, client record Websites tab
     .lyl-tile, .wallet-tile   loyalty and wallet

   .summary-counter is NOT styled here: its base in websites.css is the AM
   soft tile itself.
   ============================================================================= */

.invoice-widgets,
.hr-page .hr-widgets,
.lyl-tiles,
.wallet-tiles,
.overview-tiles,
.agency-sites__tiles { gap: 14px; }

/* ---- The tile ---------------------------------------------------------------- */

.invoice-widget,
.hr-page .hr-widget,
.lyl-tile,
.wallet-tile,
.overview-tile,
.agency-sites__tile,
.domain-tile {
    gap: 6px;
    padding: 16px 18px;
    border: 1px solid var(--am-blue-soft);
    border-radius: var(--radius-button);
    background: var(--am-blue-tint);
    box-shadow: none;
    transition: border-color 280ms ease, background-color 280ms ease, box-shadow 280ms ease;
}

.lyl-tiles--compact .lyl-tile,
.wallet-tile,
.domain-tile { padding: 13px 15px; }

.invoice-widget:not(:disabled):hover,
.hr-page .hr-widget:hover,
.lyl-tile:hover,
.wallet-tile:hover,
.overview-tile:hover,
.agency-sites__tile:hover,
.domain-tile:hover {
    border-color: var(--am-blue-soft-hover);
    background: var(--am-blue-tint);
}

/* A tile that only counts does not pretend to be pressable. */
.hr-page .hr-dash-tiles .hr-widget:not(.hr-widget--link):hover,
.hr-page .attendance-tiles .hr-widget:hover { border-color: var(--am-blue-soft); }

/* The chosen filter tile. */
.invoice-widget--active,
.invoice-widget--active:not(:disabled):hover,
.hr-page .hr-widget--selected,
.hr-page .hr-widget--link:hover {
    border-color: var(--am-blue);
    background: var(--am-blue-tint);
    box-shadow: inset 0 0 0 1px var(--am-blue);
}

/* ---- Numbers: navy unless the tile carries a tone ------------------------------- */

.invoice-widget__value,
.hr-page .hr-widget__value,
.lyl-tile__value,
.wallet-tile__value,
.overview-tile__value,
.agency-sites__value,
.domain-tile__value { color: var(--am-blue); }

.invoice-widget__value { font-size: 24px; }

.invoice-widget--success .invoice-widget__value,
.lyl-tile--success .lyl-tile__value,
.wallet-tile--success .wallet-tile__value,
.overview-tile--success .overview-tile__value,
.agency-sites__tile--success .agency-sites__value { color: var(--status-success); }

.invoice-widget--danger .invoice-widget__value,
.agency-sites__tile--danger .agency-sites__value { color: var(--status-danger); }

.invoice-widget--warning .invoice-widget__value,
.lyl-tile--warning .lyl-tile__value,
.wallet-tile--warning .wallet-tile__value,
.overview-tile--warning .overview-tile__value,
.agency-sites__tile--warning .agency-sites__value { color: var(--status-warning); }

.invoice-widget--info .invoice-widget__value,
.wallet-tile--info .wallet-tile__value { color: var(--status-info); }

/* Toned tiles keep the soft navy body; the colour stays on the number and
   the note, so a row of tiles reads as one set. */
.overview-tile--warning,
.domain-tile--warn,
.agency-sites__tile--accent,
.agency-sites__tile--danger,
.agency-sites__tile--warning { background: var(--am-blue-tint); border-color: var(--am-blue-soft); }
.agency-sites__tile--accent .agency-sites__value { color: var(--am-blue); }

/* ---- Labels: plain case, quieter ------------------------------------------------- */

.invoice-widget__label,
.lyl-tile__label {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-secondary);
}

/* ---- The icon badge ---------------------------------------------------------------- */

/* Every tile carries an icon in a soft navy badge, the Agent Meeko page look.
   The icon says what the tile counts, so it is always AM navy; the tone stays
   on the number. One badge class serves every tile family above: a tile that
   holds one lays out badge left, its own lines (value, label, note, in
   whatever order the tile already writes them) stacked on the right. A page
   adds the badge span as the tile's FIRST child and nothing else:

     <button class="invoice-widget" type="button">
         <span class="invoice-widget__badge">{renderIcon(name, 17, 1.8, 'icon')}</span>
         <span class="invoice-widget__value">12</span>
         <span class="invoice-widget__label">Overdue</span>
     </button>                                                                   */

:is(.invoice-widget, .hr-widget, .lyl-tile, .wallet-tile, .overview-tile, .agency-sites__tile, .domain-tile):has(> .invoice-widget__badge) {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-auto-rows: auto;
    align-content: start;
    align-items: start;
    column-gap: 12px;
    row-gap: 2px;
}

:is(.invoice-widget, .hr-widget, .lyl-tile, .wallet-tile, .overview-tile, .agency-sites__tile, .domain-tile):has(> .invoice-widget__badge) > :not(.invoice-widget__badge) {
    grid-column: 2;
    min-width: 0;
}

.invoice-widget__badge {
    grid-column: 1;
    grid-row: 1 / span 4;
    align-self: start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-button);
    background: var(--am-blue-soft);
    color: var(--am-blue);
}

.invoice-widget__badge svg { flex: none; }

/* The HR corner icon, until a page moves it to the badge: the same soft navy
   badge, so the two read as one family. */
.hr-page .hr-widget__icon {
    border: none;
    background: var(--am-blue-soft);
    color: var(--am-blue);
}

/* ---- Phones: two tiles a row, tighter ------------------------------------------ */

/* Five tiles at desktop padding stacked three rows deep and pushed the list
   itself below the fold of a phone. Two a row with less padding keeps the
   figures and puts the first rows of the table on screen. A half-width tile
   keeps its badge, a size smaller. */
@media (max-width: 560px) {
    :is(.finance-page, .orders-page, .bookings-page, .bks-page, .wallet-page, .tasks-scope, .tickets-page, .projects-page, .docs-page) .invoice-widgets {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .invoice-widget,
    .hr-page .hr-widget { padding: 10px 12px; }

    .invoice-widget__value { font-size: var(--font-size-large); }

    .invoice-widget__label { font-size: var(--font-size-small); }

    :is(.invoice-widget, .hr-widget, .lyl-tile, .wallet-tile, .overview-tile, .agency-sites__tile, .domain-tile):has(> .invoice-widget__badge) { column-gap: 9px; }

    .invoice-widget__badge {
        width: 30px;
        height: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .invoice-widget,
    .hr-page .hr-widget,
    .lyl-tile, .wallet-tile, .overview-tile, .agency-sites__tile, .domain-tile { transition: none; }
}
