/* public/assets/css/s45-mobile-ui-standard.css
   KHMER HRMS — S45: Mobile UI standard (UI-only, no routes/logic touched)
   Loaded LAST in layouts/main.php so it wins over the many per-season files.

   Covers:
     1. Filter panel standard on phones (User Accounts, etc.)
     2. Icon-only Filter/Reset buttons sit on the same row as the last field
        (Notification Deliveries)
     3. .mobile-data-table → real data table (horizontal scroll) on phones
        (Cron history, Recycle Bin, Audit Log, User Accounts, Perf. results)
     4. Performance Voting pages
     5. Full-width date picker in forms (Minimum Wage / Tax Bracket)
   ------------------------------------------------------------------ */

/* ═══ 1. FILTER PANEL STANDARD ═══════════════════════════════════════ */
@media (max-width: 767.98px) {

    .filter-panel {
        padding: 14px !important;
        border-radius: 16px;
    }
    .filter-panel .filter-panel-title {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0 0 12px;
        font-weight: 700;
        font-size: .95rem;
    }

    /* Remove the double box (panel → bordered bar → fields). */
    .filter-panel > .filter-bar {
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: 0 !important;
    }

    /* Forms that end with a text Apply/Reset pair. */
    .filter-panel .filter-form:has(> .filter-panel-actions:not(.filter-panel-actions-icons)) {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
        width: 100%;
        align-items: end;
    }
    .filter-panel .filter-form:has(> .filter-panel-actions:not(.filter-panel-actions-icons)) > * {
        min-width: 0;
        max-width: 100%;
    }
    .filter-panel .filter-form .filter-search-field,
    .filter-panel .filter-form .location-cascade-field {
        width: 100% !important;
        flex: none !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0;
    }
    .filter-panel .filter-form label {
        display: flex;
        align-items: center;
        gap: 6px;
        margin: 0 0 6px;
        font-size: .8rem;
        font-weight: 600;
        color: var(--text-muted);
    }
    .filter-panel .filter-form label svg { width: 15px; height: 15px; flex: 0 0 15px; }
    .filter-panel .filter-form :is(input[type="text"], input[type="search"], input[type="number"], select) {
        width: 100% !important;
        min-width: 0 !important;
        height: 44px;
        border-radius: 12px;
        box-sizing: border-box;
    }

    /* Apply (wide) + Reset in one tidy row. */
    .filter-panel .filter-form > .filter-panel-actions:not(.filter-panel-actions-icons) {
        display: grid !important;
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        gap: 10px !important;
        width: 100% !important;
        margin: 2px 0 0 !important;
        padding-top: 14px;
        border-top: 1px dashed var(--border);
    }
    .filter-panel .filter-form > .filter-panel-actions:not(.filter-panel-actions-icons) > .btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        height: 46px;
        min-height: 46px;
        padding: 0 12px !important;
        border-radius: 12px !important;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
        text-decoration: none !important;
    }
    .filter-panel .filter-form > .filter-panel-actions:not(.filter-panel-actions-icons) > .btn svg {
        width: 18px !important;
        height: 18px !important;
        flex: 0 0 18px;
        margin: 0 !important;
    }
}
/* Two columns for Role/Status style pairs once there is room. */
@media (min-width: 576px) and (max-width: 767.98px) {
    .filter-panel .filter-form:has(> .filter-panel-actions:not(.filter-panel-actions-icons)) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .filter-panel .filter-form:has(> .filter-panel-actions:not(.filter-panel-actions-icons)) > .filter-search-field,
    .filter-panel .filter-form:has(> .filter-panel-actions:not(.filter-panel-actions-icons)) > .filter-panel-actions {
        grid-column: 1 / -1;
    }
}

/* ═══ 2. ICON-ONLY FILTER / RESET ON THE LAST FIELD'S ROW ═════════════ */
@media (max-width: 767.98px) {
    .filter-panel .filter-form.filter-form-compact {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 12px;
        row-gap: 14px;
        align-items: end;
    }
    .filter-panel .filter-form-compact > .location-cascade-field,
    .filter-panel .filter-form-compact > .field-date-wide,
    .filter-panel .filter-form-compact > .filter-field-wide {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        flex: none !important;
        margin: 0;
    }
    /* The action pair becomes just another grid cell (bottom-aligned), so
       with an odd number of fields it lands beside the last date field. */
    .filter-panel .filter-form-compact > .filter-panel-actions.filter-panel-actions-icons {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        align-self: end !important;
        gap: 10px !important;
        width: auto !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }
    .filter-panel .filter-form-compact > .filter-panel-actions.filter-panel-actions-icons > .btn,
    .filter-panel .filter-form-compact > .filter-panel-actions.filter-panel-actions-icons > .btn.filter-action-icon {
        flex: 0 0 42px !important;
        width: 42px !important;
        min-width: 42px !important;
        max-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        max-height: 42px !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 10px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
}

/* ═══ 3. DATA TABLE VIEW ON PHONES (scoped to .mobile-data-table) ═════
   Real table (header row + columns) that scrolls sideways inside a
   rounded, bordered wrapper — NOT stacked cards. */
@media (max-width: 767.98px) {

    .table-wrap:has(> table.mobile-data-table) {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        background: var(--surface) !important;
        border: 1px solid var(--border) !important;
        border-radius: 14px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }

    table.data-table.mobile-data-table {
        display: table !important;          /* undo responsive.css display:block */
        width: 100% !important;
        min-width: 640px !important;        /* forces horizontal scroll, never squeezed */
        max-width: none !important;
        table-layout: auto !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
        overflow: visible !important;
        background: transparent !important;
        border: 0 !important;
    }
    table.mobile-data-table > thead { display: table-header-group !important; }
    table.mobile-data-table > tbody { display: table-row-group !important; }
    table.mobile-data-table tr { display: table-row !important; }

    table.mobile-data-table > thead > tr > th {
        display: table-cell !important;
        padding: 12px 14px !important;
        background: var(--surface-alt, var(--surface)) !important;
        border-bottom: 1px solid var(--border) !important;
        font-size: .78rem;
        font-weight: 700;
        line-height: 1.4;
        text-align: left;
        white-space: nowrap;
        vertical-align: middle;
    }
    table.mobile-data-table > tbody > tr > td {
        display: table-cell !important;
        padding: 12px 14px !important;
        border: 0 !important;
        border-bottom: 1px solid var(--border) !important;
        font-size: .85rem;
        line-height: 1.45;
        text-align: left;
        vertical-align: middle;
        white-space: normal;
        overflow-wrap: normal !important;
        word-break: normal !important;
        min-width: 90px;
    }
    table.mobile-data-table > tbody > tr:last-child > td { border-bottom: 0 !important; }
    table.mobile-data-table > tbody > tr > td::before { content: none !important; display: none !important; }

    /* Row-number column: narrow and sticky so it stays visible while scrolling. */
    table.mobile-data-table th.table-row-number,
    table.mobile-data-table td.table-row-number {
        position: sticky !important;
        left: 0;
        z-index: 3;
        width: 52px !important;
        min-width: 52px !important;
        max-width: 52px !important;
        padding-inline: 8px !important;
        text-align: center !important;
        font-weight: 700;
        background: var(--surface) !important;
        border-right: 1px solid var(--border) !important;
    }
    table.mobile-data-table th.table-row-number { background: var(--surface-alt, var(--surface)) !important; z-index: 4; }

    /* Keep short values (dates, status, durations) on one line. */
    table.mobile-data-table td .badge,
    table.mobile-data-table td time,
    table.mobile-data-table td code { white-space: nowrap; }
    table.mobile-data-table td.text-nowrap,
    table.mobile-data-table td[data-label*="Date"],
    table.mobile-data-table td[data-label*="ថ្ងៃ"] { white-space: nowrap; }

    /* Long free-text columns (summary/description) get a readable width. */
    table.mobile-data-table td:has(> .text-wrap),
    .audit-log-table td:nth-last-child(-n+2) { min-width: 160px; }

    /* Actions stay one horizontal lane on the right. */
    table.mobile-data-table th:last-child:not(.table-row-number),
    table.mobile-data-table td.actions {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        text-align: left !important;
    }
    table.mobile-data-table td.actions {
        display: table-cell !important;
        white-space: nowrap !important;
        border-top: 0 !important;
    }
    table.mobile-data-table td.actions > form,
    table.mobile-data-table td.actions > a,
    table.mobile-data-table td.actions > button,
    table.mobile-data-table td.actions > .btn {
        display: inline-flex !important;
        vertical-align: middle;
        margin: 0 4px 0 0 !important;
        width: auto;
        flex: 0 0 auto !important;
    }

    /* Empty-state row */
    table.mobile-data-table > tbody > tr > td[colspan] {
        text-align: center !important;
        white-space: normal;
        padding: 22px 14px !important;
    }

    /* Per-page select must always show its value. */
    .per-page-control select,
    .table-top-controls select {
        min-width: 76px;
        padding-inline: 10px 28px;
    }
    .table-footer {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
}

/* ═══ 4. PERFORMANCE VOTING ══════════════════════════════════════════ */
@media (max-width: 767.98px) {

    .page-header:has(> .page-header-actions),
    .page-header:has(> a.btn) {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .page-header > .page-header-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px !important;
        width: 100%;
    }
    .page-header > .page-header-actions > .btn,
    .page-header > .page-header-actions > form,
    .page-header > .page-header-actions > form > .btn {
        width: 100%;
        justify-content: center;
    }
    .page-header > .page-header-actions > :only-child,
    .page-header > .page-header-actions > :last-child:nth-child(odd) { grid-column: 1 / -1; }
    .page-header:has(> a.btn) > a.btn {
        width: 100%;
        justify-content: center;
    }

    /* Voting home */
    .performance-colleague-grid { gap: 12px; }
    .performance-colleague-grid > .card { padding: 14px !important; border-radius: 14px; }
    .performance-colleague-grid .btn { height: 42px; }

    /* Vote form */
    .perf-vote-card { padding: 16px !important; max-width: 100% !important; }
    .perf-nominee {
        padding-bottom: 14px;
        border-bottom: 1px solid var(--border);
    }
    .perf-vote-card .score-row {
        padding: 12px 14px;
        margin-bottom: 12px;
        background: var(--surface-alt, transparent);
        border: 1px solid var(--border);
        border-radius: 12px;
    }
    .perf-vote-card .score-row-head { align-items: center !important; gap: 10px; }
    .perf-vote-card .score-row-head label { flex: 1 1 auto; min-width: 0; margin: 0 !important; font-weight: 600; }
    .perf-vote-card .score-row .score-value {
        flex: 0 0 auto;
        min-width: 36px;
        padding: 3px 10px;
        text-align: center;
        border-radius: 999px;
        background: color-mix(in srgb, var(--primary) 12%, transparent);
    }
    .perf-vote-card .score-slider {
        height: 8px;
        margin: 10px 0 4px;
        touch-action: pan-y;
    }
    .perf-vote-card .score-slider::-webkit-slider-thumb { width: 26px; height: 26px; }
    .perf-vote-card .score-slider::-moz-range-thumb { width: 26px; height: 26px; }
    .perf-vote-card textarea { width: 100%; box-sizing: border-box; border-radius: 12px; }
    .perf-vote-card .form-actions,
    .perf-settings-card .form-actions,
    .perf-form-actions {
        display: grid;
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        gap: 10px;
        margin-top: 16px;
    }
    .perf-vote-card .form-actions .btn,
    .perf-settings-card .form-actions .btn {
        width: 100%;
        height: 46px;
        justify-content: center;
        border-radius: 12px;
    }

    /* Settings / criteria forms */
    .card .form-row-2 { grid-template-columns: minmax(0, 1fr) !important; }
    .card .form-row-2 input,
    .card .form-row-2 select { width: 100%; box-sizing: border-box; }

    /* Radar chart */
    #performanceRadarChart { max-width: 100%; height: auto !important; }

    /* Period card */
    .stat-strip { flex-wrap: wrap; }
}

/* ═══ 5. FULL-WIDTH DATE PICKER IN FORMS ═════════════════════════════ */
.form-group .s11-picker-field,
.form-group .s11-picker-field .hrms-date-input-wrap {
    width: 100% !important;
    max-width: 100% !important;
}

/* ═══ 6. PAYROLL SETTINGS (NSSF / OT) ════════════════════════════════ */
.payroll-settings-card .payroll-section-title { margin: 0 0 4px; font-size: 1.1rem; }
.payroll-settings-card .payroll-section-desc { margin: 0 0 16px; font-size: .85rem; line-height: 1.55; }
.payroll-settings-card .payroll-divider { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.payroll-settings-card .payroll-alert { margin: 18px 0; }
.payroll-settings-card .payroll-form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.payroll-settings-card .form-hint { display: block; margin-top: 6px; font-size: .8rem; line-height: 1.5; color: var(--text-muted); }

@media (max-width: 767.98px) {
    .payroll-settings-card { padding: 18px 16px !important; border-radius: 16px; }

    /* Every field fills the card width (the old 160px cap left them half-empty). */
    .payroll-settings-card .form-row-2 {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 0 !important;
    }
    .payroll-settings-card .form-group { margin: 0 0 16px; width: 100%; max-width: 100% !important; }
    .payroll-settings-card .form-group label {
        display: block;
        margin: 0 0 6px;
        font-size: .85rem;
        font-weight: 600;
        line-height: 1.45;
    }
    .payroll-settings-card input[type="number"] {
        width: 100% !important;
        max-width: 100% !important;
        height: 46px;
        padding: 0 14px;
        border-radius: 12px;
        box-sizing: border-box;
        font-size: 1rem;
    }
    /* Disabled/locked value (e.g. maternity 0%) stays readable, not white-on-grey. */
    .payroll-settings-card input:disabled,
    .payroll-settings-card input[readonly] {
        opacity: 1;
        -webkit-text-fill-color: var(--text-muted);
        background: var(--surface-alt);
        cursor: not-allowed;
    }
    .payroll-settings-card .alert { padding: 12px 14px; border-radius: 12px; font-size: .85rem; line-height: 1.55; }

    .payroll-settings-card .payroll-form-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        margin-top: 4px;
    }
    .payroll-settings-card .payroll-form-actions .btn {
        width: 100%;
        height: 46px;
        justify-content: center;
        border-radius: 12px;
    }
}
@media (min-width: 576px) and (max-width: 767.98px) {
    .payroll-settings-card .form-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; column-gap: 14px !important; }
    .payroll-settings-card .payroll-form-actions { grid-template-columns: 1.4fr 1fr 1fr; }
}

/* ═══ 7. CALENDAR SETTINGS — ADD HOLIDAY / CATEGORY / TYPE FORMS ═════ */
@media (max-width: 767.98px) {

    /* Let the toolbar row wrap so the opened form can take a full line
       instead of being squeezed beside the "+" button. */
    .table-top-controls:has(.calendar-add-holiday-inline),
    .hrms-table-toolbar:has(.calendar-add-holiday-inline),
    .table-action-dock:has(.calendar-add-holiday-inline),
    .header-actions:has(.calendar-add-holiday-inline) {
        flex-wrap: wrap !important;
        overflow: visible !important;
        row-gap: 12px;
    }
    .header-actions:has(> .calendar-add-holiday-inline) { width: auto; margin-left: auto; }

    .calendar-add-holiday-inline[open] {
        flex: 1 0 100% !important;
        width: 100% !important;
        order: 50;
    }
    .calendar-add-holiday-inline[open] > summary { margin-left: auto; }
    .calendar-add-holiday-inline:not([open]) > summary { width: auto; }

    .calendar-add-holiday-inline[open] > form.calendar-holiday-add-form {
        position: static !important;
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        margin: 12px 0 0 !important;
        padding: 16px !important;
        box-sizing: border-box;
        background: var(--surface-alt, var(--surface));
        border: 1px solid var(--border);
        border-radius: 16px;
        box-shadow: none;
    }
    .calendar-holiday-add-form .form-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        margin: 0;
    }
    .calendar-holiday-add-form .form-group { margin: 0 0 14px; width: 100%; min-width: 0; }
    .calendar-holiday-add-form label {
        display: block;
        margin: 0 0 6px;
        font-size: .85rem;
        font-weight: 600;
        line-height: 1.45;
    }
    .calendar-holiday-add-form :is(input[type="text"], select, textarea),
    .calendar-holiday-add-form .s11-picker-field,
    .calendar-holiday-add-form .s11-picker-field .hrms-date-input-wrap {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    .calendar-holiday-add-form :is(input[type="text"], select) { height: 46px; border-radius: 12px; }
    .calendar-holiday-add-form textarea { min-height: 84px; border-radius: 12px; }
    .calendar-holiday-add-form .form-group-check { margin: 2px 0 14px; }
    .calendar-holiday-add-form .form-group-check .checkbox-row {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0;
        padding: 12px 14px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface);
    }
    .calendar-holiday-add-form .form-group-check input { margin: 0; width: 20px; height: 20px; }
    .calendar-holiday-add-form > .btn {
        width: 100%;
        height: 46px;
        justify-content: center;
        border-radius: 12px;
    }

    /* Add Category / Add Holiday Type (EN + KH name inputs) */
    .calendar-add-details[open] .calendar-lookup-form {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        width: 100%;
        padding: 16px;
        margin-top: 12px;
        box-sizing: border-box;
        border-radius: 16px;
    }
    .calendar-lookup-form input[type="text"] {
        width: 100% !important;
        min-width: 0 !important;
        height: 46px;
        border-radius: 12px;
        box-sizing: border-box;
    }
    .calendar-lookup-form .calendar-color-field {
        width: 100%;
        height: 46px;
        justify-content: space-between;
        padding: 0 12px;
        border-radius: 12px;
        box-sizing: border-box;
    }
    .calendar-lookup-form .calendar-color-field input[type="color"] { width: 48px; height: 32px; padding: 2px; }
    .calendar-lookup-form .btn { width: 100%; height: 46px; justify-content: center; border-radius: 12px; }

    /* The details wrapper itself must not float/absolute on phones. */
    .calendar-lookup-head-actions .calendar-add-details[open] .calendar-lookup-form { position: static; }
}

/* ═══ 8. CALENDAR SETTINGS — DESKTOP POPOVER FORMS ═══════════════════
   Add Category / Add Holiday Type / Add Holiday: proper floating card
   with roomy inputs, aligned grid and a small pointer, instead of tiny
   inputs jammed into a thin strip. */
@media (min-width: 721px) {
    .calendar-lookup-head-actions .calendar-add-details[open] .calendar-lookup-form {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
        align-items: center;
        gap: 12px;
        width: min(680px, calc(100vw - 340px));
        padding: 20px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: var(--surface, #fff);
        box-shadow: 0 18px 48px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .06);
        top: calc(100% + 12px);
        z-index: 40;
    }
    /* pointer toward the "Add" button */
    .calendar-lookup-head-actions .calendar-add-details[open] .calendar-lookup-form::before {
        content: "";
        position: absolute;
        top: -7px;
        right: 64px;
        width: 12px;
        height: 12px;
        background: var(--surface, #fff);
        border-left: 1px solid var(--border);
        border-top: 1px solid var(--border);
        transform: rotate(45deg);
    }
    .calendar-lookup-form input[type="text"] {
        width: 100%;
        min-width: 0;
        height: 42px;
        padding: 0 14px;
        border-radius: 10px;
        box-sizing: border-box;
    }
    .calendar-lookup-form .calendar-color-field {
        height: 42px;
        padding: 0 12px;
        gap: 10px;
        border-radius: 10px;
        white-space: nowrap;
    }
    .calendar-lookup-form .calendar-color-field input[type="color"] { width: 40px; height: 28px; padding: 0; border: 0; background: none; }
    .calendar-lookup-form .btn {
        height: 42px;
        padding: 0 20px;
        border-radius: 10px;
        white-space: nowrap;
    }
    /* Holiday-types form has no colour: name, name, button */
    .calendar-lookup-form:not(:has(.calendar-color-field)) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important; }

    /* Add Holiday popover */
    .calendar-add-holiday-inline[open] > form.calendar-holiday-add-form {
        width: 560px;
        max-width: calc(100vw - 340px);
        padding: 22px;
        border-radius: 16px;
        margin-top: 10px;
        box-shadow: 0 18px 48px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .06);
    }
    .calendar-holiday-add-form .form-row { gap: 14px; margin-bottom: 14px; }
    .calendar-holiday-add-form .form-group { margin: 0; flex: 1 1 0; min-width: 0; }
    .calendar-holiday-add-form label { display: block; margin: 0 0 6px; font-size: .82rem; font-weight: 600; }
    .calendar-holiday-add-form :is(input[type="text"], select) { width: 100%; height: 42px; border-radius: 10px; box-sizing: border-box; }
    .calendar-holiday-add-form textarea { width: 100%; border-radius: 10px; box-sizing: border-box; }
    .calendar-holiday-add-form .form-group-check { align-self: flex-end; flex: 0 0 auto; }
    .calendar-holiday-add-form .form-group-check .checkbox-row {
        display: flex; align-items: center; gap: 8px; height: 42px; margin: 0; padding: 0 14px;
        border: 1px solid var(--border); border-radius: 10px; white-space: nowrap;
    }
    .calendar-holiday-add-form > .btn { margin-top: 16px; height: 42px; padding: 0 22px; border-radius: 10px; }
}

/* Lookup cards (categories / holiday types): calmer header spacing */
.calendar-lookup-card .calendar-lookup-head { align-items: center; gap: 16px; }
.calendar-lookup-card .calendar-lookup-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary); font-weight: 700; font-size: .8rem;
}

/* ═══ 9. COLOUR PALETTE (Add Event Category) ═════════════════════════ */
.calendar-color-palette {
    grid-column: 1 / -1;
    order: 10;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 4px;
}
.calendar-color-swatch {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 2px solid var(--surface, #fff);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--border);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}
.calendar-color-swatch:hover { transform: scale(1.12); }
.calendar-color-swatch.is-active { box-shadow: 0 0 0 2px var(--primary, #2563eb); }
@media (max-width: 767.98px) {
    .calendar-color-swatch { width: 36px; height: 36px; }
}


/* ═══ 6. SETTINGS → PERMISSION / LEAVE REQUEST TABLES (mobile) ═══════
   These two settings tables now use the standard .mobile-data-table
   (real table, header row, horizontal scroll) instead of stacked
   table-cards. The 3-column permission table is narrow, so it gets a
   smaller scroll floor than the 640px default. */
@media (max-width: 767.98px) {
    table.data-table.mobile-data-table.s11-permission-table { min-width: 440px !important; }
    table.data-table.mobile-data-table.s11-settings-table:not(.s11-permission-table) { min-width: 860px !important; }

    .s11-settings-table-wrap.table-wrap { margin-top: 14px; }
    table.mobile-data-table.s11-settings-table > tbody > tr > td .check-row {
        display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; margin: 0;
    }
    table.mobile-data-table.s11-settings-table > tbody > tr > td select,
    table.mobile-data-table.s11-settings-table > tbody > tr > td input[type="number"] {
        width: 100%; min-width: 130px; box-sizing: border-box;
    }
    table.mobile-data-table.s11-settings-table > tbody > tr > td .form-hint { white-space: nowrap; }
}

/* ═══ 7. LOCATIONS → FILTER / RESET (mobile) ═════════════════════════
   Desktop keeps the 36px icon-only pair. On phones the pair becomes the
   same labelled Apply (wide) + Reset row used by the other filter panels,
   full width, 46px tall, below the fields. */
.filter-panel-actions-labeled .filter-action-label { display: none; }

@media (max-width: 767.98px) {
    .locations-filter-panel #location-filter-form .filter-panel-actions.filter-panel-actions-labeled {
        display: grid !important;
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        gap: 10px !important;
        width: 100% !important;
        margin: 2px 0 0 !important;
        padding-top: 14px;
        border-top: 1px dashed var(--border);
        flex: none !important;
    }
    .locations-filter-panel #location-filter-form .filter-panel-actions-labeled > .btn.filter-action-icon {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 46px !important;
        min-height: 46px !important;
        max-height: none !important;
        flex: none !important;
        padding: 0 12px !important;
        border-radius: 12px !important;
        font-size: .95rem;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
        text-decoration: none !important;
    }
    .locations-filter-panel #location-filter-form .filter-panel-actions-labeled > .btn.filter-action-icon svg {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        min-height: 18px !important;
        flex: 0 0 18px;
    }
    .filter-panel-actions-labeled .filter-action-label { display: inline; }
    .filter-panel-actions-labeled .tip::before,
    .filter-panel-actions-labeled .tip::after { display: none !important; }
}

@media (max-width: 767.98px) {
    /* Give the settings tables more of the phone width. */
    .card.s11-settings-section { padding: 14px !important; }
}
