/* =========================================
   MAIN BODY & V1.3 TOOLBAR
   ========================================= */
body {
    padding-bottom: 50px !important; /* Make room for the fixed footer */
}

/* =========================================
   NATURAL-FLOW LIST LAYOUT (Projects / CRM)
   The table is exactly as tall as the rows on the current page (rows-per-page
   drives the height), the pager sits directly under the last row, and the page
   itself scrolls when needed. The footer stays fixed at the very end of the
   page (body padding-bottom reserves its strip). */

/* Top bar (dash bar OR launcher bar — whichever is enabled) + the orange
   banner stay pinned at the top while the rows scroll beneath them. The
   wrapper is opaque (page background) so content disappears cleanly under the
   banner's rounded corners / side insets. Desktop only — mobile.css keeps its
   own scrolling layout. */
@media (min-width: 769px) {
    body.app-page .app-sticky-chrome {
        position: sticky;
        top: 0;
        z-index: 500;   /* above the table rows, below modals (1000+) */
        background: var(--bg-main);
    }
}

/* Inset "card" chrome on the list pages: the toolbar, table and pager sit inset
   from the screen edges (like the banner) with rounded corners — not a centered
   1600px column and not edge-to-edge. Explicit side margins (not `auto`) so each
   stretches to fill the width minus the inset instead of shrinking to its
   content width (the bug that left the toolbar narrow and centered). */
body.app-page .app-toolbar,
body.app-page .table-container,
body.app-page .pagination-controls {
    max-width: none;
    margin-left: 20px;
    margin-right: 20px;
    box-sizing: border-box;
}

/* Compact column-header padding. No sticky positioning and no shadow overlay —
   the first row must always be fully visible below the header. */
body.app-page #projectTable thead th {
    background-color: var(--card-bg);
    padding-top: 8px;
    padding-bottom: 8px;
}

/* Shorter pager. It sits in normal flow directly under the last project row. */
body.app-page .pagination-controls {
    padding-top: 9px;
    padding-bottom: 9px;
    margin-bottom: 20px;
}

body.app-page .app-toolbar     { padding-top: 12px; padding-bottom: 12px; }
body.app-page .table-container { margin-bottom: 8px; }

/* Denser project rows (smaller vertical cell padding); horizontal padding
   stays so column spacing is unchanged. */
body.app-page #projectTable td { padding-top: 6px; padding-bottom: 6px; }


.app-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: transparent; /* Blends with the body */
    gap: 20px;
    max-width: 1600px; 
    margin: 0 auto; /* Centers perfectly with your table */
}

.toolbar-btn {
    display: flex; 
    align-items: center; 
    gap: 8px; 
    border: 1px solid var(--input-border); 
    padding: 8px 15px; 
    border-radius: 8px; 
    background: var(--card-bg); 
    color: var(--text-main); 
    font-weight: 600;
    cursor: pointer;
    transition: background-color .1s ease, border-color .1s ease, color .1s ease, box-shadow .1s ease, opacity .1s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.toolbar-btn:hover {
    background: var(--row-border);
    border-color: var(--text-muted);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* The 3 Columns — split into thirds (33% / 34% / 33%).
   flex-basis:0 + proportional grow keeps the split exact regardless of the
   toolbar gap, so the section boundaries sit at ~1/3 and ~2/3 of the width. */
.toolbar-left, .toolbar-right {
    flex: 33 1 0;
    display: flex;
    align-items: center;
    min-width: 0;
}
.toolbar-left { justify-content: flex-start; }
.toolbar-right { justify-content: flex-end; }

.toolbar-center {
    flex: 34 1 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

/* 50% Width Search Bar */
.search-wrapper {
    width: 60%; /* Adjusted slightly for better monitor scaling */
    min-width: 300px;
    position: relative;
}

/* Adding 'input' makes this rule more specific than the generic text input rule */
input.search-box-new {
    width: 100%;
    /* Use !important to guarantee the padding doesn't get crushed */
    padding: 10px 15px 10px 40px !important; 
    border: 1px solid var(--input-border);
    border-radius: 20px; 
    background-color: var(--card-bg);
    color: var(--text-main);
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.search-box-new:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px var(--brand-light);
}

.search-icon-svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* =========================================
   TABLE & FILTER STYLES
   ========================================= */

   .table-container { 
    background-color: var(--card-bg); 
    border-radius: 12px; 
    padding: 20px; 
    margin: 0 auto 20px auto; 
    max-width: 1600px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
    overflow-x: auto; 
}

table { width: 100%; border-collapse: separate; border-spacing: 0 8px; table-layout: auto; }
th { text-align: left; padding: 0 10px 10px 10px; color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; border-bottom: 1px solid var(--row-border); white-space: normal; word-wrap: break-word; }

.header-content { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
/* Task Manager / Offers columns: centre the header label + filter button to match
   their centre-aligned cell content. */
#projectTable th.col-task, #projectTable th.col-time_spent, #projectTable th.col-estimate_time, #projectTable th.col-offers { text-align: center; }
#projectTable th.col-task .header-content, #projectTable th.col-time_spent .header-content, #projectTable th.col-estimate_time .header-content, #projectTable th.col-offers .header-content { justify-content: center; }
.header-filter-btn { background: transparent; border: none; cursor: pointer; color: var(--text-muted); padding: 2px; border-radius: 3px; display: flex; align-items: center; transition: background-color .1s ease, border-color .1s ease, color .1s ease, box-shadow .1s ease, opacity .1s ease; box-shadow: none; }
.header-filter-btn:hover { background-color: var(--row-border); box-shadow: none; transform: none;}
.header-filter-btn.active { color: var(--brand-primary); } 

.filter-popup { display: none; position: absolute; background: var(--card-bg); border: 1px solid var(--row-border); border-radius: 8px; padding: 15px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 1001; min-width: 200px; }
.filter-popup input[type="text"] { width: 100%; margin-bottom: 10px; padding: 6px; box-sizing: border-box; }
.filter-list { max-height: 150px; overflow-y: auto; margin-bottom: 10px; }
.filter-item { display: block; margin-bottom: 5px; font-size: 13px; cursor: pointer; }
.filter-actions { display: flex; justify-content: space-between; gap: 5px;}

tbody tr { background-color: var(--row-bg); box-shadow: 0 1px 3px rgba(0,0,0,0.1); transition: background-color .1s ease, border-color .1s ease, color .1s ease, box-shadow .1s ease, opacity .1s ease; cursor: pointer; }
tbody tr:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.14); background-color: var(--row-hover); }   /* no lift: a list that jumps under the cursor reads as jittery */
td { padding: 10px; vertical-align: middle; font-size: 12px; border-top: 1px solid var(--row-border); border-bottom: 1px solid var(--row-border); white-space: normal; word-break: break-word; }
td:first-child { border-left: 1px solid var(--row-border); border-radius: 8px 0 0 8px; font-weight: 600; padding-left: 15px;}
td:last-child { border-right: 1px solid var(--row-border); border-radius: 0 8px 8px 0; padding-right: 15px;}

/* Badges */
.grade-badge { padding: 4px 8px; border-radius: 4px; font-weight: bold; color: var(--color-white); display: inline-block; text-align: center; min-width: 25px; font-size: 12px; }
.grade-s { background-color: var(--color-yellow); color: var(--color-black); } 
.grade-a { background-color: var(--color-green); } 
.grade-b { background-color: var(--color-blue); } 
.grade-c { background-color: var(--color-gray); } 
.grade-d { background-color: var(--color-red); }

.action-group { display: flex; justify-content: center; align-items: center; gap: 8px; }
/* Dynamic notification badges (💬/📄/💰) sit on the same vertical center as the
   .icon-btn action icons instead of stretching to the row top. */
.action-group .proj-notif-badges { display: inline-flex; align-items: center; gap: 2px; }

/* =========================================
   PAGINATION STYLES
   ========================================= */
.pagination-controls { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin: 0 auto 40px auto; 
    padding: 15px 20px; 
    background-color: var(--card-bg); 
    border-radius: 12px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
    max-width: 1600px; 
    font-size: 14px; 
}

/* Container forces the text and dropdown onto the exact same line */
.rows-per-page {
    display: flex;
    align-items: center; /* Vertically centers the text with the box */
    gap: 10px; /* Adds perfect spacing between text and dropdown */
}

/* Ensure the label NEVER wraps to a new line */
.rows-per-page label {
    margin: 0; 
    display: inline-block; 
    color: var(--text-muted); 
    font-weight: 600;
    white-space: nowrap; /* <--- ADD THIS */
}

.rows-per-page select { 
    padding: 6px 10px; 
    border: 1px solid var(--input-border); 
    border-radius: 6px; 
    background-color: var(--input-bg); 
    color: var(--text-main); 
    font-family: 'Inter', sans-serif; 
    outline: none; 
    cursor: pointer;
    width: auto !important; /* <--- ADD THIS: Overrides the global 100% width */
}

.page-navigation { display: flex; align-items: center; gap: 15px; }
.page-navigation span { font-weight: 600; color: var(--text-muted); }
/* The same bar under every paged list in the modules (UmxUtil.pager): it sits in
   the module's own column, not centred at 1600px like the projects page. */
.pagination-controls.umx-pager { max-width: none; margin: 12px 0 0; padding: 9px 20px; flex-wrap: wrap; gap: 10px; }
.pagination-controls button:disabled { opacity: .4; cursor: default; }

/* =========================================
   MODAL STYLES & FORMS
   ========================================= */
.modal { 
    display: none; 
    position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.6); backdrop-filter: blur(4px); 
    align-items: center; justify-content: center; 
}

.modal-content { 
    background-color: var(--card-bg); padding: 20px 30px; border-radius: 12px; 
    width: 90%; max-width: 600px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); 
    max-height: 85vh; overflow-y: auto; margin: 0; 
}

.modal-content.project-modal {
    max-width: 600px;
    min-height: min(650px, 85vh);
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Short screens — a 14" laptop is usually ~620-750 CSS px of viewport once the
   browser's own chrome is taken out. The project modal asked for 650px of height
   on top of 85vh, so it filled the screen and the Save row sat below the fold.
   Here it gives up its minimum height, takes a little more of the viewport and
   loses some padding; the body scrolls and the sticky action row stays put. */
@media (max-height: 800px) {
    .modal-content { max-height: 92vh; padding: 14px 22px; }
    .modal-content.project-modal { min-height: 0; }
    .modal-content .modal-actions {
        bottom: -14px;
        margin: 0 -22px -14px;
        padding: 10px 22px 14px;
    }
}

/* Ensures all sliding panes share a uniform height to prevent the modal from
   collapsing — never taller than the room above the footer. */
.pane-content {
    min-height: min(620px, calc(100vh - 200px));
}

.modal-content.project-modal.expanded {
    max-width: 1100px;
}

.modal-body-split {
    display: flex;
    gap: 20px;
}

.modal-left {
    flex: 1.2; /* Adjusted for wider right pane */
    min-width: 0;
}

.modal-right {
    flex: 1.5; /* Takes up more layout for two-column workers */
    display: none;
    flex-direction: column;
    gap: 15px;
    border-left: 1px solid var(--row-border);
    padding-left: 20px;
    opacity: 0;
}

.modal-content.project-modal.expanded .modal-right {
    display: flex;
    animation: fadeInPane 0.3s forwards 0.2s; /* Delays fade-in slightly so modal expands first */
}

@keyframes fadeInPane {
    to { opacity: 1; }
}

/* Custom Invisible-until-hover Scrollbar for the Modal */
.modal-content::-webkit-scrollbar {
    width: 6px; /* Very thin */
}

.modal-content::-webkit-scrollbar-track {
    background: transparent; 
}

.modal-content::-webkit-scrollbar-thumb {
    background: transparent; /* Invisible by default */
    border-radius: 10px;
    transition: background 0.3s ease;
}

/* ONLY show the scrollbar when the mouse is hovering over the modal */
.modal-content:hover::-webkit-scrollbar-thumb {
    background: var(--text-muted, rgba(150, 150, 150, 0.5)); 
}

/* Laptops / smaller non-mobile screens (≈13–15", e.g. 1366–1536px): reclaim the
   side insets and compress the columns so the projects/CRM table uses the FULL
   screen width and fits without a horizontal scroll (scale-to-fit). */
@media (min-width: 801px) and (max-width: 1536px) {
    body.app-page .app-toolbar,
    body.app-page .table-container,
    body.app-page .pagination-controls {
        margin-left: 8px;
        margin-right: 8px;
    }
    body.app-page .table-container { padding-left: 10px; padding-right: 10px; }
    /* Fixed layout shares the width across columns so the whole table FITS (no overflow
       past the right edge). Distortion is prevented below: avatars are flex-shrink:0
       (global rule) and the actions column gets a pinned width so it can't be starved. */
    body.app-page .table-container table { table-layout: fixed; width: 100%; border-spacing: 0 3px; }
    /* Shorter rows (less vertical padding + tighter row gap) → more rows on screen. */
    body.app-page .table-container th,
    body.app-page .table-container td { font-size: 11px; padding: 4px 6px; overflow: hidden; text-overflow: ellipsis; }
    /* Pin the actions column so fixed layout can't squeeze the delete button off-screen. */
    body.app-page .table-container th.col-actions,
    body.app-page .table-container td.col-actions { width: 96px; padding-right: 8px; overflow: visible; }
    body.app-page .table-container .action-group { gap: 2px; flex-wrap: nowrap; justify-content: flex-end; }
    body.app-page .table-container .icon-btn { padding: 2px; font-size: 13px; }
    /* Slightly smaller avatars so several overlapping bubbles fit the narrower cell. */
    body.app-page .table-container .sales-bubble { width: 24px; height: 24px; font-size: 10px; border-width: 1px; }
}

/* Responsive handling for smaller laptop screens */
/* Device-gated, not width-gated: this block used to be a phone-width
   media query. See html.umx-mobile at the top of mobile.css. */
html.umx-mobile .modal-body-split{ flex-direction: column; }
html.umx-mobile .modal-right{ 
    border-left: none; 
    border-top: 1px solid var(--row-border); 
    padding-left: 0; 
    padding-top: 20px; 
}

.modal-header { font-size: 18px; font-weight: bold; margin-bottom: 15px; border-bottom: 1px solid var(--row-border); padding-bottom: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 15px; margin-bottom: 15px; }
.form-group label { display: block; font-size: 11px; font-weight: 600; margin-bottom: 4px; color: var(--text-muted); text-transform: uppercase; }

input[type="text"], input[type="date"], input[type="number"], input[type="email"], input[type="password"], select, textarea { 
    width: 100%; padding: 8px; border: 1px solid var(--input-border); border-radius: 6px; 
    background-color: var(--input-bg); color: var(--text-main); font-family: inherit; box-sizing: border-box; 
}

textarea { height: 60px; }

/* One-row filter / tool bar. The rule above makes every field 100% wide, which is
   right inside a form but turns a wrapping row of filters into a STACK — one field
   per line (the /quotes list spent 60% of the screen on its filters). Inside a
   filter bar each control takes its natural width; give the search box `flex:1`. */
.umx-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.umx-filterbar input:not([type=checkbox]):not([type=radio]), .umx-filterbar select { width: auto; flex: 0 1 auto; min-width: 0; padding: 7px 10px; font-size: 13px; }
.umx-filterbar select { max-width: 170px; text-overflow: ellipsis; }
.umx-filterbar input[type="number"] { width: 80px; }
.umx-filterbar .umx-fb-grow { flex: 1 1 200px; min-width: 180px; }
.umx-filterbar .umx-fb-group { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.umx-filterbar .umx-fb-push { margin-left: auto; }

.readonly-input { background-color: var(--row-bg) !important; color: var(--text-muted); cursor: not-allowed; }
.split-input { display: flex; gap: 10px; width: 100%; } 
.split-input select { width: 50%; }
.modal-actions { text-align: right; border-top: 1px solid var(--row-border); padding-top: 15px; display: flex; justify-content: flex-end; gap: 10px;}

/* Save must never be the thing that scrolled off. The modal body scrolls inside
   .modal-content, and on a short screen the action row went under the fold with
   nothing to suggest it was there. Sticking it to the bottom of the scroll box
   keeps it on screen at any height; the negative margins + background let it sit
   flush over the content it covers rather than floating in a gap. */
.modal-content .modal-actions {
    position: sticky;
    bottom: -20px;                        /* cancels .modal-content's 20px bottom padding */
    background: var(--card-bg);
    margin: 0 -30px -20px;                /* bleed to the padded edges */
    padding: 15px 30px 20px;
    z-index: 2;
}

/* =========================================
   USER SETTINGS SIDE PANEL
   ========================================= */
.us-section { margin-top: 0; }
.us-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--row-border);
}

/* =========================================
   STATUS BADGES & LINKS
   ========================================= */
.status-badge { 
    padding: 4px 12px; 
    border-radius: 12px; 
    font-weight: bold; 
    color: var(--color-white); 
    display: inline-block; 
    text-align: center; 
    font-size: 11px; 
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
/* Table status badges stay on ONE line (ellipsis + full text in the tooltip). */
.status-badge-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    box-sizing: border-box;
    vertical-align: middle;
}
.status-won        { background-color: #22c55e; }
.status-lost       { background-color: #ef4444; }
.status-canceled   { background-color: #6b7280; }
.status-active     { background-color: #3b82f6; }
.status-revision   { background-color: #a855f7; }
.status-unassigned { background-color: #9ca3af; }
.status-updated    { background-color: var(--color-purple); }
.status-deleted    { background-color: var(--color-red); }

.client-link { 
    color: var(--color-blue); 
    cursor: pointer; 
    font-weight: 600; 
    transition: background-color .1s ease, border-color .1s ease, color .1s ease, box-shadow .1s ease, opacity .1s ease; 
}
.client-link:hover { 
    color: var(--color-blue-hover); 
    text-decoration: underline; 
}

/* =========================================
   DUE DATE COUNTDOWNS (BUBBLE BADGES)
   ========================================= */
.due-badge { 
    padding: 4px 10px; 
    border-radius: 12px; 
    font-size: 11px; 
    font-weight: 600; 
    display: inline-block; 
    text-align: center; 
    white-space: nowrap; 
}
.due-safe { background-color: var(--color-gray); color: var(--color-white); } 
.due-warning { background-color: var(--brand-primary); color: var(--color-white); } 
.due-danger { background-color: var(--color-red); color: var(--color-white); } 
.due-overdue { background-color: var(--color-red-dark); color: var(--color-white); } 

/* =========================================
   SALES INITIAL CIRCLES
   ========================================= */
.sales-bubble {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;          /* never let a narrow (fixed-layout) cell squeeze it into an ellipse */
    box-sizing: border-box;
    display: flex;
    align-items: center; 
    justify-content: center; 
    font-size: 13px; 
    font-weight: 700; 
    color: var(--color-white); 
    border: 2px solid var(--row-bg); 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    text-transform: uppercase; 
}

/* =========================================
   UTILITIES & EXTRACTED INLINE STYLES
   ========================================= */
.flex-1 { flex: 1; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mt-30 { margin-top: 30px; }
.ml-10 { margin-left: 10px; }
.full-width { width: 100%; }
.full-height { height: 100%; }
.d-none { display: none !important; }
.capitalize { text-transform: capitalize; }
.border-bottom { border-bottom: 1px solid var(--row-border); }
.w-1400 { max-width: 1400px; }
.w-180 { width: 180px; }
.w-200 { width: 200px; }
.w-100 { width: 100px; }
.w-120 { width: 120px; }
.w-130 { width: 130px; }
.w-150 { width: 150px; }
.text-right { text-align: right; }

/* Modal Layouts */
/* Rows: 1 = the UmxWin title bar (full width, the window's top) · 2 = the pane
   tabs under the bar · 3 = pane content.
   The window must END above the app footer (fixed, 40px): it used to start 5vh
   down and let its content grow to 85vh, so Save sat under the footer. Now the
   whole window is capped at the viewport minus the footer and a 16px margin top
   and bottom, and the content row (minmax(0,1fr)) takes what is left and
   scrolls inside itself. */
.modal-wrapper { position: relative; display: grid; grid-template-columns: repeat(5, max-content) 1fr; grid-template-rows: auto 40px minmax(0, 1fr); justify-content: start; width: max-content; max-width: 95vw; max-height: calc(100vh - 40px - 32px); pointer-events: none; margin: 16px auto auto auto; gap: 0; }

/* The OS-style title bar (built by UmxWin) is the TOP row of the whole modal —
   "📁 Project | Details" left, ◧ ◨ ⛶ ─ × right. */
.modal-wrapper > .umx-win-titlebar {
    grid-row: 1; grid-column: 1 / -1;
    pointer-events: auto; z-index: 11;
    border: 1px solid var(--row-border);   /* bottom border = the bar/tabs divider */
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -6px 18px rgba(0,0,0,0.15);
}

/* Filler strip behind the tab row: paints the area beside the tabs so it reads
   as part of the window (and a click there doesn't fall through to the page).
   Its bottom border is the line the active tab's underline sits on. */
.modal-wrapper::before {
    content: '';
    grid-row: 2; grid-column: 1 / -1;
    background: var(--card-bg);
    border-left: 1px solid var(--row-border);
    border-right: 1px solid var(--row-border);
    border-bottom: 1px solid var(--row-border);
    pointer-events: auto;
    z-index: 0;
}
.modal-header-flex { display: flex; justify-content: space-between; align-items: center; }
.modal-header-left { display: flex; align-items: center; gap: 15px; flex: 1; }
.modal-title-wrapper { flex: 1; position: relative; margin-right: 20px; max-width: 600px; }
.form-row { display: flex; gap: 15px; margin-bottom: 15px; }
.action-dropdown-menu { top: 100%; right: 0; margin-top: 5px; min-width: 220px; z-index: 9999; }
.modal-z-high { z-index: 1005; }

/* Book Pane Animations & Layouts */
.book-pane { display: contents !important; }
.book-pane[style*="display: none"], .book-pane[style*="display:none"] { display: none !important; }

/* Flat tabs with an underline — the same tabs as every other app (CRM, Team,
   Task Manager). They used to be 130px upside-down folder tabs with 20px emoji
   in capitals, the one window that looked like nothing else. */
.pane-tab { grid-row: 2; width: auto; height: 40px; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; font-weight: 600; font-size: 13px; letter-spacing: 0; color: var(--text-muted); user-select: none; cursor: pointer; pointer-events: auto; background: transparent; border: none; border-bottom: 2px solid transparent; border-radius: 0; transition: color 0.1s, border-color 0.1s; white-space: nowrap; overflow: hidden; z-index: 1; margin-top: 0; box-sizing: border-box; }

/* EXPLICIT column per tab. Auto-placement would push the tabs into implicit
   columns past the modal's right edge, because the ::before filler strip
   already spans every column of the tab row. */
#modalCenter .pane-tab { grid-column: 1; }
#modalRightPane .pane-tab { grid-column: 2; }
#modalFarLeft .pane-tab { grid-column: 3; }
#modalOffersPane .pane-tab { grid-column: 4; }   /* crm/team pages only — never coexists with Notes/Tasks */
#modalNotesPane .pane-tab { grid-column: 4; }
#modalTasksPane .pane-tab { grid-column: 5; }

.book-pane:not(.active) .pane-tab:hover { color: var(--text-main); }
.book-pane.active .pane-tab { color: var(--brand-primary); border-bottom-color: var(--brand-primary); z-index: 11; }

/* Modules name tabs in any case ("DETAILS", "Offers") — show them all as "Details". */
.pane-tab-text { writing-mode: horizontal-tb; transform: none !important; text-transform: lowercase; display: inline-block; }
.pane-tab-text::first-letter { text-transform: uppercase; }
.pane-tab-icon { font-size: 15px; }

/* width:auto + grid-column 1/-1 lets the content stretch to the FULL tab row, so
   the modal is never narrower than its tabs; min-width keeps a sensible floor. */
.pane-content { grid-row: 3; grid-column: 1 / -1; background: var(--card-bg); border: 1px solid var(--row-border); border-top: none; border-radius: 0 0 12px 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); width: auto; min-width: 640px; height: 100%; min-height: 0; padding: 18px 24px; display: none !important; flex-direction: column; overflow-y: auto; max-height: none; pointer-events: auto; z-index: 10; box-sizing: border-box; }
.book-pane.active .pane-content { display: flex !important; }
.book-pane.active.expanded .pane-content { width: auto; min-width: 1100px; }

/* The tab row's trailing space (beside the last tab) is painted by the
   .modal-wrapper::before filler strip above, so the whole row reads as part of
   the window under the title bar. */

/* Hide the blank forehead on the project modal since tabs serve as headers now */
.book-pane .modal-header, .book-pane .modal-header-flex { display: none !important; }

/* Inputs and Alerts */
.project-name-input { font-size: 20px; font-weight: 700; border: 1px solid transparent; background: transparent; color: var(--text-main); outline: none; width: 100%; padding: 4px 8px; border-radius: 6px; transition: background-color .1s ease, border-color .1s ease, color .1s ease, box-shadow .1s ease, opacity .1s ease; box-sizing: border-box; }
.project-name-input:focus { background-color: var(--input-bg); border-color: var(--brand-primary); }
.name-warning { color: var(--color-red); font-size: 12px; position: absolute; top: 100%; left: 8px; margin-top: 2px; }

/* Right Pane & Empty States */
.right-pane-wrapper { flex: 1; display: flex; flex-direction: column; }
.pane-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pane-section-header h4 { margin: 0; color: var(--text-main); font-size: 14px; }
.target-sections-container { display: flex; flex-direction: column; gap: 15px; overflow-y: auto; padding-right: 5px; }
.target-section { background: var(--bg-main); border: 1px solid var(--row-border); border-radius: 8px; padding: 12px; }
.target-section-title { font-size: 11px; font-weight: bold; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; }
.quotes-container { display: flex; gap: 10px; flex-wrap: wrap; }
.quote-add-box { width: 75px; height: 75px; background: var(--input-bg); border: 1px dashed var(--input-border); border-radius: 8px; display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; color: var(--text-muted); transition: background-color .1s ease, border-color .1s ease, color .1s ease, box-shadow .1s ease, opacity .1s ease; }
.quote-add-box:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.icon-plus { font-size: 24px; line-height: 1; }
.text-new { font-size: 10px; margin-top: 4px; font-weight: 600; text-align: center; }
.empty-state-box { flex: 1; border: 2px dashed var(--input-border); border-radius: 8px; background: var(--input-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); min-height: 150px; margin-bottom: 10px; }
.empty-state-title { font-weight: 600; font-size: 14px; }
.empty-state-subtitle { font-size: 11px; }

/* Offer Maker Modal */
.offer-maker-modal { max-width: 95vw !important; width: 1400px; height: 90vh; max-height: 90vh !important; display: flex; flex-direction: column; padding: 0 !important; overflow: hidden !important; }
.offer-header-bar { display: flex; justify-content: space-between; align-items: center; padding: 20px 30px; border-bottom: 1px solid var(--row-border); background: var(--row-bg); border-radius: 12px 12px 0 0; }
.offer-body { flex: 1; padding: 20px 30px; overflow-y: auto; background: var(--card-bg); }
.offer-footer { padding: 15px 30px; border-top: 1px solid var(--row-border); background: var(--row-bg); border-radius: 0 0 12px 12px; display: flex; justify-content: space-between; align-items: center; }

/* Interactive EAN Table */
.offer-table { width: 100%; border-collapse: collapse; margin-top: 10px; min-width: 0; }
.offer-table th { background: var(--row-bg); color: var(--text-muted); font-size: 11px; text-transform: uppercase; padding: 10px; border-bottom: 2px solid var(--row-border); }
.offer-table td { padding: 8px; border-bottom: 1px solid var(--row-border); vertical-align: middle; white-space: normal; }
.offer-table input { width: 100%; padding: 8px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--input-bg); color: var(--text-main); font-size: 13px; box-sizing: border-box; }
.offer-table input:focus { border-color: var(--brand-primary); outline: none; }
.offer-table input.readonly { background: transparent; border-color: transparent; font-weight: bold; padding: 0; }
.offer-table .total-cell { font-weight: bold; font-size: 14px; text-align: right; }

.btn-danger-icon { background: var(--color-red); color: white; border: none; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-weight: bold; display: flex; align-items: center; justify-content: center; }

/* Quote Modal */
.quote-modal-content { max-width: 500px; padding: 20px; }
.quote-modal-header { font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.col-span-all { grid-column: 1 / -1; }
.textarea-resizable { width: 100%; height: 80px; resize: vertical; }

/* Buttons extracted from inline */
.btn-gray { background: transparent; padding: 8px 15px; border-radius: 6px; border: 1px solid var(--text-muted); cursor: pointer; font-weight: bold; color: var(--text-muted); transition: background-color .1s ease, border-color .1s ease, color .1s ease, box-shadow .1s ease, opacity .1s ease; box-shadow: none; }
.btn-gray:hover { background: var(--row-hover); color: var(--text-main); border-color: var(--text-main); }
.btn-primary-solid { background: var(--brand-primary); padding: 8px 24px; border-radius: 6px; border: none; cursor: pointer; font-weight: bold; color: white; transition: background-color .1s ease, border-color .1s ease, color .1s ease, box-shadow .1s ease, opacity .1s ease; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.btn-primary-solid:hover { background: var(--brand-hover); box-shadow: 0 2px 5px rgba(0,0,0,0.15); }
.btn-primary-icon { background: var(--brand-primary); color: white; border: none; padding: 6px 12px; border-radius: 6px; font-weight: bold; cursor: pointer; gap: 5px; align-items: center; transition: background-color .1s ease, border-color .1s ease, color .1s ease, box-shadow .1s ease, opacity .1s ease; }
.btn-primary-icon:hover { filter: brightness(1.1); }

/* Logs Table extracted from inline */
.log-time { color: var(--text-muted); font-size: 12px; font-weight: 500; font-family: monospace; }
.log-user { font-weight: 600; color: var(--color-blue); }
.log-target { font-size: 12px; font-weight: bold; text-transform: uppercase; color: var(--text-muted); }
.log-empty { text-align: center; padding: 30px; color: var(--text-muted); font-size: 14px; }

/* =========================================
   APP DRAWER (SETTINGS)
   ========================================= */
.app-drawer-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 32px;
    padding: 32px 20px;
}

.drawer-category-group {
    flex: 0 0 auto;
    min-width: 160px;
}

.drawer-cat-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--row-border);
}

.drawer-cat-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width: 600px) {
    .app-drawer-grid {
        gap: 20px;
        padding: 20px 12px;
    }
}

.app-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 12px;
}

.app-icon-btn:hover {
    transform: scale(1.08);
}

.app-icon-square {
    width: 72px;
    height: 72px;
    background: var(--card-bg);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid var(--row-border);
    color: var(--brand-primary);
}

.app-icon-label {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

/* =========================================
   APP FOOTER
   ========================================= */
/* Short word beside each footer icon — where there is room for it. */
.ft-lbl { display: none; font-size: 11px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
@media (min-width: 1200px) { .ft-lbl { display: inline; } }
html.umx-mobile .ft-lbl { display: none !important; }
#app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background-color: var(--card-bg);
    border-top: 1px solid var(--row-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    /* Stay pinned and visible even when modals are open: above content modals
       (offer maker ~2000, generic ~3000) but below the footer's OWN popups so
       those still open on top of it (approvals 4000, trash 5500, modules 9000). */
    z-index: 3500;
    font-size: 12px;
    color: var(--text-muted);
}
.footer-left { font-weight: 600; letter-spacing: 0.5px; }
.footer-right { display: flex; align-items: center; gap: 10px; height: 100%; }
.footer-center { scrollbar-width: none; }
.footer-center::-webkit-scrollbar { display: none; }

.chat-window { bottom: 50px !important; }
/* ── Project details: read until Edit (2026-10-29) ─────────────────────────
   A saved project opens READ-ONLY, like a CRM client: the fields show as plain
   text (inert — nothing can be typed or picked) and the footer offers Edit.
   Edit turns them back into inputs with Cancel + Save; a new project opens in
   edit mode. Required fields carry a * while editing; a missing one turns red. */
#projectFormGrid.pm-view input, #projectFormGrid.pm-view select, #projectFormGrid.pm-view textarea { background: transparent !important; border-color: transparent !important; padding-left: 0 !important; -webkit-appearance: none; appearance: none; color: var(--text-main) !important; opacity: 1 !important; cursor: default !important; box-shadow: none !important; }
#projectFormGrid.pm-view input::placeholder { color: transparent; }
#projectFormGrid.pm-view input[type="date"]::-webkit-calendar-picker-indicator { display: none; }
#projectFormGrid.pm-view #btnAssignTeam, #projectFormGrid.pm-view #btn_req_initial { display: none !important; }
#projectFormGrid.pm-view .form-group { border-bottom: 1px solid var(--row-border); padding-bottom: 2px; }
.pm-dash { display: none; }
#projectFormGrid.pm-view .pm-empty { display: none !important; }
#projectFormGrid.pm-view .pm-empty + .pm-dash { display: block; flex: 1; padding: 8px 0; font-size: 13px; color: var(--text-muted); }
#projectFormGrid .pm-req > label::after { content: ' *'; color: var(--brand-primary); }
#projectFormGrid .pm-req > label:has(> span:first-child)::after { content: ''; }
#projectFormGrid .pm-req > label > span:first-child::after { content: ' *'; color: var(--brand-primary); }
#projectFormGrid.pm-view .pm-req > label > span:first-child::after { content: ''; }
#projectFormGrid.pm-view .pm-req > label::after { content: ''; }
#projectFormGrid .pm-missing input, #projectFormGrid .pm-missing select, #projectFormGrid input.pm-missing, #projectFormGrid select.pm-missing { border-color: var(--color-red, #ef4444) !important; }
#projectFormGrid .form-row { margin-bottom: 12px; }
#projectFormGrid .form-group.mb-15 { margin-bottom: 12px; }
.pm-derived-note { font-size: 10px; color: var(--text-muted); font-weight: 400; text-transform: none; }
/* The Details footer stays on screen while the form scrolls (it sat under the
   app footer before). Same look as the standard window footer. */
.pane-content > .modal-actions { position: sticky; bottom: -18px; background: var(--card-bg); margin: auto -24px -18px; padding: 12px 24px 16px; z-index: 2; }
.pane-content > .modal-actions button { padding: 8px 18px; font-size: 13px; }
