/* ─────────────────────────────────────────────────────────────────────
   HOMEi «المشاريع والعقارات» on the house design system (PROJ-DS-1,
   Kamal 2026-10-02: «راجع تصميم الصفحات دي وخليها زي الديزاين سيستم
   بتاعنا واضغط الداتا حاول ميبقاش فيه اسكرول كتير لتحت ولا يمين وشمال»).

   The eleven screens of the settings card — المشاريع، مجموعة المشاريع،
   تصميم المشروعات، المنتجات، الدول، المدن، البلدات، المناطق، الأراضي،
   الأقساط، الصفات — lists and record pages: the light blue-grey page, navy
   ink, the table as ONE ruled card that never scrolls sideways (the
   rarely-read columns are optional), dense rows, dense sections, the
   repeated rows (price logs, floors, steps, payments, team, exclusions) as
   one compact table row each instead of a card each, the orange decision.

   Colours: the design system's own tokens (--lm-d-* in tokens.css, with
   their dark mirror); no colour literal here — the ratchet holds this sheet
   at zero. Text never under 12px. RTL-safe: logical properties only.
   Scoped by the page classes `.ps-page` (+ `.ps-list-page` / `.ps-doc-page`).

   Registered as a Filament asset — a change here ships NOTHING until
   `php artisan filament:assets` is run and public/css/app/ is committed in
   the same change.
   ──────────────────────────────────────────────────────────────────── */

/* ── the ground and the head ── */
body:has(.ps-page) { background: var(--lm-d-page); }
body:has(.ps-page) .fi-main-ctn { background: transparent; }
.ps-page .fi-page-content { row-gap: 12px; }
.ps-page .fi-header { gap: 10px 16px; }
.ps-page .fi-header-heading { font-size: 24px; font-weight: 700; line-height: 1.25; color: var(--lm-d-ink); }
.ps-page .fi-header-subheading { margin-block-start: 2px; font-size: 13.5px; color: var(--lm-d-muted); }

/* the header's decisions: outline buttons, the create is the design's orange */
.ps-page .fi-header-actions-ctn .fi-btn {
    min-block-size: 38px;
    border-radius: 12px;
    padding-inline: 14px;
    background: var(--lm-d-surface);
    color: var(--lm-d-ink);
    box-shadow: inset 0 0 0 1px var(--lm-d-control-edge);
    font-weight: 700;
}
.ps-page .fi-header-actions-ctn .fi-btn .fi-icon { color: currentColor; }
.ps-page .fi-header-actions-ctn .fi-btn:is(.fi-color-primary, .fi-color-success) { background: var(--lm-d-accent); color: var(--lm-d-on-accent); box-shadow: 0 4px 12px var(--lm-d-accent-soft); }
.ps-page .fi-header-actions-ctn .fi-btn.fi-color-danger { background: var(--lm-d-surface); color: var(--lm-d-danger); box-shadow: inset 0 0 0 1px var(--lm-d-gap-edge); }
.ps-page .fi-header-actions-ctn .fi-dropdown-trigger .fi-btn { padding-inline: 12px; }

/* the form's own save row (sticky at the foot): the save is orange, the rest outline */
.ps-doc-page .fi-sc-actions .fi-btn,
.ps-doc-page .fi-form-actions .fi-btn { min-block-size: 38px; border-radius: 12px; font-weight: 700; }
.ps-doc-page :is(.fi-sc-actions, .fi-form-actions) .fi-btn.fi-color-primary { background: var(--lm-d-accent); color: var(--lm-d-on-accent); }
.ps-doc-page :is(.fi-sc-actions, .fi-form-actions) .fi-btn.fi-color-gray { background: var(--lm-d-surface); color: var(--lm-d-ink); box-shadow: inset 0 0 0 1px var(--lm-d-control-edge); }
.ps-doc-page .fi-form-actions.fi-sticky { background: var(--lm-d-surface); border-block-start: 1px solid var(--lm-d-border); box-shadow: 0 -4px 12px var(--lm-d-shadow); }

/* ── the tabs of a list (the units' projects): chips with counts that wrap — never a sideways scroll ── */
.ps-list-page .fi-tabs:not(.fi-contained) {
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-inline: 0;
    gap: 6px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    --tw-ring-shadow: 0 0 transparent;
}
.ps-list-page .fi-tabs .fi-tabs-item {
    flex: 0 0 auto;
    min-block-size: 34px;
    padding-inline: 12px;
    border-radius: 17px;
    border: 1px solid var(--lm-d-border);
    background: var(--lm-d-surface);
    color: var(--lm-d-ink);
    font-size: 13px;
    font-weight: 700;
}
.ps-list-page .fi-tabs .fi-tabs-item .fi-tabs-item-label { color: inherit; }
.ps-list-page .fi-tabs .fi-tabs-item:hover { border-color: var(--lm-d-control-edge); background: var(--lm-d-surface); }
.ps-list-page .fi-tabs .fi-tabs-item.fi-active { background: var(--lm-d-tab-on-bg); border-color: var(--lm-d-tab-on-bg); color: var(--lm-d-tab-on-ink); }
.ps-list-page .fi-tabs .fi-tabs-item.fi-active .fi-tabs-item-label { color: var(--lm-d-tab-on-ink); }
.ps-list-page .fi-tabs .fi-tabs-item .fi-badge { min-inline-size: 22px; justify-content: center; background: var(--lm-d-chip-bg); color: var(--lm-d-ink); box-shadow: none; font-variant-numeric: tabular-nums; font-size: 12px; }
.ps-list-page .fi-tabs .fi-tabs-item.fi-active .fi-badge { background: var(--lm-d-tab-on-count); color: var(--lm-d-tab-on-ink); }
.ps-list-page .fi-tabs .fi-tabs-item:focus-visible { outline: 2px solid var(--lm-d-info); outline-offset: 2px; }

/* ── the table: one card with the blue rule, dense rows, never wider than the screen ── */
.ps-page .fi-ta-ctn {
    background: var(--lm-d-surface);
    border: 1px solid var(--lm-d-border);
    border-block-start: 3px solid var(--lm-d-info);
    border-radius: 16px;
    box-shadow: 0 1px 2px var(--lm-d-shadow);
    --tw-ring-shadow: 0 0 transparent;
    overflow: hidden;
}
.ps-page .fi-ta-header-toolbar { padding-block: 8px; padding-inline: 14px; gap: 8px; }
.ps-page .fi-ta-search-field { max-inline-size: 280px; }
.ps-page .fi-ta-header-cell { background: var(--lm-d-surface); color: var(--lm-d-ink); font-size: 13px; font-weight: 700; padding-block: 9px; padding-inline: 8px; white-space: nowrap; }
.ps-page .fi-ta-header-cell .fi-ta-header-cell-label { color: var(--lm-d-ink); }
.ps-page .fi-ta-cell { color: var(--lm-d-ink); }
.ps-page .fi-ta-text:not(.fi-inline) { padding-block: 7px; padding-inline: 8px; }
.ps-page .fi-ta-text-item, .ps-page .fi-ta-text-item-label { font-size: 13.5px; color: var(--lm-d-ink); }
.ps-page .fi-ta-text-description { font-size: 12px; color: var(--lm-d-muted); }
.ps-page .fi-ta-icon:not(.fi-inline) { padding-block: 7px; padding-inline: 8px; }
.ps-page .fi-ta-cell .fi-ta-col, .ps-page .fi-ta-selection-cell, .ps-page .fi-ta-actions-cell { padding-block: 0; }
.ps-page .fi-ta-selection-cell { padding-inline: 12px 6px; }
.ps-page .fi-ta-actions-cell { padding-inline: 6px 10px; }
.ps-page .fi-ta-row:hover > td { background: var(--lm-d-hover); }
.ps-page .fi-ta-row > td { border-color: var(--lm-d-divider); }
.ps-page .fi-ta-summary-row td, .ps-page .fi-ta-summary-header-cell { background: var(--lm-d-info-soft); color: var(--lm-d-ink); font-weight: 700; }
.ps-page .fi-ta-text-summary { padding-block: 4px; }
.ps-page .fi-ta-summary-row > td, .ps-page .fi-ta-summary-header-row > td { padding-block: 2px; }
.ps-page .fi-ta-text-summary-label { font-size: 12px; color: var(--lm-d-muted); }
.ps-page .fi-pagination { padding-block: 8px; padding-inline: 14px; }
.ps-page .fi-ta-empty-state { padding-block: 28px; }
/* a row's money and counts read as figures: tabular, bold */
.ps-page :is(.fi-ta-cell-price, .fi-ta-cell-meter-price, .fi-ta-cell-area, .fi-ta-cell-avg-meter-price) .fi-ta-text-item { font-weight: 700; font-variant-numeric: tabular-nums; }
.ps-page .fi-ta-cell-name .fi-ta-text-item { font-weight: 700; }
.ps-page .fi-badge { font-weight: 700; }

/* ── the record page (create / edit): dense sections ── */
.ps-doc-page .fi-sc-has-gap { gap: 12px; }
.ps-doc-page .fi-section {
    border-radius: 16px;
    background: var(--lm-d-surface);
    box-shadow: 0 1px 2px var(--lm-d-shadow);
    --tw-ring-color: var(--lm-d-border);
}
.ps-doc-page .fi-section-header { padding-block: 9px; padding-inline: 16px; }
.ps-doc-page .fi-section-header-heading { color: var(--lm-d-ink); font-size: 15px; font-weight: 700; }
.ps-doc-page .fi-section-header-description { font-size: 12.5px; color: var(--lm-d-muted); }
.ps-doc-page .fi-section-content { padding: 12px 16px; }
.ps-doc-page .fi-section-content .fi-sc-has-gap { gap: 10px 14px; }
.ps-doc-page .fi-section .fi-section { box-shadow: none; }
.ps-doc-page .fi-sc-flex { gap: 12px; }
.ps-doc-page .fi-fo-field { row-gap: 5px; }
.ps-doc-page .fi-fo-field-label-content { color: var(--lm-d-ink); font-weight: 600; font-size: 13px; }
.ps-doc-page .fi-sc-text { font-size: 12px; color: var(--lm-d-muted); }
.ps-doc-page .fi-fo-field-wrp-hint { font-size: 12px; }
/* the first section of the page carries the blue rule */
.ps-doc-page .fi-page-content > .fi-sc-form > .fi-sc > :first-child .fi-section:first-of-type,
.ps-doc-page .ps-ruled { border-block-start: 3px solid var(--lm-d-info); }

/* card repeaters (images, amenities, attributes): tight cards */
.ps-doc-page .fi-fo-repeater-item { border-radius: 12px; }
.ps-doc-page .fi-fo-repeater-item-header { padding-block: 6px; padding-inline: 12px; }
.ps-doc-page .fi-fo-repeater-item-content { padding: 10px 12px; }
.ps-doc-page .fi-fo-repeater-items { gap: 8px; }

/* table repeaters: one row per item, the head in navy, inputs compact */
.ps-doc-page .fi-fo-table-repeater > table { border-radius: 12px; }
.ps-doc-page .fi-fo-table-repeater th { background: var(--lm-d-chip-bg); color: var(--lm-d-ink); font-size: 12.5px; font-weight: 700; padding-block: 7px; white-space: nowrap; }
.ps-doc-page .fi-fo-table-repeater td { padding-block: 4px; vertical-align: middle; }
.ps-doc-page .fi-fo-table-repeater td .fi-input-wrp { min-block-size: 34px; }
.ps-doc-page .fi-fo-table-repeater td .fi-sc-text,
.ps-doc-page .fi-fo-table-repeater td .fi-in-entry { font-size: 12.5px; color: var(--lm-d-muted); line-height: 1.45; }
/* a long list (36 instalments, price logs) scrolls inside its card, not the page — only while it is a
   real table (the repeater turns into stacked cards below 36rem of its own width) */
@container (min-width: 36rem) {
    .ps-doc-page .fi-fo-table-repeater.ps-scroll > table { display: block; max-block-size: 440px; overflow-y: auto; }
    .ps-doc-page .fi-fo-table-repeater.ps-scroll > table > :is(thead, tbody) { display: table; inline-size: 100%; table-layout: fixed; }
    .ps-doc-page .fi-fo-table-repeater.ps-scroll > table > thead { position: sticky; inset-block-start: 0; z-index: 1; }
    /* head and body are laid out apart: equal data columns in both, the row's delete column fixed */
    .ps-doc-page .fi-fo-table-repeater.ps-scroll > table > :is(thead, tbody) > tr > :last-child:is(.fi-fo-table-repeater-empty-header-cell, :has(.fi-fo-table-repeater-actions)) { inline-size: 56px; }
}
/* narrow (a phone, or a side card): every row is a small card, two fields to a line, the delete at its foot */
@container (max-width: 35.99rem) {
    .ps-doc-page .fi-fo-table-repeater > table > tbody > tr { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 10px 12px; }
    .ps-doc-page .fi-fo-table-repeater > table > tbody > tr { position: relative; padding-inline-end: 44px; }
    /* six short fields (a plan's step) sit three to a line */
    .ps-doc-page .fi-fo-table-repeater > table > tbody > tr:has(> td:nth-of-type(6)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    /* the row's delete sits in its corner instead of a line of its own */
    .ps-doc-page .fi-fo-table-repeater > table > tbody > tr > td:last-child:has(.fi-fo-table-repeater-actions) { position: absolute; inset-block-start: 8px; inset-inline-end: 8px; }
    .ps-doc-page .fi-fo-table-repeater > table > tbody > tr > td:last-child .fi-fo-table-repeater-actions { flex-direction: column; gap: 10px; }
    /* the reorder handle of a sortable list (the floors) sits in the opposite corner */
    .ps-doc-page .fi-fo-table-repeater > table > tbody > tr > td:first-child:has(.fi-fo-table-repeater-actions) { position: absolute; inset-block-end: 10px; inset-inline-end: 8px; }
    .ps-doc-page .fi-fo-table-repeater > table > tbody > tr > td:has(.fi-fo-tags-input, .fi-in-entry, textarea) { grid-column: 1 / -1; }
    /* a row headed by its name (the default exclusions): the name and its switch share the first line */
    .ps-doc-page .fi-fo-table-repeater > table > tbody > tr > td:first-of-type:has(.fi-in-entry) { grid-column: auto; order: -2; font-weight: 700; color: var(--lm-d-ink); }
    .ps-doc-page .fi-fo-table-repeater > table > tbody > tr:has(> td:first-of-type .fi-in-entry) > td:has(.fi-fo-toggle) { order: -1; }
    .ps-doc-page .fi-fo-table-repeater .fi-fo-table-repeater-actions { justify-content: flex-end; }
    .ps-doc-page .fi-fo-table-repeater td .fi-fo-field { row-gap: 3px; }
    .ps-doc-page .fi-fo-table-repeater td .fi-fo-field-label-content { font-size: 12px; }
    /* a long plan (36 steps) or many logs still scroll inside the card, not the page */
    .ps-doc-page .fi-fo-table-repeater.ps-scroll > table > tbody { max-block-size: 70vh; overflow-y: auto; }
}

/* the relation managers under a record (attribute options) */
.ps-doc-page .fi-resource-relation-manager .fi-ta-ctn { border-block-start-width: 1px; }

/* ── under 1024px: the page scrolls, the table cards stack ── */
@media (max-width: 1023.98px) {
    .ps-page .fi-header-heading { font-size: 21px; }
    .ps-page .fi-ta-search-field { max-inline-size: none; }
}
/* ── a phone: a list row is a card — the main cell on top, «label · value» two to a line ── */
@media (max-width: 639.98px) {
    .ps-page .fi-header-actions-ctn .fi-btn { min-block-size: 44px; }
    .ps-page .fi-header { gap: 8px; }
    .ps-page .fi-header-heading { font-size: 20px; }
    .ps-doc-page .fi-section-content { padding: 10px 12px; }
    .ps-doc-page .fi-section-header { padding-inline: 12px; }
    /* a form section of several columns keeps two short fields to a line (one only for a long one) */
    .ps-doc-page .fi-section-content.fi-grid.lg\:fi-grid-cols { --cols-default: repeat(2, minmax(0, 1fr)) !important; }
    .ps-doc-page .fi-section-content.fi-grid.lg\:fi-grid-cols > .fi-grid-col:has(textarea, .fi-fo-file-upload, .fi-fo-repeater, .fi-fo-table-repeater, .fi-fo-tags-input, .fi-section, .fi-in-entry, .fi-input-wrp-prefix, .fi-input-wrp-suffix) { --col-span-default: 1 / -1 !important; }
    /* card repeaters (amenities, images): two cards to a line */
    .ps-doc-page .fi-fo-repeater-items.fi-grid.lg\:fi-grid-cols { --cols-default: repeat(2, minmax(0, 1fr)) !important; }

    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr:not(.fi-ta-group-header-row):not(.fi-ta-summary-row):not(.fi-ta-summary-header-row) {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2px 12px;
        padding: 10px 14px 10px 14px;
        padding-inline-end: 48px; /* room for the row's checkbox at the end */
    }
    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr > td { padding-inline: 0; min-inline-size: 0; }
    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr > td.fi-ta-cell {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        padding-block: 2px;
    }
    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr > td.fi-ta-cell > .fi-ta-cell-label { padding-block: 0; font-size: 12px; font-weight: 600; color: var(--lm-d-muted); white-space: nowrap; }
    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr > td.fi-ta-cell > .fi-ta-cell-content { min-inline-size: 0; text-align: end; }
    .ps-list-page .fi-ta-table-stacked-on-mobile .fi-ta-cell .fi-ta-text,
    .ps-list-page .fi-ta-table-stacked-on-mobile .fi-ta-cell .fi-ta-icon { padding: 0; }
    /* the row's own name reads as its title: full width, no label */
    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr > td.fi-ta-cell:is(.fi-ta-cell-name, .fi-ta-cell-project\.name, .fi-ta-cell-code) { grid-column: 1 / -1; display: block; padding-block-end: 4px; }
    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr > td.fi-ta-cell:is(.fi-ta-cell-name, .fi-ta-cell-project\.name, .fi-ta-cell-code) > .fi-ta-cell-label { display: none; }
    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr > td.fi-ta-cell:is(.fi-ta-cell-name, .fi-ta-cell-project\.name, .fi-ta-cell-code) > .fi-ta-cell-content { text-align: start; }
    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr > td.fi-ta-cell:is(.fi-ta-cell-name, .fi-ta-cell-project\.name, .fi-ta-cell-code) .fi-ta-text-item { font-size: 15px; font-weight: 700; }
    /* the row's actions sit at its foot, the checkbox at its end */
    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr > td.fi-ta-actions-cell { grid-column: 1 / -1; display: flex; justify-content: flex-end; padding-block: 2px 0; }
    .ps-list-page .fi-ta-table-stacked-on-mobile > tbody > tr > td.fi-ta-selection-cell { inset-block-start: 12px; inset-inline-end: 14px; }
    .ps-list-page .fi-ta-table-stacked-header-cell { padding-block: 8px; padding-inline: 14px; background: var(--lm-d-chip-bg); }
    /* the units' summary rows: one compact line each */
    .ps-list-page .fi-ta-table-stacked-on-mobile :is(.fi-ta-summary-row, .fi-ta-summary-header-row) > td { padding-block: 2px; padding-inline: 14px; }
    .ps-list-page .fi-pagination { padding-inline: 10px; }
}
