/* TLC palette: warm paper, deep navy, and restrained gold. */
:root {
  --theme-paper: #f8f1e7; /* Matches the brick-edge SVG and the homepage footer. */
  --theme-background: #f4eae0;
  --theme-surface: #fcf7f0;
  --theme-surface-soft: #f2e7da;
  --theme-border: #dfd0bf;
  --theme-gold: #96773e;
  --theme-gold-soft: #b79861;
  --theme-blue: #102d55;
  --theme-blue-dark: #091b36;
  --theme-blue-soft: #e9ddce;
  --theme-blue-border: #d9cbbb;
  --theme-ink: #0b1d38;
  --theme-muted: #59626d;
  --ink: var(--theme-ink);
  --cream: var(--theme-background);
  --line: var(--theme-border);
}

body { background-color: var(--theme-background); color: var(--theme-ink); }

/* Public homepage */
.home-page { background-color: #faf7f2; }
.home-header {
  background: rgba(255, 255, 255, .82);
  border-bottom-color: var(--theme-border);
}
.home-nav .home-login { border-color: var(--theme-gold-soft); }
.welcome { background-color: #fff; }
.welcome::after { filter: brightness(0) invert(1) drop-shadow(0 8px 9px rgba(33, 58, 79, .16)); }
.dashboard-footer { background-color: var(--theme-paper); }
.welcome-logo img { mix-blend-mode: multiply; }
.home-eyebrow, .gallery-details-label, .services-section .eyebrow { color: var(--theme-gold); }
.home-eyebrow span { background: var(--theme-gold-soft); }
.welcome > p:not(.eyebrow) { color: var(--theme-muted); }
.text-link { color: var(--theme-blue-dark); }
.gallery-card {
  background: linear-gradient(145deg, rgba(255, 253, 249, .94), rgba(225, 238, 244, .88));
  border-color: var(--theme-blue-border);
  box-shadow: 0 14px 35px rgba(35, 56, 70, .12), 0 2px 7px rgba(62, 52, 38, .05);
}
.gallery-details-label { color: var(--theme-gold); }
.enquiry-section {
  background-color: #dceaf0;
  background-image: url('/images/blueprint-pattern.svg'), radial-gradient(circle at 85% 10%, rgba(227, 195, 139, .18), transparent 42%), linear-gradient(130deg, #eaf1f3, #d1e3ec);
}
.home-page .enquiry-section::before { background: radial-gradient(ellipse 760px 600px at 0% 0%, rgba(224, 187, 116, .16), transparent 75%); }
.home-page .enquiry-section::after { background: radial-gradient(ellipse 760px 600px at 100% 100%, rgba(224, 187, 116, .16), transparent 75%); }
.enquiry-panel { background: rgba(255, 253, 249, .9); border-color: var(--theme-blue-border); }
.enquiry-copy .eyebrow { color: var(--theme-blue); }
.enquiry-copy h2 { color: var(--theme-blue-dark); }
.enquiry-copy h2 em { color: var(--theme-blue); }
.enquiry-panel input:not([type=hidden]):not([type=file]), .enquiry-panel textarea, .enquiry-panel select {
  background: var(--theme-surface);
  border-color: #cfc4b4;
}
.enquiry-submit { background: var(--theme-blue); }
.enquiry-submit:hover { background: var(--theme-blue-dark); }
.services-grid article { border-top-color: var(--theme-gold-soft); }
.home-footer { border-top-color: var(--theme-border); }

/* Sign-in and the shared portal shell */
.auth-body {
  background: radial-gradient(circle at 80% 18%, rgba(160, 194, 213, .3), transparent 42%), radial-gradient(circle at 58% 82%, rgba(203, 177, 131, .2), transparent 38%), var(--theme-background);
}
.auth-intro {
  background: radial-gradient(circle at 15% 20%, rgba(143, 193, 226, .2), transparent 42%), linear-gradient(145deg, #1d3d56, #315f80);
}
.auth-intro-copy h1 em { color: #ead4a9; }
.auth-brand { background: var(--theme-surface); }
.auth-panel {
  background: rgba(255, 253, 249, .82);
  border-color: rgba(222, 209, 189, .85);
  box-shadow: 0 0 0 1px rgba(153, 110, 43, .08), 0 18px 52px rgba(65, 52, 36, .10), 0 0 58px rgba(199, 159, 90, .13);
}
.auth-panel input:not([type=hidden]) { background: rgba(255, 253, 249, .92); border-color: #cfc4b4; }
.auth-role-links a { background: rgba(255, 253, 249, .7); border-color: var(--theme-border); }
.auth-button, .message-open, .message-form-bottom button, .stage-action { background: var(--theme-blue); }
.auth-button:hover, .message-open:not(:disabled):hover, .message-form-bottom button:hover, .stage-action:hover { background: var(--theme-blue-dark); }
.shell {
  background-color: var(--theme-background);
  background-image: url('/images/dot-matrix.svg'), radial-gradient(ellipse 950px 900px at 100% 100%, rgba(198, 160, 94, .16), transparent 75%), radial-gradient(circle at 78% 15%, rgba(137, 181, 205, .25), transparent 40%), linear-gradient(135deg, #f7f2ea, #e6eff3 55%, #f0e9dd);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  background-size: 24px 24px, 100% 100%, 100% 100%, 100% 100%;
}
.sidebar { background: rgba(250, 247, 241, .82); border-right-color: var(--theme-border); }
.topbar { background: rgba(250, 247, 241, .8); border-bottom-color: var(--theme-border); }
.nav-link.active, .client-dashboard .client-project-link.is-current, .client-projects-overview.is-current {
  background: var(--theme-blue-soft);
  box-shadow: inset 3px 0 0 var(--theme-gold-soft);
}

/* Cards retain their existing layout and stage colours. */
.dashboard-card:not(.variation-stack), body[data-stage] .dashboard-card:not(.variation-stack) {
  background: rgba(255, 253, 249, .9);
  border-color: var(--theme-border);
  box-shadow: 0 10px 30px rgba(65, 52, 36, .06);
}
.dashboard-card.ai-summary, body[data-stage] .dashboard-card.ai-summary, .dashboard-card.manager-summary {
  background: linear-gradient(120deg, rgba(255, 253, 249, .96), rgba(226, 239, 245, .94));
  border-color: var(--theme-border);
}
.manager-summary-list li { background: rgba(255, 253, 249, .72); border-color: var(--theme-border); }
.admin-enquiry-card, .admin-enquiry-card.admin-tender-card {
  background: linear-gradient(135deg, #fffdf9, #f5ede1);
  border-color: var(--theme-border);
}
.admin-enquiry-kicker, .record-kicker { color: var(--theme-gold); }
.example-label, .summary-client-label { background: #eee5d6; color: #5c594e; }
.message-preview-item, .message-empty, .message-quoted, .offer-summary { background-color: var(--theme-surface-soft); }
.message-item:not(.message-item-own) { background: var(--theme-surface-soft); }
.message-preview-item-own, .message-item-own { background: #dbeaf2; }
.message-panel, .message-form, .file-preview, .variation-item { border-color: var(--theme-border); }
.message-form textarea { background: var(--theme-surface); border-color: #cfc4b4; }
.message-quoted { border-left-color: var(--theme-gold-soft); }
.enquiry-record, .no-enquiries { background: rgba(255, 253, 249, .9); border-color: var(--theme-border); }
.dashboard-footer-meta { border-color: var(--theme-border); }

@media (prefers-reduced-transparency: reduce) {
  .home-header, .gallery-card, .enquiry-panel, .auth-panel, .sidebar, .topbar,
  .dashboard-card:not(.variation-stack), body[data-stage] .dashboard-card:not(.variation-stack),
  .enquiry-record, .no-enquiries { background: var(--theme-surface); }
  .home-header { background: #fff; }
  .auth-panel input:not([type=hidden]) { background: var(--theme-surface); }
}

/* Portal and sign-in: quiet paper surfaces, navy actions, and gold details. */
.auth-body { background: #f4eae0; }
.auth-intro { position: relative; z-index: 1; background: linear-gradient(145deg, #091b36, #193657); border-right: 2px solid #b79861; box-shadow: 10px 0 28px rgba(27, 35, 43, .16); -webkit-backdrop-filter: none; backdrop-filter: none; }
.auth-main { background: #f7f1e9 url('/images/dot-matrix.svg') repeat; background-size: 24px 24px; }
.auth-intro-copy h1 em { color: #d5bb8b; }
.auth-brand { background: transparent; color: #fff; }
.auth-brand .brand-wordmark { color: #fffaf2; }
.auth-brand .brand-label { color: #d5bb8b; }
.auth-panel { background: #fcf7f0; border-color: #dfd0bf; border-radius: 4px; box-shadow: 0 8px 24px rgba(63, 48, 33, .08); -webkit-backdrop-filter: none; backdrop-filter: none; }
.auth-panel input:not([type=hidden]) { background: #fffdf9; border-color: #d4c5b5; border-radius: 3px; color: var(--theme-ink); }
.auth-role-links a { background: #fcf7f0; border-color: #d4c5b5; border-radius: 3px; color: var(--theme-blue-dark); }
.auth-role-links a:hover { background: #eee2d3; }

.shell { background: radial-gradient(ellipse at 90% 0%, rgba(255, 252, 247, .48), transparent 50%), #f4eae0; }
.shell .sidebar, .shell .topbar { background: #f8f0e7; border-color: #dfd0bf; -webkit-backdrop-filter: none; backdrop-filter: none; }
.shell .sidebar-note, .shell .card, .shell .enquiry-record, .shell .no-enquiries, .shell .area-panel {
  background: #fcf7f0; border-color: #dfd0bf; border-radius: 3px;
  box-shadow: 0 8px 24px rgba(63, 48, 33, .08), 0 2px 5px rgba(63, 48, 33, .04); -webkit-backdrop-filter: none; backdrop-filter: none;
}
.shell .dashboard-card:not(.variation-stack), body[data-stage] .dashboard-card:not(.variation-stack),
.shell .dashboard-card.ai-summary, body[data-stage] .dashboard-card.ai-summary, .shell .dashboard-card.manager-summary {
  background: #fcf7f0; border-color: #dfd0bf; border-radius: 3px; box-shadow: 0 8px 24px rgba(63, 48, 33, .08), 0 2px 5px rgba(63, 48, 33, .04);
}
.shell .nav-link { color: #142a48; }
.shell .nav-link > span { color: #a48249; }
.shell .nav-link:hover, .shell .nav-link.active, .shell .client-project-link.is-current, .shell .client-projects-overview.is-current {
  background: #eaddcc; color: #091b36; box-shadow: inset 3px 0 0 #b79861;
}
.shell .topbar, .shell .dashboard-heading, .shell .project-area h1, .shell .project-area h2,
.shell .dashboard-card h2, .shell .dashboard-card h3 { color: #0b1d38; }
.shell .admin-enquiry-card, .shell .admin-enquiry-card.admin-tender-card { background: #fcf7f0; border-color: #dfd0bf; box-shadow: 0 8px 24px rgba(63, 48, 33, .08), 0 2px 5px rgba(63, 48, 33, .04); }
.shell .manager-summary-list li, .shell .message-preview-item, .shell .message-empty,
.shell .message-quoted, .shell .offer-summary, .shell .variation-question { background: #f2e7da; border-color: #dfd0bf; }
.shell .message-preview-item-own, .shell .message-item-own { background: #e5ded1; }
.shell .project-card:not([data-deck-panel]) { background: #153252; border-color: #153252; border-radius: 4px; box-shadow: 0 5px 16px rgba(15, 29, 47, .12); -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (max-width: 800px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-main, .auth-group { min-width: 0; }
  .auth-intro { border-right: 0; border-bottom: 2px solid #b79861; box-shadow: 0 10px 28px rgba(27, 35, 43, .16); }
}

/* Keep each timeline recognisable, blending its original colour into a muted blue. */
.dashboard-content .project-card[data-deck-panel="enquiry"], .dashboard-content .deck-ghost--enquiry, .shell .deck-tab.deck-tab--enquiry {
  background: radial-gradient(ellipse at 82% 18%, rgba(125, 165, 184, .16), transparent 58%), linear-gradient(100deg, #284e68 0%, #37698d 30%, #618eae 100%);
}
.dashboard-content .project-card[data-deck-panel="tender"], .dashboard-content .deck-ghost--tender, .shell .deck-tab.deck-tab--tender {
  background: radial-gradient(ellipse at 80% 15%, rgba(182, 125, 118, .14), transparent 56%), linear-gradient(100deg, #69404a 0%, #76505a 22%, #416f99 100%);
}
.dashboard-content .project-card[data-deck-panel="project"], .dashboard-content .deck-ghost--project, .shell .deck-tab.deck-tab--project {
  background: radial-gradient(ellipse at 78% 18%, rgba(127, 183, 165, .14), transparent 59%), linear-gradient(100deg, #214e4e 0%, #30665f 22%, #416f99 100%);
}
.shell .timeline-marker { background: #455d73; border-color: #f9f2e8; }
.shell .timeline-marker--reached { background: #b79861; }
.shell .timeline-marker--current { background: #fff; box-shadow: 0 0 0 3px rgba(183, 152, 97, .45); }
.shell .timeline-settings { background: #fcf7f0; border-color: #b79861; color: #0b1d38; border-radius: 4px; }

/* Explicit primary and secondary selectors leave toggles and destructive actions intact. */
.auth-body .auth-button:not(:disabled), .shell .stage-action:not(:disabled),
.shell .message-open:not(:disabled), .shell .message-form-bottom button:not(:disabled),
.shell .timeline-action:not(:disabled), .shell .area-form button:not(:disabled),
.shell .area-filters button:not(:disabled), .shell .area-button,
.shell .project-edit-actions button:not(:disabled), .shell .estimark-sync button:not(:disabled),
.shell .widget-dialog-actions button[type="submit"]:not(:disabled) {
  background: #102d55; border-color: #102d55; border-radius: 3px; color: #fff;
}
.auth-body .auth-button:not(:disabled):hover, .shell .stage-action:not(:disabled):hover,
.shell .message-open:not(:disabled):hover, .shell .message-form-bottom button:not(:disabled):hover,
.shell .timeline-action:not(:disabled):hover, .shell .area-form button:not(:disabled):hover,
.shell .area-filters button:not(:disabled):hover, .shell .area-button:hover,
.shell .project-edit-actions button:not(:disabled):hover, .shell .estimark-sync button:not(:disabled):hover,
.shell .widget-dialog-actions button[type="submit"]:not(:disabled):hover { background: #091b36; border-color: #091b36; }
.shell .signout-button, .shell .timeline-secondary, .shell .timeline-close, .shell .timeline-row-button,
.shell .programme-chart-button, .shell .manage-subcontractors-button, .shell .manager-client-view-button {
  background: transparent; border-color: #b9a789; border-radius: 3px; color: #102d55;
}
.shell .signout-button:hover, .shell .timeline-secondary:not(:disabled):hover, .shell .timeline-close:hover,
.shell .timeline-row-button:not(:disabled):hover, .shell .programme-chart-button:hover,
.shell .manage-subcontractors-button:hover, .shell .manager-client-view-button:hover { background: #eee2d3; }
.shell .calendar-days button[aria-pressed="true"], .shell .time-slots button[aria-pressed="true"],
.shell .admin-survey-slots button[aria-pressed="true"] { background: #102d55; border-color: #102d55; color: #fff; }
.shell :is(button, a, input, select, textarea):focus-visible,
.auth-body :is(button, a, input, select, textarea):focus-visible { outline: 3px solid #b79861; outline-offset: 2px; }

/* Project pages: match their controls and legends to the same palette. */
.shell .project-legend { color: #59626d; }
.shell .project-legend-title { color: #0b1d38; }
.shell .project-legend-swatch--enquiry { background: #325b75; }
.shell .project-legend-swatch--tender { background: #76505a; }
.shell .project-legend-swatch--project { background: #30665f; }
.shell .timeline-settings--enquiry { border-color: #325b75; }
.shell .timeline-settings--tender { border-color: #76505a; }
.shell .timeline-settings--project { border-color: #30665f; }
.shell .project-record-toggle:not(:disabled), .shell .live-variations-link,
.shell .contract-form button:not(:disabled), .shell .enquiry-quote-inner form button:not(:disabled) {
  background: #102d55; border-color: #102d55; border-radius: 3px; color: #fff;
}
.shell .project-record-toggle:not(:disabled):hover, .shell .live-variations-link:hover,
.shell .contract-form button:not(:disabled):hover, .shell .enquiry-quote-inner form button:not(:disabled):hover {
  background: #091b36; border-color: #091b36;
}
.shell .materials-control:not(:disabled), .shell .enquiry-quote-toggle:not(:disabled),
.shell .project-file-remove:not(:disabled), .shell .widget-dialog-actions button:not([type="submit"]):not(:disabled) {
  background: transparent; border-color: #b9a789; border-radius: 3px; color: #102d55;
}
.shell .materials-control:not(:disabled):hover, .shell .enquiry-quote-toggle:not(:disabled):hover,
.shell .project-file-remove:not(:disabled):hover, .shell .widget-dialog-actions button:not([type="submit"]):not(:disabled):hover { background: #eee2d3; }
.shell .widget-add-button:not(:disabled) { background: #f6ecdf; border-color: #b9a789; color: #102d55; }
.shell .widget-add-button:not(:disabled):hover { background: #eaddcc; }
.shell .project-gallery-remove:not(:disabled) { background: rgba(9, 27, 54, .88); }
.shell .stage-action:disabled, .shell .message-open:disabled { background: #e8ded1; color: #77716b; }
.shell .message-conversation-switcher { background: #efe5d9; border-color: #d3c3b0; }
.shell .message-conversation-switcher::before { background: #102d55; }
.shell .message-conversation-switcher button:not([aria-pressed="true"]) { color: #102d55; }
.shell .calendar { background: #f9f2e9; border-color: #dfd0bf; }
.shell .calendar-days button.is-available:not([aria-pressed="true"]),
.shell .calendar-days button.has-times:not([aria-pressed="true"]) { background: #eee2d2; color: #102d55; }
.shell .calendar-days button.is-available:not([aria-pressed="true"]):hover { background: #e4d4bf; }
.shell .time-slots button:not([aria-pressed="true"]), .shell .admin-survey-slots button:not([aria-pressed="true"]),
.shell .calendar-header button { background: #fcf7f0; border-color: #d4c5b5; color: #102d55; }
.shell .stage-controls > div { background: #eee2d3; }
.shell .stage-controls button[aria-pressed="true"] { background: #fcf7f0; color: #102d55; }
