/* =============================================================================
   Bouillabaise — Custom Filament overrides                             v22
   =============================================================================

   HOW THIS FILE IS ORGANISED
   ──────────────────────────
   § 1  Global form density  — tighter gaps between fields + section content
   § 2  Flat-row repeater base  — shared styles for .fi-repeater-no-cards
                                   and .fi-repeater-labor-rows
   § 3  Line-Items column widths  — nth-child flex values for line items
   § 4  Labor-Hours column widths — nth-child flex values for labor hours
   § 5  Page actions              — bottom bar clean-up

   KEY SOURCE PATHS (Mac)
   ──────────────────────
   CSS:  projects/PM tool/unity-pm/public/css/unity-pm.css   ← this file
   PHP:  projects/PM tool/unity-pm/app/Filament/Resources/RcoResource.php
         projects/PM tool/unity-pm/app/Providers/Filament/AdminPanelProvider.php

   To push changes to the VM:
       bash "/media/psf/PM tool/unity-pm/sync.sh"
   ============================================================================= */


/* ── § 0  Layout width ───────────────────────────────────────────────────── */

/* Auth pages — constrain and centre the login/register card. */
.fi-simple-main-ctn {
    max-width: 28rem !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Main panel content — restore full-width after removing maxContentWidth('full').
   Covers the known class + container utility Tailwind's compiled CSS may add. */
.fi-main-ctn,
.fi-layout-container > main,
.fi-layout > main {
    max-width: 100% !important;
    width: 100% !important;
}


/* ── § 1  Global form density ────────────────────────────────────────────── */

/* Tighter grid gaps between fields */
.fi-fo-section-content > div,
.fi-fo-section-content .fi-fo-component-ctn > div.grid {
    gap:        0.2rem !important;
    column-gap: 0.5rem !important;
    row-gap:    0.2rem !important;
}

/* Section card inner padding — strip all layers */
.fi-section-content-ctn {
    padding: 0.25rem 1.2rem 1.2rem !important;
}

/* Labor rates grid — halve the row gap between journeyman/foreman/engineer rows */
.unity-labor-rates .fi-fo-section-content > div {
    row-gap: 0.1rem !important;
}
.fi-section-content {
    padding: 0 !important;
}
.fi-fo-section-content {
    padding: 0 !important;
}

/* Input field vertical padding */
.fi-input {
    padding-top:    0.15rem !important;
    padding-bottom: 0.15rem !important;
}

/* Label-to-input gap */
.fi-fo-field-wrp {
    gap:     0.1rem !important;
    row-gap: 0.1rem !important;
}

/* Field label margin */
.fi-fo-field-wrp > label {
    margin-bottom: 0 !important;
}

/* Section header */
.fi-section-header-ctn {
    padding-top:    0.25rem !important;
    padding-bottom: 0.25rem !important;
}

/* Between sections */
.fi-fo-section + .fi-fo-section,
.fi-section + .fi-section {
    margin-top: 0.35rem !important;
}

/* Select inputs */
.fi-select-input {
    padding-top:    0.15rem !important;
    padding-bottom: 0.15rem !important;
}

/* Textarea */
.fi-fo-field-wrp textarea {
    padding-top:    0.25rem !important;
    padding-bottom: 0.25rem !important;
}


/* ── § 2  Flat-row repeater base ─────────────────────────────────────────────
   Applied to .fi-repeater-no-cards (Line Items) and
              .fi-repeater-labor-rows (Labor Hours)
   ──────────────────────────────────────────────────────────────────────────── */

/* Sortable grid wrapper — Filament sets gap-4 here; collapse it to nothing */
.fi-fo-repeater.fi-repeater-no-cards [x-sortable],
.fi-fo-repeater.fi-repeater-labor-rows [x-sortable] {
    gap: 0 !important;
}

/* Row container — flex-row.
   JS (fixRepeaterLayout) physically moves handle+delete OUT of
   fi-fo-repeater-item-header and appends them as direct flex children of this
   item, so the CSS order values below actually take effect. */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item,
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item {
    display:        flex !important;
    flex-direction: row !important;
    align-items:    center !important;
    gap:            0 !important;
    padding:        0 0.25rem !important;
    border-radius:  0.2rem !important;
    background:     transparent !important;
    box-shadow:     none !important;
    --tw-ring-shadow: none !important;
    --tw-shadow:      none !important;
}

/* Collapse the (now-empty) Filament card header — it has been stripped of its
   handle and actions by JS, so we hide it to reclaim the space. */
.fi-repeater-no-cards .fi-fo-repeater-item-header,
.fi-repeater-labor-rows .fi-fo-repeater-item-header {
    flex:     0 0 0 !important;
    padding:  0 !important;
    overflow: hidden !important;
    gap:      0 !important;
}

/* Content — order:1, fills remaining space */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item .fi-fo-repeater-item-content,
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item .fi-fo-repeater-item-content {
    order: 1 !important;
}

/* Delete — order:2.  JS tags moved action roots with .unity-repeater-actions.
   Also keep the Filament class name as a fallback. */
.fi-repeater-no-cards .unity-repeater-actions,
.fi-repeater-labor-rows .unity-repeater-actions,
.fi-repeater-no-cards .fi-fo-repeater-item-actions,
.fi-repeater-labor-rows .fi-fo-repeater-item-actions {
    order:      2 !important;
    position:   static !important;
    flex:       0 0 2rem !important;
    align-self: center !important;
}

/* Drag handle — order:3, far right.
   JS also sets position:static via inline !important to beat Filament's
   position:absolute, bringing the handle into item's flex flow. */
.fi-repeater-no-cards [x-sortable-handle],
.fi-repeater-labor-rows [x-sortable-handle],
.fi-repeater-no-cards .fi-fo-repeater-item-reorder-handle,
.fi-repeater-labor-rows .fi-fo-repeater-item-reorder-handle {
    order:      3 !important;
    position:   static !important;
    flex:       0 0 1.5rem !important;
    align-self: center !important;
    opacity:    0.3;
    cursor:     grab;
}
.fi-repeater-no-cards .fi-fo-repeater-item:hover [x-sortable-handle],
.fi-repeater-labor-rows .fi-fo-repeater-item:hover [x-sortable-handle] {
    opacity: 0.7;
}

/* Nuclear: zero vertical space on every element inside a flat row.
   Two passes:
   (a) fi-fo-* class names — catches all Filament field wrappers by prefix.
   (b) Full descendant wildcard on each column cell — catches anything else
       regardless of class, going arbitrarily deep. */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item [class*="fi-fo-"],
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item [class*="fi-fo-"],
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item-content > div > div *,
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item-content > div > div * {
    padding-top:    0 !important;
    padding-bottom: 0 !important;
    margin-top:     0 !important;
    margin-bottom:  0 !important;
    min-height:     0 !important;
}

/* Content area fills the row item.
   Override Filament's p-4 (1rem each side) — that horizontal padding shifts the
   data grid inward and misaligns it with the label header row. */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item .fi-fo-repeater-item-content,
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item .fi-fo-repeater-item-content {
    flex:    1 !important;
    padding: 0 !important;
    min-width: 0 !important;
}
/* Keep Filament's own 9-col grid so col-span-N values on field wrappers still work.
   Override only gap, padding, and vertical alignment so rows stay compact. */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item .fi-fo-repeater-item-content > div {
    display:               grid !important;
    grid-template-columns: repeat(9, minmax(0, 1fr)) !important;
    align-items:           center !important;
    gap:                   0.35rem !important;
    padding:               0 !important;
}
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item .fi-fo-repeater-item-content > div {
    display:               grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    align-items:           center !important;
    gap:                   0.35rem !important;
    padding:               0 !important;
}


/* Text inputs — 1.5rem + 2px tall, 2px extra vertical padding */
.fi-fo-repeater.fi-repeater-no-cards input.fi-input,
.fi-fo-repeater.fi-repeater-labor-rows input.fi-input {
    min-height:     calc(1.5rem + 2px) !important;
    height:         calc(1.5rem + 2px) !important;
    padding-top:    calc(0.1rem + 2px) !important;
    padding-bottom: calc(0.1rem + 2px) !important;
    font-size:      0.825rem !important;
}
.fi-fo-repeater.fi-repeater-no-cards .fi-input-wrapper,
.fi-fo-repeater.fi-repeater-labor-rows .fi-input-wrapper {
    min-height: calc(1.5rem + 2px) !important;
}

/* Select elements — native <select> fallback */
.fi-fo-repeater.fi-repeater-no-cards select,
.fi-fo-repeater.fi-repeater-labor-rows select {
    min-height:     1.5rem !important;
    height:         1.5rem !important;
    padding-top:    0 !important;
    padding-bottom: 0 !important;
    line-height:    1.5rem !important;
    font-size:      0.825rem !important;
}
/* Filament custom Select component inside labor-rows repeater */
.fi-fo-repeater.fi-repeater-labor-rows .fi-select-input,
.fi-fo-repeater.fi-repeater-labor-rows [class*="fi-select"] button {
    min-height:     1.5rem !important;
    height:         1.5rem !important;
    padding-top:    0.05rem !important;
    padding-bottom: 0.05rem !important;
    font-size:      0.825rem !important;
}
.fi-fo-repeater.fi-repeater-labor-rows .fi-select-input > span,
.fi-fo-repeater.fi-repeater-labor-rows [class*="fi-select"] span {
    font-size: 0.825rem !important;
    line-height: 1.5rem !important;
}

/* No number spinners */
.fi-fo-repeater.fi-repeater-no-cards input[type=number]::-webkit-inner-spin-button,
.fi-fo-repeater.fi-repeater-no-cards input[type=number]::-webkit-outer-spin-button,
.fi-fo-repeater.fi-repeater-labor-rows input[type=number]::-webkit-inner-spin-button,
.fi-fo-repeater.fi-repeater-labor-rows input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}
.fi-fo-repeater.fi-repeater-no-cards input[type=number],
.fi-fo-repeater.fi-repeater-labor-rows input[type=number] {
    -moz-appearance: textfield !important;
}

/* Alternating row shading + 1px row gap */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-items-list,
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-items-list {
    gap:        0 !important;
    row-gap:    1px !important;
    margin-top: 0.1rem !important;
}
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item:nth-child(even),
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item:nth-child(even) {
    background: #f9fafb !important;
}
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item + .fi-fo-repeater-item,
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item + .fi-fo-repeater-item {
    border-top: 0.5px solid #f3f4f6 !important;
}


/* ── § 3  Line Items column widths (.fi-repeater-no-cards) ──────────────────
   nth-child order: # | qty | description | unit_mat | unit_lab | tot_mat | tot_lab
   ──────────────────────────────────────────────────────────────────────────── */

.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(1) { flex: 0 0 2.25rem; }    /* # */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(2) { flex: 0 0 3.5rem; }     /* qty */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(3) { flex: 3; min-width: 0; } /* description */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(4) { flex: 1; min-width: 0; } /* unit_mat */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(5) { flex: 1; min-width: 0; } /* unit_lab */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(6) { flex: 1; min-width: 0; } /* tot_mat */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(7) { flex: 1; min-width: 0; } /* tot_lab */

/* Right-align editable numerics */
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item-content > div > div:nth-child(2) input,
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item-content > div > div:nth-child(4) input,
.fi-fo-repeater.fi-repeater-no-cards .fi-fo-repeater-item-content > div > div:nth-child(5) input {
    text-align: right !important;
}

/* ── Read-only cells: item #, Mat Total, Labor Total ─────────────────────────
   Same nuclear chrome-strip as each other.  Item # is centred and lighter;
   totals are right-aligned and slightly darker (they carry meaningful values). */

/* Exclude .estimate-line-items — it has its own nth-child rules (offset +1) */
.fi-fo-repeater.fi-repeater-no-cards:not(.estimate-line-items) .fi-fo-repeater-item-content > div > div:nth-child(1),
.fi-fo-repeater.fi-repeater-no-cards:not(.estimate-line-items) .fi-fo-repeater-item-content > div > div:nth-child(1) *,
.fi-fo-repeater.fi-repeater-no-cards:not(.estimate-line-items) .fi-fo-repeater-item-content > div > div:nth-child(6),
.fi-fo-repeater.fi-repeater-no-cards:not(.estimate-line-items) .fi-fo-repeater-item-content > div > div:nth-child(6) *,
.fi-fo-repeater.fi-repeater-no-cards:not(.estimate-line-items) .fi-fo-repeater-item-content > div > div:nth-child(7),
.fi-fo-repeater.fi-repeater-no-cards:not(.estimate-line-items) .fi-fo-repeater-item-content > div > div:nth-child(7) * {
    background:              transparent !important;
    border:                  none !important;
    box-shadow:              none !important;
    --tw-ring-shadow:        0 0 #0000 !important;
    --tw-ring-offset-shadow: 0 0 #0000 !important;
    --tw-shadow:             0 0 #0000 !important;
    outline:                 none !important;
    pointer-events:          none !important;
}

/* Item # — centred, light gray */
.fi-fo-repeater.fi-repeater-no-cards:not(.estimate-line-items) .fi-fo-repeater-item-content > div > div:nth-child(1) input {
    text-align: center !important;
    color:      #9ca3af !important;   /* gray-400 */
    padding:    0 !important;
    cursor:     default !important;
    font-size:  0.825rem !important;
}

/* Totals — right-aligned, medium gray (darker than item #, lighter than editable) */
.fi-fo-repeater.fi-repeater-no-cards:not(.estimate-line-items) .fi-fo-repeater-item-content > div > div:nth-child(6) input,
.fi-fo-repeater.fi-repeater-no-cards:not(.estimate-line-items) .fi-fo-repeater-item-content > div > div:nth-child(7) input {
    text-align:   right !important;
    color:        #6b7280 !important;  /* gray-500 */
    padding-right: 0.25rem !important;
    font-size:    0.825rem !important;
}


/* ── § 4  Labor Hours column widths (.fi-repeater-labor-rows) ────────────────
   nth-child order: trade | rate_type | hours | rate | total
   ──────────────────────────────────────────────────────────────────────────── */

.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(1) { flex: 2; min-width: 0; } /* trade */
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(2) { flex: 1; min-width: 0; } /* rate_type */
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(3) { flex: 1; min-width: 0; } /* hours */
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(4) { flex: 1; min-width: 0; } /* rate */
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(5) { flex: 1; min-width: 0; } /* total */

/* Right-align editable numerics in labor hours */
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item-content > div > div:nth-child(3) input,
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item-content > div > div:nth-child(4) input {
    text-align: right !important;
}

/* Labor Total — same chrome-strip + medium gray as line-item totals */
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item-content > div > div:nth-child(5),
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item-content > div > div:nth-child(5) * {
    background:              transparent !important;
    border:                  none !important;
    box-shadow:              none !important;
    --tw-ring-shadow:        0 0 #0000 !important;
    --tw-ring-offset-shadow: 0 0 #0000 !important;
    --tw-shadow:             0 0 #0000 !important;
    outline:                 none !important;
    pointer-events:          none !important;
}
.fi-fo-repeater.fi-repeater-labor-rows .fi-fo-repeater-item-content > div > div:nth-child(5) input {
    text-align:    right !important;
    color:         #6b7280 !important;
    padding-right: 0.25rem !important;
    font-size:     0.825rem !important;
}


/* ── § 5  Cost Summary tightening ───────────────────────────────────────────
   Targets only the section tagged .cost-summary-section in RcoResource.php    */

/* Reduce vertical padding inside the card border */
.cost-summary-section .fi-section-content-ctn {
    padding-top:    0.1rem !important;
    padding-bottom: 0.1rem !important;
}

/* Halve the label-to-value gap inside each Placeholder.
   Filament wraps label + content in a flex-col container; gap defaults ~0.5rem. */
.cost-summary-section [class*="fi-fo-"] {
    gap:     0.25rem !important;
    row-gap: 0.25rem !important;
}

/* Also target the label element directly in case margin drives the spacing */
.cost-summary-section label {
    margin-bottom: 0 !important;
}


/* ── § 6  Dashboard nav buttons ─────────────────────────────────────────── */

/* Section heading — 3× the previous text-xs (12px → 36px) */
.unity-nav-section-label {
    font-size:   2.25rem;        /* 36px = 3× 12px */
    font-weight: 600;
    color:       #374151;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}
.dark .unity-nav-section-label {
    color: #e5e7eb;
}

/* HR between section label and buttons — 10px gap below */
.unity-nav-section-hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin-bottom: 10px;
}
.dark .unity-nav-section-hr {
    border-top-color: #374151;
}

.unity-dash-btn {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    gap:             0.6rem;
    width:           9rem;        /* fixed — ensures uniform width across all sections */
    height:          9rem;        /* fixed — ensures uniform height */
    padding:         0.75rem 0.5rem;
    border-radius:   0.75rem;
    border:          1px solid #e5e7eb;
    background:      #ffffff;
    color:           #374151;
    font-size:       1.3125rem;  /* 1.5× 0.875rem */
    font-weight:     500;
    text-align:      center;
    text-decoration: none;
    transition:      background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    box-sizing:      border-box;
}
.dark .unity-dash-btn {
    background:   #1f2937;
    border-color: #374151;
    color:        #e5e7eb;
}

.unity-dash-btn:hover {
    background:    #fffbeb;
    border-color:  #f59e0b;
    color:         #92400e;
    box-shadow:    0 2px 8px rgba(0,0,0,0.06);
}
.dark .unity-dash-btn:hover {
    background:   #292524;
    border-color: #d97706;
    color:        #fcd34d;
    box-shadow:   0 2px 8px rgba(0,0,0,0.3);
}

.unity-dash-icon {
    width:  2rem;
    height: 2rem;
    color:  #9ca3af;
    transition: color 0.15s;
}
.dark .unity-dash-icon {
    color: #6b7280;
}

.unity-dash-btn:hover .unity-dash-icon {
    color: #d97706;
}
.dark .unity-dash-btn:hover .unity-dash-icon {
    color: #fbbf24;
}


/* ── § 7  Compact tables (global — all list views) ──────────────────────────
   Filament 3 puts py-4 on .fi-ta-text (the innermost content div), not on
   fi-ta-col-wrp or the <td>. Selection + actions cells use plain divs.
   ──────────────────────────────────────────────────────────────────────────── */

/* Main text content div — this is where py-4 actually lives */
.fi-ta-text {
    padding-top:    4px !important;
    padding-bottom: 4px !important;
}

/* Selection cell checkbox div (no fi- class, direct child of td) */
.fi-ta-selection-cell > div {
    padding-top:    4px !important;
    padding-bottom: 4px !important;
}

/* Actions cell div */
.fi-ta-actions-cell > div {
    padding-top:    4px !important;
    padding-bottom: 4px !important;
}

/* Header cells */
.fi-ta-header-cell {
    padding-top:    6px !important;
    padding-bottom: 6px !important;
}

/* Cell font size */
.fi-ta-text,
.fi-ta-text * {
    font-size: 0.825rem !important;
}

/* Badge sizing */
.fi-badge {
    font-size:   0.75rem !important;
    padding:     2px 6px !important;
    line-height: 1.25 !important;
}

/* Alternating row shade */
.fi-ta-row:nth-child(even) {
    background: #f9fafb !important;
}
.dark .fi-ta-row:nth-child(even) {
    background: rgba(255,255,255,0.04) !important;
}

/* mailto links */
.fi-ta-text a[href^="mailto:"] {
    color:           inherit;
    text-decoration: none;
}
.fi-ta-text a[href^="mailto:"]:hover {
    text-decoration: underline;
    color:           #d97706;
}


/* ── § 8  Page actions ───────────────────────────────────────────────────── */

.fi-form-actions {
    justify-content: flex-end !important;
}

.fi-fo-section + .fi-fo-section {
    margin-top: 0 !important;
}


/* ── § 9  Material autocomplete dropdown ──────────────────────────────────── */

.unity-mat-dd {
    display:       none;
    position:      absolute;
    left:          0;
    right:         0;
    top:           100%;
    z-index:       100;
    background:    #fff;
    border:        1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow:    0 4px 6px -1px rgba(0,0,0,0.10), 0 2px 4px -1px rgba(0,0,0,0.06);
    max-height:    220px;
    overflow-y:    auto;
    margin-top:    2px;
}

.unity-mat-dd > div:last-child {
    border-bottom: none;
}


/* ── § 10  Estimate line items — nth-child offset (Hidden _item_id at child 1) ──
   The estimate items repeater has Hidden::make('_item_id') as first schema
   field, which renders a wrapper div and shifts every nth-child by +1 relative
   to the general .fi-repeater-no-cards rules above.
   .estimate-line-items class is set on EstimateResource's items repeater.
   ─────────────────────────────────────────────────────────────────────────── */

/* Hide the _item_id wrapper div (it's a grid cell but should be invisible) */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(1) {
    display: none !important;
}

/* Column widths — offset +1 from the general selectors */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(2) { flex: 0 0 2.25rem; }     /* # */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(3) { flex: 0 0 3.5rem; }      /* qty */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(4) { flex: 3; min-width: 0; }  /* description */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(5) { flex: 1; min-width: 0; }  /* unit_mat */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(6) { flex: 1; min-width: 0; }  /* unit_lab */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(7) { flex: 1; min-width: 0; }  /* tot_mat */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item .fi-fo-repeater-item-content > div > div:nth-child(8) { flex: 1; min-width: 0; }  /* tot_lab */

/* Read-only cells for estimates: item # (child 2), tot_mat (7), tot_lab (8) */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(2),
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(2) *,
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(7),
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(7) *,
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(8),
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(8) * {
    background:              transparent !important;
    border:                  none !important;
    box-shadow:              none !important;
    --tw-ring-shadow:        0 0 #0000 !important;
    --tw-ring-offset-shadow: 0 0 #0000 !important;
    --tw-shadow:             0 0 #0000 !important;
    outline:                 none !important;
    pointer-events:          none !important;
}

/* Item # — centred, light gray */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(2) input {
    text-align: center !important;
    color:      #9ca3af !important;
    padding:    0 !important;
    cursor:     default !important;
    font-size:  0.825rem !important;
}

/* Totals — right-aligned, medium gray */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(7) input,
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(8) input {
    text-align:    right !important;
    color:         #6b7280 !important;
    padding-right: 0.25rem !important;
    font-size:     0.825rem !important;
}

/* Right-align editable numerics in estimate rows: qty(3), unit_mat(5), unit_lab(6) */
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(3) input,
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(5) input,
.fi-fo-repeater.fi-repeater-no-cards.estimate-line-items .fi-fo-repeater-item-content > div > div:nth-child(6) input {
    text-align: right !important;
}


/* ── § 11  Brand logo — 90 % of navbar height ───────────────────────────────
   Markup: <a href="/"><img class="fi-logo …" style="height:Xrem"></a>
   The <img> elements carry .fi-logo directly (no wrapper div).
   Strategy: stretch the <a> to the full bar height, then set image to 90%.  */

/* Stretch the logo anchor to fill the flex topbar */
.fi-topbar a:has(> img.fi-logo) {
    align-self:  stretch !important;
    display:     flex    !important;
    align-items: center  !important;
}

/* 90% of the anchor height; beats the inline style="height:…" */
.fi-topbar img.fi-logo {
    height:     90%  !important;
    width:      auto !important;
    max-width:  10rem;
    object-fit: contain !important;
}

/* Tailwind's own dark:hidden / dark:flex rules handle light/dark switching. */


/* ── § 6  Project RCO inline list ───────────────────────────────────────── */

/* 6 columns: #, description, status, bill, submitted, edit-link */
.unity-rco-row {
    display:               grid;
    grid-template-columns: 3rem 1fr 7rem 6rem 7rem 3rem;
    gap:                   0 0.5rem;
    align-items:           center;
    padding:               0.375rem 0;
    font-size:             0.8125rem;  /* ~13px */
    border-bottom:         1px solid #f3f4f6;
}
.dark .unity-rco-row  { border-bottom-color: #1f2937; }

.unity-rco-row:last-child { border-bottom: none; }

.unity-rco-row:not(.unity-rco-header):hover {
    background: #f9fafb;
}
.dark .unity-rco-row:not(.unity-rco-header):hover {
    background: rgba(255,255,255,0.04);
}

.unity-rco-header {
    font-size:      0.68rem;
    font-weight:    600;
    color:          #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-bottom: 0.375rem;
    border-bottom:  2px solid #e5e7eb !important;
}
.dark .unity-rco-header { border-bottom-color: #374151 !important; color: #9ca3af; }

/* right-align the bill column */
.unity-rco-num { text-align: right; }


/* ── § 11  Light-variant upload wells ───────────────────────────────────────
   FilePond inherits the page background, which in dark mode is near-black.
   Light logo / favicon fields need a white well so the graphic is visible.
   The dark-mode variants intentionally do NOT get this treatment.           */

.unity-upload-light .filepond--panel-root {
    background-color: #ffffff !important;
    border-color:     #d1d5db !important;
}

/* Image preview strip also goes dark — keep it white */
.unity-upload-light .filepond--image-preview-wrapper,
.unity-upload-light .filepond--image-preview {
    background-color: #ffffff !important;
}

/* Drop label text should stay readable on the white background */
.unity-upload-light .filepond--drop-label label {
    color: #6b7280 !important;
}

/* ── § 12  Filament 4 — full-width layout ────────────────────────────────────
   Filament 4 applies max-w-7xl (1280px) to the panel content container by
   default. On wide monitors this constrains pages to ~50% viewport width.
   The selectors below cover the known Filament 4 layout class names.        */

.fi-main,
main.fi-main,
.fi-simple-main,
.fi-main-ctn,
.fi-layout-sidebar-nav-content,
.fi-body,
.fi-page,
.fi-page-content,
.fi-page-ctn { max-width: none !important; }

/* Ensure the dashboard widget grid doesn't add a second empty column
   that narrows visible content. Column-span utilities for the fi-wi wrappers. */
.col-span-full { grid-column: 1 / -1 !important; }
.col-span-1    { grid-column: span 1 / span 1 !important; }
.col-span-2    { grid-column: span 2 / span 2 !important; }
.col-span-3    { grid-column: span 3 / span 3 !important; }
.col-span-4    { grid-column: span 4 / span 4 !important; }


/* ── § 13  Filament 4 form schema: force single-column outer layout ──────────
   Filament 4 defaults to a 2-column grid at the form schema level.  All our
   forms are designed as single-column (sections stack vertically).  Adding
   ->columnSpanFull() per section is the correct fix per resource; this CSS
   rule is belt-and-suspenders in case any section is missed.                */

.fi-form > .fi-fo-schema {
    grid-template-columns: 1fr !important;
}


/* ── § 14  Missing Tailwind utilities (Filament 4 pre-compiled CSS) ──────────
   Filament 4 ships pre-compiled CSS containing only the classes it uses
   internally.  Our custom blade templates reference additional Tailwind
   utilities that are absent from Filament 4's bundle — they are defined here.
   ──────────────────────────────────────────────────────────────────────────── */

/* Display */
.flex         { display: flex; }
.inline-flex  { display: inline-flex; }
.inline-block { display: inline-block; }
.grid         { display: grid; }

/* Flex direction / wrap */
.flex-col  { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1    { flex: 1 1 0%; }
.shrink-0  { flex-shrink: 0; }

/* Alignment */
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }

/* Gap */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Grid columns */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Sizing */
.w-3\.5  { width:  0.875rem; }
.h-3\.5  { height: 0.875rem; }
.w-4     { width:  1rem; }
.h-4     { height: 1rem; }
.w-5     { width:  1.25rem; }
.h-5     { height: 1.25rem; }
.w-9     { width:  2.25rem; }
.h-9     { height: 2.25rem; }
.w-full  { width:  100%; }
.h-full  { height: 100%; }
.min-w-0 { min-width: 0; }

/* Overflow */
.overflow-hidden { overflow: hidden; }

/* Aspect + object */
.aspect-square  { aspect-ratio: 1 / 1; }
.object-cover   { object-fit: cover; }
.object-contain { object-fit: contain; }
.object-center  { object-position: center; }

/* Text helpers */
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-none { user-select: none; -webkit-user-select: none; }

/* Cursor */
.cursor-zoom-in { cursor: zoom-in; }
.cursor-pointer { cursor: pointer; }

/* Margin / Padding */
.mt-auto   { margin-top: auto; }
.mt-0\.5   { margin-top:    0.125rem; }
.mt-2      { margin-top:    0.5rem; }
.mb-4      { margin-bottom: 1rem; }
.px-1\.5   { padding-left: 0.375rem; padding-right: 0.375rem; }
.py-1      { padding-top:  0.25rem;  padding-bottom: 0.25rem; }

/* Position */
.fixed    { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.inset-0  { top: 0; right: 0; bottom: 0; left: 0; }
.top-4    { top:    1rem; }
.right-4  { right:  1rem; }
.bottom-0 { bottom: 0; }
.left-0   { left:   0; }

/* Z-index */
.z-10          { z-index: 10; }
.z-\[9999\]    { z-index: 9999; }

/* Border radius */
.rounded-full { border-radius: 9999px; }

/* Arbitrary JIT values used in photo lightbox */
.max-h-\[90vh\] { max-height: 90vh; }
.max-w-\[90vw\] { max-width:  90vw; }

/* Opacity-modified colors (lightbox close button) */
.bg-black\/60        { background-color: rgba(0, 0, 0, 0.6); }
.hover\:bg-black\/80:hover { background-color: rgba(0, 0, 0, 0.8); }
.border-white\/30    { border-color: rgba(255, 255, 255, 0.3); }
.text-white\/60      { color: rgba(255, 255, 255, 0.6); }

/* Line clamp */
.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* Transitions */
.transition-transform { transition-property: transform; transition-timing-function: cubic-bezier(0.4,0,0.2,1); transition-duration: 150ms; }
.transition-colors    { transition-property: color, background-color, border-color; transition-timing-function: cubic-bezier(0.4,0,0.2,1); transition-duration: 150ms; }
.duration-200         { transition-duration: 200ms; }
.hover\:scale-105:hover { transform: scale(1.05); }

/* Pointer events */
.pointer-events-none { pointer-events: none; }

/* ── Padding ─────────────────────────────────────────────────────────────────── */
.p-3     { padding: 0.75rem; }
.p-4     { padding: 1rem; }
.p-10    { padding: 2.5rem; }
.px-2    { padding-left: 0.5rem;  padding-right: 0.5rem; }
.px-3    { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4    { padding-left: 1rem;    padding-right: 1rem; }
.px-6    { padding-left: 1.5rem;  padding-right: 1.5rem; }
.py-2    { padding-top: 0.5rem;   padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3    { padding-top: 0.75rem;  padding-bottom: 0.75rem; }
.py-4    { padding-top: 1rem;     padding-bottom: 1rem; }

/* ── Additional widths ───────────────────────────────────────────────────────── */
.w-10  { width: 2.5rem; }
.w-16  { width: 4rem; }
.w-24  { width: 6rem; }
.w-28  { width: 7rem; }

/* ── Typography ──────────────────────────────────────────────────────────────── */
.text-xs  { font-size: 0.75rem;  line-height: 1rem; }
.text-sm  { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg  { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl  { font-size: 1.25rem;  line-height: 1.75rem; }
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
                 "Liberation Mono", "Courier New", monospace;
}
.italic          { font-style: italic; }
.uppercase       { text-transform: uppercase; }
.tracking-wide   { letter-spacing: 0.025em; }
.tracking-wider  { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.text-center { text-align: center; }

/* ── Text colors (light mode) ────────────────────────────────────────────────── */
.text-gray-100 { color: #f3f4f6; }
.text-gray-200 { color: #e5e7eb; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-white    { color: #ffffff; }
.hover\:text-amber-600:hover { color: #d97706; }

/* ── Borders ──────────────────────────────────────────────────────────────────── */
.border   { border-width: 1px; border-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-t { border-top-width:    1px; border-top-style:    solid; }
.border-l { border-left-width:   1px; border-left-style:   solid; }
.border-r { border-right-width:  1px; border-right-style:  solid; }
.border-gray-50  { border-color: #f9fafb; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-700 { border-color: #374151; }
.border-gray-800 { border-color: #1f2937; }

/* ── Backgrounds ─────────────────────────────────────────────────────────────── */
.bg-white    { background-color: #ffffff; }
.bg-gray-50  { background-color: #f9fafb; }
.bg-gray-800 { background-color: #1f2937; }
.bg-gray-900 { background-color: #111827; }
.bg-gray-50\/50  { background-color: rgba(249,250,251,0.5); }
.bg-gray-50\/80  { background-color: rgba(249,250,251,0.8); }
.bg-gray-800\/20 { background-color: rgba(31,41,55,0.2); }
.bg-gray-800\/50 { background-color: rgba(31,41,55,0.5); }

/* ── Border radius ───────────────────────────────────────────────────────────── */
.rounded    { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }

/* ── Shadow ──────────────────────────────────────────────────────────────────── */
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05); }

/* ── Dark-mode variants (Filament sets class="dark" on <html>) ───────────────── */
.dark .dark\:bg-gray-900     { background-color: #111827; }
.dark .dark\:bg-gray-800\/50 { background-color: rgba(31,41,55,0.5); }
.dark .dark\:bg-gray-800\/20 { background-color: rgba(31,41,55,0.2); }
.dark .dark\:text-gray-100   { color: #f3f4f6; }
.dark .dark\:text-gray-200   { color: #e5e7eb; }
.dark .dark\:text-gray-300   { color: #d1d5db; }
.dark .dark\:text-gray-400   { color: #9ca3af; }
.dark .dark\:border-gray-700 { border-color: #374151; }


/* ── § 16  Sections repeater — handle + delete inline with fields ────────── */

/* Strip padding from the _sect_act Placeholder field wrapper */
.fi-repeater-sections .fi-fo-field-wrp:has([data-sect-act]) {
    padding:    0 !important;
    gap:        0 !important;
    min-height: 0 !important;
}

/* Strip the inner placeholder content element */
.fi-repeater-sections .fi-fo-placeholder:has([data-sect-act]),
.fi-repeater-sections .fi-fo-placeholder-content:has([data-sect-act]) {
    padding: 0 !important;
    margin:  0 !important;
}

/* The slot span: flex container that holds the moved handle + actions */
.fi-repeater-sections [data-sect-act] {
    display:         flex !important;
    align-items:     flex-end !important;
    justify-content: flex-end !important;
    gap:             0.125rem !important;
    height:          100% !important;
    padding-bottom:  0.3rem !important;
}

/* Tidy up any now-empty actions area left in the header */
.fi-repeater-sections .fi-fo-repeater-item-header .fi-fo-repeater-item-actions:empty {
    display: none !important;
}
.dark .dark\:border-gray-800 { border-color: #1f2937; }
