/* ─────────────────────────────────────────────────────────────────────
   MYSPACE-MOBILE-1 — «مساحتي» on a phone (Kamal 2026-11-17: «راجع الصفحات
   اللي كل الموظفين بيدخلوها في الاتش ار وراجع تصميم الموبايل», design
   approved the same day «نفذ التصميم»; «مش عايز ايقون في الصفحات» — only
   the section's tab strip keeps its icons).

   The screens every employee opens: ملفي · بصمتي · طلباتي · حضوري ·
   أدائي · عهدتي · قسائم راتبي · مفاتيح المساعد. Scoped to a page that
   carries the «مساحتي» strip (.hr-strip[data-section="my_space"]) and, but
   for two colour fixes and the hidden summary, to ≤640px — the desktop is
   as it was. The strip itself (project-360.css) is not restyled here.

   House tokens only (no colour literal), text never under 12px, logical
   properties. Registered as a Filament asset: run `filament:assets` and
   commit public/css/app/ with any change.
   ──────────────────────────────────────────────────────────────────── */

/* ── every width ── */

/* the summary beside a section of «بياناتي» belongs to the phone */
.wf-sec-sum { display: none; }
.wf-acts-toggle { display: none; }

/* the house orange for the page's main button (it was blue on «مفاتيح المساعد») */
body:has(.hr-strip[data-section="my_space"]) .fi-page-content .fi-btn.fi-color-primary {
    background: var(--lm-d-accent);
    color: var(--lm-d-on-accent);
}

/* «بياناتي»: a section folds only on a phone — from 641px it stays open and its header is not a switch */
@media (min-width: 641px) {
    .wf-fold > .fi-section > .fi-section-header > .fi-section-collapse-btn { display: none; }
    .wf-fold > .fi-section > .fi-section-header { cursor: auto; }
    .wf-fold > .fi-section.fi-collapsed > .fi-section-content-ctn { visibility: visible; position: static; block-size: auto; overflow: visible; }
}

@media (max-width: 640px) {
    /* ── no icons inside the page (the tab strip keeps its own) ── */
    body:has(.hr-strip[data-section="my_space"]) .fi-page-content :is(
        .wf-fold > .fi-section > .fi-section-header > .fi-icon,
        .fi-btn > .fi-icon,
        .mcp-kpi > .ic,
        .mcp-month > .mcp-ic,
        .wf-kpi-ic,
        .wf-banner > svg,
        .wf-empty > .fi-icon,
        .hr-asset > .ic,
        .fi-ta-empty-state-icon-bg
    ) { display: none; }
    body:has(.hr-strip[data-section="my_space"]) .fi-header-actions-ctn .fi-btn > .fi-icon { display: none; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-actions :is(.fi-link, .fi-btn) > .fi-icon { display: none; }

    /* the strip's last tab can come out from under the fade at its end */
    .hr-strip[data-section="my_space"] .hr-strip-tabs::after { content: ''; flex: none; inline-size: 32px; }

    /* ── «ملفي»: the buttons of the file fold behind «إجراءات» (three or more) ── */
    .fi-header-actions-ctn:has(> .wf-acts-toggle):has(> .fi-ac > :nth-child(3)) > .wf-acts-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-block-size: 44px;
        padding-inline: 16px;
        border: 1px solid var(--lm-d-control-edge);
        border-radius: 12px;
        background: var(--lm-d-surface);
        color: var(--lm-d-ink);
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
    }
    .fi-header-actions-ctn:has(> .wf-acts-toggle):has(> .fi-ac > :nth-child(3)):not(.is-open) > .fi-ac { display: none; }
    .fi-header-actions-ctn.is-open:has(> .wf-acts-toggle) > .fi-ac {
        position: fixed;
        inset: auto 0 0 0;
        z-index: 70;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        max-block-size: 80dvh;
        overflow-y: auto;
        padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0;
        background: var(--lm-d-surface);
        box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--lm-d-ink) 45%, transparent);
    }
    .fi-header-actions-ctn.is-open > .fi-ac > :is(.fi-btn, .fi-dropdown, a) { inline-size: 100%; }
    .fi-header-actions-ctn.is-open > .fi-ac .fi-btn { justify-content: center; min-block-size: 48px; inline-size: 100%; }

    /* ── «ملفي»: the identity card is short — its facts are in «البيانات الأساسية» below,
       and the readiness line keeps its words without the paragraph that explains it ── */
    .fi-page:has(.fi-sc-tabs-tab.wf-my-data.fi-active) .wf-hero-facts { display: none; }
    .fi-page:has(.fi-sc-tabs-tab.wf-my-data.fi-active) .wf-banner > span[style*='flex-basis:100%'] { display: none; }
    .fi-page:has(.fi-sc-tabs-tab.wf-my-data.fi-active) .wf-banner { padding: 8px 10px; gap: 6px; }
    /* the page starts under the tab strip, not a screen-width gap below it */
    .fi-page:has(.hr-strip[data-section="my_space"]) .fi-page-header-main-ctn { padding-block-start: 8px; row-gap: 8px; }

    /* ── «بياناتي»: each section is one line with its summary, opened in place ── */
    .wf-my-data .wf-fold:not([data-fold-ready]) > .fi-section > .fi-section-content-ctn { display: none; }
    .wf-my-data .wf-fold > .fi-section > .fi-section-header { min-block-size: 54px; padding-block: 10px; gap: 10px; flex-wrap: nowrap; align-items: center; cursor: pointer; }
    .wf-my-data .wf-fold > .fi-section > .fi-section-header > .fi-section-collapse-btn { flex: none; }
    .wf-my-data .wf-fold > .fi-section.fi-collapsed > .fi-section-header > .fi-section-header-after-ctn { display: none; }
    /* the folded lines sit close together — one list, not nine cards apart */
    .wf-my-data .fi-sc.fi-grid, .wf-my-data .fi-sc-component > div > .fi-sc.fi-grid { gap: 8px; }
    .wf-my-data .wf-fold > .fi-section > .fi-section-header .fi-section-header-heading {
        display: flex;
        align-items: baseline;
        gap: 8px;
        font-size: 14px;
        font-weight: 700;
    }
    .wf-my-data .wf-fold .wf-sec-sum {
        display: inline;
        margin-inline-start: auto;
        font-size: 12px;
        font-weight: 500;
        color: var(--lm-d-muted);
        white-space: nowrap;
    }
    .wf-my-data .wf-fold > .fi-section > .fi-section-header .fi-section-header-text-ctn { flex: 1 1 auto; min-inline-size: 0; }
    .wf-my-data .wf-fold > .fi-section.fi-collapsed > .fi-section-header .fi-section-header-description { display: none; }
    .wf-my-data .wf-fold > .fi-section:not(.fi-collapsed) > .fi-section-header { background: var(--lm-d-info-soft); }
    /* one card, not a card inside a card */
    .wf-my-data .wf-fold > .fi-section > .fi-section-content-ctn > .fi-section-content { padding: 10px; }
    .wf-my-data .wf-fold .wf-card { border: 0; box-shadow: none; padding: 0; background: transparent; }

    /* the tasks asked of you (and the other one-line lists): the title across
       the card, then its key and date, then its stage — the stage no longer
       squeezes the title into half the width */
    .wf-my-data .wf-fold :is(.wf-rows-grid, [data-my-data-section] .wf-rows) { grid-template-columns: minmax(0, 1fr); }
    .wf-my-data .wf-fold :is(.wf-rows-grid, [data-my-data-section] .wf-rows) .wf-row { flex-wrap: wrap; }
    .wf-my-data .wf-fold :is(.wf-rows-grid, [data-my-data-section] .wf-rows) .wf-row-main { flex: 1 1 100%; min-inline-size: 0; }
    .wf-my-data .wf-fold :is(.wf-rows-grid, [data-my-data-section] .wf-rows) .wf-row-side { flex: 1 1 100%; justify-content: flex-start; }
    .wf-my-data .wf-fold .wf-rows-grid .wf-row-title {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        flex: 1 1 100%;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.45;
    }

    /* ── «حضوري»: the month's figures two by two, the rule in one line ── */
    .hr-facts .mcp-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; }
    .hr-facts .mcp-kpis > .mcp-kpi { inline-size: auto; min-inline-size: 0; padding: 10px 12px; }
    .hr-facts .mcp-kpis > .mcp-kpi .n { font-size: 12px; }
    .hr-facts .hr-fair-long { display: none; }
    .hr-facts .hr-fair-short { display: block; font-size: 12px; }
    /* a day is one card: the day and its stage, then the time it says */
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-check-in) { display: block; inline-size: 100%; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-check-in) thead { display: none; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-check-in) tbody { display: block; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-check-in) .fi-ta-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px 10px;
        padding: 10px 12px;
        border-block-end: 1px solid var(--lm-d-divider);
    }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-check-in) .fi-ta-row > td { display: block; padding: 0; border: 0; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-check-in) .fi-ta-row > td :is(.fi-ta-col, .fi-ta-text) { padding: 0; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-date { flex: 1 1 auto; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-status { flex: none; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-check-in { flex: 1 1 100%; order: 3; display: flex; align-items: baseline; gap: 6px; }
    /* what the phone never showed stays hidden on the card too */
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td:is(.fi-ta-cell-check-out, .fi-ta-cell-late-minutes, .fi-ta-cell-flags) { display: none; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-check-in::before {
        content: attr(data-label) ' ';
        font-size: 12px;
        color: var(--lm-d-muted);
    }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-check-in :is(.fi-ta-text-item, .fi-ta-text) { display: inline; font-size: 12px; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-check-in) .fi-ta-row > td:has(> .fi-ta-actions) { order: 4; flex: 1 1 100%; }

    /* ── «قسائم راتبي»: a slip is a card — the month and its status, the net,
       then its number and date beside «تنزيل», always in sight ── */
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-payslip-number) { display: block; inline-size: 100%; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-payslip-number) thead { display: none; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-payslip-number) tbody { display: block; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-payslip-number) .fi-ta-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 10px;
        padding: 12px;
        border-block-end: 1px solid var(--lm-d-divider);
    }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-payslip-number) .fi-ta-row > td { display: block; padding: 0; border: 0; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-payslip-number) .fi-ta-row > td :is(.fi-ta-col, .fi-ta-text) { padding: 0; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-period { order: 1; flex: 1 1 auto; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-period :is(.fi-ta-text-item, .fi-ta-text) { font-size: 15px; font-weight: 700; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-payment-status { order: 2; flex: none; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-net { order: 3; flex: 1 1 100%; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-net :is(.fi-ta-text-item, .fi-ta-text) { justify-content: flex-start; text-align: start; font-size: 20px; font-weight: 700; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-payslip-number { order: 4; flex: 0 1 auto; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td.fi-ta-cell-generated-at { order: 5; flex: 1 1 auto; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table .fi-ta-row > td:is(.fi-ta-cell-payslip-number, .fi-ta-cell-generated-at) :is(.fi-ta-text-item, .fi-ta-text) { font-size: 12px; font-weight: 500; color: var(--lm-d-muted); }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-payslip-number) .fi-ta-row > td:has(> .fi-ta-actions) { order: 6; flex: none; }
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-table:has(.fi-ta-cell-payslip-number) .fi-ta-actions :is(.fi-link, .fi-btn) {
        min-block-size: 40px;
        padding-inline: 14px;
        border: 1px solid var(--lm-d-control-edge);
        border-radius: 12px;
        font-weight: 700;
    }
    /* the column picker has nothing to pick on a card */
    body:has(.hr-strip[data-section="my_space"]) .fi-ta:has(.fi-ta-cell-payslip-number) .fi-ta-header-ctn:not(:has(.fi-ta-header-heading)) { display: none; }

    /* ── «طلباتي» and the other lists: no column heads over an empty list ── */
    body:has(.hr-strip[data-section="my_space"]) .fi-ta-ctn:has(.fi-ta-empty-state) .fi-ta-table thead { display: none; }

    /* ── «عهدتي» with nothing in it: a card, like the other empty screens ── */
    .hr-custody > .hr-quiet {
        padding: 28px 18px;
        border: 1px solid var(--lm-d-border);
        border-radius: 14px;
        background: var(--lm-d-surface);
        text-align: center;
        font-size: 15px;
        font-weight: 700;
        color: var(--lm-d-ink);
    }

    /* ── «أدائي»: the page name is in the top bar — no second title, no way back to the Work Center ── */
    body:has(.hr-strip[data-section="my_space"]) :is(.prf-title, .prf-back) { display: none; }
    /* a long reading: four lines, the rest behind «اقرأ أكتر» */
    .prf-story-wrap:not(.is-more) .prf-story {
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* ── «مساعد هومي»: a small round button from the start on these screens ── */
    body:has(.hr-strip[data-section="my_space"]) .hoas-dock .hoas-fab { padding-inline: 0.75rem; gap: 0; }
    body:has(.hr-strip[data-section="my_space"]) .hoas-dock .hoas-fab-label { max-inline-size: 0; opacity: 0; }
}

/* «اقرأ أكتر» is a phone control — a wider screen shows the whole reading */
.prf-story-more {
    display: none;
    margin-block-start: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--lm-d-info);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
@media (max-width: 640px) {
    .prf-story-more { display: inline-block; min-block-size: 32px; }
}
