:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --text: #17212b;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #245c4a;
    --accent-soft: #eaf3ef;
    --nav: #182521;
    --nav-text: #d8e2de;
    --danger: #9f3434;
    --warning-bg: #fff8e6;
    --warning-text: #7c5a10;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar { background: var(--nav); color: var(--nav-text); padding: 22px 16px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; color: white; font-weight: 750; font-size: 20px; padding: 4px 8px 24px; }
.brand-logo { display: block; width: 100%; max-width: 210px; height: auto; object-fit: contain; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #3d846d; }
.sidebar-nav { display: grid; gap: 5px; }
.sidebar-nav a, .sidebar-footer a, .link-button { border: 0; background: transparent; color: var(--nav-text); padding: 10px 12px; border-radius: 8px; text-align: left; width: 100%; cursor: pointer; }
.sidebar-nav a:hover, .sidebar-nav a.active, .sidebar-footer a:hover, .link-button:hover { background: rgba(255,255,255,.09); color: white; }
.sidebar-footer { margin-top: auto; display: grid; gap: 4px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.10); }

.main-column { min-width: 0; }
.topbar { min-height: 70px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 10px 32px; box-sizing: border-box; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.user-chip { display: flex; flex-direction: column; justify-content: center; text-align: right; font-size: 14px; }
.user-chip small { color: var(--muted); margin-top: 2px; }
.account-link { color: var(--accent); font-size: 12px; margin-top: 3px; font-weight: 650; }
.account-link:hover { text-decoration: underline; }
.content { padding: 30px 32px 48px; max-width: 1500px; }

.page-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
.page-header h1 { margin: 0 0 5px; font-size: 30px; letter-spacing: -.03em; }
.page-header p { margin: 0; color: var(--muted); }
.header-actions { display: flex; gap: 8px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.metric-card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.025); }
.metric-card { padding: 20px; }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.metric-value { font-size: 30px; font-weight: 750; margin-top: 6px; }
.panel { overflow: hidden; }
.panel-header { padding: 17px 19px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-header h2 { margin: 0; font-size: 17px; }
.panel-body { padding: 18px 19px; }
.section { margin-top: 22px; }

.searchbar { display: flex; gap: 8px; margin-bottom: 18px; }
.searchbar input { width: min(520px, 100%); padding: 10px 12px; border: 1px solid #cfd5dc; border-radius: 8px; background: white; }
.searchbar select { padding: 10px 12px; border: 1px solid #cfd5dc; border-radius: 8px; background: white; color: var(--text); }
.button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--accent); background: var(--accent); color: white; padding: 9px 13px; border-radius: 8px; cursor: pointer; font-weight: 650; font-size: 14px; }
.button.secondary { background: white; color: var(--accent); }
.button.subtle { border-color: var(--line); background: white; color: var(--text); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); }
td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafbfb; }
.primary-link { color: var(--accent); font-weight: 700; }
.subtext { color: var(--muted); font-size: 13px; margin-top: 3px; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.badge.muted { background: #eef0f2; color: #59616b; }
.badge.billing { background: var(--warning-bg); color: var(--warning-text); }

.detail-hero { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin-bottom: 20px; }
.detail-title { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.detail-title h1 { margin: 0; font-size: 30px; letter-spacing: -.03em; }
.detail-meta { color: var(--muted); margin-top: 5px; }
.contact-block { display: grid; gap: 9px; }
.contact-line { display: grid; grid-template-columns: 82px 1fr; gap: 10px; font-size: 14px; }
.contact-line .label { color: var(--muted); }
.empty { color: var(--muted); padding: 20px; text-align: center; }
.card-list { display: grid; gap: 10px; }
.person-card, .site-card { border: 1px solid var(--line); border-radius: 9px; padding: 13px 14px; }
.person-card:hover, .site-card:hover { border-color: #bdc9c4; background: #fbfcfc; }
.person-card strong, .site-card strong { color: var(--accent); }
.split-row { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.history-row { display: grid; grid-template-columns: minmax(180px,1.5fr) minmax(140px,1fr) 150px 90px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef2f0; }
.login-card { width: min(420px, 100%); background: white; border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-card h1 { margin: 0 0 6px; }
.login-card p { color: var(--muted); margin: 0 0 22px; }
.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.form-row input { width: 100%; padding: 10px 11px; border: 1px solid #cfd5dc; border-radius: 8px; }
.login-card .button { width: 100%; margin-top: 4px; }
.errorlist { color: var(--danger); padding-left: 18px; font-size: 13px; }

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; padding: 12px 16px; }
    .brand { padding-bottom: 10px; }
    .sidebar-nav { display: flex; overflow-x: auto; }
    .sidebar-footer { display: none; }
    .topbar { padding: 0 18px; height: 58px; }
    .content { padding: 20px 16px 36px; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .history-row { grid-template-columns: 1fr; gap: 3px; }
}


/* Native CRM editing */
.message-stack { display: grid; gap: 8px; margin-bottom: 18px; }
.message { background: var(--accent-soft); color: var(--accent); border: 1px solid #cfe2da; padding: 11px 13px; border-radius: 8px; font-size: 14px; }
.message.error { background: #fff1f1; color: var(--danger); border-color: #efcaca; }

.record-form { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-field { min-width: 0; }
.form-field label:not(.checkbox-label) { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.form-field input:not([type="checkbox"]), .form-field select, .form-field textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #cfd5dc;
    border-radius: 8px;
    background: white;
    color: var(--text);
}
.form-field textarea { resize: vertical; min-height: 96px; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: 2px solid rgba(36,92,74,.15);
    border-color: var(--accent);
}
.checkbox-field { align-self: end; padding-bottom: 9px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; cursor: pointer; }
.checkbox-label input { width: 17px; height: 17px; }
.helptext { color: var(--muted); font-size: 12px; margin-top: 4px; }
.form-field .errorlist { margin: 5px 0 0; }
.formset-list { display: grid; gap: 12px; }
.formset-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fbfcfc; }
.delete-field { color: var(--danger); }
.form-actions { display: flex; gap: 9px; margin-top: 20px; padding-bottom: 20px; }

@media (max-width: 1050px) {
    .form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
}


/* Manager dashboard */
.dashboard-kicker { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 5px; }
.dashboard-current { cursor: default; }
.disabled-action { opacity: .55; cursor: default; }
.manager-tools { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.back-office-sections { display: grid; gap: 18px; }
.manager-section { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.025); }
.manager-section-priority { border-color: var(--accent); }
.manager-section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.manager-section-header h2 { margin: 0 0 4px; font-size: 19px; }
.manager-section-header p { margin: 0; color: var(--muted); font-size: 13px; }
.manager-section-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.manager-section-grid-four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.manager-section-grid-single { grid-template-columns: 1fr; }
.manager-section-grid-narrow { max-width: 760px; }
.manager-section-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.manager-section .manager-tool-card { background: var(--bg); }
.manager-tool-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 19px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.manager-tool-card strong { display: block; margin-top: 4px; font-size: 17px; }
.dashboard-placeholder .panel-body { min-height: 220px; }
.gauge-placeholder { width: 220px; height: 120px; margin: 12px auto 18px; position: relative; overflow: hidden; }
.gauge-arc { width: 220px; height: 220px; border: 22px solid #e8ecea; border-bottom-color: transparent; border-left-color: #c9d8d2; border-radius: 50%; transform: rotate(45deg); }
.gauge-center { position: absolute; inset: 54px 0 0; text-align: center; display: flex; flex-direction: column; }
.gauge-center strong { font-size: 28px; }
.gauge-center span { color: var(--muted); font-size: 12px; }
.placeholder-note { color: var(--muted); font-size: 13px; text-align: center; }
.project-filter-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.project-filter-preview span { border: 1px solid var(--line); border-radius: 8px; background: #fafbfb; padding: 8px 10px; font-size: 13px; color: var(--muted); }
.compact-empty { padding: 24px 8px; }
.queue-body { padding: 0; }
.assignment-queue { display: grid; }
.assignment-row { display: grid; grid-template-columns: 90px minmax(220px,1fr) minmax(300px,420px); gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.assignment-row:last-child { border-bottom: 0; }
.assignment-record { min-width: 0; }
.inline-assignment-form { display: grid; grid-template-columns: minmax(170px,1fr) auto; gap: 8px; }
.inline-assignment-form select { width: 100%; padding: 9px 10px; border: 1px solid #cfd5dc; border-radius: 8px; background: white; color: var(--text); }
.queue-clear { padding: 34px 18px; }
.queue-clear strong { color: var(--text); }

@media (max-width: 1100px) {
    .manager-section-grid-four { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .manager-section-row { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .manager-section-grid, .manager-section-grid-four { grid-template-columns: 1fr; }
    .manager-section { padding: 14px; }
    .manager-tool-card { padding: 15px; }
}

@media (max-width: 900px) {
    .manager-tools { grid-template-columns: 1fr; }
    .assignment-row { grid-template-columns: 1fr; gap: 7px; }
    .inline-assignment-form { grid-template-columns: 1fr auto; }
}

.table-actions { width: 1%; white-space: nowrap; text-align: right; }
.account-note { margin-top: 18px; padding: 12px 14px; border-radius: 8px; background: #fafbfb; border: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.5; }
.account-note strong { color: var(--text); }

.rate-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.rate-summary { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: #fbfcfc; }
.rate-value { font-size: 28px; font-weight: 750; margin-top: 5px; }
.compact-actions { margin-bottom: 0; padding-bottom: 0; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.detail-grid > div { display: flex; flex-direction: column; gap: 4px; }
.section-rule { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.qualification-entry { margin-bottom: 14px; }
.qualification-entry > summary { display: inline-flex; cursor: pointer; list-style: none; }
.qualification-entry > summary::-webkit-details-marker { display: none; }
.qualification-form { margin-top: 16px; }

.tenant-switch-form {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.2rem 0;
}
.tenant-switch-form select {
    max-width: 220px;
    min-width: 150px;
}
.tenant-switch-button {
    padding: 0.35rem 0.6rem;
}


/* Projects */
.project-detail-titlebar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:10px 12px;margin-bottom:10px}
.project-detail-titlebar h1{margin:0 8px 0 0;font-size:23px}.project-detail-titlebar>div{display:flex;align-items:center;gap:5px;font-size:12px}.project-detail-titlebar>div span{font-weight:700}.project-detail-titlebar>div strong{background:#fff;border:1px solid var(--line);border-radius:4px;padding:4px 7px}.project-name-field{flex:1 1 250px}.project-name-field strong{flex:1}
.project-inline-header{margin-top:0}
.project-inline-header .project-header-field{display:flex;align-items:center;gap:5px;font-size:12px;font-weight:400;min-width:0}
.project-inline-header .project-header-field>span{font-weight:700;white-space:nowrap}
.project-inline-header .project-header-field input,.project-inline-header .project-header-field select{height:31px;min-width:0;padding:3px 6px;font-size:12px;border:1px solid var(--line);border-radius:4px;background:#fff}
.project-inline-header .project-header-status select{width:110px}
.project-inline-header .project-header-sales select{width:145px}
.project-inline-header .project-header-pm select{width:130px}
.project-inline-header .project-name-field{display:flex;flex:1 1 340px}
.project-inline-header .project-name-field input{flex:1;width:100%}
.project-inline-header .project-header-po input{width:105px}
.project-header-save-state{margin-left:auto;font-size:10px;color:var(--muted);white-space:nowrap}
.project-header-save-state.is-saving{color:#7a6400}
.project-header-save-state.is-saved{color:#2f7a3e}
.project-header-save-state.is-error{color:#b6352b;font-weight:700}
.project-info-grid{display:grid;grid-template-columns:1.1fr 1.1fr 1.1fr .8fr 2fr 1.1fr;gap:7px;margin-bottom:10px}.project-info-grid section{border:1px solid #9bcf77;border-radius:7px;background:#e7f5d9;padding:9px;min-height:98px;font-size:12px}.project-info-grid h3{margin:0 0 6px;color:#315c20;font-size:12px}.project-info-card-title{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}.project-info-card-title h3{margin-bottom:6px}.project-card-edit{font-size:10px;font-weight:800;color:#315c20;border:1px solid #9bcf77;background:#fff;border-radius:4px;padding:2px 5px;line-height:1.2}.project-info-grid .primary-link{color:#245c4a}.project-info-grid .project-notes-card{background:#f5f7f5}.project-tools-card{display:flex;flex-direction:column;gap:4px}.project-tools-card a,.project-tools-card span{padding:4px 6px;background:#315c20;color:#fff;text-decoration:none;text-align:center;font-weight:700;border-radius:3px}
.project-tabs{display:flex;gap:2px;border-bottom:1px solid var(--line);margin-bottom:9px}.project-tabs a,.project-tabs span{padding:7px 12px;border:1px solid var(--line);border-bottom:0;border-radius:6px 6px 0 0;background:#f1f2f1;color:var(--text);text-decoration:none;font-weight:700;font-size:12px}.project-tabs a.active{background:#fff;color:#b72619}.project-tabs span{color:#747a74}
.project-workspace{display:grid;grid-template-columns:minmax(0,1fr) 145px;gap:9px;align-items:start}.project-actionbar{display:flex;align-items:center;gap:8px;margin-bottom:7px}.project-actionbar form,.phase-actions form{margin:0}
.proposal-actionbar{flex-wrap:nowrap}.proposal-terms-inline{margin-left:4px!important;display:flex;align-items:end;gap:6px;min-width:0;flex:1}.proposal-terms-inline label{display:flex;align-items:center;gap:5px;min-width:0;margin:0;font-size:10px;font-weight:700;white-space:nowrap}.proposal-terms-inline select{min-width:190px;max-width:310px;height:34px;padding:4px 26px 4px 7px;font-size:11px}.proposal-terms-inline input{width:58px;height:34px;padding:4px 6px;font-size:11px}.proposal-terms-inline .button{height:34px;padding:5px 9px}.proposal-validity-inline{flex:0 0 auto}
@media(max-width:1050px){.proposal-actionbar{flex-wrap:wrap}.proposal-terms-inline{flex-basis:100%;margin-left:0!important}}.project-flag{margin-left:auto;color:#b72619;font-size:12px}
.project-summary{position:sticky;top:12px;display:flex;flex-direction:column;gap:4px}.project-summary>div{background:#fff;border:1px solid #6f8b60;text-align:center}.project-summary span{display:block;background:#376b22;color:#fff;padding:3px;font-weight:700;font-size:11px}.project-summary strong{display:block;padding:5px;font-size:16px}
.phase-card{border:1px solid #72a94c;background:#dff1c9;margin-bottom:6px}.phase-excluded{opacity:.55}.phase-card-header{display:grid;grid-template-columns:55px 105px 120px minmax(180px,1fr) 130px 70px 95px 60px;background:#4d842b;color:#fff}.phase-card-header>div{padding:4px 6px;border-right:1px solid rgba(255,255,255,.35);min-width:0}.phase-card-header span,.phase-card-body span{display:block;font-size:9px;font-weight:700}.phase-card-header strong{display:block;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.phase-card-body{display:grid;grid-template-columns:44px 320px minmax(250px,1fr) 92px;gap:7px;align-items:center;padding:6px}.phase-open-button{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;background:#1665d8;color:#fff;font-size:26px;font-weight:800;text-decoration:none}.phase-metrics{display:grid;grid-template-columns:repeat(4,1fr)}.phase-metrics>div{border:1px solid #8bab75;background:#f1f7e9;padding:4px 5px}.phase-metrics strong{font-size:12px}.phase-notes{background:#fff0be;border:1px solid #d2bd78;padding:6px 8px;min-height:44px;font-size:11px}.phase-actions{display:flex;gap:4px;align-items:center;justify-content:end}.phase-proposal-button{width:36px;height:36px;border:2px solid #267b2f;border-radius:6px;background:#69c84c;color:#154c1b;font-size:22px;font-weight:800;cursor:pointer}
.project-search{display:flex;gap:8px;padding:9px;margin-bottom:10px}.project-search input{flex:1}
@media(max-width:1200px){.project-info-grid{grid-template-columns:repeat(3,1fr)}.phase-card-body{grid-template-columns:44px 280px minmax(220px,1fr) 90px}}
@media(max-width:900px){.project-info-grid{grid-template-columns:1fr 1fr}.project-workspace{grid-template-columns:1fr}.project-summary{position:static;display:grid;grid-template-columns:repeat(4,1fr)}.phase-card-header{grid-template-columns:repeat(2,1fr)}.phase-card-body{grid-template-columns:44px 1fr}.phase-metrics,.phase-notes,.phase-actions{grid-column:2}}


/* Phase Detail V1 */
.phase-detail-page{display:flex;flex-direction:column;gap:12px}
.phase-context-row{display:grid;grid-template-columns:1.1fr 1.1fr 2.4fr;gap:10px}
.phase-context-card,.phase-setup-card{background:#f4dfbd;border:1px solid #ba9159;border-radius:12px;padding:12px}
.phase-context-card h3,.phase-setup-heading{margin:0 0 8px;font-weight:800}
.phase-context-company{margin-top:10px;padding-top:8px;border-top:1px solid rgba(120,85,40,.25)}
.phase-note-preview{margin-top:10px;background:#ffe7a6;border:1px solid #d4b66b;padding:7px;min-height:42px}
.phase-setup-card{background:#e8c58d}
.phase-setup-grid{display:grid;grid-template-columns:1fr 120px;gap:8px 10px}
.phase-setup-grid label,.phase-setup-secondary label,.phase-setup-notes label{display:flex;flex-direction:column;gap:3px;font-size:12px;font-weight:700}
.phase-setup-secondary{display:grid;grid-template-columns:1.6fr .5fr .5fr;gap:8px;margin-top:8px}
.phase-setup-notes{margin-top:8px}
.phase-work-code-box{display:grid;grid-template-columns:1fr 240px;gap:10px;align-items:start;margin:10px 0}
.phase-work-code-box select{width:100%}
.calculator-tabs{display:flex;gap:4px;align-items:end;border-bottom:1px solid var(--line)}
.calculator-tab{border:1px solid var(--line);border-bottom:0;border-radius:16px 16px 0 0;padding:7px 14px;background:#f2f2f2;font-weight:700}
.calculator-tab.active{background:#fff4c7;color:#6c5610}
.calculator-tab.future{opacity:.55}
.phase-calc-panel,.phase-resource-panel,.apply-hours-box,.phase-price-summary{border:1px solid var(--line);border-radius:10px;background:#fff;padding:10px}
.calc-totals{display:flex;gap:16px;align-items:center;flex-wrap:wrap}.calc-totals span{font-size:12px}.calc-totals strong{font-size:16px;margin-left:4px}.calc-update-line-items{margin:0}
.calc-table th{background:#b98a49;color:#fff}.calc-table td{background:#fff9d8}
.calc-table input,.calc-table select{min-width:76px;max-width:140px}
.phase-estimate-grid{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:12px}
.phase-resource-column,.phase-resource-side{display:flex;flex-direction:column;gap:12px}
.phase-resource-panel h2,.phase-price-summary h2{margin:0;font-size:18px}
.phase-resource-panel table input,.phase-resource-panel table select{min-width:80px}
.phase-placeholder{min-height:95px;background:#fafafa}
.apply-hours-box{text-align:center}
.phase-price-summary>div{display:flex;justify-content:space-between;gap:10px;padding:7px 4px;border-bottom:1px solid var(--line)}
.phase-price-summary>div:last-child{border-bottom:0}
.phase-summary-total{font-size:17px;font-weight:800}
.field-error{color:#a1271c;font-size:12px;margin:4px 0}
@media(max-width:1100px){.phase-context-row{grid-template-columns:1fr 1fr}.phase-setup-card{grid-column:1/-1}.phase-estimate-grid{grid-template-columns:1fr}}
@media(max-width:720px){.phase-context-row{grid-template-columns:1fr}.phase-setup-grid,.phase-setup-secondary,.phase-work-code-box{grid-template-columns:1fr}}


/* Compact Project / Phase workflow headers */
.content > .project-detail-titlebar,
.content > .phase-detail-page {
    margin-top: -18px;
}

.compact-phase-header {
    grid-template-columns: 0.95fr 1fr 3.6fr;
    gap: 8px;
    align-items: stretch;
}

.compact-context-card,
.compact-phase-setup {
    min-height: 0;
    padding: 9px 10px;
    border-radius: 9px;
}

.compact-card-title,
.compact-phase-setup .phase-setup-heading {
    margin: 0 0 5px;
    font-size: 13px;
    font-weight: 800;
}

.compact-context-line {
    font-size: 12px;
    line-height: 1.25;
    margin: 1px 0;
}

.compact-context-company {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(120,85,40,.25);
}

.compact-note-preview {
    min-height: 0;
    margin-top: 6px;
    padding: 5px 7px;
    font-size: 11px;
    line-height: 1.2;
}

.compact-phase-grid {
    display: grid;
    grid-template-columns:
        minmax(145px, 1.35fr)
        72px
        minmax(180px, 1.7fr)
        minmax(120px, 0.9fr)
        minmax(105px, 0.85fr)
        58px;
    gap: 5px 7px;
    align-items: end;
}

.compact-phase-grid label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: 10px;
    font-weight: 800;
}

.compact-phase-grid input:not([type="checkbox"]),
.compact-phase-grid select,
.compact-phase-grid textarea {
    width: 100%;
    min-width: 0;
    padding: 4px 6px;
    min-height: 28px;
    border: 1px solid #b8a06f;
    border-radius: 4px;
    background: white;
    font-size: 12px;
}

.compact-phase-grid textarea {
    height: 48px;
    min-height: 48px;
    resize: vertical;
}

.compact-phase-grid .exclude-field {
    align-items: center;
    justify-content: end;
}

.compact-phase-grid .exclude-field input {
    width: 16px;
    height: 16px;
    margin-top: 5px;
}

.phase-label-field {
    grid-column: 1 / span 2;
}

.phase-notes-field {
    grid-column: 4 / span 2;
}

.compact-work-codes {
    grid-column: 6;
    grid-row: 2 / span 2;
    min-width: 150px;
    align-self: stretch;
}

.compact-work-codes strong {
    display: block;
    font-size: 11px;
    margin-bottom: 2px;
}

.compact-work-codes .subtext {
    font-size: 9px;
    line-height: 1.15;
    margin: 0 0 3px;
}

.compact-work-codes select {
    height: 70px;
    min-height: 70px;
    padding: 2px 4px;
}

.compact-phase-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.compact-phase-actions .button {
    padding: 6px 9px;
    font-size: 12px;
}

@media (max-width: 1300px) {
    .compact-phase-header {
        grid-template-columns: 0.9fr 0.95fr 3fr;
    }
    .compact-phase-grid {
        grid-template-columns: minmax(130px,1.2fr) 68px minmax(165px,1.5fr) minmax(110px,.9fr) minmax(100px,.8fr) 55px;
    }
}

@media (max-width: 1000px) {
    .compact-phase-header {
        grid-template-columns: 1fr 1fr;
    }
    .compact-phase-setup {
        grid-column: 1 / -1;
    }
    .compact-phase-grid {
        grid-template-columns: repeat(4, minmax(0,1fr));
    }
    .phase-label-field,
    .phase-notes-field,
    .compact-work-codes {
        grid-column: auto;
        grid-row: auto;
    }
}


/* Phase header compact v2 */
.compact-phase-header.v2 {
    align-items: start;
}
.compact-phase-header.v2 .compact-context-card {
    align-self: start;
}
.compact-phase-setup-v2 {
    padding: 7px 9px;
}
.phase-setup-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
}
.phase-setup-topline .phase-setup-heading {
    margin: 0;
}
.phase-setup-topline .compact-phase-actions {
    margin: 0;
    flex: 0 0 auto;
}
.phase-setup-topline .compact-phase-actions .button {
    padding: 5px 8px;
    font-size: 11px;
}

.compact-phase-grid-v2 {
    grid-template-columns:
        minmax(145px, 1.2fr)
        72px
        minmax(210px, 1.65fr)
        minmax(115px, .85fr)
        minmax(105px, .78fr)
        55px
        minmax(150px, 1fr);
    gap: 4px 7px;
    align-items: end;
}
.compact-phase-grid-v2 .crew-field { grid-column: 1; grid-row: 1; }
.compact-phase-grid-v2 .days-field { grid-column: 2; grid-row: 1; }
.compact-phase-grid-v2 .service-field { grid-column: 3; grid-row: 1; }
.compact-phase-grid-v2 .site-type-field { grid-column: 4; grid-row: 1; }
.compact-phase-grid-v2 .status-field { grid-column: 5; grid-row: 1; }
.compact-phase-grid-v2 .exclude-field { grid-column: 6; grid-row: 1; }
.compact-phase-grid-v2 .phase-label-field { grid-column: 1 / span 2; grid-row: 2; }
.compact-phase-grid-v2 .qty-field { grid-column: 3; grid-row: 2; }
.compact-phase-grid-v2 .unit-field { grid-column: 4; grid-row: 2; }
.compact-phase-grid-v2 .phase-notes-field { grid-column: 5 / span 2; grid-row: 2; }
.compact-phase-grid-v2 .compact-work-codes-v2 { grid-column: 7; grid-row: 1 / span 2; }

.compact-phase-grid-v2 textarea {
    height: 34px;
    min-height: 34px;
}
.compact-work-codes-v2 {
    min-width: 0;
    align-self: stretch;
}
.compact-work-codes-v2 strong {
    font-size: 10px;
}
.compact-work-codes-v2 .subtext {
    display: none;
}
.compact-work-codes-v2 select {
    height: 54px;
    min-height: 54px;
}
.compact-phase-header.v2 .compact-context-card {
    padding: 8px 9px;
}
.compact-phase-header.v2 .compact-note-preview {
    margin-top: 4px;
    padding: 4px 6px;
}
@media (max-width: 1250px) {
    .compact-phase-grid-v2 {
        grid-template-columns: repeat(6, minmax(0,1fr));
    }
    .compact-phase-grid-v2 .crew-field { grid-column: 1 / span 2; }
    .compact-phase-grid-v2 .days-field { grid-column: 3; }
    .compact-phase-grid-v2 .service-field { grid-column: 4 / span 2; }
    .compact-phase-grid-v2 .site-type-field { grid-column: 1 / span 2; grid-row: 2; }
    .compact-phase-grid-v2 .status-field { grid-column: 3 / span 2; grid-row: 2; }
    .compact-phase-grid-v2 .exclude-field { grid-column: 5; grid-row: 2; }
    .compact-phase-grid-v2 .phase-label-field { grid-column: 1 / span 2; grid-row: 3; }
    .compact-phase-grid-v2 .qty-field { grid-column: 3; grid-row: 3; }
    .compact-phase-grid-v2 .unit-field { grid-column: 4; grid-row: 3; }
    .compact-phase-grid-v2 .phase-notes-field { grid-column: 5 / span 2; grid-row: 3; }
    .compact-phase-grid-v2 .compact-work-codes-v2 { grid-column: 6; grid-row: 1 / span 2; }
}


/* Pavement calculator compact desktop layout */
.phase-calc-panel {
    padding: 8px;
}
.phase-calc-panel .panel-header {
    padding: 8px 10px;
}
.calc-table {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}
.calc-table th,
.calc-table td {
    padding: 6px 5px;
    font-size: 11px;
}
.calc-table th:nth-child(1),
.calc-table td:nth-child(1) { width: 7.5%; }
.calc-table th:nth-child(2),
.calc-table td:nth-child(2) { width: 9%; }
.calc-table th:nth-child(3),
.calc-table td:nth-child(3) { width: 9%; }
.calc-table th:nth-child(4),
.calc-table td:nth-child(4) { width: 8%; }
.calc-table th:nth-child(5),
.calc-table td:nth-child(5) { width: 12%; }
.calc-table th:nth-child(6),
.calc-table td:nth-child(6) { width: 10%; }
.calc-table th:nth-child(7),
.calc-table td:nth-child(7) { width: 10%; }
.calc-table th:nth-child(8),
.calc-table td:nth-child(8) { width: 9%; }
.calc-table th:nth-child(9),
.calc-table td:nth-child(9) { width: 8%; }
.calc-table th:nth-child(10),
.calc-table td:nth-child(10) { width: 10%; }

.calc-table input:not([type="checkbox"]),
.calc-table select {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 32px;
    min-height: 32px;
    padding: 4px 6px;
    font-size: 12px;
}
.calc-table input[disabled] {
    opacity: 1;
}
.phase-calc-panel .form-actions {
    margin-top: 8px;
    padding-bottom: 0;
}

@media (max-width: 1150px) {
    .calc-table {
        min-width: 1050px;
    }
}


/* Compact Labor / Equipment estimate tables */
.resource-table-wrap {
    overflow-x: visible;
}
.resource-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}
.resource-table th,
.resource-table td {
    padding: 6px 7px;
    vertical-align: middle;
}
.resource-table input:not([type="checkbox"]),
.resource-table select {
    width: 100%;
    min-width: 0 !important;
    max-width: none;
    height: 32px;
    min-height: 32px;
    box-sizing: border-box;
    padding: 4px 6px;
}
.resource-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Labor: keep the category roomy; hour fields only need about 3 digits. */
.labor-resource-table th:nth-child(1),
.labor-resource-table td:nth-child(1) { width: 7%; }
.labor-resource-table th:nth-child(2),
.labor-resource-table td:nth-child(2) { width: 24%; }
.labor-resource-table th:nth-child(3),
.labor-resource-table td:nth-child(3) { width: 11%; }
.labor-resource-table th:nth-child(4),
.labor-resource-table td:nth-child(4) { width: 9%; }
.labor-resource-table th:nth-child(5),
.labor-resource-table td:nth-child(5) { width: 9%; }
.labor-resource-table th:nth-child(6),
.labor-resource-table td:nth-child(6) { width: 10%; }
.labor-resource-table th:nth-child(7),
.labor-resource-table td:nth-child(7) { width: 15%; }
.labor-resource-table th:nth-child(8),
.labor-resource-table td:nth-child(8) { width: 8%; }

.labor-resource-table td:nth-child(4) input,
.labor-resource-table td:nth-child(5) input,
.equipment-resource-table td:nth-child(4) input,
.equipment-resource-table td:nth-child(5) input {
    max-width: 72px;
    margin: 0 auto;
}

/* Equipment */
.equipment-resource-table th:nth-child(1),
.equipment-resource-table td:nth-child(1) { width: 8%; }
.equipment-resource-table th:nth-child(2),
.equipment-resource-table td:nth-child(2) { width: 31%; }
.equipment-resource-table th:nth-child(3),
.equipment-resource-table td:nth-child(3) { width: 13%; }
.equipment-resource-table th:nth-child(4),
.equipment-resource-table td:nth-child(4) { width: 10%; }
.equipment-resource-table th:nth-child(5),
.equipment-resource-table td:nth-child(5) { width: 10%; }
.equipment-resource-table th:nth-child(6),
.equipment-resource-table td:nth-child(6) { width: 18%; }
.equipment-resource-table th:nth-child(7),
.equipment-resource-table td:nth-child(7) { width: 8%; }

@media (max-width: 900px) {
    .resource-table-wrap {
        overflow-x: auto;
    }
    .labor-resource-table {
        min-width: 760px;
    }
    .equipment-resource-table {
        min-width: 680px;
    }
}


/* Phase autosave / compact notes */
.estimator-notes-popover {
    position: relative;
}
.estimator-notes-popover > summary {
    list-style: none;
    cursor: pointer;
}
.estimator-notes-popover > summary::-webkit-details-marker {
    display: none;
}
.estimator-notes-button {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.estimator-notes-bubble {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    right: 0;
    width: 360px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0,0,0,.14);
}
.estimator-notes-bubble textarea {
    width: 100%;
    min-height: 130px;
    box-sizing: border-box;
    margin-top: 6px;
    resize: vertical;
}
.autosave-hint {
    padding-top: 6px;
    font-size: 11px;
    color: var(--muted);
}
.compact-phase-grid-v2 {
    grid-template-rows: auto;
}
.compact-work-codes-v2 {
    grid-row: 1;
    align-self: end;
}
.compact-phase-setup-v2 {
    min-height: 0;
}
@media (max-width: 720px) {
    .estimator-notes-bubble {
        position: fixed;
        left: 12px;
        right: 12px;
        top: 90px;
        width: auto;
    }
}


/* In-place autosave feedback */
tr.autosaving {
    opacity: .68;
}
tr.autosave-ok {
    box-shadow: inset 3px 0 0 #2f7a35;
}
tr.autosave-error {
    box-shadow: inset 3px 0 0 #b3261e;
}


/* Align compact project context cards and allow resource portals to grow */
.compact-phase-header.v2 .compact-context-card {
    min-height: 116px;
    box-sizing: border-box;
}
.resource-table tbody tr {
    transition: box-shadow .15s ease, opacity .15s ease;
}


/* Project phase action icons */
.phase-actions {
    min-width: 0;
}
.phase-delete-button {
    width: 36px;
    height: 36px;
    border: 2px solid #b3261e;
    border-radius: 6px;
    background: #fff5f4;
    color: #b3261e;
    display: grid;
    place-items: center;
    padding: 5px;
    cursor: pointer;
}
.phase-delete-button:hover {
    background: #fde1de;
}
.phase-delete-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}


/* Project phase note preview */
.phase-notes-text {
    min-height: 18px;
}
.phase-notes-empty {
    color: var(--muted);
    font-style: italic;
}
.phase-work-code-preview {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.phase-notes-qty {
    margin-top: 4px;
}


/* Phase detail vertical compaction */
.phase-detail-page {
    gap: 6px;
}
.calculator-tabs {
    margin-bottom: 0;
}
.phase-calc-panel {
    padding: 4px 8px 6px;
}
.phase-calc-panel .panel-header {
    padding: 2px 4px 5px;
    min-height: 0;
}
.phase-calc-panel .panel-header h2 {
    font-size: 16px;
    line-height: 1.1;
}
.phase-calc-panel .panel-header .subtext {
    margin-top: 2px;
    line-height: 1.15;
}
.phase-estimate-grid {
    gap: 6px;
}
.phase-resource-column,
.phase-resource-side {
    gap: 6px;
}
.phase-resource-panel {
    padding: 4px 8px 6px;
}
.phase-resource-panel .panel-header {
    padding: 2px 4px 4px;
    min-height: 0;
    margin: 0;
}
.phase-resource-panel .panel-header h2 {
    font-size: 16px;
    line-height: 1.05;
}
.phase-resource-panel .table-wrap {
    margin-top: 0;
}
.phase-resource-panel .autosave-hint {
    padding-top: 3px;
}


/* Phase estimate column balance */
.phase-estimate-grid {
    grid-template-columns: minmax(0, 1fr) 390px;
}

/* Keep remove columns compact and centered. */
.labor-resource-table th:nth-child(8),
.labor-resource-table td:nth-child(8),
.equipment-resource-table th:nth-child(7),
.equipment-resource-table td:nth-child(7),
.material-resource-table th:nth-child(8),
.material-resource-table td:nth-child(8),
.trucking-resource-table th:nth-child(7),
.trucking-resource-table td:nth-child(7) {
    width: 5%;
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
}

/* Give the working fields the space recovered from Remove. */
.labor-resource-table th:nth-child(2),
.labor-resource-table td:nth-child(2) { width: 27%; }
.equipment-resource-table th:nth-child(2),
.equipment-resource-table td:nth-child(2) { width: 34%; }

.trucking-resource-table th,
.trucking-resource-table td {
    padding-left: 4px;
    padding-right: 4px;
}
.trucking-resource-table th:nth-child(1),
.trucking-resource-table td:nth-child(1) { width: 10%; }
.trucking-resource-table th:nth-child(2),
.trucking-resource-table td:nth-child(2) { width: 28%; }
.trucking-resource-table th:nth-child(3),
.trucking-resource-table td:nth-child(3) { width: 13%; }
.trucking-resource-table th:nth-child(4),
.trucking-resource-table td:nth-child(4) { width: 13%; }
.trucking-resource-table th:nth-child(5),
.trucking-resource-table td:nth-child(5) { width: 13%; }
.trucking-resource-table th:nth-child(6),
.trucking-resource-table td:nth-child(6) { width: 16%; }

@media (max-width: 1180px) {
    .phase-estimate-grid {
        grid-template-columns: minmax(0, 1fr) 360px;
    }
}


/* Phase estimate column balance v2 */
.labor-resource-table th:nth-child(7),
.labor-resource-table td:nth-child(7) { width: 11%; }
.labor-resource-table th:nth-child(8),
.labor-resource-table td:nth-child(8) { width: 4%; }
.labor-resource-table th:nth-child(2),
.labor-resource-table td:nth-child(2) { width: 31%; }

.equipment-resource-table th:nth-child(6),
.equipment-resource-table td:nth-child(6) { width: 13%; }
.equipment-resource-table th:nth-child(7),
.equipment-resource-table td:nth-child(7) { width: 4%; }
.equipment-resource-table th:nth-child(2),
.equipment-resource-table td:nth-child(2) { width: 40%; }

.material-resource-table th:nth-child(8),
.material-resource-table td:nth-child(8) { width: 4%; }

.trucking-resource-table th,
.trucking-resource-table td {
    font-size: 11px;
    padding-left: 3px;
    padding-right: 3px;
}
.trucking-resource-table th:nth-child(1),
.trucking-resource-table td:nth-child(1) { width: 9%; }
.trucking-resource-table th:nth-child(2),
.trucking-resource-table td:nth-child(2) { width: 35%; }
.trucking-resource-table th:nth-child(3),
.trucking-resource-table td:nth-child(3) { width: 12%; }
.trucking-resource-table th:nth-child(4),
.trucking-resource-table td:nth-child(4) { width: 11%; }
.trucking-resource-table th:nth-child(5),
.trucking-resource-table td:nth-child(5) { width: 11%; }
.trucking-resource-table th:nth-child(6),
.trucking-resource-table td:nth-child(6) { width: 18%; }
.trucking-resource-table th:nth-child(7),
.trucking-resource-table td:nth-child(7) { width: 4%; }

/* Keep the right side inside the content edge while still giving Trucking room. */
.phase-estimate-grid {
    grid-template-columns: minmax(0, 1fr) 375px;
}
.phase-resource-side {
    min-width: 0;
}
.phase-resource-side .phase-resource-panel,
.phase-resource-side .apply-hours-box,
.phase-resource-side .phase-price-summary {
    min-width: 0;
    box-sizing: border-box;
}


/* Phase estimate column balance v3: prioritize Trucking width */
.phase-estimate-grid {
    grid-template-columns: minmax(0, 1fr) 520px;
}

/* Left-side tables can give up some name-field width to make room for Trucking. */
.labor-resource-table th:nth-child(2),
.labor-resource-table td:nth-child(2) { width: 24%; }
.equipment-resource-table th:nth-child(2),
.equipment-resource-table td:nth-child(2) { width: 28%; }

/* Keep the Remove columns compact, but wide enough to keep the label/check box inside. */
.labor-resource-table th:nth-child(8),
.labor-resource-table td:nth-child(8),
.equipment-resource-table th:nth-child(7),
.equipment-resource-table td:nth-child(7),
.material-resource-table th:nth-child(8),
.material-resource-table td:nth-child(8) {
    width: 6%;
    text-align: center;
    white-space: nowrap;
}

.trucking-resource-table th,
.trucking-resource-table td {
    padding-left: 5px;
    padding-right: 5px;
}
.trucking-resource-table th:nth-child(1),
.trucking-resource-table td:nth-child(1) { width: 9%; }
.trucking-resource-table th:nth-child(2),
.trucking-resource-table td:nth-child(2) { width: 31%; }
.trucking-resource-table th:nth-child(3),
.trucking-resource-table td:nth-child(3) { width: 13%; }
.trucking-resource-table th:nth-child(4),
.trucking-resource-table td:nth-child(4) { width: 12%; }
.trucking-resource-table th:nth-child(5),
.trucking-resource-table td:nth-child(5) { width: 12%; }
.trucking-resource-table th:nth-child(6),
.trucking-resource-table td:nth-child(6) { width: 15%; }
.trucking-resource-table th:nth-child(7),
.trucking-resource-table td:nth-child(7) {
    width: 8%;
    text-align: center;
    white-space: nowrap;
}

.phase-resource-side,
.phase-resource-side .phase-resource-panel,
.phase-resource-side .apply-hours-box,
.phase-resource-side .phase-price-summary {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

/* On narrower windows, stack before either side gets clipped. */
@media (max-width: 1280px) {
    .phase-estimate-grid {
        grid-template-columns: 1fr;
    }
}


/* Phase estimate column balance v4: reclaim left-table remove space for Trucking */
.phase-estimate-grid {
    grid-template-columns: minmax(0, 1fr) 590px;
}

/* Pull left-side Remove columns inward by shortening the wide descriptive fields. */
.labor-resource-table th:nth-child(2),
.labor-resource-table td:nth-child(2) { width: 21%; }
.equipment-resource-table th:nth-child(2),
.equipment-resource-table td:nth-child(2) { width: 23%; }
.material-resource-table th:nth-child(2),
.material-resource-table td:nth-child(2) { width: 13%; }
.material-resource-table th:nth-child(3),
.material-resource-table td:nth-child(3) { width: 13%; }
.material-resource-table th:nth-child(4),
.material-resource-table td:nth-child(4) { width: 13%; }

.labor-resource-table th:nth-child(8),
.labor-resource-table td:nth-child(8),
.equipment-resource-table th:nth-child(7),
.equipment-resource-table td:nth-child(7),
.material-resource-table th:nth-child(8),
.material-resource-table td:nth-child(8) {
    width: 5%;
    min-width: 48px;
    text-align: center;
    white-space: nowrap;
}

/* Trucking gets the reclaimed width; keep Remove fully inside the card. */
.trucking-resource-table {
    table-layout: fixed;
    width: 100%;
}
.trucking-resource-table th,
.trucking-resource-table td {
    padding-left: 4px;
    padding-right: 4px;
}
.trucking-resource-table th:nth-child(1),
.trucking-resource-table td:nth-child(1) { width: 8%; }
.trucking-resource-table th:nth-child(2),
.trucking-resource-table td:nth-child(2) { width: 30%; }
.trucking-resource-table th:nth-child(3),
.trucking-resource-table td:nth-child(3) { width: 17%; }
.trucking-resource-table th:nth-child(4),
.trucking-resource-table td:nth-child(4) { width: 11%; }
.trucking-resource-table th:nth-child(5),
.trucking-resource-table td:nth-child(5) { width: 11%; }
.trucking-resource-table th:nth-child(6),
.trucking-resource-table td:nth-child(6) { width: 14%; }
.trucking-resource-table th:nth-child(7),
.trucking-resource-table td:nth-child(7) {
    width: 9%;
    min-width: 50px;
    text-align: center;
    white-space: nowrap;
}
.trucking-resource-table input,
.trucking-resource-table select {
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1360px) {
    .phase-estimate-grid {
        grid-template-columns: 1fr;
    }
}


/* Keep Materials table fully contained inside its panel */
.material-resource-table {
    width: 100%;
    table-layout: fixed;
}
.material-resource-table th,
.material-resource-table td {
    padding-left: 5px;
    padding-right: 5px;
}
.material-resource-table th:nth-child(1),
.material-resource-table td:nth-child(1) { width: 14%; }
.material-resource-table th:nth-child(2),
.material-resource-table td:nth-child(2) { width: 13%; }
.material-resource-table th:nth-child(3),
.material-resource-table td:nth-child(3) { width: 13%; }
.material-resource-table th:nth-child(4),
.material-resource-table td:nth-child(4) { width: 13%; }
.material-resource-table th:nth-child(5),
.material-resource-table td:nth-child(5) { width: 12%; }
.material-resource-table th:nth-child(6),
.material-resource-table td:nth-child(6) { width: 13%; }
.material-resource-table th:nth-child(7),
.material-resource-table td:nth-child(7) { width: 15%; }
.material-resource-table th:nth-child(8),
.material-resource-table td:nth-child(8) {
    width: 7%;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
}
.material-resource-table input,
.material-resource-table select {
    max-width: 100%;
    box-sizing: border-box;
}


/* Combined Misc. Expenses / Subs */
.misc-resource-table {
    width: 100%;
    table-layout: fixed;
}
.misc-resource-table th,
.misc-resource-table td {
    padding-left: 5px;
    padding-right: 5px;
}
.misc-resource-table th:nth-child(1),
.misc-resource-table td:nth-child(1) { width: 36%; }
.misc-resource-table th:nth-child(2),
.misc-resource-table td:nth-child(2) { width: 32%; }
.misc-resource-table th:nth-child(3),
.misc-resource-table td:nth-child(3) { width: 21%; }
.misc-resource-table th:nth-child(4),
.misc-resource-table td:nth-child(4) {
    width: 11%;
    text-align: center;
    white-space: nowrap;
}
.misc-resource-table input,
.misc-resource-table select {
    max-width: 100%;
    box-sizing: border-box;
}


/* Estimating pricing settings */
.settings-mode-panel {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}
.settings-mode-panel h3 {
    margin: 0 0 8px;
    font-size: 14px;
}

.phase-pricing-panel .panel-header {
    margin-bottom: 2px;
}
.phase-pricing-fields {
    display: grid;
    gap: 8px;
}
.phase-pricing-fields > label {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
}
.phase-pricing-fields input {
    width: 100%;
    box-sizing: border-box;
}
.phase-pricing-grid {
    display: grid;
    gap: 4px 8px;
    align-items: center;
}
.phase-pricing-grid-detailed {
    grid-template-columns: minmax(0, 1fr) 90px 92px;
}
.phase-pricing-grid-detailed > * {
    min-width: 0;
    font-size: 11px;
}
.phase-pricing-grid-detailed input {
    width: 100%;
    box-sizing: border-box;
}


/* Project Processing */
.processing-workspace{
    display:grid;
    grid-template-columns:minmax(250px,.8fr) minmax(480px,1.8fr) minmax(260px,.9fr);
    gap:10px;
    align-items:start;
}
.processing-column,.processing-center{min-width:0}
.processing-center{display:flex;flex-direction:column;gap:10px}
.processing-section-title{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:8px}
.processing-section-title h2{margin:0;font-size:16px}
.processing-phases,.processing-tasks{
    border:1px solid var(--line);
    border-radius:9px;
    background:#fff;
    padding:10px;
}
.processing-phase-list,.processing-task-list{display:flex;flex-direction:column;gap:7px}
.processing-phase-card{
    border:1px solid #9fc984;
    background:#eef8e6;
    border-radius:7px;
    padding:8px;
}
.processing-phase-heading{display:flex;align-items:center;gap:7px;margin-bottom:5px}
.processing-phase-heading strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.processing-phase-meta{display:flex;gap:8px;flex-wrap:wrap;font-size:11px;color:var(--muted);margin-bottom:6px}
.processing-schedule-dates{min-height:28px;margin-bottom:7px;font-size:11px}
.processing-communications{min-height:245px}
.processing-placeholder{
    min-height:165px;
    border:1px dashed var(--line);
    border-radius:7px;
    background:#f8f9f8;
    color:var(--muted);
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    padding:18px;
}
.processing-lower-grid{display:grid;grid-template-columns:minmax(260px,.9fr) minmax(300px,1.1fr);gap:10px}
.processing-checklist-card{
    border:1px solid #6e4a16;
    background:#6f4305;
    color:#fff;
    border-radius:9px;
    padding:10px;
}
.processing-checklist-card .subtext{color:#f4e7c8}
.processing-checklist-card .button.subtle{background:#fff;color:#4e350f}
.processing-checklist-items{display:flex;flex-direction:column;gap:4px}
.processing-check-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    margin:0;
    padding:5px 3px;
    border-bottom:1px solid rgba(255,255,255,.16);
}
.processing-check-row:last-child{border-bottom:0}
.processing-check-row label{display:flex;align-items:center;gap:7px;font-weight:700;font-size:12px}
.processing-check-meta{display:flex;align-items:center;gap:5px;font-size:10px;text-align:right}
.processing-files-placeholder{min-height:150px;flex-direction:column;gap:6px}
.processing-task-form{
    display:grid;
    grid-template-columns:1fr;
    gap:6px;
    margin-bottom:10px;
    padding-bottom:10px;
    border-bottom:1px solid var(--line);
}
.processing-task-form input{width:100%;min-width:0}
.processing-task-row{
    border:1px solid var(--line);
    border-radius:6px;
    padding:7px;
    background:#fff;
    font-size:11px;
}
.processing-task-row.is-complete{opacity:.65;background:#f3f4f3}
.processing-task-date{margin:5px 0;font-weight:700}
.processing-task-completion{display:flex;align-items:center;justify-content:space-between;gap:6px}
.processing-task-completion form{margin:0}
@media(max-width:1200px){
    .processing-workspace{grid-template-columns:minmax(230px,.8fr) minmax(420px,1.5fr)}
    .processing-tasks{grid-column:1/-1}
}
@media(max-width:850px){
    .processing-workspace,.processing-lower-grid{grid-template-columns:1fr}
}


/* Daily Phase Scheduling */
.schedule-site-notes{margin-bottom:12px}
.schedule-site-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;padding:10px}
.schedule-site-grid>div{border:1px solid var(--line);border-radius:6px;background:#f8fbff;padding:7px;min-width:0}
.schedule-site-grid span{display:block;font-size:10px;font-weight:800;color:var(--muted);margin-bottom:3px}
.schedule-site-grid strong{font-size:12px}
.schedule-site-notes-text{grid-column:span 2}
.schedule-planned-total{font-size:13px;padding:6px 9px;border-radius:6px;background:#eef7e9;border:1px solid #9fc984}
.schedule-planned-total.warning{background:#fff0be;border-color:#d2bd78}
.schedule-table th{white-space:nowrap}
.schedule-table td{vertical-align:middle;font-size:12px}
.schedule-row-actions{display:flex;gap:4px;align-items:center;flex-wrap:wrap}
.schedule-row-actions form,.schedule-table form{margin:0}
.schedule-form-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.schedule-form-grid .form-field{min-width:0}
.schedule-form-grid input,.schedule-form-grid select{width:100%;min-width:0}
.processing-task-form-grid{display:grid;grid-template-columns:1fr;gap:6px}
.processing-task-form-grid label{display:flex;flex-direction:column;gap:2px;font-size:10px;font-weight:700}
.processing-task-form-grid input,.processing-task-form-grid select{width:100%;min-width:0}
.processing-task-form-grid .processing-task-check{display:flex;flex-direction:row;align-items:center;gap:6px}
.processing-task-row-main{display:flex;justify-content:space-between;gap:8px;align-items:flex-start}
.processing-task-row-main>div:first-child{display:flex;gap:5px;align-items:center;min-width:0}
.processing-task-resources{display:flex;gap:6px;flex-wrap:wrap;margin:6px 0}
.processing-task-resources span{background:#f1f4f1;border:1px solid var(--line);border-radius:4px;padding:3px 5px}
@media(max-width:1000px){.schedule-site-grid,.schedule-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.schedule-site-grid,.schedule-form-grid{grid-template-columns:1fr}.schedule-site-notes-text{grid-column:auto}}


/* Project Communications Log */
.communication-log-list{display:flex;flex-direction:column;gap:7px;max-height:330px;overflow:auto}
.communication-log-row{border:1px solid var(--line);border-radius:7px;background:#fff;padding:8px}
.communication-log-row.open-concern{border-color:#c88969;background:#fff6ef}
.communication-log-head{display:flex;justify-content:space-between;gap:8px;align-items:flex-start}
.communication-log-head>div{display:flex;gap:5px;flex-wrap:wrap}
.badge.warning{background:#fff0be;border-color:#d2bd78;color:#6c4f00}
.communication-log-note{font-size:12px;line-height:1.35;margin:7px 0;white-space:normal}
.communication-log-meta{display:flex;gap:10px;flex-wrap:wrap;font-size:10px;color:var(--muted)}
.communication-entry-panel{padding:16px;background:#fffdf0}
.communication-entry-top{display:grid;grid-template-columns:minmax(160px,.7fr) minmax(180px,.9fr) auto auto;gap:12px;align-items:end}
.communication-entry-top>div>label,.communication-note-field>label,.communication-email-area label{display:block;font-weight:800;font-size:11px;margin-bottom:4px}
.communication-entry-top select,.communication-note-field textarea,.communication-email-area select,.communication-email-area textarea{width:100%;min-width:0}
.communication-check{display:flex;align-items:center;gap:6px;font-weight:700;font-size:12px;padding-bottom:8px}
.communication-note-field{margin-top:14px}
.communication-note-field textarea{min-height:280px}
.communication-entry-meta{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:12px 0}
.communication-entry-meta>div{border:1px solid var(--line);border-radius:6px;background:#fff;padding:7px}
.communication-entry-meta span{display:block;font-size:10px;color:var(--muted);font-weight:800;margin-bottom:3px}
.communication-email-area{display:grid;grid-template-columns:minmax(220px,.65fr) minmax(320px,1.35fr);gap:12px;align-items:start}
.communication-group-controls{display:flex;gap:6px}
.communication-group-controls select{flex:1}
.communication-recipient-field textarea{min-height:110px}
.communication-email-status{display:flex;align-items:center;gap:9px;margin-top:10px}
.button.danger{background:#b6352b;border-color:#9e2b23;color:#fff}
@media(max-width:900px){
  .communication-entry-top{grid-template-columns:1fr 1fr}
  .communication-entry-meta{grid-template-columns:1fr 1fr}
  .communication-email-area{grid-template-columns:1fr}
}
@media(max-width:600px){
  .communication-entry-top,.communication-entry-meta{grid-template-columns:1fr}
}


/* Compact inline Project Tasks */
.processing-task-table-wrap{overflow-x:auto}
.processing-task-table{width:100%;min-width:760px;border-collapse:collapse}
.processing-task-table th{font-size:10px;text-transform:uppercase;letter-spacing:.02em;text-align:left;padding:4px 5px;white-space:nowrap}
.processing-task-table td{padding:4px 5px;vertical-align:middle}
.processing-task-table input,.processing-task-table select{width:100%;min-width:0;height:30px;font-size:11px;padding:3px 5px}
.processing-task-table th:nth-child(1),.processing-task-table td:nth-child(1){width:17%}
.processing-task-table th:nth-child(2),.processing-task-table td:nth-child(2){width:24%}
.processing-task-table th:nth-child(3),.processing-task-table td:nth-child(3){width:14%}
.processing-task-table th:nth-child(4),.processing-task-table td:nth-child(4){width:13%}
.processing-task-table th:nth-child(5),.processing-task-table td:nth-child(5){width:20%}
.processing-task-table th:nth-child(6),.processing-task-table td:nth-child(6){width:10%}
.processing-task-inline-row{border-bottom:1px solid var(--line)}
.processing-task-inline-row.is-complete{opacity:.62;background:#f3f4f3}
.processing-task-new-row{background:#fbfcfb}
.processing-task-status-cell{white-space:nowrap}
.processing-task-status-cell form,.processing-task-remove-cell form{margin:0;display:inline-block}
.processing-task-status-cell{display:flex;gap:5px;align-items:center}
.task-complete-meta{font-size:10px;white-space:nowrap}
.button.compact{padding:4px 6px;min-height:26px;font-size:10px}
.processing-task-inline-row.autosaving{opacity:.72}
.processing-task-inline-row.autosave-ok{box-shadow:inset 3px 0 0 #3c8a4e}
.processing-task-inline-row.autosave-error{box-shadow:inset 3px 0 0 #b6352b}

.project-notes-card textarea{width:100%;min-height:120px;resize:vertical;border:1px solid var(--line);border-radius:5px;background:#fff;padding:8px;font:inherit;font-size:12px;line-height:1.35}
.project-notes-card textarea:focus{outline:2px solid rgba(67,130,49,.18);border-color:#6aa455}
.project-notes-save-hint{margin-top:4px;font-size:10px;color:var(--muted)}

/* FileMaker-style compact Processing task list */
.processing-task-table{min-width:0}
.processing-task-table th:nth-child(1),.processing-task-table td:nth-child(1){width:48%}
.processing-task-table th:nth-child(2),.processing-task-table td:nth-child(2){width:24%}
.processing-task-table th:nth-child(3),.processing-task-table td:nth-child(3){width:24%}
.processing-task-table th:nth-child(4),.processing-task-table td:nth-child(4){width:4%}
.processing-task-status-cell{justify-content:space-between}
.processing-task-remove-cell{text-align:right}


/* Project Documents & Photos */
.project-file-upload-form{border:1px solid var(--line);border-radius:7px;background:#f8fbff;padding:9px;margin-bottom:10px}
.project-file-upload-grid{display:grid;grid-template-columns:minmax(110px,.7fr) minmax(150px,1fr);gap:7px}
.project-file-caption{grid-column:1/-1}
.project-file-upload-grid label{display:flex;flex-direction:column;gap:3px;font-size:10px;font-weight:800}
.project-file-upload-grid select,.project-file-upload-grid input:not([type="checkbox"]){width:100%;min-width:0;height:30px;font-size:11px;padding:3px 5px}
.project-file-visibility{grid-column:1/-1;display:flex!important;flex-direction:row!important;align-items:center;gap:6px!important;width:max-content;max-width:100%;font-size:10px!important}
.project-file-visibility input[type="checkbox"]{width:14px;height:14px;min-width:14px;margin:0;padding:0}
.project-file-picker-row{display:flex;align-items:center;gap:7px;margin-top:7px}
.project-file-picker-row input[type="file"]{flex:1;min-width:0;font-size:11px}
.project-file-list{display:flex;flex-direction:column;gap:6px;max-height:330px;overflow:auto}
.project-file-row{display:grid;grid-template-columns:54px minmax(0,1fr) auto;gap:8px;align-items:center;border:1px solid var(--line);border-radius:7px;background:#fff;padding:6px}
.project-file-preview{width:54px;height:54px;display:flex;align-items:center;justify-content:center;overflow:hidden;border:1px solid var(--line);border-radius:5px;background:#f5f6f5}
.project-file-preview img{width:100%;height:100%;object-fit:cover;display:block}
.project-file-icon{font-size:10px;font-weight:800;color:var(--muted)}
.project-file-info{min-width:0}
.project-file-name{font-size:11px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.project-file-meta{font-size:9px;color:var(--muted);margin-top:2px}
.project-file-caption-text{font-size:10px;margin-top:3px}
.project-file-visibility-form{margin:4px 0 0}
.project-file-visibility-toggle{display:inline-flex;align-items:center;gap:5px;font-size:9px;font-weight:700;color:var(--muted);white-space:nowrap;cursor:pointer}
.project-file-visibility-toggle input[type="checkbox"]{width:13px;height:13px;margin:0;flex:0 0 auto}
.project-file-visibility-toggle input[type="checkbox"]:disabled{cursor:not-allowed}
.project-file-actions{display:flex;align-items:center;gap:4px;flex-wrap:wrap;justify-content:flex-end}
.project-file-actions form{margin:0}
@media(max-width:850px){
  .project-file-upload-grid{grid-template-columns:1fr}
  .project-file-row{grid-template-columns:46px minmax(0,1fr)}
  .project-file-actions{grid-column:1/-1;justify-content:flex-start}
}


/* Project Takeoff */
.takeoff-titlebar{margin-bottom:8px}
.takeoff-workspace{display:grid;grid-template-columns:300px minmax(0,1fr);gap:10px;align-items:start}
.takeoff-sidebar{display:flex;flex-direction:column;gap:8px;min-width:0}
.takeoff-sidebar-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
.takeoff-sidebar-tab{border:1px solid var(--line);border-radius:6px;background:#f5f6f5;color:var(--text);padding:7px 5px;font-size:10px;font-weight:800;cursor:pointer}
.takeoff-sidebar-tab:hover{background:#fff}
.takeoff-sidebar-tab.active{background:#2f6f35;border-color:#2f6f35;color:#fff;box-shadow:0 1px 2px rgba(0,0,0,.12)}
.takeoff-tab-panel[hidden]{display:none}
.takeoff-panel{padding:10px}
.takeoff-panel h2{font-size:14px;margin:0 0 8px}
.takeoff-panel-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}
.takeoff-field{display:flex;flex-direction:column;gap:3px;margin-bottom:7px;font-size:10px;font-weight:800}
.takeoff-field input,.takeoff-field select{width:100%;min-width:0;height:31px;font-size:11px;padding:4px 6px}
.takeoff-address-row{display:flex;gap:5px}
.takeoff-address-row input{flex:1}
.takeoff-tool-buttons{display:flex;gap:5px;margin-top:6px;flex-wrap:wrap}
.takeoff-tool-buttons .button{flex:1;min-width:76px}
.takeoff-measurement{margin-top:9px;border:1px solid var(--line);border-radius:6px;background:#fff;padding:8px}
.takeoff-measurement span{display:block;font-size:9px;color:var(--muted);font-weight:800;text-transform:uppercase}
.takeoff-measurement strong{display:block;font-size:19px;line-height:1.15;margin-top:2px}
.takeoff-measurement small{display:block;color:var(--muted);font-size:10px;margin-top:2px;min-height:12px}
.takeoff-save-button{width:100%;margin-top:7px}
.takeoff-saved-panel{min-height:150px}
.takeoff-saved-list{display:flex;flex-direction:column;gap:5px;max-height:300px;overflow:auto}
.takeoff-saved-row{display:flex;justify-content:space-between;gap:8px;align-items:center;border:1px solid var(--line);border-radius:5px;background:#fff;padding:6px}
.takeoff-saved-row>div:first-child{min-width:0}
.takeoff-saved-row strong{display:block;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.takeoff-saved-actions{display:flex;gap:3px;align-items:center}
.takeoff-map-panel{border:1px solid var(--line);border-radius:8px;background:#fff;overflow:hidden;min-width:0}
#takeoff-map{width:100%;height:680px}
@media(max-width:900px){
  .takeoff-workspace{grid-template-columns:1fr}
  #takeoff-map{height:560px}
}

.phase-takeoff-button{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;line-height:1}

.takeoff-tool-group{margin-top:8px}
.takeoff-tool-label{margin-bottom:4px;font-size:9px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.takeoff-marker-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
.takeoff-marker-buttons .button{width:100%}

.takeoff-cutout-parent-field[hidden]{display:none}
.takeoff-cutout-summary{color:var(--muted)}

.auto-takeoff-panel{border-color:#d49b54;background:#fffaf2}
.auto-takeoff-panel .badge{background:#f0e0c8;color:#6f4e22}
.auto-takeoff-step{border-top:1px solid var(--line);padding-top:8px;margin-top:8px}
.auto-takeoff-step-header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:5px;font-size:10px}
.auto-takeoff-step-header strong{font-size:10px}
.auto-takeoff-step-header span{color:var(--muted);font-size:9px;font-weight:700}
.auto-takeoff-step-header span.is-saved{color:#2f6f35;font-weight:900}
#auto-finish-work-area.is-saved{background:#e8f5e9;border-color:#7db583;color:#235b29;font-weight:800}


/* Customer-facing proposal preview */
.proposal-preview-body{margin:0;background:#eef1f2;color:#1d2329;font-family:Arial,Helvetica,sans-serif}
.proposal-preview-toolbar{width:min(980px,calc(100% - 32px));margin:18px auto 10px;display:flex;justify-content:flex-end;gap:8px}
.proposal-document{width:min(980px,calc(100% - 32px));min-height:1260px;margin:0 auto 36px;background:#fff;box-shadow:0 4px 22px rgba(0,0,0,.10);padding:48px 54px 42px}
.proposal-document-header{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:24px;align-items:end;margin-bottom:18px}
.proposal-company-brand{min-height:82px;display:flex;align-items:center}
.proposal-logo-placeholder{font-size:40px;font-weight:900;letter-spacing:.05em;color:#315c20;line-height:1}
.proposal-heading-meta{display:grid;grid-template-columns:1fr 1fr;gap:18px;min-width:330px}
.proposal-heading-meta div{display:flex;flex-direction:column;gap:3px}
.proposal-heading-meta span{font-size:11px;font-weight:800;text-transform:uppercase;color:#697078;letter-spacing:.05em}
.proposal-heading-meta strong{font-size:15px}
.proposal-party-grid{display:grid;grid-template-columns:1.05fr 1fr .95fr;gap:8px;margin-bottom:24px}
.proposal-party-card{border:1px solid #b8bec4;border-radius:6px;padding:11px 12px;min-height:150px;font-size:12px;line-height:1.35}
.proposal-party-card h2{font-size:12px;margin:0 0 6px;text-transform:uppercase;color:#41474d;letter-spacing:.03em}
.proposal-party-card>strong{display:block;font-size:13px;margin-bottom:1px}
.proposal-contact-block{margin-top:10px;padding-top:8px;border-top:1px solid #e1e4e6;display:grid;gap:2px}
.proposal-contact-block div{display:grid;grid-template-columns:88px 1fr;gap:6px}
.proposal-contact-block span,.proposal-inline-label{font-weight:800;color:#535a61}
.proposal-inline-label{margin-right:6px}
.proposal-services{margin-top:10px;border-bottom:2px solid #7e2e26}
.proposal-services-head,.proposal-service-row{display:grid;grid-template-columns:110px minmax(0,1fr) 120px;gap:14px}
.proposal-services-head{padding:7px 8px;border-bottom:2px solid #7e2e26;font-size:11px;text-transform:uppercase;font-weight:800;color:#454b50}
.proposal-services-head span:last-child{text-align:right}
.proposal-service-row{padding:14px 8px;border-bottom:1px solid #eceeef;min-height:74px}
.proposal-service-row:last-of-type{border-bottom:0}
.proposal-service-qty{display:flex;flex-direction:column;gap:2px;font-size:12px}
.proposal-service-qty strong{font-size:14px}
.proposal-service-qty span{color:#5f666c}
.proposal-service-copy>strong{display:block;font-size:14px;margin-bottom:4px}
.proposal-service-copy div{font-size:12px;line-height:1.45;color:#343a40}
.proposal-service-price{text-align:right;font-size:14px;font-weight:800;white-space:nowrap}
.proposal-no-lines{padding:28px;text-align:center;color:#777}
.proposal-total-row{margin:18px 0 0 auto;width:310px;display:flex;justify-content:space-between;align-items:center;border-bottom:2px solid #202428;padding:8px 4px;font-size:14px}
.proposal-total-row strong{font-size:18px}
.proposal-acceptance{display:grid;grid-template-columns:1fr 1fr;gap:42px;margin-top:52px}
.proposal-signature-caption{font-weight:800;font-size:12px;margin-bottom:24px}
.proposal-signature-line{border-bottom:1px solid #222;min-height:30px;font-size:13px;font-style:italic;padding:0 8px 5px}
.proposal-document-footer{margin-top:230px;border-top:3px solid #7e2e26;padding-top:8px;text-align:center;font-size:12px;font-weight:800}
.proposal-empty-state{text-align:center;padding:120px 20px}
.proposal-empty-state h1{margin:0 0 8px}
.proposal-empty-state p{color:#677078;margin:0 0 20px}
@media(max-width:760px){
  .proposal-document{width:100%;margin:0;min-height:0;padding:28px 22px;box-shadow:none}
  .proposal-preview-toolbar{width:calc(100% - 24px)}
  .proposal-document-header,.proposal-party-grid,.proposal-acceptance{grid-template-columns:1fr}
  .proposal-heading-meta{min-width:0}
  .proposal-services-head,.proposal-service-row{grid-template-columns:82px minmax(0,1fr) 90px;gap:8px}
  .proposal-document-footer{margin-top:100px}
}
@media print{
  @page{size:letter;margin:.42in}
  .proposal-preview-body{background:#fff}
  .proposal-preview-toolbar{display:none!important}
  .proposal-document{width:auto;min-height:0;margin:0;box-shadow:none;padding:0}
  .proposal-document-footer{margin-top:2.1in}
}

.proposal-settings-current-logo{margin-top:18px;display:grid;gap:8px}
.proposal-settings-current-logo img{max-width:260px;max-height:100px;object-fit:contain;border:1px solid var(--line);border-radius:8px;background:#fff;padding:8px}
.proposal-signature-preview{max-width:260px;max-height:90px;object-fit:contain;background:#fff}
.proposal-company-logo{max-width:320px;max-height:86px;object-fit:contain;object-position:left center}
.proposal-rep-signature{max-width:220px;max-height:58px;object-fit:contain;object-position:left bottom}
.proposal-terms-row{margin-top:18px;padding:9px 0;border-top:1px solid #d7dadd;border-bottom:1px solid #d7dadd;display:grid;grid-template-columns:120px 1fr;gap:12px;font-size:12px}
.proposal-validity-note{margin-top:9px;font-size:11px;color:#555d64}

.proposal-package-form{display:grid;gap:14px}
.proposal-package-options{display:grid;gap:8px}
.proposal-package-choice{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:center;border:1px solid var(--line);border-radius:8px;padding:10px 12px;background:#fff;cursor:pointer}
.proposal-package-choice.locked{background:#f5f7f5;cursor:default}
.proposal-package-choice input{margin:0}
.proposal-package-choice span{display:grid;gap:2px}
.proposal-package-choice small{color:var(--muted);font-size:12px}
.proposal-package-errors{border:1px solid #c76767;background:#fff2f2;border-radius:8px;padding:10px 12px}
.proposal-package-errors ul{margin:0;padding-left:20px}

.proposal-package-success{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid #8db58b;background:#f1f8ef;border-radius:8px;padding:10px 12px;margin-bottom:14px}
.proposal-package-success strong{color:#315c20}
.proposal-package-success span{flex:1;min-width:260px}

.crew-color-preview{display:inline-block;min-width:120px;padding:6px 10px;border-radius:6px;background:var(--crew-bg);color:var(--crew-text);font-weight:700}
.schedule-page-header{align-items:flex-end}
.schedule-week-nav{display:flex;gap:8px;flex-wrap:wrap}
.schedule-board-wrap{overflow-x:auto;padding-bottom:8px}
.schedule-week-grid{display:grid;grid-template-columns:repeat(7,minmax(190px,1fr));gap:8px;min-width:1380px}
.schedule-day-column{border:1px solid var(--line);border-radius:10px;background:#f7f8f9;min-height:620px;overflow:hidden}
.schedule-day-column.today{box-shadow:0 0 0 2px rgba(66,104,146,.2)}
.schedule-day-header{display:grid;grid-template-columns:1fr auto;align-items:center;gap:2px;padding:10px 12px;background:#fff;border-bottom:1px solid var(--line)}
.schedule-day-header span{font-size:12px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.schedule-day-header strong{font-size:16px}
.schedule-day-header small{grid-column:1 / -1;font-size:11px;color:var(--muted)}
.schedule-day-body{display:grid;align-content:start;gap:8px;padding:8px}
.schedule-card{background:var(--crew-bg);color:var(--crew-text);border-radius:8px;padding:9px 10px;border:1px solid rgba(0,0,0,.12);box-shadow:0 1px 2px rgba(0,0,0,.05)}
.schedule-card.complete{opacity:.68}
.schedule-card-topline{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:5px}
.schedule-crew-name{font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.03em}
.schedule-complete-mark{font-weight:900}
.schedule-card-link{display:grid;gap:2px;color:inherit;text-decoration:none}
.schedule-card-link:hover{text-decoration:underline}
.schedule-card-link strong{font-size:13px}
.schedule-card-link span{font-size:12px;line-height:1.25}
.schedule-card-meta{display:grid;gap:1px;margin-top:7px;padding-top:6px;border-top:1px solid currentColor;font-size:10.5px;line-height:1.25;opacity:.9}
.schedule-day-empty{padding:18px 8px;text-align:center;color:var(--muted);font-size:12px}
.schedule-stage-note{margin-top:12px}
@media(max-width:900px){
  .schedule-page-header{align-items:stretch}
}

.schedule-filter-bar{display:flex;align-items:end;gap:10px;flex-wrap:wrap;margin:0 0 12px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#fff}
.schedule-filter-bar label{display:grid;gap:4px;min-width:190px}
.schedule-filter-bar label>span{font-size:11px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.schedule-filter-bar select{min-height:38px}
.schedule-csrf-form{display:none}
.schedule-board-message{margin:0 0 10px;padding:9px 11px;border:1px solid #8db58b;background:#f1f8ef;border-radius:8px}
.schedule-board-message.error{border-color:#c76767;background:#fff2f2}
.schedule-card-actions{display:flex;align-items:center;gap:5px}
.schedule-drag-handle{display:inline-grid;place-items:center;width:24px;height:24px;padding:0;border:1px solid currentColor;border-radius:5px;background:rgba(255,255,255,.32);color:inherit;font-size:16px;line-height:1;cursor:grab;opacity:.78}
.schedule-drag-handle:hover{opacity:1;background:rgba(255,255,255,.5)}
.schedule-drag-handle:active{cursor:grabbing}
.schedule-card.dragging{opacity:.42}
.schedule-card.saving{opacity:.55;pointer-events:none}
.schedule-day-body.drag-over{outline:2px dashed #516b85;outline-offset:-4px;background:#eef4fa}

.schedule-view-toggle{display:inline-flex;gap:4px;padding:3px;border:1px solid var(--line);border-radius:8px;background:#fff}
.schedule-view-toggle .button{min-width:72px;text-align:center}
.schedule-month-wrap{overflow-x:auto}
.schedule-month-weekdays,.schedule-month-grid{display:grid;grid-template-columns:repeat(7,minmax(145px,1fr));min-width:1080px}
.schedule-month-weekdays{border:1px solid var(--line);border-bottom:0;border-radius:10px 10px 0 0;background:#fff}
.schedule-month-weekdays span{padding:8px 10px;font-size:11px;font-weight:800;text-transform:uppercase;color:var(--muted);border-right:1px solid var(--line)}
.schedule-month-weekdays span:last-child{border-right:0}
.schedule-month-grid{border-left:1px solid var(--line);border-top:1px solid var(--line)}
.schedule-month-day{min-height:170px;background:#fff;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}
.schedule-month-day.outside-month{background:#f5f6f7}
.schedule-month-day.today{box-shadow:inset 0 0 0 2px rgba(66,104,146,.28)}
.schedule-month-day-header{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;border-bottom:1px solid #eceeef}
.schedule-month-day-header strong{font-size:12px}
.schedule-month-day-header small{font-size:10px;color:var(--muted)}
.schedule-month-day-body{min-height:135px;padding:5px;display:grid;align-content:start;gap:4px}
.schedule-month-day-body.drag-over{outline:2px dashed #516b85;outline-offset:-3px;background:#eef4fa}
.schedule-month-card{background:var(--crew-bg);color:var(--crew-text);border:1px solid rgba(0,0,0,.12);border-radius:6px;padding:5px 6px;box-shadow:0 1px 1px rgba(0,0,0,.04)}
.schedule-month-card.complete{opacity:.68}
.schedule-month-card.dragging{opacity:.42}
.schedule-month-card.saving{opacity:.55;pointer-events:none}
.schedule-month-card-top{display:flex;align-items:center;justify-content:space-between;gap:4px}
.schedule-month-crew{font-size:9px;font-weight:900;text-transform:uppercase;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.schedule-month-card .schedule-drag-handle{width:20px;height:20px;font-size:13px;flex:0 0 auto}
.schedule-month-card-link{display:grid;gap:1px;color:inherit;text-decoration:none;margin-top:2px}
.schedule-month-card-link:hover{text-decoration:underline}
.schedule-month-card-link strong{font-size:11px}
.schedule-month-card-link span{font-size:10px;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.schedule-month-hidden{display:grid;gap:4px}
.schedule-more-button{border:0;background:transparent;padding:3px 2px;text-align:left;font-size:10.5px;font-weight:800;color:#4f6479;cursor:pointer}
.schedule-more-button:hover{text-decoration:underline}


/* Daily Job Report / field shell */
.daily-report-shell{max-width:1280px;margin:0 auto;display:flex;flex-direction:column;gap:12px}
.daily-report-topbar{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}
.daily-report-topbar h1{margin:2px 0 4px;font-size:26px;letter-spacing:-.025em}
.daily-report-topbar p{margin:0;color:var(--muted);font-size:12px}
.daily-report-status{display:flex;flex-direction:column;align-items:flex-end;gap:4px}
.daily-report-status small{font-size:10px;color:var(--muted)}
.daily-report-summary{border:1px solid var(--line);border-radius:9px;background:#fff;padding:10px}
.daily-summary-main{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:7px}
.daily-summary-main>div,.daily-site-ops-grid>div{border:1px solid var(--line);border-radius:6px;background:#f8faf9;padding:7px;min-width:0}
.daily-summary-main span,.daily-site-ops-grid span{display:block;font-size:9px;font-weight:800;text-transform:uppercase;color:var(--muted);letter-spacing:.04em;margin-bottom:2px}
.daily-summary-main strong,.daily-site-ops-grid strong{display:block;font-size:11px;line-height:1.3}
.daily-summary-main small{display:block;font-size:9px;color:var(--muted);margin-top:2px;line-height:1.3}
.daily-site-ops{margin-top:8px;padding-top:8px;border-top:1px solid var(--line)}
.daily-site-ops-title{font-size:10px;font-weight:800;text-transform:uppercase;color:var(--muted);margin-bottom:5px}
.daily-site-ops-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.daily-site-ops-grid .wide{grid-column:span 2}
.daily-report-two-column{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}
.daily-report-two-column .panel{padding:10px;min-width:0}
.daily-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;margin-bottom:7px}
.daily-section-head h2{font-size:14px;margin:0 0 2px}
.daily-section-head p{font-size:10px;color:var(--muted);margin:0}
.daily-report-note-form{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;align-items:end;margin-bottom:8px}
.daily-report-note-form textarea{width:100%;min-height:66px;resize:vertical;border:1px solid var(--line);border-radius:6px;padding:7px;font:inherit;font-size:11px}
.daily-note-list{display:flex;flex-direction:column;gap:5px;max-height:270px;overflow:auto}
.daily-note-row{border:1px solid var(--line);border-radius:6px;padding:7px;background:#fff}
.daily-note-head{display:flex;align-items:center;gap:4px;flex-wrap:wrap}
.daily-note-head small{margin-left:auto;color:var(--muted);font-size:9px}
.daily-note-body{font-size:11px;line-height:1.35;margin:5px 0}
.daily-note-row>small{font-size:9px;color:var(--muted)}
.daily-quick-upload{border:1px solid var(--line);border-radius:6px;background:#f8fbff;padding:7px;margin-bottom:8px}
.daily-quick-upload>input[type="text"]{width:100%;height:29px;border:1px solid var(--line);border-radius:5px;padding:4px 6px;font-size:11px;margin-bottom:5px}
.daily-upload-row{display:flex;align-items:center;gap:6px}
.daily-upload-row input[type="file"]{min-width:0;flex:1;font-size:10px}
.daily-quick-upload small{display:block;font-size:9px;color:var(--muted);margin-top:4px}
.daily-file-list{display:flex;flex-direction:column;gap:5px;max-height:270px;overflow:auto}
.daily-file-row{display:grid;grid-template-columns:64px minmax(0,1fr) auto;gap:7px;align-items:center;border:1px solid var(--line);border-radius:6px;padding:6px;background:#fff}
.daily-file-icon,.daily-file-thumb-link{width:64px;height:48px;border:1px solid var(--line);border-radius:5px;background:#f5f6f5;display:grid;place-items:center;overflow:hidden;font-size:9px;font-weight:800;color:var(--muted)}
.daily-file-thumb-link{padding:0}
.daily-file-thumb{width:100%;height:100%;display:block;object-fit:cover}
.daily-file-info{min-width:0}
.daily-file-info strong{display:block;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.daily-file-info small{display:block;font-size:8px;color:var(--muted);margin-top:1px}
.daily-file-info span{display:block;font-size:9px;margin-top:2px}
.daily-file-actions{display:flex;gap:3px;align-items:center}
.daily-field-entry-section{border:1px solid var(--line);border-radius:9px;background:#fff;padding:10px}
.daily-field-entry-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}
.daily-entry-panel{display:flex;justify-content:space-between;align-items:center;gap:6px;border:1px solid var(--line);border-radius:7px;background:#f8faf9;padding:8px}
.daily-entry-panel>div{min-width:0}
.daily-entry-label{display:block;font-size:10px;font-weight:800}
.daily-entry-panel strong{font-size:17px;line-height:1;margin-right:2px}
.daily-entry-panel small{font-size:8px;color:var(--muted)}
.daily-report-submit{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid #aac9a8;border-radius:9px;background:#eff7ed;padding:10px}
.daily-report-submit strong{font-size:12px}
.daily-report-submit p{margin:2px 0 0;font-size:10px;color:var(--muted)}
.daily-report-submit form{margin:0}
@media(max-width:1050px){
  .daily-summary-main{grid-template-columns:repeat(3,minmax(0,1fr))}
  .daily-field-entry-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:850px){
  .daily-report-two-column{grid-template-columns:1fr}
  .daily-site-ops-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:620px){
  .daily-report-topbar,.daily-report-submit{flex-direction:column;align-items:stretch}
  .daily-report-status{align-items:flex-start}
  .daily-summary-main{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-field-entry-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-report-note-form{grid-template-columns:1fr}
  .daily-file-row{grid-template-columns:56px minmax(0,1fr)}
  .daily-file-icon,.daily-file-thumb-link{width:56px;height:44px}
  .daily-file-actions{grid-column:1/-1}
}

.schedule-daily-report-link{display:inline-flex;align-items:center;justify-content:center;margin-top:5px;padding:4px 6px;border:1px solid rgba(0,0,0,.14);border-radius:5px;background:rgba(255,255,255,.72);font-size:9px;font-weight:800}
.schedule-daily-report-link:hover{background:#fff}
.schedule-month-report-link{display:inline-block;margin-top:3px;font-size:8px;font-weight:800;text-decoration:underline;text-underline-offset:2px}

.daily-plan-section{border:1px solid var(--line);border-radius:9px;background:#fff;padding:10px}
.daily-plan-grid{display:grid;grid-template-columns:1.15fr repeat(4,minmax(0,1fr));gap:6px}
.daily-plan-card{border:1px solid var(--line);border-radius:7px;background:#f8faf9;padding:8px;min-width:0}
.daily-plan-scope{background:#f3f7fb}
.daily-plan-label{display:block;font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin-bottom:5px}
.daily-plan-card>strong{display:block;font-size:15px;line-height:1.15}
.daily-plan-card>small{display:block;font-size:9px;color:var(--muted);margin-top:3px;line-height:1.3}
.daily-plan-row{padding:4px 0;border-bottom:1px solid var(--line)}
.daily-plan-row:last-child{border-bottom:0}
.daily-plan-row strong{display:block;font-size:10px;line-height:1.25}
.daily-plan-row small{display:block;font-size:8px;color:var(--muted);margin-top:1px}
.daily-plan-empty{font-size:9px;color:var(--muted);font-style:italic}
.daily-plan-tags{display:flex;flex-wrap:wrap;gap:3px;margin-top:6px}
.daily-plan-tags span{font-size:8px;font-weight:700;border:1px solid var(--line);border-radius:999px;background:#fff;padding:2px 5px}
@media(max-width:1100px){
  .daily-plan-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:760px){
  .daily-plan-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:520px){
  .daily-plan-grid{grid-template-columns:1fr}
}

/* Stage 3A actual labor entry */
.daily-labor-panel{border:1px solid var(--line);border-radius:8px;background:#f8faf9;padding:9px;margin-bottom:8px}
.daily-labor-panel-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:7px}
.daily-labor-panel-head>div{display:flex;align-items:baseline;gap:5px}
.daily-labor-panel-head>div>strong{font-size:18px;line-height:1}
.daily-labor-panel-head>div>small{font-size:8px;color:var(--muted)}
.daily-labor-form{display:grid;grid-template-columns:1.5fr 1.25fr .7fr .7fr .65fr .7fr 1.4fr auto;gap:5px;align-items:end}
.daily-labor-form label{display:flex;flex-direction:column;gap:2px;min-width:0}
.daily-labor-form label>span{font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-labor-form select,.daily-labor-form input{width:100%;min-width:0;height:30px;border:1px solid var(--line);border-radius:5px;background:#fff;padding:3px 5px;font:inherit;font-size:10px}
.daily-labor-add-button{height:30px;white-space:nowrap}
.daily-labor-form-help{font-size:8px;color:var(--muted);margin:4px 0 7px}
.daily-labor-list{display:flex;flex-direction:column;gap:5px}
.daily-labor-row{border:1px solid var(--line);border-radius:6px;background:#fff;padding:7px}
.daily-labor-row.is-verified{background:#f3f8f1}
.daily-labor-row-main{display:grid;grid-template-columns:1.6fr 1.1fr 1.2fr .7fr .7fr auto;gap:8px;align-items:center}
.daily-labor-row-main>div{min-width:0}
.daily-labor-row-main>div>span:not(.badge){display:block;font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-labor-row-main>div>strong{display:block;font-size:10px;line-height:1.25}
.daily-labor-row-main>div:first-child>strong{font-size:11px}
.daily-labor-row-main>div:first-child>small{display:block;font-size:8px;color:var(--muted);margin-top:1px}
.daily-labor-total strong{font-size:13px!important}
.daily-labor-verified{text-align:right}
.daily-labor-row-notes{font-size:9px;color:var(--muted);margin-top:5px;padding-top:5px;border-top:1px solid var(--line)}
.daily-labor-inline-actions{display:flex;justify-content:flex-end;align-items:center;gap:4px;white-space:nowrap}
.daily-labor-inline-actions form{margin:0}
.daily-labor-inline-actions .button{min-height:25px;padding:3px 7px;font-size:9px}
.daily-labor-edit-panel{margin-top:6px;padding-top:6px;border-top:1px solid var(--line)}
.daily-labor-edit-panel[hidden]{display:none}
.daily-field-entry-grid-pending{grid-template-columns:repeat(5,minmax(0,1fr))}
@media(max-width:1100px){
  .daily-labor-form{grid-template-columns:repeat(4,minmax(0,1fr))}
  .daily-labor-notes{grid-column:span 2}
  .daily-labor-add-button{grid-column:span 2}
  .daily-labor-row-main{grid-template-columns:1.5fr 1fr 1.1fr .65fr .65fr auto}
  .daily-field-entry-grid-pending{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:760px){
  .daily-labor-form{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-labor-notes,.daily-labor-add-button{grid-column:span 2}
  .daily-labor-row-main{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-labor-inline-actions{grid-column:1/-1;justify-content:flex-start}
  .daily-field-entry-grid-pending{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* Stage 3B actual equipment entry */
.daily-equipment-panel{border:1px solid var(--line);border-radius:8px;background:#f8faf9;padding:9px;margin-bottom:8px}
.daily-equipment-panel-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:7px}
.daily-equipment-panel-head>div:first-child{display:flex;align-items:baseline;gap:5px}
.daily-equipment-panel-head>div:first-child>strong{font-size:18px;line-height:1}
.daily-equipment-panel-head>div:first-child>small{font-size:8px;color:var(--muted)}
.daily-equipment-head-actions form{margin:0}
.daily-load-estimate{white-space:nowrap}
.daily-equipment-form{display:grid;grid-template-columns:1.4fr 1.5fr .55fr .7fr 1.5fr auto;gap:5px;align-items:end}
.daily-equipment-form label{display:flex;flex-direction:column;gap:2px;min-width:0}
.daily-equipment-form label>span{font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-equipment-form select,.daily-equipment-form input{width:100%;min-width:0;height:30px;border:1px solid var(--line);border-radius:5px;background:#fff;padding:3px 5px;font:inherit;font-size:10px}
.daily-equipment-add-button{height:30px;white-space:nowrap}
.daily-equipment-list{display:flex;flex-direction:column;gap:5px;margin-top:7px}
.daily-equipment-row{border:1px solid var(--line);border-radius:6px;background:#fff;padding:7px}
.daily-equipment-row.is-verified{background:#f3f8f1}
.daily-equipment-row-main{display:grid;grid-template-columns:1.8fr .55fr .8fr auto;gap:8px;align-items:center}
.daily-equipment-row-main>div{min-width:0}
.daily-equipment-row-main>div>span:not(.badge){display:block;font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-equipment-row-main>div>strong{display:block;font-size:10px;line-height:1.25}
.daily-equipment-row-main>div:first-child>strong{font-size:11px}
.daily-equipment-row-main>div:first-child>small{display:block;font-size:8px;color:var(--muted);margin-top:1px}
.daily-equipment-total strong{font-size:13px!important}
.daily-equipment-verified{text-align:right}
.daily-equipment-inline-actions{display:flex;justify-content:flex-end;align-items:center;gap:4px;white-space:nowrap}
.daily-equipment-inline-actions form{margin:0}
.daily-equipment-inline-actions .button{min-height:25px;padding:3px 7px;font-size:9px}
.daily-equipment-row-notes{font-size:9px;color:var(--muted);margin-top:5px;padding-top:5px;border-top:1px solid var(--line)}
.daily-equipment-edit-panel{margin-top:6px;padding-top:6px;border-top:1px solid var(--line)}
.daily-equipment-edit-panel[hidden]{display:none}
@media(max-width:1100px){
  .daily-equipment-form{grid-template-columns:repeat(3,minmax(0,1fr))}
  .daily-equipment-notes{grid-column:span 2}
  .daily-equipment-add-button{grid-column:span 1}
  .daily-equipment-row-main{grid-template-columns:1.6fr .5fr .7fr auto}
}
@media(max-width:760px){
  .daily-equipment-panel-head{align-items:flex-start}
  .daily-equipment-form{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-equipment-notes,.daily-equipment-add-button{grid-column:span 2}
  .daily-equipment-row-main{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-equipment-inline-actions{grid-column:1/-1;justify-content:flex-start}
}

/* Stage 3C actual material entry */
.daily-material-panel{border:1px solid var(--line);border-radius:8px;background:#f8faf9;padding:9px;margin-bottom:8px}
.daily-material-panel-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:7px}
.daily-material-panel-head>div:first-child{display:flex;align-items:baseline;gap:5px}
.daily-material-panel-head>div:first-child>strong{font-size:18px;line-height:1}
.daily-material-panel-head>div:first-child>small{font-size:8px;color:var(--muted)}
.daily-material-head-actions form{margin:0}
.daily-material-form{display:grid;grid-template-columns:1.7fr .7fr .65fr 1.6fr auto;gap:5px;align-items:end}
.daily-material-form label{display:flex;flex-direction:column;gap:2px;min-width:0}
.daily-material-form label>span{font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-material-form select,.daily-material-form input{width:100%;min-width:0;height:30px;border:1px solid var(--line);border-radius:5px;background:#fff;padding:3px 5px;font:inherit;font-size:10px}
.daily-material-add-button{height:30px;white-space:nowrap}
.daily-material-list{display:flex;flex-direction:column;gap:5px;margin-top:7px}
.daily-material-row{border:1px solid var(--line);border-radius:6px;background:#fff;padding:7px}
.daily-material-row.is-verified{background:#f3f8f1}
.daily-material-row-main{display:grid;grid-template-columns:1.8fr 1fr auto;gap:8px;align-items:center}
.daily-material-row-main>div{min-width:0}
.daily-material-row-main>div>span:not(.badge){display:block;font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-material-row-main>div>strong{display:block;font-size:10px;line-height:1.25}
.daily-material-row-main>div:first-child>strong{font-size:11px}
.daily-material-row-main>div:first-child>small{display:block;font-size:8px;color:var(--muted);margin-top:1px}
.daily-material-total strong{font-size:13px!important}
.daily-material-verified{text-align:right}
.daily-material-inline-actions{display:flex;justify-content:flex-end;align-items:center;gap:4px;white-space:nowrap}
.daily-material-inline-actions form{margin:0}
.daily-material-inline-actions .button{min-height:25px;padding:3px 7px;font-size:9px}
.daily-material-row-notes{font-size:9px;color:var(--muted);margin-top:5px;padding-top:5px;border-top:1px solid var(--line)}
.daily-material-edit-panel{margin-top:6px;padding-top:6px;border-top:1px solid var(--line)}
.daily-material-edit-panel[hidden]{display:none}
@media(max-width:1100px){
  .daily-material-form{grid-template-columns:repeat(3,minmax(0,1fr))}
  .daily-material-notes{grid-column:span 2}
  .daily-material-add-button{grid-column:span 1}
}
@media(max-width:760px){
  .daily-material-panel-head{align-items:flex-start}
  .daily-material-form{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-material-notes,.daily-material-add-button{grid-column:span 2}
  .daily-material-row-main{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-material-inline-actions{grid-column:1/-1;justify-content:flex-start}
}

/* Stage 3D actual trucking entry */
.daily-trucking-panel{border:1px solid var(--line);border-radius:8px;background:#f8faf9;padding:9px;margin-bottom:8px}
.daily-trucking-panel-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:7px}
.daily-trucking-panel-head>div:first-child{display:flex;align-items:baseline;gap:5px}
.daily-trucking-panel-head>div:first-child>strong{font-size:18px;line-height:1}
.daily-trucking-panel-head>div:first-child>small{font-size:8px;color:var(--muted)}
.daily-trucking-head-actions form{margin:0}
.daily-trucking-form{display:grid;grid-template-columns:1.25fr .8fr 1.35fr .55fr .7fr .6fr 1.35fr auto;gap:5px;align-items:end}
.daily-trucking-form label{display:flex;flex-direction:column;gap:2px;min-width:0}
.daily-trucking-form label>span{font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-trucking-form select,.daily-trucking-form input{width:100%;min-width:0;height:30px;border:1px solid var(--line);border-radius:5px;background:#fff;padding:3px 5px;font:inherit;font-size:10px}
.daily-trucking-add-button{height:30px;white-space:nowrap}
.daily-trucking-list{display:flex;flex-direction:column;gap:5px;margin-top:7px}
.daily-trucking-row{border:1px solid var(--line);border-radius:6px;background:#fff;padding:7px}
.daily-trucking-row.is-verified{background:#f3f8f1}
.daily-trucking-row-main{display:grid;grid-template-columns:1.45fr 1.35fr .5fr .7fr auto;gap:8px;align-items:center}
.daily-trucking-row-main>div{min-width:0}
.daily-trucking-row-main>div>span:not(.badge){display:block;font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-trucking-row-main>div>strong{display:block;font-size:10px;line-height:1.25}
.daily-trucking-row-main>div:first-child>strong{font-size:11px}
.daily-trucking-row-main>div:first-child>small{display:block;font-size:8px;color:var(--muted);margin-top:1px}
.daily-trucking-total strong{font-size:13px!important}
.daily-trucking-verified{text-align:right}
.daily-trucking-inline-actions{display:flex;justify-content:flex-end;align-items:center;gap:4px;white-space:nowrap}
.daily-trucking-inline-actions form{margin:0}
.daily-trucking-inline-actions .button{min-height:25px;padding:3px 7px;font-size:9px}
.daily-trucking-row-notes{font-size:9px;color:var(--muted);margin-top:5px;padding-top:5px;border-top:1px solid var(--line)}
.daily-trucking-edit-panel{margin-top:6px;padding-top:6px;border-top:1px solid var(--line)}
.daily-trucking-edit-panel[hidden]{display:none}
@media(max-width:1100px){
  .daily-trucking-form{grid-template-columns:repeat(4,minmax(0,1fr))}
  .daily-trucking-notes{grid-column:span 2}
  .daily-trucking-add-button{grid-column:span 1}
}
@media(max-width:760px){
  .daily-trucking-panel-head{align-items:flex-start}
  .daily-trucking-form{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-trucking-notes,.daily-trucking-add-button{grid-column:span 2}
  .daily-trucking-row-main{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-trucking-inline-actions{grid-column:1/-1;justify-content:flex-start}
}

.js-trucking-source-field[hidden]{display:none}


/* Stage 3E actual subcontractor entry */
.daily-subcontractor-panel{border:1px solid var(--line);border-radius:8px;background:#f8faf9;padding:9px;margin-bottom:8px}
.daily-subcontractor-panel-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:7px}
.daily-subcontractor-panel-head>div:first-child{display:flex;align-items:baseline;gap:5px}
.daily-subcontractor-panel-head>div:first-child>strong{font-size:18px;line-height:1}
.daily-subcontractor-panel-head>div:first-child>small{font-size:8px;color:var(--muted)}
.daily-subcontractor-head-actions form{margin:0}
.daily-subcontractor-form{display:grid;grid-template-columns:1.35fr 1.8fr .55fr 1.4fr auto;gap:5px;align-items:end}
.daily-subcontractor-form label{display:flex;flex-direction:column;gap:2px;min-width:0}
.daily-subcontractor-form label>span{font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-subcontractor-form select,.daily-subcontractor-form input{width:100%;min-width:0;height:30px;border:1px solid var(--line);border-radius:5px;background:#fff;padding:3px 5px;font:inherit;font-size:10px}
.daily-subcontractor-add-button{height:30px;white-space:nowrap}
.daily-subcontractor-list{display:flex;flex-direction:column;gap:5px;margin-top:7px}
.daily-subcontractor-row{border:1px solid var(--line);border-radius:6px;background:#fff;padding:7px}
.daily-subcontractor-row.is-verified{background:#f3f8f1}
.daily-subcontractor-row-main{display:grid;grid-template-columns:2fr .55fr auto;gap:8px;align-items:center}
.daily-subcontractor-row-main>div{min-width:0}
.daily-subcontractor-row-main>div>span:not(.badge){display:block;font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-subcontractor-row-main>div>strong{display:block;font-size:10px;line-height:1.25}
.daily-subcontractor-row-main>div:first-child>strong{font-size:11px}
.daily-subcontractor-row-main>div:first-child>small{display:block;font-size:8px;color:var(--muted);margin-top:1px}
.daily-subcontractor-total strong{font-size:13px!important}
.daily-subcontractor-verified{text-align:right}
.daily-subcontractor-inline-actions{display:flex;justify-content:flex-end;align-items:center;gap:4px;white-space:nowrap}
.daily-subcontractor-inline-actions form{margin:0}
.daily-subcontractor-inline-actions .button{min-height:25px;padding:3px 7px;font-size:9px}
.daily-subcontractor-row-notes{font-size:9px;color:var(--muted);margin-top:5px;padding-top:5px;border-top:1px solid var(--line)}
.daily-subcontractor-edit-panel{margin-top:6px;padding-top:6px;border-top:1px solid var(--line)}
.daily-subcontractor-edit-panel[hidden]{display:none}
@media(max-width:1100px){
  .daily-subcontractor-form{grid-template-columns:repeat(3,minmax(0,1fr))}
  .daily-subcontractor-description,.daily-subcontractor-notes{grid-column:span 1}
}
@media(max-width:760px){
  .daily-subcontractor-panel-head{align-items:flex-start}
  .daily-subcontractor-form{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-subcontractor-description,.daily-subcontractor-notes,.daily-subcontractor-add-button{grid-column:span 2}
  .daily-subcontractor-row-main{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-subcontractor-inline-actions{grid-column:1/-1;justify-content:flex-start}
}


/* Stage 3F actual misc expense entry */
.daily-expense-panel{border:1px solid var(--line);border-radius:8px;background:#f8faf9;padding:9px;margin-bottom:8px}
.daily-expense-panel-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:7px}
.daily-expense-panel-head>div:first-child{display:flex;align-items:baseline;gap:5px}
.daily-expense-panel-head>div:first-child>strong{font-size:18px;line-height:1}
.daily-expense-panel-head>div:first-child>small{font-size:8px;color:var(--muted)}
.daily-expense-head-actions form{margin:0}
.daily-expense-form{display:grid;grid-template-columns:1.8fr .55fr .7fr 1.4fr auto;gap:5px;align-items:end}
.daily-expense-form label{display:flex;flex-direction:column;gap:2px;min-width:0}
.daily-expense-form label>span{font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-expense-form input{width:100%;min-width:0;height:30px;border:1px solid var(--line);border-radius:5px;background:#fff;padding:3px 5px;font:inherit;font-size:10px}
.daily-expense-add-button{height:30px;white-space:nowrap}
.daily-expense-list{display:flex;flex-direction:column;gap:5px;margin-top:7px}
.daily-expense-row{border:1px solid var(--line);border-radius:6px;background:#fff;padding:7px}
.daily-expense-row.is-verified{background:#f3f8f1}
.daily-expense-row-main{display:grid;grid-template-columns:2fr .55fr .8fr auto;gap:8px;align-items:center}
.daily-expense-row-main>div{min-width:0}
.daily-expense-row-main>div>span:not(.badge){display:block;font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.daily-expense-row-main>div>strong{display:block;font-size:10px;line-height:1.25}
.daily-expense-row-main>div:first-child>strong{font-size:11px}
.daily-expense-total strong{font-size:13px!important}
.daily-expense-verified{text-align:right}
.daily-expense-inline-actions{display:flex;justify-content:flex-end;align-items:center;gap:4px;white-space:nowrap}
.daily-expense-inline-actions form{margin:0}
.daily-expense-inline-actions .button{min-height:25px;padding:3px 7px;font-size:9px}
.daily-expense-row-notes{font-size:9px;color:var(--muted);margin-top:5px;padding-top:5px;border-top:1px solid var(--line)}
.daily-expense-edit-panel{margin-top:6px;padding-top:6px;border-top:1px solid var(--line)}
.daily-expense-edit-panel[hidden]{display:none}
@media(max-width:760px){
  .daily-expense-panel-head{align-items:flex-start}
  .daily-expense-form{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-expense-description,.daily-expense-notes,.daily-expense-add-button{grid-column:span 2}
  .daily-expense-row-main{grid-template-columns:repeat(2,minmax(0,1fr))}
  .daily-expense-inline-actions{grid-column:1/-1;justify-content:flex-start}
}


/* Stage 4A office job costing */
.processing-phase-actions{display:flex;gap:6px;flex-wrap:wrap}
.office-costing-page{display:flex;flex-direction:column;gap:12px}
.office-costing-header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.office-costing-header h1{margin:2px 0 4px}
.office-costing-header p{margin:0;color:var(--muted)}
.office-costing-header-actions{display:flex;gap:6px;flex-wrap:wrap}
.office-costing-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.office-costing-summary>div{border:1px solid var(--line);border-radius:8px;background:#fff;padding:10px}
.office-costing-summary span,.office-cost-row-summary span{display:block;font-size:9px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.office-costing-summary strong{font-size:18px}
.office-cost-section{border:1px solid var(--line);border-radius:9px;background:#f8faf9;padding:10px}
.office-cost-section-head{display:flex;justify-content:space-between;gap:12px;align-items:center}
.office-cost-section-head h2{margin:0}
.office-cost-section-head>div:first-child>span{font-size:9px;color:var(--muted)}
.office-cost-section-totals{display:flex;gap:14px;flex-wrap:wrap}
.office-cost-section-totals span{font-size:9px;color:var(--muted)}
.office-cost-section-totals strong{display:block;font-size:13px;color:var(--text)}
.office-cost-add{margin-top:8px}
.office-cost-add>summary{display:inline-flex;list-style:none;cursor:pointer}
.office-cost-form{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;align-items:end;margin-top:8px;padding:8px;border:1px solid var(--line);border-radius:7px;background:#fff}
.office-cost-form label{display:flex;flex-direction:column;gap:2px;min-width:0}
.office-cost-form label>span{font-size:8px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.office-cost-form input,.office-cost-form select{width:100%;min-width:0;height:32px;border:1px solid var(--line);border-radius:5px;background:#fff;padding:4px 6px;font:inherit;font-size:10px}
.office-cost-form small{font-size:8px;color:#8b2b2b}
.office-cost-list{display:flex;flex-direction:column;gap:6px;margin-top:8px}
.office-cost-row{border:1px solid var(--line);border-radius:7px;background:#fff;padding:8px}
.office-cost-row.is-verified{background:#f3f8f1}
.office-cost-row-summary{display:grid;grid-template-columns:.7fr 1.7fr 1fr .8fr .9fr .8fr auto;gap:8px;align-items:center}
.office-cost-row-summary>div{min-width:0}
.office-cost-row-summary strong{font-size:10px;line-height:1.25}
.office-cost-row-name strong{font-size:11px}
.office-cost-row-actions{display:flex;gap:4px;justify-content:flex-end;flex-wrap:wrap}
.office-cost-row-actions form{margin:0}
.office-cost-row-notes{margin-top:6px;padding-top:6px;border-top:1px solid var(--line);font-size:9px;color:var(--muted)}
.office-cost-edit{margin-top:7px}
.office-cost-edit[hidden]{display:none}
@media(max-width:1100px){
  .office-cost-row-summary{grid-template-columns:repeat(4,minmax(0,1fr))}
  .office-cost-row-actions{grid-column:1/-1;justify-content:flex-start}
}
@media(max-width:760px){
  .office-costing-header{flex-direction:column}
  .office-costing-summary{grid-template-columns:1fr}
  .office-cost-section-head{align-items:flex-start;flex-direction:column}
  .office-cost-form{grid-template-columns:repeat(2,minmax(0,1fr))}
  .office-cost-row-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
}


/* Stage 4A project Actual Cost Entry tab */
.actual-cost-project-workspace{display:flex;flex-direction:column;gap:12px}
.actual-cost-project-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.actual-cost-project-summary>div{border:1px solid var(--line);border-radius:8px;background:#fff;padding:10px}
.actual-cost-project-summary span,.actual-cost-phase-metrics span{display:block;font-size:9px;font-weight:800;text-transform:uppercase;color:var(--muted)}
.actual-cost-project-summary strong{display:block;font-size:18px}
.actual-cost-project-summary small,.actual-cost-phase-metrics small{display:block;font-size:9px;color:var(--muted);margin-top:2px}
.actual-cost-project-panel{padding:12px}
.actual-cost-phase-list{display:flex;flex-direction:column;gap:8px;margin-top:10px}
.actual-cost-phase-card{border:1px solid var(--line);border-radius:8px;background:#fff;padding:10px}
.actual-cost-phase-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}
.actual-cost-phase-heading>div{min-width:0}
.actual-cost-phase-heading strong{display:block;margin-top:3px}
.actual-cost-phase-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-top:9px}
.actual-cost-phase-metrics>div{border-top:1px solid var(--line);padding-top:7px}
.actual-cost-phase-metrics strong{display:block;font-size:13px}
@media(max-width:760px){
  .actual-cost-project-summary,.actual-cost-phase-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  .actual-cost-phase-heading{align-items:flex-start;flex-direction:column}
}


/* Compact numeric inputs: hide browser spinner controls on selected calculator fields. */
input.no-number-spinner[type="number"] {
    -moz-appearance: textfield;
}
input.no-number-spinner[type="number"]::-webkit-outer-spin-button,
input.no-number-spinner[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


/* Calculator area takeoff sheet */
.calc-takeoff-trigger {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    font-weight: 800;
    color: #315c20;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    cursor: pointer;
}
.calc-takeoff-trigger:hover { color: #173e0d; }
.calculator-takeoff-dialog {
    width: min(720px, calc(100vw - 32px));
    border: 1px solid #9bcf77;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 18px 55px rgba(0,0,0,.28);
}
.calculator-takeoff-dialog::backdrop { background: rgba(20, 28, 24, .45); }
.calculator-takeoff-shell { padding: 16px; }
.calculator-takeoff-header,
.calculator-takeoff-footer,
.calculator-takeoff-copy-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.calculator-takeoff-header {
    justify-content: space-between;
    margin-bottom: 12px;
}
.calculator-takeoff-header h2 { margin: 2px 0 0; }
.calculator-takeoff-table-wrap {
    max-height: 420px;
    overflow: auto;
    border: 1px solid #d7ddd8;
    border-radius: 8px;
}
.calculator-takeoff-table {
    width: 100%;
    border-collapse: collapse;
}
.calculator-takeoff-table th,
.calculator-takeoff-table td {
    padding: 7px 8px;
    border-bottom: 1px solid #e5e9e6;
    text-align: right;
}
.calculator-takeoff-table th:first-child,
.calculator-takeoff-table td:first-child { text-align: center; width: 70px; }
.calculator-takeoff-table th:last-child,
.calculator-takeoff-table td:last-child { width: 44px; text-align: center; }
.calculator-takeoff-table input { width: 110px; text-align: right; }
.takeoff-row-remove {
    border: 0;
    background: transparent;
    color: #a62e24;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.calculator-takeoff-add-row { padding: 10px 0; }
.calculator-takeoff-footer {
    justify-content: space-between;
    align-items: flex-end;
    border-top: 1px solid #d7ddd8;
    padding-top: 12px;
}
.calculator-takeoff-copy { min-width: 0; flex: 1; }
.calculator-takeoff-copy-row { margin-top: 6px; }
.calculator-takeoff-copy-row select { max-width: 320px; }
.calculator-takeoff-total {
    min-width: 180px;
    text-align: right;
}
.calculator-takeoff-total span { display: block; font-size: 12px; color: #66716a; }
.calculator-takeoff-total strong { display: block; font-size: 22px; margin: 2px 0 8px; }
@media (max-width: 700px) {
    .calculator-takeoff-footer { display: block; }
    .calculator-takeoff-total { margin-top: 14px; }
    .calculator-takeoff-table input { width: 90px; }
}


/* Billing and progress invoicing */
.billing-workspace { display: grid; gap: 12px; }
.billing-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.billing-summary > div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; text-align: center; overflow: hidden; }
.billing-summary span { display: block; background: var(--accent); color: white; padding: 5px 7px; font-size: 11px; font-weight: 700; }
.billing-summary strong { display: block; padding: 10px 7px; font-size: 18px; }
.billing-note { border: 1px solid var(--line); background: var(--warning-bg); color: var(--warning-text); border-radius: 8px; padding: 9px 11px; font-size: 12px; }
.billing-panel { margin: 0; }
.billing-work-table th, .billing-work-table td { vertical-align: middle; }
.billing-work-table td:first-child { text-align: center; width: 60px; }
.billing-amount-input { width: 115px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--text); text-align: right; }
.billing-row-complete { opacity: .65; }
.billing-create-actions { display: flex; justify-content: flex-end; padding: 10px 14px 12px; border-top: 1px solid var(--line); background: var(--panel); }

.invoice-layout { display: grid; grid-template-columns: minmax(0,1fr) 190px; gap: 12px; align-items: start; }
.invoice-main { min-width: 0; }
.invoice-side { position: sticky; top: 12px; }
.invoice-page-header .header-actions form { margin: 0; }
.invoice-readonly-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.invoice-readonly-grid > div, .invoice-side-metrics > div { border: 1px solid var(--line); border-radius: 7px; padding: 9px; background: var(--bg); }
.invoice-readonly-grid span, .invoice-side-metrics span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 700; margin-bottom: 3px; }
.invoice-side-metrics { display: grid; gap: 7px; padding: 10px; }
.invoice-line-list { display: grid; }
.invoice-line-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.invoice-line-row.is-manual { background: var(--warning-bg); }
.invoice-line-form { min-width: 0; }
.invoice-line-source { margin-bottom: 6px; }
.invoice-line-fields { display: grid; grid-template-columns: minmax(160px,1.1fr) minmax(210px,1.8fr) 80px 80px 110px minmax(170px,1.2fr); gap: 7px; align-items: end; }
.invoice-line-fields .form-field label, .invoice-manual-grid .form-field label { font-size: 10px; margin-bottom: 3px; }
.invoice-line-fields input, .invoice-line-fields textarea, .invoice-manual-grid input, .invoice-manual-grid textarea {
    width: 100%; padding: 6px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--text); min-height: 32px;
}
.invoice-line-fields textarea, .invoice-manual-grid textarea { resize: vertical; min-height: 32px; }
.invoice-line-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.invoice-line-delete { align-self: end; margin-bottom: 1px; }
.invoice-line-readonly { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0,1fr) 120px minmax(160px,220px) 130px; gap: 10px; align-items: center; }
.invoice-line-readonly > strong { text-align: right; }
.invoice-total-bar { display: flex; justify-content: flex-end; align-items: center; gap: 18px; padding: 10px 14px; background: var(--bg); border-top: 1px solid var(--line); }
.invoice-total-bar span { color: var(--muted); font-size: 12px; font-weight: 700; }
.invoice-total-bar strong { font-size: 20px; }
.invoice-manual-grid { display: grid; grid-template-columns: minmax(160px,1.1fr) minmax(210px,1.8fr) 80px 80px 110px minmax(170px,1.2fr); gap: 8px; align-items: end; }
.invoice-notes-field { grid-column: span 1; }

@media(max-width:1100px){
    .billing-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .invoice-layout { grid-template-columns: 1fr; }
    .invoice-side { position: static; }
    .invoice-line-fields, .invoice-manual-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .invoice-line-detail { grid-column: 1 / -1; }
}
@media(max-width:700px){
    .billing-summary { grid-template-columns: 1fr; }
    .invoice-readonly-grid { grid-template-columns: 1fr 1fr; }
    .invoice-line-fields, .invoice-manual-grid { grid-template-columns: 1fr; }
    .invoice-line-readonly { grid-template-columns: 1fr; }
    .invoice-line-readonly > strong { text-align: left; }
}


/* Invoice document output */
.invoice-history-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); }
.invoice-history-row:last-child { border-bottom:0; }
.invoice-history-row > div { min-width:0; }

/* Compact project header panels: keep all six cards aligned while reducing empty space. */
.project-info-grid{align-items:stretch}
.project-info-grid section{min-height:0}
.project-info-grid .project-notes-card textarea{min-height:72px;height:72px;box-sizing:border-box}
.project-info-grid .project-notes-card textarea:focus{height:120px}
@media(max-width:900px){.project-info-grid .project-notes-card textarea{height:88px;min-height:88px}}
