﻿:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --primary: #0f4c81;
  --primary-strong: #0b3559;
  --text: #1b1f24;
  --muted: #5f6c7b;
  --border: #d9e1ea;
  --global-nav-collapsed-width: 78px;
  --global-nav-expanded-width: 228px;
  --global-nav-width: var(--global-nav-collapsed-width);
  --app-primary-btn-border: #434ce8;
  --app-primary-btn-start: #4a54f4;
  --app-primary-btn-end: #3d45d8;
  --app-primary-btn-text: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eef3fa 0%, var(--bg) 35%, var(--bg) 100%);
  min-height: 100vh;
  padding-left: var(--global-nav-width);
  transition: none;
}

body.global-nav-ready {
  transition: padding-left 0.22s ease;
}

body.global-nav-expanded {
  --global-nav-width: var(--global-nav-expanded-width);
}

html.global-nav-expanded {
  --global-nav-width: var(--global-nav-expanded-width);
}

.site-header {
  padding: 18px 28px 10px;
  text-align: left;
}

.site-header h1 {
  margin: 0;
  font-size: 2rem;
  color: var(--primary-strong);
}

.site-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.site-nav {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--global-nav-width);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 11px;
  padding: 14px 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #f2f7fd 100%);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 22px rgba(11, 53, 89, 0.1);
  backdrop-filter: saturate(1.06);
  overflow-y: auto;
  z-index: 20;
  transition: width 0.22s ease, padding 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.site-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  text-decoration: none;
  color: var(--primary-strong);
  border: 1px solid #d3dbe6;
  background: #ffffff;
  padding: 9px 10px;
  border-radius: 9px;
  font-weight: 650;
  font-size: 0.88rem;
  min-height: 44px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 10px rgba(11, 53, 89, 0.08);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  text-align: center;
}

body:not(.global-nav-expanded) .site-nav a,
html:not(.global-nav-expanded) .site-nav a {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  align-self: flex-start;
}

.site-nav a.active,
.site-nav a:hover {
  background: linear-gradient(135deg, var(--app-primary-btn-start) 0%, var(--app-primary-btn-end) 100%);
  border-color: var(--app-primary-btn-border);
  color: var(--app-primary-btn-text);
  box-shadow: 0 8px 16px rgba(11, 53, 89, 0.24);
}

.site-nav a:hover {
  transform: translateY(-1px);
}

.site-nav a:focus-visible {
  outline: 2px solid rgba(15, 76, 129, 0.35);
  outline-offset: 1px;
}

.global-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid #d3dbe6;
  border-radius: 9px;
  background: #ffffff;
  color: var(--primary-strong);
  cursor: pointer;
  padding: 0;
  margin-bottom: 2px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95), 0 4px 10px rgba(11, 53, 89, 0.08);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  align-self: flex-start;
}

.global-nav-toggle:hover {
  background: #edf5ff;
  border-color: #d3dbe6;
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(11, 53, 89, 0.12);
}

.global-nav-toggle svg,
.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.nav-label {
  opacity: 0;
  visibility: hidden;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.16s ease, width 0.16s ease;
}

body.global-nav-expanded .site-nav a,
html.global-nav-expanded .site-nav a {
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px 10px 11px;
  width: 100%;
  margin: 0;
  align-self: stretch;
}

body.global-nav-expanded .nav-label,
html.global-nav-expanded .nav-label {
  opacity: 1;
  visibility: visible;
  width: auto;
}

.project-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 10px 28px 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid #dfe8f2;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(246, 250, 255, 0.64) 100%);
  backdrop-filter: blur(2px);
}

.project-nav-project {
  margin-right: 12px;
  color: #3b5470;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.project-nav-project strong {
  color: var(--primary-strong);
}

.project-nav a {
  text-decoration: none;
  color: var(--primary-strong);
  border: 1px solid #d3dbe6;
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 3px 8px rgba(11, 53, 89, 0.08);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.project-nav a.active,
.project-nav a:hover {
  color: var(--app-primary-btn-text);
  background: linear-gradient(135deg, var(--app-primary-btn-start) 0%, var(--app-primary-btn-end) 100%);
  border-color: var(--app-primary-btn-border);
  box-shadow: 0 8px 16px rgba(11, 53, 89, 0.22);
}

.project-nav a:hover {
  transform: translateY(-1px);
}

.project-nav a:focus-visible {
  outline: 2px solid rgba(15, 76, 129, 0.35);
  outline-offset: 1px;
}

.page-content {
  width: auto;
  margin: 0 28px 0 28px;
  padding-bottom: 32px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 8px 20px rgba(11, 53, 89, 0.08);
}

.card h2 {
  margin-top: 0;
  color: var(--primary-strong);
}

.card p {
  color: var(--muted);
}

.card ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.card li {
  padding: 3px 0;
}

.table-note {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.projects-manager {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
  max-width: 620px;
}

.projects-manager label {
  color: #4a617a;
  font-size: 0.84rem;
  font-weight: 700;
}

.projects-manager select,
.projects-manager input,
.projects-manager textarea {
  width: 100%;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.9rem;
  color: #1f3a55;
  background: #ffffff;
}

.projects-manager textarea {
  resize: vertical;
}

.projects-manager button {
  justify-self: start;
  height: 34px;
  border: 1px solid var(--app-primary-btn-border);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--app-primary-btn-start) 0%, var(--app-primary-btn-end) 100%);
  color: var(--app-primary-btn-text);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 14px;
  cursor: pointer;
}

.projects-manager button:hover {
  filter: brightness(1.05);
}

body[data-page="projects"] {
  --projects-bg: #edf2f7;
  --projects-surface: #ffffff;
  --projects-surface-soft: #f6f9fd;
  --projects-border: #d2dcea;
  --projects-text: #18263a;
  --projects-muted: #52647c;
  --projects-accent: #0d5a94;
  --projects-accent-strong: #0a436e;
  font-family: "Manrope", "Avenir Next", "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at 0% 0%, #dce8f8 0%, #dce8f8 14%, transparent 34%),
    radial-gradient(circle at 100% 10%, #d7f0ec 0%, #d7f0ec 12%, transparent 34%),
    linear-gradient(180deg, #f5f8fd 0%, var(--projects-bg) 65%, #f0f4fa 100%);
}

body[data-page="projects"] .projects-page-content {
  display: grid;
  gap: 20px;
  padding-bottom: 28px;
}

body[data-page="projects"] .projects-toolbar-card,
body[data-page="projects"] .projects-table-card {
  border: 1px solid var(--projects-border);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--projects-surface) 0%, var(--projects-surface-soft) 100%);
  box-shadow: 0 18px 34px rgba(20, 42, 70, 0.1);
}

body[data-page="projects"] .projects-toolbar-card {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

body[data-page="projects"] .projects-eyebrow {
  margin: 0 0 4px;
  color: var(--projects-accent);
  font: 800 0.72rem "Space Grotesk", "Manrope", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body[data-page="projects"] .projects-toolbar-copy h1 {
  margin: 0 0 4px;
  color: var(--projects-text);
  font: 700 clamp(1.45rem, 1.9vw, 2rem) "Space Grotesk", "Manrope", sans-serif;
}

body[data-page="projects"] .projects-active-name {
  margin: 0;
  color: #39546f;
  font: 600 0.9rem "Manrope", "Segoe UI", sans-serif;
}

body[data-page="projects"] .projects-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

body[data-page="projects"] .projects-primary-button {
  min-height: 36px;
  border: 1px solid #1f5f95;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--projects-accent) 0%, var(--projects-accent-strong) 100%);
  color: #ffffff;
  font: 700 0.8rem "Space Grotesk", "Manrope", sans-serif;
  letter-spacing: 0.02em;
  padding: 0 14px;
  cursor: pointer;
  box-shadow: 0 11px 20px rgba(13, 90, 148, 0.24);
}

body[data-page="projects"] .projects-feedback-modern {
  margin: 10px 0 0;
  min-height: 18px;
  color: #50647e;
  font-size: 0.8rem;
}

body[data-page="projects"] .projects-table-card {
  padding: 18px;
}

body[data-page="projects"] .projects-table-wrap {
  border: 1px solid #d6e2f0;
  border-radius: 12px;
  background: #ffffff;
  overflow-x: auto;
  overflow-y: visible;
}

body[data-page="projects"] .projects-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
}

body[data-page="projects"] .projects-table th,
body[data-page="projects"] .projects-table td {
  border-left: 0;
  border-right: 0;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
  padding: 0 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

body[data-page="projects"] .projects-table th {
  background: #f5f6ff;
  border-bottom: 1px solid #d6e2f0;
  color: #000000;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 36px;
  height: 36px;
  text-transform: none;
  letter-spacing: 0;
  position: sticky;
  top: 0;
  z-index: 4;
}

body[data-page="projects"] .projects-table td {
  background: #ffffff;
  color: #172434;
  font: 400 0.8rem "Roboto", "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 30px;
  height: 30px;
}

body[data-page="projects"] .projects-table tbody tr:hover td {
  background: #f8fbff;
}

body[data-page="projects"] .projects-table tbody tr:nth-child(even) td {
  background: #ffffff;
}

body[data-page="projects"] .projects-table tbody tr.projects-row-clickable {
  cursor: pointer;
}

body[data-page="projects"] .projects-table tbody tr.is-active-project-row td {
  background: rgba(66, 92, 255, 0.08);
}

body[data-page="projects"] .projects-actions-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

body[data-page="projects"] .projects-table-btn {
  min-height: 24px;
  border: 1px solid #ccd9ea;
  border-radius: 8px;
  background: #ffffff;
  color: #2a4f73;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0 8px;
  cursor: pointer;
}

body[data-page="projects"] .projects-table-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

body[data-page="projects"] .projects-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(12, 30, 51, 0.46);
}

body[data-page="projects"] .projects-modal[hidden] {
  display: none !important;
}

body[data-page="projects"] .projects-modal-dialog {
  width: min(520px, calc(100% - 28px));
  border: 1px solid #d4dfec;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 26px 48px rgba(8, 24, 42, 0.26);
  padding: 18px;
}

body[data-page="projects"] .projects-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

body[data-page="projects"] .projects-modal-header h2 {
  margin: 0;
  color: #173556;
  font: 700 1.02rem "Space Grotesk", "Manrope", sans-serif;
}

body[data-page="projects"] .projects-modal-close,
body[data-page="projects"] .projects-modal-secondary {
  min-height: 30px;
  border: 1px solid #d1d7e3;
  border-radius: 9px;
  background: #f8f9fd;
  color: #3f4a5b;
  font: 700 0.78rem "Manrope", "Segoe UI", sans-serif;
  padding: 0 10px;
  cursor: pointer;
}

body[data-page="projects"] .projects-modal-form {
  display: grid;
  gap: 8px;
}

body[data-page="projects"] .projects-modal-form label {
  color: #39516d;
  font-size: 0.8rem;
  font-weight: 700;
}

body[data-page="projects"] .projects-modal-form input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #c8d6e8;
  border-radius: 10px;
  background: #ffffff;
  color: #1b3652;
  font: 600 0.88rem "Manrope", "Avenir Next", sans-serif;
  padding: 0 11px;
}

body[data-page="projects"] .projects-modal-form input[type="file"] {
  min-height: 40px;
  padding: 6px 9px;
}

body[data-page="projects"] .projects-modal-actions {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 640px) {
  body[data-page="projects"] .projects-page-content {
    margin: 0 12px;
  }

  body[data-page="projects"] .projects-toolbar-card {
    flex-direction: column;
    align-items: stretch;
  }

  body[data-page="projects"] .projects-toolbar-actions {
    justify-content: flex-start;
  }
}

.database-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
}

.database-sidebar h3,
.database-view h3 {
  margin: 0 0 12px;
  color: var(--primary-strong);
}

.database-sidebar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.database-sidebar h3 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-toggle-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--primary-strong);
  border-radius: 9px;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-toggle-btn:hover {
  background: #eef4fc;
  border-color: #c8d7e8;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 76, 129, 0.14);
}

.db-nav-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--primary-strong);
  padding: 0;
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  cursor: pointer;
  gap: 0;
  justify-content: center;
  position: relative;
  overflow: visible;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.db-nav-btn:hover {
  background: #eef4fc;
  border-color: #c8d7e8;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 76, 129, 0.14);
}

.db-nav-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.db-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.db-label {
  position: absolute;
  left: 56px;
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 11px 13px;
  border: 1px solid var(--border);
  vertical-align: top;
  font-size: 0.95rem;
}

.data-table th {
  background: #e8eff7;
  color: var(--primary-strong);
  font-weight: 700;
}

.data-table tbody tr:nth-child(even) {
  background: #f8fbff;
}

body[data-page="database"] {
  --db-bg: #f3f7fc;
  --db-bg-accent: #e8f1fb;
  --db-surface: #ffffff;
  --db-surface-soft: #f8fbff;
  --db-border: #d7e2ef;
  --db-shadow: 0 18px 36px rgba(22, 52, 90, 0.11);
  --db-shadow-soft: 0 8px 18px rgba(22, 52, 90, 0.08);
  --db-text: #172434;
  --db-muted: #5f6f83;
  --db-accent: #0f4c81;
  --db-accent-strong: #0b3559;
  font-family: "Avenir Next", "Manrope", "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at 10% -8%, #dbeafe 0, #dbeafe 12%, transparent 34%),
    radial-gradient(circle at 95% 2%, #d8f3ee 0, #d8f3ee 10%, transparent 30%),
    linear-gradient(180deg, #eff5fc 0%, var(--db-bg) 58%, #eef4fb 100%);
}

body[data-page="database"] .page-content {
  width: 100%;
  margin: 0;
  padding: 0 28px 36px 0;
}

body[data-page="database"] .database-layout {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.3));
  border: 0;
  box-shadow: none;
  padding: 0;
  display: block;
}

body[data-page="database"] .database-sidebar {
  position: fixed;
  left: var(--global-nav-width, 220px);
  top: var(--db-sidebar-top, 154px);
  width: 88px;
  height: calc(100vh - var(--db-sidebar-top, 154px));
  overflow-y: auto;
  padding: 16px 22px;
  background: linear-gradient(180deg, var(--db-surface) 0%, #f4f9ff 100%);
  border-right: 1px solid var(--db-border);
  box-shadow: 8px 0 22px rgba(19, 47, 85, 0.08);
  transition: width 0.24s ease, padding 0.24s ease;
  transform-origin: left center;
  z-index: 5;
}

body[data-page="database"] .database-view {
  margin-left: 104px;
  margin-right: 8px;
  background: linear-gradient(180deg, var(--db-surface) 0%, var(--db-surface-soft) 100%);
  border: 1px solid var(--db-border);
  border-radius: 20px;
  box-shadow: var(--db-shadow);
  padding: 28px;
  min-height: calc(100vh - 208px);
  transition: margin-left 0.24s ease, box-shadow 0.24s ease;
}

body[data-page="database"] .database-view h3 {
  margin-bottom: 8px;
  color: var(--db-accent-strong);
  font-size: 1.45rem;
  letter-spacing: 0.01em;
}

body[data-page="database"] .table-note {
  color: var(--db-muted);
  margin-bottom: 16px;
}

body[data-page="database"] .database-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

body[data-page="database"] .column-chooser-controls {
  position: relative;
}

body[data-page="database"] .database-controls label {
  color: #4a617a;
  font-size: 0.86rem;
  font-weight: 700;
}

body[data-page="database"] .database-group-select {
  height: 34px;
  border: 1px solid #ccd9ea;
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
  color: #1f3a55;
  font-size: 0.9rem;
}

body[data-page="database"] .database-group-select:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"].db-sidebar-expanded .database-sidebar {
  width: 244px;
  align-items: flex-start;
  padding: 16px 22px;
}

body[data-page="database"].db-sidebar-expanded .database-view {
  margin-left: 260px;
}

body[data-page="database"].db-sidebar-expanded .db-label {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
  color: #2c4561;
  font-size: 0.92rem;
}

body[data-page="database"] .sidebar-toggle-btn,
body[data-page="database"] .db-nav-btn {
  background: #fdfefe;
  border-color: #d0dced;
}

body[data-page="database"] .database-sidebar h3 {
  color: #6d7f95;
}

body[data-page="database"] .db-nav-btn.active {
  background: linear-gradient(135deg, var(--db-accent) 0%, #1b6aa9 100%);
  border-color: #1d6094;
  box-shadow: 0 10px 20px rgba(15, 76, 129, 0.28);
}

body[data-page="database"] .sidebar-toggle-btn:focus-visible,
body[data-page="database"] .db-nav-btn:focus-visible {
  outline: 2px solid #7cb4e5;
  outline-offset: 2px;
}

body[data-page="database"] .table-wrap {
  border: 1px solid #d6e2f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: #c7cfda transparent;
}

body[data-page="database"] .assembly-builder {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: rgba(12, 30, 51, 0.46);
  padding: 20px;
}

body[data-page="database"] .assembly-builder[hidden] {
  display: none !important;
}

body[data-page="database"] .assembly-modal-dialog {
  width: min(860px, 94vw);
  max-height: 88vh;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid #d6e2f0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 16px;
  box-shadow: 0 28px 56px rgba(8, 24, 42, 0.26);
}

body[data-page="database"] .assembly-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

body[data-page="database"] .assembly-builder h4 {
  margin: 0;
  color: #1f4264;
  font-size: 1.06rem;
}

body[data-page="database"] .assembly-close-btn {
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  background: #ffffff;
  color: #284664;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
}

body[data-page="database"] .assembly-close-btn:hover {
  background: #eef5ff;
}

body[data-page="database"] .assembly-helper {
  margin: 6px 0 14px;
  color: #62768e;
  font-size: 0.92rem;
}

body[data-page="database"] .assembly-form {
  display: grid;
  gap: 12px;
}

body[data-page="database"] .assembly-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body[data-page="database"] .assembly-grid label {
  display: grid;
  gap: 6px;
  color: #39526d;
  font-size: 0.85rem;
  font-weight: 700;
}

body[data-page="database"] .assembly-notes-field {
  grid-column: 1 / -1;
}

body[data-page="database"] .assembly-grid input {
  height: 38px;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 0.92rem;
  color: #1c2e41;
  background: #ffffff;
}

body[data-page="database"] .assembly-grid input:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"] .assembly-grid select {
  height: 38px;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 0.92rem;
  color: #1c2e41;
  background: #ffffff;
}

body[data-page="database"] .assembly-grid select:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"] .assembly-items-fieldset {
  margin: 0;
  border: 1px solid #d6e2f0;
  border-radius: 12px;
  padding: 10px;
}

body[data-page="database"] .assembly-items-fieldset legend {
  padding: 0 6px;
  color: #3f5874;
  font-size: 0.83rem;
  font-weight: 700;
}

body[data-page="database"] .table-section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
}

body[data-page="database"] .section-toggle-btn {
  width: 22px;
  height: 22px;
  border: 1px solid #b9cde3;
  border-radius: 7px;
  background: #f6fbff;
  color: #3e6286;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

body[data-page="database"] .section-toggle-btn:hover {
  background: #eaf3ff;
  border-color: #a7c1dd;
}

body[data-page="database"] .assembly-item-picker {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

body[data-page="database"] .assembly-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  color: #27435f;
  font-size: 0.9rem;
  cursor: pointer;
}

body[data-page="database"] .assembly-item-row:hover {
  background: #edf5ff;
}

body[data-page="database"] .assembly-item-checkbox {
  margin: 0;
}

body[data-page="database"] .assembly-items-table-wrap {
  overflow-x: auto;
}

body[data-page="database"] .assembly-items-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: #fbfdff;
}

body[data-page="database"] .assembly-items-table th,
body[data-page="database"] .assembly-items-table td {
  border: 1px solid #d6e2f0;
  padding: 7px 8px;
  text-align: left;
  vertical-align: middle;
}

body[data-page="database"] .assembly-items-table th {
  background: #edf4fd;
  color: #234566;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

body[data-page="database"] .assembly-items-table input,
body[data-page="database"] .assembly-items-table select {
  width: 100%;
  height: 32px;
  border: 1px solid #ccd9ea;
  border-radius: 8px;
  padding: 0 8px;
  background: #ffffff;
  color: #1c2e41;
  font-size: 0.86rem;
}

body[data-page="database"] .assembly-items-table input[readonly] {
  background: #f4f8fd;
  color: #40586f;
}

body[data-page="database"] .assembly-items-table input:focus,
body[data-page="database"] .assembly-items-table select:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"] .assembly-catalog-header {
  margin-top: 12px;
  color: #3f5874;
  font-size: 0.83rem;
  font-weight: 700;
}

body[data-page="database"] .assembly-catalog-header > span {
  display: inline-block;
}

body[data-page="database"] .catalog-search-input {
  height: 30px;
  min-width: 170px;
  max-width: 260px;
  border: 1px solid #c9d8ec;
  border-radius: 8px;
  background: #ffffff;
  color: #1f344b;
  font-size: 0.8rem;
  padding: 0 9px;
}

body[data-page="database"] .catalog-search-input:focus {
  outline: 2px solid rgba(120, 153, 219, 0.3);
  border-color: #9db7e1;
}

body[data-page="database"] .assembly-catalog-table {
  margin-top: 8px;
}

body[data-page="database"] .assembly-catalog-table tr.catalog-row-selected td {
  background: #e6f2ff;
}

body[data-page="database"] #assembly-catalog-table thead th:nth-child(2),
body[data-page="database"] #assembly-catalog-table tbody td:nth-child(2),
body[data-page="database"] #crew-labor-catalog-table thead th:nth-child(2),
body[data-page="database"] #crew-labor-catalog-table tbody td:nth-child(2),
body[data-page="database"] #crew-equipment-catalog-table thead th:nth-child(2),
body[data-page="database"] #crew-equipment-catalog-table tbody td:nth-child(2),
body[data-page="database"] #crew-members-table thead th:nth-child(2),
body[data-page="database"] #crew-members-table tbody td:nth-child(2) {
  display: none;
}

body[data-page="database"] .assembly-add-row-btn {
  margin-top: 10px;
  border: 1px solid #9eb6ce;
  border-radius: 9px;
  background: #ffffff;
  color: #2a4f73;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
}

body[data-page="database"] .assembly-add-row-btn:hover {
  background: #eef5ff;
}

body[data-page="database"] .column-chooser-btn {
  margin-top: 0;
  display: none !important;
}

body[data-page="database"] .column-chooser-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  min-width: 220px;
  max-width: 320px;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 26px rgba(18, 45, 75, 0.18);
  padding: 10px;
}

body[data-page="database"] .column-chooser-title {
  margin: 0 0 8px;
  color: #3f5874;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

body[data-page="database"] .column-chooser-list {
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
}

body[data-page="database"] .column-chooser-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #2f4c6a;
  font-size: 0.84rem;
}

body[data-page="database"] .column-chooser-option input {
  width: 14px;
  height: 14px;
}

body[data-page="database"] .data-table th.has-column-menu,
body[data-page="database"] .assembly-items-table th.has-column-menu {
  position: relative;
  padding-right: 26px;
}

body[data-page="database"] .column-header-menu-trigger {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #5a7390;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}

body[data-page="database"] .data-table th.has-column-menu:hover .column-header-menu-trigger,
body[data-page="database"] .data-table th.has-column-menu:focus-within .column-header-menu-trigger,
body[data-page="database"] .assembly-items-table th.has-column-menu:hover .column-header-menu-trigger,
body[data-page="database"] .assembly-items-table th.has-column-menu:focus-within .column-header-menu-trigger {
  opacity: 1;
  pointer-events: auto;
}

body[data-page="database"] .column-header-menu-trigger:hover {
  background: #e8f2ff;
  color: #1f4f7b;
}

body[data-page="database"] .column-header-menu-panel {
  z-index: 60;
  min-width: 220px;
  max-width: 320px;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 26px rgba(18, 45, 75, 0.18);
  padding: 10px;
}

body[data-page="estimating"] .data-table th.has-column-menu {
  position: relative;
  padding-right: 26px;
}

body[data-page="estimating"] .column-header-menu-trigger {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #5a7390;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}

body[data-page="estimating"] .data-table th.has-column-menu:hover .column-header-menu-trigger,
body[data-page="estimating"] .data-table th.has-column-menu:focus-within .column-header-menu-trigger {
  opacity: 1;
  pointer-events: auto;
}

body[data-page="estimating"] .column-header-menu-trigger:hover {
  background: #e8f2ff;
  color: #1f4f7b;
}

body[data-page="estimating"] .column-header-menu-panel {
  z-index: 60;
  min-width: 220px;
  max-width: 320px;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 26px rgba(18, 45, 75, 0.18);
  padding: 10px;
}

body[data-page="estimating"] .column-chooser-title {
  margin: 0 0 8px;
  color: #3f5874;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

body[data-page="estimating"] .column-chooser-list {
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
}

body[data-page="estimating"] .column-chooser-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #2f4c6a;
  font-size: 0.84rem;
}

body[data-page="estimating"] .column-chooser-option input {
  width: 14px;
  height: 14px;
}

body[data-page="database"] #crew-builder .assembly-catalog-table th,
body[data-page="database"] #crew-builder .assembly-catalog-table td {
  padding: 4px 6px;
  font-size: 0.78rem;
}

body[data-page="database"] #crew-builder .assembly-catalog-table th {
  font-size: 0.74rem;
}

body[data-page="database"] #crew-builder .assembly-catalog-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

body[data-page="database"] #crew-builder .assembly-items-table {
  background: #ffffff;
}

body[data-page="database"] #crew-builder #crew-members-rows td {
  padding: 4px 6px;
  background: #ffffff;
}

body[data-page="database"] #crew-builder #crew-members-rows input {
  height: 24px;
  border: 0;
  border-radius: 0;
  padding: 0 2px;
  background: transparent;
  font-size: 0.78rem;
  color: #223a52;
}

body[data-page="database"] #crew-builder #crew-members-rows input[readonly] {
  background: transparent;
  color: #223a52;
}

body[data-page="database"] #crew-builder #crew-members-rows .crew-member-quantity-input,
body[data-page="database"] #crew-builder #crew-members-rows .crew-member-cost-input {
  border-bottom: 1px solid #ccd9ea;
}

body[data-page="database"] #crew-builder #crew-members-rows .crew-member-quantity-input:focus,
body[data-page="database"] #crew-builder #crew-members-rows .crew-member-cost-input:focus {
  outline: none;
  border-bottom-color: #7fb2de;
}

body[data-page="database"] #crew-builder #crew-members-rows tr:nth-child(even) {
  background: #f9fcff;
}

body[data-page="database"] #crew-builder #crew-members-rows .row-remove-btn {
  width: 20px;
  height: 20px;
  font-size: 0.82rem;
}

body[data-page="database"] #crew-builder .assembly-catalog-header {
  margin-top: 8px;
}

body[data-page="database"] #crew-builder .crew-catalog-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

body[data-page="database"] #crew-builder .crew-catalog-panel .assembly-catalog-header {
  margin-top: 8px;
}

body[data-page="database"] #crew-builder .crew-catalog-panel .assembly-items-table-wrap {
  margin-top: 8px;
}

body[data-page="database"] #crew-builder .crew-code-field {
  display: none;
}

body[data-page="database"] #assembly-builder .assembly-code-field {
  display: none;
}

body[data-page="database"] #assembly-builder #assembly-items-table thead th:nth-child(1),
body[data-page="database"] #assembly-builder #assembly-items-table tbody td:nth-child(1) {
  display: none;
}

@media (max-width: 1180px) {
  body[data-page="database"] #crew-builder .crew-catalog-split {
    grid-template-columns: 1fr;
  }
}

body[data-page="database"] .assembly-items-table-wrap {
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 12px;
  background: #ffffff;
}

body[data-page="database"] .assembly-items-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

body[data-page="database"] .assembly-items-table th,
body[data-page="database"] .assembly-items-table td {
  border: 0;
  border-bottom: 1px solid rgba(16, 24, 40, 0.06);
  padding: 0 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

body[data-page="database"] .assembly-items-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f5f6ff;
  color: #000000;
  font-size: 12.5px;
  font-weight: 400;
  height: 36px;
  line-height: 36px;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
}

body[data-page="database"] .assembly-items-table tbody tr:hover td {
  background: #f8fbff;
}

body[data-page="database"] .assembly-items-table tbody tr:nth-child(even) td {
  background: #ffffff;
}

body[data-page="database"] .assembly-items-table tr.catalog-row-selected td {
  background: rgba(66, 92, 255, 0.08) !important;
}

body[data-page="database"] .assembly-items-table tbody tr.is-selected td {
  background: rgba(66, 92, 255, 0.08) !important;
}

body[data-page="database"] .assembly-items-table tbody tr.catalog-row-selected td:first-child,
body[data-page="database"] .assembly-items-table tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 #4f46e5;
}

body[data-page="database"] .assembly-items-table tbody tr:last-child td {
  border-bottom: 0;
}

body[data-page="database"] .assembly-items-table input,
body[data-page="database"] .assembly-items-table select {
  height: 28px;
  border: 1px solid rgba(16, 24, 40, 0.12);
  border-radius: 7px;
  background: #ffffff;
  color: #101828;
  font-size: 0.8rem;
  padding: 0 7px;
}

body[data-page="database"] .assembly-items-table input[readonly] {
  background: #ffffff;
  color: #101828;
}

body[data-page="database"] .assembly-items-table input:focus,
body[data-page="database"] .assembly-items-table select:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

body[data-page="database"] #crew-builder .crew-catalog-add-btn {
  width: 22px;
  height: 22px;
  border: 1px solid #9eb6ce;
  border-radius: 7px;
  background: #ffffff;
  color: #2a4f73;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body[data-page="database"] #crew-builder .crew-catalog-add-btn:hover {
  background: #eef5ff;
}

body[data-page="database"] .row-remove-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #cbd8e8;
  border-radius: 7px;
  background: #ffffff;
  color: #49698b;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body[data-page="database"] .row-remove-btn:hover {
  background: #fff1f1;
  border-color: #e2b6b6;
  color: #9a3b3b;
}

body[data-page="database"] .row-remove-btn svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  pointer-events: none;
}

body[data-page="database"] .assembly-items-table td:has(> .row-remove-btn) {
  text-align: center;
}

body[data-page="database"] .item-details-modern {
  padding: 12px;
  background: linear-gradient(180deg, #fcfeff 0%, #f7fbff 100%);
  border-color: #cfdeef;
  overflow: visible;
  isolation: isolate;
}

body[data-page="database"] .item-details-modern-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  overflow: visible;
}

body[data-page="database"] .item-detail-field {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid #d5e2f1;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  min-width: 0;
  overflow: visible;
  position: relative;
  z-index: 1;
}

body[data-page="database"] .item-detail-field:focus-within {
  z-index: 120;
}

body[data-page="database"] .item-detail-field > span {
  color: #4a6179;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body[data-page="database"] .item-detail-field input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid #cddced;
  border-radius: 8px;
  padding: 0 9px;
  color: #1f3247;
  background: #ffffff;
  font-size: 0.87rem;
}

body[data-page="database"] .item-detail-field input:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"] .item-detail-code {
  display: none;
}

body[data-page="database"] .item-detail-description {
  grid-column: span 12;
}

body[data-page="database"] .item-detail-quantity {
  grid-column: span 6;
}

body[data-page="database"] .item-detail-unit {
  grid-column: span 6;
}

body[data-page="database"] .item-detail-division {
  grid-column: span 4;
}

body[data-page="database"] .item-detail-category {
  grid-column: span 4;
}

body[data-page="database"] .item-detail-subcategory {
  grid-column: span 4;
}

body[data-page="database"] .item-formula-input-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

body[data-page="database"] .item-detail-mode-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 26px;
  height: 26px;
  border: 1px solid #cbd9ea;
  border-radius: 7px;
  background: #f7fbff;
  color: #446587;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

body[data-page="database"] .item-detail-field:hover .item-detail-mode-btn,
body[data-page="database"] .item-detail-field:focus-within .item-detail-mode-btn {
  opacity: 1;
}

body[data-page="database"] .item-detail-mode-btn:hover {
  background: #eaf3ff;
  border-color: #a9c1db;
}

body[data-page="database"] .item-detail-mode-btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  pointer-events: none;
}

body[data-page="database"] .item-detail-mode-menu {
  position: absolute;
  top: 34px;
  right: 7px;
  z-index: 1000;
  display: grid;
  gap: 4px;
  min-width: 140px;
  border: 1px solid #ccd9ea;
  border-radius: 9px;
  background: #ffffff;
  box-shadow: 0 12px 22px rgba(18, 45, 75, 0.18);
  padding: 6px;
}

body[data-page="database"] .item-detail-mode-menu[hidden] {
  display: none !important;
}

body[data-page="database"] .item-detail-mode-menu button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #2e4f70;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
  padding: 6px 8px;
  cursor: pointer;
}

body[data-page="database"] .item-detail-mode-menu button:hover {
  background: #edf5ff;
}

body[data-page="database"] .item-detail-formula-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

body[data-page="database"] .item-detail-formula-wrap[hidden] {
  display: none !important;
}

body[data-page="database"] .item-detail-formula-wrap .item-detail-formula-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body[data-page="database"] .item-detail-formula-badge {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(4px);
  width: 18px;
  height: 18px;
  border: 1px solid #9fc2e2;
  border-radius: 999px;
  background: #e8f4ff;
  color: #1f5b8b;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: lowercase;
  pointer-events: none;
}

body[data-page="database"] .item-detail-formula-badge[hidden] {
  display: none !important;
}

body[data-page="database"] .item-detail-field.is-formula-mode {
  border-color: #9cc3e9;
  background: linear-gradient(180deg, #fafdff 0%, #f1f8ff 100%);
}

body[data-page="database"] .item-detail-field.is-formula-mode input[readonly] {
  background: #eef4fb;
  border-color: #b9cde3;
  color: #3d5874;
  cursor: not-allowed;
}

body[data-page="database"] .item-formula-input-wrap input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body[data-page="database"] .item-formula-helper-open-btn {
  margin-top: 0;
  height: 38px;
  min-width: 38px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: lowercase;
}

body[data-page="database"] .item-formula-helper-dialog {
  width: min(760px, 94vw);
  max-width: 100%;
  overflow-x: hidden;
}

body[data-page="database"] .item-formula-template-grid {
  grid-template-columns: minmax(0, 1fr);
}

body[data-page="database"] .item-formula-prompts {
  display: grid;
  gap: 8px;
}

body[data-page="database"] .item-formula-prompt-row {
  display: grid;
  gap: 6px;
  color: #39526d;
  font-size: 0.85rem;
  font-weight: 700;
}

body[data-page="database"] .item-formula-prompt-row input {
  height: 38px;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 0.92rem;
  color: #1c2e41;
  background: #ffffff;
}

body[data-page="database"] .item-formula-prompt-row input:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"] .item-formula-insert-block {
  display: grid;
  gap: 6px;
}

body[data-page="database"] .item-formula-insert-title {
  color: #3f5874;
  font-size: 0.83rem;
  font-weight: 700;
}

body[data-page="database"] .item-formula-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body[data-page="database"] .item-formula-variable-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

body[data-page="database"] #item-formula-variable-select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  padding: 0 10px;
  background: #ffffff;
  color: #1c2e41;
  font-size: 0.9rem;
}

body[data-page="database"] #item-formula-variable-select:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"] .item-formula-chip-btn {
  border: 1px solid #ccd9ea;
  border-radius: 999px;
  background: #ffffff;
  color: #2a4f73;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
}

body[data-page="database"] .item-formula-chip-btn:hover {
  background: #eef5ff;
}

body[data-page="database"] .item-formula-preview-label {
  display: grid;
  gap: 6px;
  color: #39526d;
  font-size: 0.85rem;
  font-weight: 700;
}

body[data-page="database"] .item-formula-if-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

body[data-page="database"] .item-formula-value-field {
  display: grid;
  gap: 6px;
}

body[data-page="database"] .item-formula-if-grid input,
body[data-page="database"] .item-formula-if-grid select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  padding: 0 10px;
  background: #ffffff;
  color: #1c2e41;
  font-size: 0.9rem;
}

body[data-page="database"] .item-formula-if-grid input:focus,
body[data-page="database"] .item-formula-if-grid select:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"] #item-formula-preview {
  width: 100%;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  padding: 8px 10px;
  background: #ffffff;
  color: #1c2e41;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 84px;
}

body[data-page="database"] #item-formula-preview:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"] .item-formula-live-output {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #d1ddec;
  border-radius: 10px;
  background: #f8fbff;
}

body[data-page="database"] .item-formula-live-label {
  color: #4e6783;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

body[data-page="database"] .item-formula-live-value {
  color: #1f4466;
  font-size: 0.9rem;
  font-weight: 700;
}

body[data-page="database"] .assembly-formula-helper-menu {
  position: fixed;
  z-index: 3200;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #c8d7e8;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
  padding: 4px;
}

body[data-page="database"] .assembly-formula-helper-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #123754;
  text-align: left;
  font-size: 0.82rem;
  line-height: 1.25;
  padding: 7px 10px;
  cursor: pointer;
}

body[data-page="database"] .assembly-formula-helper-item:hover,
body[data-page="database"] .assembly-formula-helper-item.is-active {
  background: rgba(66, 92, 255, 0.14);
  color: #153e6a;
}

@media (max-width: 980px) {
  body[data-page="database"] .item-detail-code,
  body[data-page="database"] .item-detail-description,
  body[data-page="database"] .item-detail-quantity,
  body[data-page="database"] .item-detail-unit,
  body[data-page="database"] .item-detail-division,
  body[data-page="database"] .item-detail-category,
  body[data-page="database"] .item-detail-subcategory {
    grid-column: span 6;
  }

  body[data-page="database"] .item-formula-if-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="database"] .item-formula-if-grid .item-formula-helper-open-btn {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 640px) {
  body[data-page="database"] .item-details-modern-grid {
    grid-template-columns: 1fr;
  }

  body[data-page="database"] .item-detail-code,
  body[data-page="database"] .item-detail-description,
  body[data-page="database"] .item-detail-quantity,
  body[data-page="database"] .item-detail-unit,
  body[data-page="database"] .item-detail-division,
  body[data-page="database"] .item-detail-category,
  body[data-page="database"] .item-detail-subcategory,
  body[data-page="database"] .item-detail-formula {
    grid-column: span 1;
  }

  body[data-page="database"] .item-formula-variable-row {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="database"] .item-formula-variable-row .item-formula-helper-open-btn {
    justify-self: start;
  }

  body[data-page="database"] .item-formula-if-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

body[data-page="database"] .assembly-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

body[data-page="database"] .assembly-open-btn {
  margin-top: 14px;
  border: 1px solid #1f69a7;
  border-radius: 10px;
  background: #ffffff;
  color: #1f69a7;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 12px;
  cursor: pointer;
}

body[data-page="database"] .assembly-open-btn:hover {
  background: #eef5ff;
}

.assembly-submit-btn {
  border: 1px solid var(--app-primary-btn-border);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--app-primary-btn-start) 0%, var(--app-primary-btn-end) 100%);
  color: var(--app-primary-btn-text);
  font-weight: 700;
  font-size: 0.8rem;
  height: 34px;
  padding: 0 14px;
  cursor: pointer;
}

.assembly-submit-btn:hover {
  filter: brightness(1.04);
}

body[data-page="database"] .assembly-feedback {
  margin: 0;
  color: #33567b;
  font-size: 0.88rem;
}

body[data-page="database"] .formula-variable-opacity-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

body[data-page="database"] .formula-variable-opacity-wrap input[type="range"] {
  width: 100%;
}

body[data-page="database"] .formula-variable-opacity-wrap span {
  color: #36597d;
  font-size: 0.84rem;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}

body[data-page="database"] .formula-variable-form-layout {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

body[data-page="database"] #formula-variable-modal .assembly-modal-dialog.is-dropdown-items-mode {
  width: min(1080px, 96vw);
}

body[data-page="database"] #formula-variable-modal .assembly-modal-dialog.is-dropdown-items-mode .formula-variable-form-layout {
  grid-template-columns: minmax(0, 1fr) 300px;
}

body[data-page="database"] .formula-variable-main-fields {
  min-width: 0;
}

body[data-page="database"] .formula-variable-main-fields .assembly-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body[data-page="database"] .formula-variable-form-layout > .assembly-actions {
  grid-column: 1 / -1;
}

body[data-page="database"] .formula-variable-dropdown-items-card {
  border: 1px solid #d6e2f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 10px;
  box-shadow: var(--db-shadow-soft);
  position: sticky;
  top: 0;
}

body[data-page="database"] .formula-variable-dropdown-items-card h5 {
  margin: 0;
  color: #234566;
  font-size: 0.86rem;
}

body[data-page="database"] .formula-variable-dropdown-items-card p {
  margin: 4px 0 10px;
  color: #5f6f83;
  font-size: 0.8rem;
}

body[data-page="database"] .formula-variable-dropdown-mode-row {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

body[data-page="database"] .formula-variable-dropdown-mode-row > span {
  color: #3f5874;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

body[data-page="database"] .formula-variable-dropdown-mode-row select {
  height: 34px;
  border: 1px solid #ccd9ea;
  border-radius: 8px;
  padding: 0 9px;
  font-size: 0.86rem;
  color: #1c2e41;
  background: #ffffff;
}

body[data-page="database"] .formula-variable-dropdown-mode-row select:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"] .formula-variable-dropdown-items-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

body[data-page="database"] .formula-variable-dropdown-items-input-row input {
  height: 34px;
  border: 1px solid #ccd9ea;
  border-radius: 8px;
  padding: 0 9px;
  font-size: 0.86rem;
  color: #1c2e41;
  background: #ffffff;
}

body[data-page="database"] .formula-variable-dropdown-items-input-row input:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="database"] .formula-variable-dropdown-items-input-row .assembly-add-row-btn {
  margin-top: 0;
  height: 34px;
}

body[data-page="database"] .formula-variable-dropdown-items-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  max-height: 300px;
  overflow: auto;
}

body[data-page="database"] .formula-variable-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #d6e2f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 6px 8px;
  color: #2c4a68;
  font-size: 0.84rem;
  font-weight: 700;
}

body[data-page="database"] .formula-variable-dropdown-item.is-name-value {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
}

body[data-page="database"] .formula-variable-dropdown-item-name,
body[data-page="database"] .formula-variable-dropdown-item-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="database"] .formula-variable-dropdown-item-value {
  color: #5a7390;
  font-weight: 600;
}

body[data-page="database"] .formula-variable-dropdown-items-empty {
  border: 1px dashed #c8d7e8;
  border-radius: 8px;
  background: #f8fbff;
  padding: 8px;
  color: #607890;
  font-size: 0.82rem;
}

body[data-page="database"] #crew-total-cost {
  margin-left: auto;
  padding: 7px 11px;
  border: 1px solid #d1ddec;
  border-radius: 10px;
  background: #f8fbff;
  color: #1f4466;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body[data-page="database"] .data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
  border: 0;
  border-radius: 0;
}

body[data-page="database"] .data-table th {
  background: #f5f6ff;
  border-bottom: 1px solid #d6e2f0;
  color: #000000;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 36px;
  height: 36px;
  position: sticky;
  top: 0;
  z-index: 12;
  border-left: 0;
  border-right: 0;
  padding: 0 14px;
}

body[data-page="database"] .data-table td {
  background: #ffffff;
  color: var(--db-text);
  font-size: 0.8rem;
  font-weight: 400;
  height: 30px;
  line-height: 30px;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
  border-left: 0;
  border-right: 0;
  padding: 0 14px;
  vertical-align: middle;
  white-space: nowrap;
  font-family: "Roboto", "Segoe UI", Tahoma, Arial, sans-serif;
}

body[data-page="database"] .data-table th.database-selection-col,
body[data-page="database"] .data-table td.database-selection-col {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}

body[data-page="database"] .db-select-all,
body[data-page="database"] .db-row-select {
  width: 14px;
  height: 14px;
  accent-color: #4a54f4;
}

body[data-page="database"] .data-table tbody tr.db-data-row.is-selected td {
  background: rgba(66, 92, 255, 0.16);
}

body[data-page="database"] .data-table tbody tr.db-data-row.is-selected td:first-child {
  box-shadow: inset 3px 0 0 #4a54f4;
}

body[data-page="database"] .data-table tbody tr.db-data-row.is-selected:hover td {
  background: rgba(66, 92, 255, 0.16);
}

body[data-page="database"] .data-table tbody td.db-cell-active {
  background: rgba(79, 70, 229, 0.2) !important;
  box-shadow: inset 0 0 0 2px #4f46e5;
}

body[data-page="database"] .data-table tbody td.db-cell-drag-selected {
  background: rgba(79, 70, 229, 0.14) !important;
  --db-drag-edge-top: inset 0 0 0 transparent;
  --db-drag-edge-right: inset 0 0 0 transparent;
  --db-drag-edge-bottom: inset 0 0 0 transparent;
  --db-drag-edge-left: inset 0 0 0 transparent;
  box-shadow: var(--db-drag-edge-top), var(--db-drag-edge-right), var(--db-drag-edge-bottom), var(--db-drag-edge-left);
}

body[data-page="database"] .data-table tbody td.db-cell-drag-edge-top {
  --db-drag-edge-top: inset 0 2px 0 #4f46e5;
}

body[data-page="database"] .data-table tbody td.db-cell-drag-edge-right {
  --db-drag-edge-right: inset -2px 0 0 #4f46e5;
}

body[data-page="database"] .data-table tbody td.db-cell-drag-edge-bottom {
  --db-drag-edge-bottom: inset 0 -2px 0 #4f46e5;
}

body[data-page="database"] .data-table tbody td.db-cell-drag-edge-left {
  --db-drag-edge-left: inset 2px 0 0 #4f46e5;
}

body[data-page="database"] .db-context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 180px;
  background: #ffffff;
  border: 1px solid rgba(16, 24, 40, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.18);
  padding: 6px;
  display: grid;
  gap: 4px;
}

body[data-page="database"] .db-context-menu-item {
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  color: #1f344b;
  font-size: 0.8rem;
  text-align: left;
  padding: 0 10px;
  cursor: pointer;
}

body[data-page="database"] .db-context-menu-item:hover {
  background: #f3f7ff;
}

body[data-page="database"] .db-context-menu-item:disabled {
  color: #9aa7b8;
  background: #ffffff;
  cursor: not-allowed;
}

body[data-page="database"] .db-context-menu-item.db-context-menu-item-danger {
  background: #fff1f2;
  color: #b42318;
}

body[data-page="database"] .db-context-menu-item.db-context-menu-item-danger:hover {
  background: #ffe4e8;
}

body[data-page="database"] .db-context-menu-add-rows {
  display: grid;
  grid-template-columns: auto 58px auto;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
}

body[data-page="database"] .db-context-menu-add-rows-input {
  width: 100%;
  height: 22px;
  border: 1px solid #d1dae9;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 0.76rem;
  text-align: center;
  color: #0f172a;
  background: #ffffff;
}

body[data-page="database"] .db-context-menu-add-rows-input:focus {
  outline: none;
  border-color: #9cb0d3;
  box-shadow: 0 0 0 2px rgba(76, 110, 168, 0.18);
}

body[data-page="database"] .db-context-menu-add-rows-apply {
  border: 1px solid #d3deef;
  border-radius: 7px;
  background: #eef4ff;
  color: #1f3a62;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  cursor: pointer;
}

body[data-page="database"] .db-context-menu-add-rows-apply:hover {
  background: #e3edff;
}

body[data-page="database"] .data-table tbody tr {
  transition: background-color 0.18s ease;
}

body[data-page="database"] .data-table tbody tr:hover td {
  background: #f8fbff;
}

body[data-page="database"] .data-table tbody tr:nth-child(even) td {
  background: #ffffff;
}

body[data-page="database"] .data-table.is-entering {
  opacity: 0;
  transform: translateY(8px);
}

body[data-page="database"] .data-table.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

body[data-page="estimating"] .table-wrap {
  border: 1px solid #d7dbe2;
  border-radius: 18px;
  background: #f8fafc;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  overflow: auto;
}

body[data-page="estimating"] .estimating-shell {
  border-radius: 22px;
  border: 1px solid #d9deea;
  background: linear-gradient(180deg, #f5f7fb 0%, #f1f4f9 100%);
  box-shadow: 0 14px 30px rgba(16, 24, 40, 0.08);
  padding: 16px;
}

body[data-page="estimating"] .estimating-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

body[data-page="estimating"] .estimating-header-row h2 {
  margin: 0;
  color: #1f2937;
  font-size: 1.22rem;
  letter-spacing: 0.01em;
}

body[data-page="estimating"] .estimating-header-row .table-note {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 0.82rem;
}

body[data-page="estimating"] .estimating-primary-button {
  height: 34px;
  border: 1px solid var(--app-primary-btn-border);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--app-primary-btn-start) 0%, var(--app-primary-btn-end) 100%);
  color: var(--app-primary-btn-text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 14px;
  cursor: pointer;
}

body[data-page="estimating"] .estimating-primary-button:hover {
  filter: brightness(1.05);
}

body[data-page="estimating"] .estimating-tab-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  overflow-x: auto;
}

body[data-page="estimating"] .estimating-tab {
  height: 30px;
  border: 1px solid #d6dce8;
  border-radius: 999px;
  background: #f9fbff;
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
}

body[data-page="estimating"] .estimating-tab.is-active {
  border-color: #bdc6ff;
  background: #eef1ff;
  color: #3a47c6;
}

body[data-page="estimating"] .estimating-view-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 460px) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid #e3e7ee;
  border-radius: 12px;
  background: #f9fbfd;
}

body[data-page="estimating"] .estimating-toolbar-left {
  flex: 0 1 460px;
  min-width: 0;
  width: min(460px, 100%);
}

body[data-page="estimating"] .estimating-toolbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
}

body[data-page="estimating"] .estimating-toolbar-right > * {
  flex: 0 0 auto;
}

body[data-page="estimating"] .estimating-toolbar-right > label {
  display: none;
}

body[data-page="estimating"] .estimating-view-toolbar label {
  color: #4b5563;
  font-size: 0.8rem;
  font-weight: 500;
}

body[data-page="estimating"] .estimating-view-toolbar select,
body[data-page="estimating"] .estimating-view-toolbar input {
  height: 32px;
  border: 1px solid #d7dde7;
  border-radius: 9px;
  padding: 0 10px;
  background: #ffffff;
  color: #374151;
  font-size: 0.82rem;
}

body[data-page="estimating"] .estimating-search-input {
  min-width: 0;
  width: min(460px, 100%);
}

body[data-page="estimating"] .estimating-view-toolbar select:focus,
body[data-page="estimating"] .estimating-view-toolbar input:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="estimating"] .estimating-view-toolbar button {
  height: 32px;
  border: 1px solid #d3dbe6;
  border-radius: 9px;
  background: #ffffff;
  color: #4b5563;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0 10px;
  cursor: pointer;
}

body[data-page="estimating"] .estimating-view-toolbar button:hover {
  background: #f3f6fa;
}

body[data-page="estimating"] .estimating-view-toolbar button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f8fafc;
}

body[data-page="estimating"] .estimating-views-dropdown {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
}

body[data-page="estimating"] .estimating-views-button {
  width: 100%;
  text-align: left;
  padding: 0 11px;
}

body[data-page="estimating"] .estimating-views-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 300px;
  border: 1px solid #d6deeb;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 26px rgba(16, 24, 40, 0.16);
  padding: 10px;
  display: grid;
  gap: 7px;
  z-index: 42;
}

body[data-page="estimating"] .estimating-views-menu[hidden] {
  display: none !important;
}

body[data-page="estimating"] .estimating-views-menu label {
  font-size: 0.76rem;
  color: #64748b;
}

body[data-page="estimating"] .estimating-views-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

body[data-page="estimating"] .estimating-views-actions button {
  flex: 1;
}

body[data-page="estimating"] #estimating-save-view-button {
  border: 1px solid var(--app-primary-btn-border);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--app-primary-btn-start) 0%, var(--app-primary-btn-end) 100%);
  color: var(--app-primary-btn-text);
}

body[data-page="estimating"] #estimating-save-view-button:hover {
  filter: brightness(1.05);
}

body[data-page="estimating"] .estimating-group-by-dropdown {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
}

body[data-page="estimating"] .estimating-group-by-button {
  width: 100%;
  text-align: left;
  padding: 0 11px;
}

@media (min-width: 901px) {
  body[data-page="estimating"] .estimating-toolbar-right {
    flex-wrap: nowrap;
  }

  body[data-page="estimating"] .estimating-views-button,
  body[data-page="estimating"] .estimating-group-by-button {
    width: auto;
    white-space: nowrap;
  }
}

body[data-page="estimating"] .estimating-group-by-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: auto;
  right: 0;
  width: 280px;
  max-width: min(360px, calc(100vw - 16px));
  border: 1px solid #d6deeb;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 26px rgba(16, 24, 40, 0.16);
  padding: 8px;
  z-index: 40;
}

body[data-page="estimating"] .estimating-group-by-menu-note {
  margin: 0 0 6px;
  color: #6b7280;
  font-size: 0.75rem;
}

body[data-page="estimating"] .estimating-group-by-list {
  display: grid;
  gap: 4px;
}

body[data-page="estimating"] .estimating-group-by-option {
  display: grid;
  grid-template-columns: 14px 16px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  cursor: move;
}

body[data-page="estimating"] .estimating-group-by-option:hover {
  background: #f7faff;
  border-color: #e1e8f2;
}

body[data-page="estimating"] .estimating-group-by-option.is-drag-over {
  border-color: #9fb6d1;
  background: #edf4ff;
}

body[data-page="estimating"] .estimating-group-by-option.is-dragging {
  opacity: 0.55;
}

body[data-page="estimating"] .estimating-group-by-drag {
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: -0.08em;
  user-select: none;
}

body[data-page="estimating"] .estimating-group-by-option input[type="checkbox"] {
  margin: 0;
  width: 14px;
  height: 14px;
}

body[data-page="estimating"] .estimating-group-by-option-label {
  color: #1f2937;
  font-size: 0.82rem;
}

body[data-page="estimating"] #estimating-fit-columns-button[aria-pressed="true"] {
  background: #eaf3ff;
  border-color: #9ebfe0;
  color: #1d4f7c;
}

body[data-page="estimating"] #estimating-view-feedback {
  margin: 0;
  color: #33567b;
  font-size: 0.78rem;
}

body[data-page="estimating"] .page-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0 28px 36px;
  height: calc(100vh - 150px);
  overflow: hidden;
}

body[data-page="estimating"] .card {
  width: 100%;
}

body[data-page="estimating"] .data-table {
  width: max-content;
  min-width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

body[data-page="estimating"] .data-table th,
body[data-page="estimating"] .data-table td {
  border-right: 0;
  border-bottom: 1px solid #e6eaf0;
  padding: 10px 14px;
  text-align: left;
  vertical-align: middle;
}

body[data-page="estimating"] .data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f5f9;
  color: #4b5563;
  font-size: 0.74rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  line-height: 1.2;
  user-select: none;
  cursor: grab;
  overflow: hidden;
}

body[data-page="estimating"] .data-table th.has-column-menu {
  padding-right: 36px;
}

body[data-page="estimating"] .data-table th:active {
  cursor: grabbing;
}

body[data-page="estimating"] .data-table td {
  color: #374151;
  font-size: 0.8rem;
  background: #fdfefe;
  white-space: nowrap;
}

body[data-page="estimating"] .data-table .estimating-add-row td {
  position: static;
  background: #f5f7fa;
  border-bottom-color: #d8dee8;
}

body[data-page="estimating"] .data-table .estimating-add-row td .estimating-add-input {
  width: 100%;
  height: 30px;
  border: 1px solid #d2d9e4;
  border-radius: 10px;
  padding: 0 10px;
  background: #ffffff;
  color: #1f2937;
  font-size: 0.82rem;
}

body[data-page="estimating"] .data-table .estimating-add-row td .estimating-add-input:focus {
  outline: 2px solid #a8d1f3;
  border-color: #8ebbe3;
}

body[data-page="estimating"] .estimating-add-first-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

body[data-page="estimating"] .estimating-add-row-button {
  width: 30px;
  height: 30px;
  border: 1px solid #d2dae5;
  border-radius: 10px;
  background: #ffffff;
  color: #4b5563;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

body[data-page="estimating"] .estimating-add-row-button:hover {
  background: #f3f6fa;
}

body[data-page="estimating"] .data-table.fit-columns {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

body[data-page="estimating"] .data-table.fit-columns th,
body[data-page="estimating"] .data-table.fit-columns td {
  width: calc(100% / var(--estimating-visible-columns, 1));
  min-width: 0;
  max-width: none;
}

body[data-page="estimating"] .data-table.fit-columns th {
  overflow: visible;
  text-overflow: clip;
}

body[data-page="estimating"] .data-table.fit-columns td {
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-page="estimating"] .data-table th.estimating-dragging {
  opacity: 0.6;
}

body[data-page="estimating"] .data-table th.estimating-drag-over-left {
  box-shadow: inset 2px 0 0 #6a9bcf;
}

body[data-page="estimating"] .data-table th.estimating-drag-over-right {
  box-shadow: inset -2px 0 0 #6a9bcf;
}

body[data-page="estimating"] .estimating-column-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}

body[data-page="estimating"] .estimating-column-resize-handle::before {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  right: 2px;
  width: 1px;
  background: rgba(107, 114, 128, 0.24);
}

body[data-page="estimating"] .data-table th:hover .estimating-column-resize-handle::before {
  background: rgba(75, 85, 99, 0.5);
}

body[data-page="estimating"] .data-table tbody tr {
  transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

body[data-page="estimating"] .data-table tbody tr:hover {
  background: #f3f7fd;
  box-shadow: inset 0 0 0 9999px rgba(243, 247, 253, 0.72);
}

body[data-page="estimating"] .data-table tbody tr:nth-child(even) {
  background: transparent;
}

body[data-page="estimating"] .data-table th:last-child,
body[data-page="estimating"] .data-table td:last-child {
  border-right: 0;
}

body[data-page="estimating"] .data-table tbody tr:last-child td {
  border-bottom: 0;
}

body[data-page="summary"] {
  --est-bg: #f4f6fa;
  --est-surface: #ffffff;
  --est-border: rgba(16, 24, 40, 0.08);
  --est-separator: rgba(16, 24, 40, 0.06);
  --est-text: #101828;
  --est-muted: #667085;
  --est-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
  --est-radius: 14px;
  --sort-types-header-row-height: 36px;
  --sort-types-body-row-height: 20px;
  background: var(--est-bg);
}

body[data-page="summary"] .summary-card {
  background: var(--est-surface);
  border: 1px solid var(--est-border);
  border-radius: var(--est-radius);
  box-shadow: var(--est-shadow);
}

body[data-page="summary"] .summary-table-wrap {
  background: var(--est-surface);
  border: 1px solid var(--est-border);
  border-radius: 12px;
  padding: 0;
  overflow-x: auto;
  overflow-y: visible;
}

body[data-page="summary"] .summary-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  border: 0;
  border-radius: 0;
}

body[data-page="summary"] .summary-table th,
body[data-page="summary"] .summary-table td {
  border-bottom: 1px solid var(--est-separator);
  border-left: 0;
  border-right: 0;
  padding: 0 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

body[data-page="summary"] .summary-table th {
  background: #f5f6ff;
  border-bottom: 1px solid var(--est-border);
  color: #000000;
  font-size: 12.5px;
  font-weight: 400;
  line-height: var(--sort-types-header-row-height);
  height: var(--sort-types-header-row-height);
}

body[data-page="summary"] .summary-table td {
  background: var(--est-surface);
  color: var(--est-text);
  font-size: 0.8rem;
  font-weight: 400;
  height: var(--sort-types-body-row-height);
  line-height: var(--sort-types-body-row-height);
}

body[data-page="summary"] .summary-table tbody tr:hover td {
  background: #f8fbff;
}

body[data-page="summary"] .summary-table tbody tr:nth-child(even) td {
  background: var(--est-surface);
}

body[data-page="summary"] .summary-table th:nth-child(n + 2),
body[data-page="summary"] .summary-table td:nth-child(n + 2) {
  text-align: right;
}

body[data-page="summary"] .summary-table td input {
  width: 100%;
  height: var(--sort-types-body-row-height);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 0.8rem;
  font-weight: 400;
  padding: 0;
  line-height: var(--sort-types-body-row-height);
  text-align: right;
}

body[data-page="summary"] .summary-table td input:focus {
  outline: none;
  background: transparent;
}

body[data-page="summary"] .summary-table output {
  color: var(--est-text);
  font-weight: 400;
}

body[data-page="summary"] .summary-table tfoot th {
  background: #f5f6ff;
  border-bottom: 1px solid var(--est-border);
  color: #000000;
  font-size: 12.5px;
  font-weight: 400;
}

/* Estimating SaaS Datagrid Theme */
body[data-page="estimating"] {
  --est-bg: #f4f6fa;
  --est-surface: #ffffff;
  --est-border: rgba(16, 24, 40, 0.08);
  --est-separator: rgba(16, 24, 40, 0.06);
  --est-text: #101828;
  --est-muted: #667085;
  --est-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
  --est-radius: 14px;
  --est-hover: rgba(16, 24, 40, 0.03);
  --est-selected: rgba(66, 92, 255, 0.08);
  --est-primary: #4f46e5;
  font-family: "Inter", "SF Pro Text", "SF Pro Display", "Segoe UI", Tahoma, sans-serif;
  background: var(--est-bg);
  height: 100vh;
  overflow: hidden;
}

body[data-page="estimating"] .estimating-shell {
  background: var(--est-surface);
  border-radius: var(--est-radius);
  border: 1px solid var(--est-border);
  box-shadow: var(--est-shadow);
  padding: 18px;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body[data-page="estimating"] .estimating-header-row h2 {
  font-size: 1.1rem;
}

body[data-page="estimating"] .estimating-tab-row {
  margin-bottom: 12px;
}

body[data-page="estimating"] .estimating-tab,
body[data-page="estimating"] .estimating-view-toolbar button,
body[data-page="estimating"] .estimating-view-toolbar select,
body[data-page="estimating"] .estimating-view-toolbar input,
body[data-page="estimating"] .estimating-primary-button {
  border-radius: 11px;
}

body[data-page="estimating"] .estimating-primary-button {
  border-color: var(--app-primary-btn-border);
  background: linear-gradient(135deg, var(--app-primary-btn-start) 0%, var(--app-primary-btn-end) 100%);
}

body[data-page="estimating"] .estimating-view-toolbar {
  background: #f8fafc;
}

body[data-page="estimating"] .estimating-grid-wrap {
  background: var(--est-surface);
  border: 1px solid var(--est-border);
  border-radius: 12px;
  padding: 0;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #c7cfda transparent;
}

body[data-page="estimating"] .estimating-grid-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body[data-page="estimating"] .estimating-grid-wrap::-webkit-scrollbar-track {
  background: transparent;
}

body[data-page="estimating"] .estimating-grid-wrap::-webkit-scrollbar-thumb {
  background: #c7cfda;
  border-radius: 999px;
}

body[data-page="estimating"] .data-table {
  width: max-content;
  min-width: 100%;
  min-width: 1080px;
}

body[data-page="estimating"] .data-table th,
body[data-page="estimating"] .data-table td {
  border-bottom: 1px solid var(--est-separator);
  padding: 0 14px;
}

body[data-page="estimating"] .data-table th {
  background: #f8fafc;
  border-bottom: 1px solid var(--est-border);
  color: var(--est-muted);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.25;
  position: sticky;
  top: 0;
  z-index: 12;
}

body[data-page="estimating"] .data-table thead th.estimating-selection-col {
  z-index: 13;
}

body[data-page="estimating"] .data-table td {
  background: var(--est-surface);
  color: var(--est-text);
  font-size: 13.5px;
  font-weight: 400;
  height: 30px;
  line-height: 30px;
}

body[data-page="estimating"] .data-table tbody tr:hover td {
  background: var(--est-hover);
}

body[data-page="estimating"] .data-table tbody tr.is-selected td {
  background: var(--est-selected);
}

body[data-page="estimating"] .data-table tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--est-primary);
}

body[data-page="estimating"] .data-table .estimating-selection-col {
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  position: sticky;
  left: 0;
  z-index: 4;
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
}

body[data-page="estimating"] .data-table tbody td.estimating-selection-col {
  z-index: 3;
}

body[data-page="estimating"] #estimating-select-all,
body[data-page="estimating"] .estimating-row-select {
  width: 14px;
  height: 14px;
  accent-color: var(--est-primary);
}

body[data-page="estimating"] .data-table .estimating-add-row td {
  background: #f5f8fd;
  position: static;
  top: auto;
  z-index: auto;
  border-bottom: 1px dashed rgba(16, 24, 40, 0.08);
  height: 30px;
  vertical-align: middle;
  padding-top: 0;
  padding-bottom: 0;
}

body[data-page="estimating"] .data-table .estimating-add-row td.estimating-add-cell {
  position: static;
  height: 30px;
  line-height: 30px;
}

body[data-page="estimating"] .data-table .estimating-add-row {
  position: static;
}

body[data-page="estimating"] .estimating-grid-wrap {
  overflow-y: auto !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  background: #f8fafc !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table thead th.estimating-selection-col {
  z-index: 21 !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-add-row td {
  position: sticky !important;
  top: 38px !important;
  z-index: 18 !important;
  background: #f5f8fd !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-add-row td.estimating-selection-col {
  z-index: 19 !important;
}

body[data-page="estimating"] .estimating-add-row-button {
  width: 24px;
  height: 24px;
  border-color: #cfd7e3;
}

body[data-page="estimating"] .estimating-add-spacer {
  display: inline-block;
  width: 1px;
  height: 24px;
}

body[data-page="estimating"] .data-table td.estimating-cell-editable {
  cursor: text;
}

body[data-page="estimating"] .data-table td.estimating-cell-editable:focus {
  outline: 2px solid #c7d7ff;
  outline-offset: -2px;
  background: #ffffff;
}

body[data-page="estimating"] .data-table td.estimating-cell-select-wrap {
  padding-top: 0;
  padding-bottom: 0;
}

body[data-page="estimating"] .data-table td.estimating-cell-bid-item-wrap {
  padding-top: 0;
  padding-bottom: 0;
}

body[data-page="estimating"] .data-table td.estimating-cell-productivity-wrap,
body[data-page="estimating"] .data-table td.estimating-add-productivity-cell {
  padding-top: 0;
  padding-bottom: 0;
}

body[data-page="estimating"] .data-table .estimating-add-row td.estimating-cell-select-wrap {
  padding-top: 0;
  padding-bottom: 0;
}

body[data-page="estimating"] .data-table .estimating-add-row td.estimating-cell-bid-item-wrap {
  padding-top: 0;
  padding-bottom: 0;
}

body[data-page="estimating"] .data-table .estimating-add-row td.estimating-cell-select-wrap .estimating-crew-trigger {
  height: 30px;
}

body[data-page="estimating"] .estimating-crew-dropdown {
  width: 100%;
}

body[data-page="estimating"] .estimating-productivity-control {
  width: 100%;
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

body[data-page="estimating"] .estimating-productivity-control-add {
  border-color: #cfd8e6;
  background: #f9fbff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

body[data-page="estimating"] .estimating-productivity-control:focus-within {
  border-color: #9eb7de;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(156, 182, 226, 0.18);
}

body[data-page="estimating"] .estimating-productivity-amount {
  flex: 1 1 auto;
  min-width: 0;
  color: #24374d;
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-page="estimating"] .estimating-productivity-amount:focus {
  outline: none;
}

body[data-page="estimating"] .estimating-productivity-divider {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1;
}

body[data-page="estimating"] .estimating-productivity-unit-dropdown {
  position: relative;
  flex: 0 0 auto;
}

body[data-page="estimating"] .estimating-productivity-unit-trigger {
  min-width: 52px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid #cfd8e6;
  border-radius: 7px;
  padding: 0 7px;
  background: #f9fbff;
  color: #334155;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}

body[data-page="estimating"] .estimating-productivity-unit-trigger:focus {
  outline: 2px solid #c7d7ff;
  border-color: #9eb7de;
}

body[data-page="estimating"] tbody tr.estimating-data-row .estimating-productivity-unit-trigger {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

body[data-page="estimating"] tbody tr.estimating-data-row .estimating-productivity-unit-trigger:hover {
  border-color: transparent;
  background: transparent;
}

body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-select-wrap .estimating-crew-trigger-chevron,
body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-bid-item-wrap .estimating-crew-trigger-chevron,
body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-productivity-wrap .estimating-productivity-unit-chevron {
  width: 0;
  opacity: 0;
  overflow: hidden;
  flex: 0 0 auto;
  transition: width 0.14s ease, opacity 0.14s ease;
}

body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-select-wrap .estimating-crew-trigger,
body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-bid-item-wrap .estimating-crew-trigger {
  justify-content: flex-start;
  gap: 0;
}

body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-select-wrap .estimating-crew-trigger-label,
body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-bid-item-wrap .estimating-crew-trigger-label {
  flex: 1 1 auto;
}

body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-select-wrap:hover .estimating-crew-trigger-chevron,
body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-select-wrap:focus-within .estimating-crew-trigger-chevron,
body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-bid-item-wrap:hover .estimating-crew-trigger-chevron,
body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-bid-item-wrap:focus-within .estimating-crew-trigger-chevron,
body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-productivity-wrap:hover .estimating-productivity-unit-chevron,
body[data-page="estimating"] tbody tr.estimating-data-row td.estimating-cell-productivity-wrap:focus-within .estimating-productivity-unit-chevron,
body[data-page="estimating"] tbody tr.estimating-data-row .estimating-crew-dropdown.is-open .estimating-crew-trigger-chevron,
body[data-page="estimating"] tbody tr.estimating-data-row .estimating-productivity-unit-dropdown.is-open .estimating-productivity-unit-chevron {
  width: 10px;
  opacity: 1;
}

body[data-page="estimating"] tbody tr.estimating-data-row .estimating-productivity-unit-dropdown.is-open .estimating-productivity-unit-trigger,
body[data-page="estimating"] tbody tr.estimating-data-row .estimating-productivity-unit-trigger:focus {
  border-color: #9eb7de;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(156, 182, 226, 0.18);
}

body[data-page="estimating"] .estimating-productivity-unit-label {
  white-space: nowrap;
}

body[data-page="estimating"] .estimating-productivity-unit-chevron {
  width: 10px;
  height: 10px;
  color: #667085;
  flex: 0 0 auto;
}

body[data-page="estimating"] .estimating-productivity-unit-chevron svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-page="estimating"] .estimating-productivity-unit-menu {
  position: fixed;
  display: block;
  min-width: 74px;
  border: 1px solid rgba(16, 24, 40, 0.14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.16);
  padding: 4px;
  z-index: 1200;
  overflow: auto;
  white-space: normal;
}

body[data-page="estimating"] .estimating-productivity-unit-menu[hidden] {
  display: none !important;
}

body[data-page="estimating"] .estimating-productivity-unit-option {
  display: block;
  width: 100%;
  min-height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #0f172a;
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: left;
  padding: 4px 7px;
  cursor: pointer;
  white-space: nowrap;
}

body[data-page="estimating"] .estimating-productivity-unit-option:hover {
  background: #f3f7ff;
}

body[data-page="estimating"] .estimating-productivity-unit-option.is-selected {
  background: #eaf2ff;
  color: #1f3f66;
}

body[data-page="estimating"] .estimating-crew-trigger {
  width: 100%;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  padding: 0 10px;
  background-color: #f9fbff;
  color: #24374d;
  font-size: 0.8rem;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
  cursor: pointer;
}

body[data-page="estimating"] .estimating-crew-trigger:hover {
  border-color: #b7c8de;
  background-color: #f2f7ff;
}

body[data-page="estimating"] .estimating-crew-trigger:focus {
  outline: 2px solid #c7d7ff;
  border-color: #9eb7de;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(156, 182, 226, 0.18);
}

body[data-page="estimating"] .estimating-crew-trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="estimating"] .estimating-crew-trigger-chevron {
  width: 10px;
  height: 10px;
  color: #667085;
  flex: 0 0 auto;
}

body[data-page="estimating"] .estimating-crew-trigger-chevron svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-page="estimating"] .estimating-crew-dropdown.is-open .estimating-crew-trigger {
  border-color: #9eb7de;
  background-color: #ffffff;
}

body[data-page="estimating"] .estimating-crew-menu {
  position: fixed;
  z-index: 1200;
  background: #ffffff;
  border: 1px solid rgba(16, 24, 40, 0.14);
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(16, 24, 40, 0.18);
  overflow: auto;
  padding: 4px;
}

body[data-page="estimating"] .estimating-crew-menu[hidden] {
  display: none !important;
}

body[data-page="estimating"] .estimating-crew-option {
  display: block;
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #0f172a;
  font-size: 0.82rem;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  padding: 5px 8px;
  cursor: pointer;
}

body[data-page="estimating"] .estimating-crew-option:hover {
  background: #f3f7ff;
}

body[data-page="estimating"] .estimating-crew-option.is-selected {
  background: #eaf2ff;
  color: #1f3f66;
}

body[data-page="estimating"] tbody tr.estimating-data-row .estimating-crew-trigger {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: transparent;
  padding: 0 10px;
  color: #1f344b;
  box-shadow: none;
}

body[data-page="estimating"] tbody tr.estimating-data-row .estimating-crew-trigger:focus {
  outline: 2px solid #c7d7ff;
  border-color: #9eb7de;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(156, 182, 226, 0.18);
}

body[data-page="estimating"] tbody tr.estimating-data-row .estimating-crew-trigger:hover {
  border-color: transparent;
  background-color: transparent;
}

body[data-page="estimating"] tbody tr.estimating-data-row .estimating-crew-dropdown.is-open .estimating-crew-trigger {
  border-color: #9eb7de;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(156, 182, 226, 0.18);
}

body[data-page="estimating"] .data-table td.estimating-cell-computed {
  color: #1d2939;
  background: #f8fafc;
}

body[data-page="estimating"] .data-table td.estimating-add-cell[data-placeholder][data-placeholder-visible="true"]:not(:focus)::before {
  content: attr(data-placeholder);
  color: #7f8ea3;
  font-size: 12px;
  font-style: italic;
  line-height: 30px;
  display: block;
  pointer-events: none;
}

body[data-page="estimating"] .data-table td.estimating-add-cell {
  min-height: 0;
  line-height: 30px;
}

body[data-page="estimating"] .status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
}

body[data-page="estimating"] .status-pill.is-success {
  background: #e8f9ef;
  color: #15743a;
}

body[data-page="estimating"] .status-pill.is-warning {
  background: #fff6e5;
  color: #9a6700;
}

body[data-page="estimating"] .status-pill.is-info {
  background: #e8f1ff;
  color: #1849a9;
}

body[data-page="estimating"] #estimating-add-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
}

body[data-page="estimating"] #estimating-add-modal[hidden] {
  display: none !important;
}

body[data-page="estimating"] #estimating-add-modal .assembly-modal-dialog {
  width: min(980px, 96vw);
  max-height: 88vh;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid #d8e0ec;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 28px 56px rgba(15, 23, 42, 0.25);
  padding: 16px;
}

body[data-page="estimating"] #estimating-add-modal .assembly-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

body[data-page="estimating"] #estimating-add-modal .assembly-modal-header h4 {
  margin: 0;
  color: #1f3a55;
  font-size: 1.02rem;
}

body[data-page="estimating"] #estimating-add-modal .assembly-helper {
  margin: 6px 0 12px;
  color: #667085;
  font-size: 0.86rem;
}

body[data-page="estimating"] #estimating-add-form-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

body[data-page="estimating"] #estimating-add-form-fields label {
  display: grid;
  gap: 5px;
  color: #475467;
  font-size: 0.78rem;
  font-weight: 500;
}

body[data-page="estimating"] #estimating-add-form-fields input,
body[data-page="estimating"] #estimating-add-form-fields select {
  width: 100%;
  height: 34px;
  border: 1px solid #d4dce8;
  border-radius: 9px;
  padding: 0 10px;
  background: #ffffff;
  color: #1f2937;
  font-size: 0.82rem;
}

body[data-page="estimating"] #estimating-add-form-fields input:focus,
body[data-page="estimating"] #estimating-add-form-fields select:focus {
  outline: 2px solid #c7d7ff;
  border-color: #aebde6;
}

body[data-page="estimating"] #estimating-add-modal .assembly-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

body[data-page="estimating"] #estimating-save-add-modal {
  min-width: 120px;
}

body[data-page="estimating"] .estimating-group-row td {
  padding: 0;
  border-bottom: 1px solid var(--est-separator);
  background: #f7f9fc;
}

body[data-page="estimating"] .estimating-group-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: #000000;
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
}

body[data-page="estimating"] .estimating-group-toggle:hover {
  background: rgba(16, 24, 40, 0.03);
}

body[data-page="estimating"] .estimating-group-arrow {
  width: 20px;
  height: 20px;
  border: 1px solid #cfd8e6;
  border-radius: 6px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #667085;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
}

body[data-page="estimating"] .estimating-group-count {
  color: #000000;
  font-size: 0.74rem;
  font-weight: 500;
  min-width: 20px;
  text-align: right;
}

body[data-page="estimating"] .estimating-group-total {
  color: #1d4f91;
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 88px;
  text-align: right;
}

body[data-page="estimating"] .estimating-group-name-editable {
  border-radius: 6px;
  padding: 1px 4px;
  cursor: text;
}

body[data-page="estimating"] .estimating-group-name-editable:focus {
  outline: 2px solid #c7d7ff;
  background: #ffffff;
}

body[data-page="estimating"] .estimating-recommend-panel {
  z-index: 80;
  border: 1px solid #d7ddeb;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 16px 30px rgba(16, 24, 40, 0.16);
  max-height: 280px;
  overflow: auto;
}

body[data-page="estimating"] .estimating-recommend-list {
  display: grid;
  gap: 0;
}

body[data-page="estimating"] .estimating-recommend-option {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
  background: #ffffff;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

body[data-page="estimating"] .estimating-recommend-option:last-child {
  border-bottom: 0;
}

body[data-page="estimating"] .estimating-recommend-option:hover {
  background: #f5f8ff;
}

body[data-page="estimating"] .estimating-recommend-main {
  color: #101828;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.2;
}

body[data-page="estimating"] .estimating-recommend-meta {
  color: #667085;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
}

body[data-page="estimating"] .estimating-recommend-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table td,
body[data-page="estimating"] .estimating-grid-wrap .data-table td *,
body[data-page="estimating"] .estimating-grid-wrap .data-table .estimating-group-toggle,
body[data-page="estimating"] .estimating-grid-wrap .data-table .estimating-group-arrow,
body[data-page="estimating"] .estimating-grid-wrap .data-table .status-pill {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
  font-weight: 400 !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td,
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td * {
  font-size: 0.8rem !important;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td.estimating-cell-editable,
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td.estimating-cell-computed,
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="code"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="description"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="quantity"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="unit"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="material_cost"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="labor_cost"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="subcontractor_cost"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="total"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="equipment_cost"] {
  font-size: 0.8rem !important;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
  font-weight: 400 !important;
  color: #1f344b !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td b,
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td strong {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
  font-weight: 400 !important;
}

body[data-page="estimating"] .estimating-recommend-icon {
  width: 24px;
  height: 24px;
  border: 1px solid #d6ddeb;
  border-radius: 7px;
  background: #f8fbff;
  color: #335a82;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body[data-page="estimating"] .estimating-recommend-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 640px) {
  body[data-page="estimating"] {
    height: auto;
    overflow: auto;
  }

  body[data-page="estimating"] .estimating-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  body[data-page="estimating"] .estimating-view-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="estimating"] #estimating-view-feedback {
    justify-self: start;
  }

  body[data-page="estimating"] .page-content {
    width: min(900px, 92%);
    margin: 0 auto;
    padding-bottom: 32px;
    height: auto;
    overflow: visible;
  }

  body[data-page="estimating"] .estimating-shell {
    height: auto;
    min-height: 0;
  }

  body[data-page="estimating"] .estimating-grid-wrap {
    flex: initial;
    min-height: 0;
  }
}

body[data-page="database"] .data-table .group-row td {
  padding: 0;
  background: linear-gradient(180deg, #edf4fd 0%, #e7f0fb 100%);
}

body[data-page="database"] .group-toggle-btn {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: #2d5175;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
}

body[data-page="database"] .group-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.45);
}

body[data-page="database"] .group-toggle-indicator {
  width: 20px;
  height: 20px;
  border: 1px solid #c6d7ea;
  border-radius: 6px;
  background: #f8fbff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #3f678e;
  font-size: 0.95rem;
  font-weight: 700;
}

body[data-page="database"] .group-toggle-label {
  flex: 1;
  text-align: left;
}

body[data-page="database"] .group-toggle-count {
  color: #4f6d8c;
  font-size: 0.76rem;
  font-weight: 700;
}

body[data-page="database"] .data-row-clickable {
  cursor: pointer;
}

body[data-page="database"] .data-row-clickable:focus-visible {
  outline: 2px solid #8abde8;
  outline-offset: -2px;
}

body[data-page="database"] .assembly-items-toggle-btn {
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  color: #2d5175;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

body[data-page="database"] .assembly-items-toggle-indicator {
  width: 20px;
  height: 20px;
  border: 1px solid #c6d7ea;
  border-radius: 6px;
  background: #f8fbff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #3f678e;
  font-size: 0.95rem;
  font-weight: 700;
}

body[data-page="database"] .assembly-items-detail-wrap {
  display: grid;
  gap: 4px;
  padding: 8px 10px 8px 26px;
  color: #36597d;
  font-size: 0.84rem;
}

body[data-page="database"] .assembly-items-detail-line::before {
  content: "- ";
  color: #6f88a5;
}

@media (max-width: 640px) {
  body {
    padding-left: 0;
  }

  .site-header {
    padding: 18px 16px 10px;
    text-align: center;
  }

  .site-nav {
    position: static;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px 12px;
    border-right: 0;
    box-shadow: 0 10px 18px rgba(20, 53, 88, 0.08);
    background: transparent;
  }

  .global-nav-toggle {
    display: none;
  }

  .site-nav a {
    justify-content: flex-start;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    width: auto;
    height: auto;
    margin: 0;
  }

  .nav-label {
    opacity: 1;
    visibility: visible;
    width: auto;
  }

  .project-nav {
    justify-content: center;
    padding: 8px 12px 12px;
    margin: 0 0 6px;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .page-content {
    width: min(900px, 92%);
    margin: 0 auto;
  }

  .site-header h1 {
    font-size: 1.6rem;
  }

  .card {
    padding: 18px;
  }

  .database-layout {
    grid-template-columns: 1fr;
  }

  body[data-page="database"] .page-content {
    width: min(900px, 92%);
    margin: 0 auto;
    padding-bottom: 32px;
  }

  body[data-page="database"] .database-sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 0 0 4px;
    background: transparent;
    border-right: 0;
    box-shadow: none;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }

  .database-sidebar h3 {
    width: 100%;
    margin: 0 0 6px;
    text-align: left;
  }

  .sidebar-toggle-btn {
    display: none;
  }

  body[data-page="database"] .database-view {
    margin: 12px 0 0;
    min-height: 0;
    padding: 18px;
    border-radius: 14px;
  }

  body[data-page="database"] .assembly-grid {
    grid-template-columns: 1fr;
  }

  body[data-page="database"] .assembly-builder {
    padding: 10px;
  }

  body[data-page="database"] .assembly-modal-dialog {
    width: min(860px, 98vw);
    max-height: 92vh;
  }

  body[data-page="database"] .formula-variable-form-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="database"] .formula-variable-main-fields .assembly-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="database"] .formula-variable-dropdown-items-card {
    position: static;
  }

  body[data-page="database"].db-sidebar-expanded .database-sidebar {
    width: auto;
    align-items: flex-start;
    padding: 0 0 4px;
  }

  body[data-page="database"].db-sidebar-expanded .database-view {
    margin: 12px 0 0;
  }

  body[data-page="database"].db-sidebar-expanded .db-nav-btn {
    width: 44px;
    justify-content: center;
    padding: 0;
    gap: 0;
  }

  body[data-page="database"].db-sidebar-expanded .db-label {
    opacity: 0;
    visibility: hidden;
  }
}

/* Enforce non-bold text across estimating page (except table headers) */
body[data-page="estimating"] {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
  font-synthesis: none;
  font-synthesis-weight: none;
}

body[data-page="estimating"] .data-table tbody td,
body[data-page="estimating"] .data-table tbody td *,
body[data-page="estimating"] .data-table tbody td b,
body[data-page="estimating"] .data-table tbody td strong {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
  font-weight: 400 !important;
}

/* Keep table headers bold in estimating */
body[data-page="estimating"] .data-table thead tr,
body[data-page="estimating"] .data-table thead th,
body[data-page="estimating"] .data-table thead th * {
  font-weight: 700 !important;
}



/* Keep estimating header row readable with wrapping */
body[data-page="estimating"] .data-table thead tr {
  height: 38px;
  min-height: 38px;
}

body[data-page="database"] .lists-workspace {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

body[data-page="database"] .lists-workspace[hidden] {
  display: none !important;
}

body[data-page="database"] .lists-workspace select {
  min-width: 220px;
  height: 32px;
  border: 1px solid #ccd5e4;
  border-radius: 8px;
  background: #fff;
  color: #2f3f57;
  padding: 0 9px;
  font: 600 0.82rem Segoe UI, Tahoma, sans-serif;
}

body[data-page="database"] .lists-workspace .assembly-items-table-wrap {
  border: 1px solid #d6e2f0;
  border-radius: 12px;
  background: #ffffff;
  overflow-x: auto;
  overflow-y: visible;
}

body[data-page="database"] .lists-workspace .assembly-items-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
  border: 0;
}

body[data-page="database"] .lists-workspace .assembly-items-table th,
body[data-page="database"] .lists-workspace .assembly-items-table td {
  border-left: 0;
  border-right: 0;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
  padding: 0 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

body[data-page="database"] .lists-workspace .assembly-items-table th {
  background: #f5f6ff;
  border-bottom: 1px solid #d6e2f0;
  color: #000000;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 36px;
  height: 36px;
  text-transform: none;
  letter-spacing: 0;
  position: sticky;
  top: 0;
  z-index: 12;
}

body[data-page="database"] .lists-workspace .assembly-items-table td {
  background: #ffffff;
  color: var(--db-text);
  font: 400 0.8rem "Roboto", "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 20px;
  height: 20px;
  min-height: 20px;
  max-height: 20px;
}

body[data-page="database"] .lists-workspace .assembly-items-table tbody tr:hover td {
  background: #f8fbff;
}

body[data-page="database"] .lists-workspace .assembly-items-table tbody tr:nth-child(even) td {
  background: #ffffff;
}

body[data-page="database"] .lists-workspace .assembly-items-table td input {
  width: 100%;
  height: 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  line-height: 20px;
}

body[data-page="database"] .lists-workspace .data-table tbody td[data-column-key]:not(.database-selection-col) {
  user-select: none;
}

body[data-page="database"] .lists-workspace .data-table tbody td.db-list-cell-editing {
  user-select: text;
  cursor: text;
  outline: 2px solid #c7d7ff;
  outline-offset: -2px;
  background: rgba(79, 70, 229, 0.12) !important;
}

body[data-page="estimating"] .data-table thead th {
  height: 38px;
  min-height: 38px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
  text-overflow: clip;
  vertical-align: middle;
}






/* Right-align numeric columns in estimating */
body[data-page="estimating"] .data-table td[data-column-key="quantity"],
body[data-page="estimating"] .data-table td[data-column-key="material_cost"],
body[data-page="estimating"] .data-table td[data-column-key="labor_cost"],
body[data-page="estimating"] .data-table td[data-column-key="material_unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="subcontractor_cost"],
body[data-page="estimating"] .data-table td[data-column-key="total"],
body[data-page="estimating"] .data-table td[data-column-key="material_factor"],
body[data-page="estimating"] .data-table td[data-column-key="material_rounding"],
body[data-page="estimating"] .data-table td[data-column-key="material_waste"],
body[data-page="estimating"] .data-table td[data-column-key="material_quantity"],
body[data-page="estimating"] .data-table td[data-column-key="material_total"],
body[data-page="estimating"] .data-table td[data-column-key="labor_unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="man_hours"],
body[data-page="estimating"] .data-table td[data-column-key="man_days"],
body[data-page="estimating"] .data-table td[data-column-key="crew_days"],
body[data-page="estimating"] .data-table td[data-column-key="labor_hours"],
body[data-page="estimating"] .data-table td[data-column-key="labor_total"],
body[data-page="estimating"] .data-table td[data-column-key="labor_rate"],
body[data-page="estimating"] .data-table td[data-column-key="subcontractor_unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="subcontractor_total"],
body[data-page="estimating"] .data-table td[data-column-key="equipment_cost"],
body[data-page="estimating"] .data-table td[data-column-key="equipment_unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="equipment_rounding"],
body[data-page="estimating"] .data-table td[data-column-key="equipment_hours"],
body[data-page="estimating"] .data-table td[data-column-key="equipment_total"],
body[data-page="estimating"] .data-table td[data-column-key="other_cost"],
body[data-page="estimating"] .data-table td[data-column-key="other_unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="other_total"],
body[data-page="estimating"] .data-table td[data-column-key="unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="unit_estimate"],
body[data-page="estimating"] .data-table td[data-column-key="total_markup"],
body[data-page="estimating"] .data-table td[data-column-key="total_estimate"],
body[data-page="estimating"] .data-table td[data-column-key="daily_hours"] {
  text-align: right !important;
}

/* Group header colors by grouping level (1/2/3) */
body[data-page="estimating"] .estimating-group-row[data-group-level="1"] td {
  background: #e9eef6 !important;
  border-top: 1px solid #cfd8e6 !important;
  border-bottom: 1px solid #cfd8e6 !important;
}

body[data-page="estimating"] .estimating-group-row[data-group-level="2"] td {
  background: #f4f7fc !important;
  border-top: 1px solid #e1e8f2 !important;
  border-bottom: 1px solid #e1e8f2 !important;
}

body[data-page="estimating"] .estimating-group-row[data-group-level="3"] td {
  background: #fbfcfe !important;
  border-top: 1px solid #edf2f7 !important;
  border-bottom: 1px solid #edf2f7 !important;
}



/* Remove vertical table borders/indicators in estimating */
body[data-page="estimating"] .data-table th,
body[data-page="estimating"] .data-table td {
  border-left: 0 !important;
  border-right: 0 !important;
}

body[data-page="estimating"] .data-table th.estimating-drag-over-left,
body[data-page="estimating"] .data-table th.estimating-drag-over-right {
  box-shadow: none !important;
}

body[data-page="estimating"] .estimating-column-resize-handle::before {
  display: none !important;
}

/* Very light vertical dividers for item rows */
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td {
  border-right: 1px solid rgba(15, 23, 42, 0.06) !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td:last-child {
  border-right: 0 !important;
}

/* Estimating column emphasis refinements */
body[data-page="estimating"] .data-table th[data-column-key="description"],
body[data-page="estimating"] .data-table td[data-column-key="description"] {
  min-width: 320px !important;
}

body[data-page="estimating"] .data-table td[data-column-key="description"] {
  color: #0f172a !important;
}

body[data-page="estimating"] .data-table td[data-column-key="quantity"],
body[data-page="estimating"] .data-table td[data-column-key="material_cost"],
body[data-page="estimating"] .data-table td[data-column-key="labor_cost"],
body[data-page="estimating"] .data-table td[data-column-key="material_unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="subcontractor_cost"],
body[data-page="estimating"] .data-table td[data-column-key="total"],
body[data-page="estimating"] .data-table td[data-column-key="material_factor"],
body[data-page="estimating"] .data-table td[data-column-key="material_rounding"],
body[data-page="estimating"] .data-table td[data-column-key="material_waste"],
body[data-page="estimating"] .data-table td[data-column-key="material_quantity"],
body[data-page="estimating"] .data-table td[data-column-key="material_total"],
body[data-page="estimating"] .data-table td[data-column-key="labor_unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="man_hours"],
body[data-page="estimating"] .data-table td[data-column-key="man_days"],
body[data-page="estimating"] .data-table td[data-column-key="crew_days"],
body[data-page="estimating"] .data-table td[data-column-key="labor_hours"],
body[data-page="estimating"] .data-table td[data-column-key="labor_total"],
body[data-page="estimating"] .data-table td[data-column-key="labor_rate"],
body[data-page="estimating"] .data-table td[data-column-key="subcontractor_unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="subcontractor_total"],
body[data-page="estimating"] .data-table td[data-column-key="equipment_cost"],
body[data-page="estimating"] .data-table td[data-column-key="equipment_unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="equipment_rounding"],
body[data-page="estimating"] .data-table td[data-column-key="equipment_hours"],
body[data-page="estimating"] .data-table td[data-column-key="equipment_total"],
body[data-page="estimating"] .data-table td[data-column-key="other_cost"],
body[data-page="estimating"] .data-table td[data-column-key="other_unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="other_total"],
body[data-page="estimating"] .data-table td[data-column-key="unit_cost"],
body[data-page="estimating"] .data-table td[data-column-key="unit_estimate"],
body[data-page="estimating"] .data-table td[data-column-key="total_markup"],
body[data-page="estimating"] .data-table td[data-column-key="total_estimate"],
body[data-page="estimating"] .data-table td[data-column-key="daily_hours"] {
  text-align: right !important;
  color: #000000 !important;
}

body[data-page="estimating"] .data-table td[data-column-key="crew"],
body[data-page="estimating"] .data-table td[data-column-key="phase"],
body[data-page="estimating"] .data-table td[data-column-key="subcontractor_package"],
body[data-page="estimating"] .data-table td[data-column-key="crew"] .estimating-crew-trigger-label {
  font-size: 12px !important;
  color: #000000 !important;
}

body[data-page="estimating"] .data-table td[data-column-key="total"] {
  font-weight: 700 !important;
  color: #1d4f91 !important;
}

body[data-page="estimating"] .data-table td[data-column-key="total_estimate"] {
  font-weight: 700 !important;
  color: #1d4f91 !important;
}

/* Row-first reading model for estimating grid */
body[data-page="estimating"] .data-table tbody tr.estimating-data-row td {
  background: #ffffff !important;
}

body[data-page="estimating"] .data-table tbody tr.estimating-data-row:hover td {
  background: #f8fbff !important;
  box-shadow: none !important;
}

body[data-page="estimating"] .data-table td.estimating-cell-editable {
  cursor: default !important;
  outline: none !important;
}

body[data-page="estimating"] .data-table td.estimating-cell-editable:focus {
  outline: none !important;
  background: #ffffff !important;
}

body[data-page="estimating"] .data-table td.estimating-cell-editable.is-editing {
  cursor: text !important;
  background: #ffffff !important;
  outline: 2px solid #bfdbfe !important;
  outline-offset: -2px;
}

body[data-page="estimating"] .data-table th[data-column-key="description"],
body[data-page="estimating"] .data-table td[data-column-key="description"] {
  min-width: 380px !important;
  color: #0b1628 !important;
}

body[data-page="estimating"] .data-table th[data-column-key="crew"],
body[data-page="estimating"] .data-table th[data-column-key="phase"],
body[data-page="estimating"] .data-table th[data-column-key="subcontractor_package"],
body[data-page="estimating"] .data-table td[data-column-key="crew"],
body[data-page="estimating"] .data-table td[data-column-key="phase"],
body[data-page="estimating"] .data-table td[data-column-key="subcontractor_package"] {
  color: #667085 !important;
  font-size: 12px !important;
}

/* Ensure Total Estimate stays emphasized over computed-cell defaults */
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td.estimating-cell-computed[data-column-key="total_estimate"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="total_estimate"] {
  font-weight: 700 !important;
  color: #1d4f91 !important;
}

/* Use Roboto for estimating table typography */
body[data-page="estimating"] .data-table,
body[data-page="estimating"] .data-table th,
body[data-page="estimating"] .data-table td,
body[data-page="estimating"] .data-table td * {
  font-family: "Roboto", "Segoe UI", Tahoma, Arial, sans-serif !important;
}

/* Make read-only computed cells stand out with a modern treatment */
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td.estimating-cell-computed {
  background-color: #f5f9ff !important;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.04) 0 10px,
    rgba(59, 130, 246, 0.015) 10px 20px
  ) !important;
  color: #16324f !important;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.14) !important;
  border-top: 1px dashed rgba(59, 130, 246, 0.2) !important;
  border-bottom: 1px dashed rgba(59, 130, 246, 0.2) !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row:hover td.estimating-cell-computed {
  background-color: #edf4ff !important;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.055) 0 10px,
    rgba(59, 130, 246, 0.02) 10px 20px
  ) !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td.estimating-cell-computed[data-column-key="total"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td.estimating-cell-computed[data-column-key="total_estimate"] {
  background-color: #fbfaff !important;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.025) 0 10px,
    rgba(139, 92, 246, 0.012) 10px 20px
  ) !important;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.08) !important;
  border-top: 1px dashed rgba(129, 140, 248, 0.1) !important;
  border-bottom: 1px dashed rgba(129, 140, 248, 0.1) !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row:hover td.estimating-cell-computed[data-column-key="total"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row:hover td.estimating-cell-computed[data-column-key="total_estimate"] {
  background-color: #f8f6ff !important;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.03) 0 10px,
    rgba(139, 92, 246, 0.015) 10px 20px
  ) !important;
}

/* Keep grouped Total Estimate value emphasized */
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-group-row .estimating-group-total {
  font-weight: 700 !important;
  color: #1d4f91 !important;
}

/* Item rows: Total Estimate should not be bold */
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td.estimating-cell-computed[data-column-key="total_estimate"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="total_estimate"] {
  font-weight: 400 !important;
}
body[data-page="estimating"] .estimating-fill-menu {
  position: fixed;
  z-index: 1400;
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  padding: 6px;
  border: 1px solid #d0d9e6;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
}

body[data-page="estimating"] .estimating-fill-menu-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #0f172a;
  text-align: left;
  font-size: 0.82rem;
  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-page="estimating"] .estimating-fill-menu-item:hover {
  background: #eff6ff;
  border-color: #cfe2ff;
}

body[data-page="estimating"] .estimating-fill-menu-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: transparent;
  border-color: transparent;
}

body[data-page="estimating"] .estimating-fill-menu-add-rows {
  display: grid;
  grid-template-columns: auto 58px auto;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  cursor: default;
}

body[data-page="estimating"] .estimating-fill-menu-add-rows:hover {
  background: transparent;
  border-color: transparent;
}

body[data-page="estimating"] .estimating-fill-menu-add-rows-input {
  width: 100%;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 0.76rem;
  text-align: center;
  color: #0f172a;
  background: transparent;
}

body[data-page="estimating"] .estimating-fill-menu-add-rows-input:focus {
  outline: 2px solid #c7d7ff;
  border-color: #aebde6;
}

body[data-page="estimating"] .estimating-fill-menu-add-rows-apply {
  height: 22px;
  width: 22px;
  min-width: 22px;
  border: 1px solid #d0d9e5;
  border-radius: 6px;
  background: #ffffff;
  color: #1f344b;
  font-size: 0.9rem;
  line-height: 1;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

body[data-page="estimating"] .estimating-fill-menu-add-rows-apply:hover {
  background: #f3f7ff;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-cell-drag-selected {
  background: rgba(79, 70, 229, 0.14) !important;
  --estimating-drag-edge-top: inset 0 0 0 transparent;
  --estimating-drag-edge-right: inset 0 0 0 transparent;
  --estimating-drag-edge-bottom: inset 0 0 0 transparent;
  --estimating-drag-edge-left: inset 0 0 0 transparent;
  box-shadow: var(--estimating-drag-edge-top), var(--estimating-drag-edge-right), var(--estimating-drag-edge-bottom),
    var(--estimating-drag-edge-left) !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-cell-drag-edge-top {
  --estimating-drag-edge-top: inset 0 2px 0 #4f46e5;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-cell-drag-edge-right {
  --estimating-drag-edge-right: inset -2px 0 0 #4f46e5;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-cell-drag-edge-bottom {
  --estimating-drag-edge-bottom: inset 0 -2px 0 #4f46e5;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-cell-drag-edge-left {
  --estimating-drag-edge-left: inset 2px 0 0 #4f46e5;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row:hover td.estimating-cell-drag-selected {
  box-shadow: var(--estimating-drag-edge-top), var(--estimating-drag-edge-right), var(--estimating-drag-edge-bottom),
    var(--estimating-drag-edge-left) !important;
}

body.is-drag-selecting-estimating-cells[data-page="estimating"] .estimating-grid-wrap .data-table,
body.is-drag-selecting-estimating-cells[data-page="estimating"] .estimating-grid-wrap .data-table * {
  user-select: none !important;
  -webkit-user-select: none !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row.is-selected td {
  background: #eef1ff !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row.is-selected td:first-child {
  box-shadow: inset 3px 0 0 #6b7cff !important;
}

body[data-page="estimating"]
  .estimating-grid-wrap
  .data-table
  tbody
  tr.estimating-data-row.is-selected
  td.estimating-cell-computed {
  background-color: #e8ecff !important;
  background-image: none !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row.is-selected:hover td {
  background: #eef1ff !important;
}

body[data-page="estimating"]
  .estimating-grid-wrap
  .data-table
  tbody
  tr.estimating-data-row.is-selected
  td.estimating-column-hover-selected {
  box-shadow: inset 1px 0 0 rgba(107, 124, 255, 0.55), inset -1px 0 0 rgba(107, 124, 255, 0.55) !important;
  background: #e9edff !important;
}

body[data-page="estimating"]
  .estimating-grid-wrap
  .data-table
  tbody
  tr.estimating-data-row.is-selected
  td.estimating-column-hover-selected.estimating-column-hover-selected-first {
  box-shadow: inset 1px 0 0 rgba(107, 124, 255, 0.55), inset -1px 0 0 rgba(107, 124, 255, 0.55),
    inset 0 1px 0 rgba(107, 124, 255, 0.55) !important;
}

body[data-page="estimating"]
  .estimating-grid-wrap
  .data-table
  tbody
  tr.estimating-data-row.is-selected
  td.estimating-column-hover-selected.estimating-column-hover-selected-last {
  box-shadow: inset 1px 0 0 rgba(107, 124, 255, 0.55), inset -1px 0 0 rgba(107, 124, 255, 0.55),
    inset 0 -1px 0 rgba(107, 124, 255, 0.55) !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-context-source-cell {
  box-shadow: inset 0 0 0 2px rgba(96, 110, 255, 0.75) !important;
  background: #e6ebff !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-cell-drag-selected.estimating-context-source-cell {
  box-shadow: var(--estimating-drag-edge-top), var(--estimating-drag-edge-right), var(--estimating-drag-edge-bottom),
      var(--estimating-drag-edge-left), inset 0 0 0 2px rgba(96, 110, 255, 0.75) !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-context-source-cell-multi {
  box-shadow: inset 0 0 0 2px rgba(79, 70, 229, 0.9), 0 0 0 1px rgba(79, 70, 229, 0.35) !important;
  background: #e3e8ff !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-cell-drag-selected.estimating-context-source-cell-multi {
  box-shadow: var(--estimating-drag-edge-top), var(--estimating-drag-edge-right), var(--estimating-drag-edge-bottom),
      var(--estimating-drag-edge-left), inset 0 0 0 2px rgba(79, 70, 229, 0.9), 0 0 0 1px rgba(79, 70, 229, 0.35) !important;
}

body[data-page="estimating"]
  .estimating-grid-wrap
  .data-table
  tbody
  td.estimating-context-source-cell.estimating-column-hover-selected {
  box-shadow: inset 0 0 0 2px rgba(96, 110, 255, 0.75), inset 1px 0 0 rgba(107, 124, 255, 0.55),
    inset -1px 0 0 rgba(107, 124, 255, 0.55) !important;
}

body[data-page="estimating"]
  .estimating-grid-wrap
  .data-table
  tbody
  td.estimating-context-source-cell.estimating-column-hover-selected.estimating-column-hover-selected-first {
  box-shadow: inset 0 0 0 2px rgba(96, 110, 255, 0.75), inset 1px 0 0 rgba(107, 124, 255, 0.55),
    inset -1px 0 0 rgba(107, 124, 255, 0.55), inset 0 1px 0 rgba(107, 124, 255, 0.55) !important;
}

body[data-page="estimating"]
  .estimating-grid-wrap
  .data-table
  tbody
  td.estimating-context-source-cell.estimating-column-hover-selected.estimating-column-hover-selected-last {
  box-shadow: inset 0 0 0 2px rgba(96, 110, 255, 0.75), inset 1px 0 0 rgba(107, 124, 255, 0.55),
    inset -1px 0 0 rgba(107, 124, 255, 0.55), inset 0 -1px 0 rgba(107, 124, 255, 0.55) !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-context-source-cell-multi {
  position: relative;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody td.estimating-context-source-cell-multi::after {
  content: "";
  position: absolute;
  inset: 1px;
  border: 2px solid rgba(79, 70, 229, 0.95);
  border-radius: 6px;
  pointer-events: none;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table .estimating-group-toggle,
body[data-page="estimating"] .estimating-grid-wrap .data-table .estimating-group-arrow,
body[data-page="estimating"] .estimating-grid-wrap .data-table .estimating-group-name,
body[data-page="estimating"] .estimating-grid-wrap .data-table .estimating-group-total {
  font-weight: 700 !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-group-row .estimating-group-total {
  color: #000000 !important;
}

body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td[data-column-key="total_estimate"],
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-data-row td.estimating-cell-computed[data-column-key="total_estimate"] {
  color: #000000 !important;
}

/* Responsive polish for estimating across desktop/tablet/mobile */
body[data-page="estimating"] .estimating-grid-wrap .data-table tbody tr.estimating-add-row td {
  top: var(--estimating-header-height, 38px) !important;
}

@media (max-width: 1100px) {
  body[data-page="estimating"] .page-content {
    padding: 0 16px 22px !important;
    height: calc(100vh - 136px) !important;
  }

  body[data-page="estimating"] .estimating-shell {
    padding: 14px !important;
  }

  body[data-page="estimating"] .data-table {
    min-width: 900px !important;
  }

  body[data-page="estimating"] .estimating-view-toolbar {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body[data-page="estimating"] .estimating-toolbar-right {
    justify-content: flex-start !important;
  }

  body[data-page="estimating"] .estimating-toolbar-right > label {
    display: none;
  }
}

@media (max-width: 900px) {
  body[data-page="estimating"] .page-content {
    height: calc(100dvh - 132px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body[data-page="estimating"] .estimating-shell {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body[data-page="estimating"] .estimating-header-row {
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  body[data-page="estimating"] .estimating-view-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  body[data-page="estimating"] .estimating-toolbar-left,
  body[data-page="estimating"] .estimating-toolbar-right {
    width: 100%;
    min-width: 0;
  }

  body[data-page="estimating"] .estimating-toolbar-right {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  body[data-page="estimating"] .estimating-toolbar-right > label {
    display: none;
  }

  body[data-page="estimating"] .estimating-views-dropdown,
  body[data-page="estimating"] .estimating-group-by-dropdown {
    flex: 1 1 220px;
    min-width: 180px;
  }

  body[data-page="estimating"] .estimating-group-by-menu {
    left: 0;
    right: auto;
  }

  body[data-page="estimating"] #estimating-fit-columns-button {
    flex: 0 0 auto;
  }

  body[data-page="estimating"] .data-table {
    min-width: 760px !important;
  }

  body[data-page="estimating"] .data-table th,
  body[data-page="estimating"] .data-table td {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}

@media (max-width: 640px) {
  body[data-page="estimating"] .page-content {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 10px 18px !important;
    height: calc(100dvh - 118px) !important;
    overflow: hidden !important;
  }

  body[data-page="estimating"] .card.estimating-shell {
    padding: 10px !important;
    border-radius: 10px !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  body[data-page="estimating"] .estimating-tab-row {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 2px;
  }

  body[data-page="estimating"] .estimating-tab {
    flex: 0 0 auto;
  }

  body[data-page="estimating"] .estimating-grid-wrap {
    border-radius: 10px !important;
    max-height: none !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
  }

  body[data-page="estimating"] .data-table {
    min-width: 680px !important;
  }

  body[data-page="estimating"] .data-table th {
    font-size: 0.68rem !important;
    line-height: 1.2 !important;
  }

  body[data-page="estimating"] .data-table td,
  body[data-page="estimating"] .data-table td * {
    font-size: 0.74rem !important;
  }

  body[data-page="estimating"] .estimating-view-toolbar button,
  body[data-page="estimating"] .estimating-view-toolbar input,
  body[data-page="estimating"] .estimating-view-toolbar select {
    height: 30px !important;
    font-size: 0.76rem !important;
  }

  body[data-page="estimating"] .estimating-views-menu,
  body[data-page="estimating"] .estimating-group-by-menu {
    width: min(92vw, 320px) !important;
    max-width: min(92vw, 320px) !important;
  }
}

/* Sort Types aligned to Estimating visual system */
body[data-page="sort-types"] {
  --est-bg: #f4f6fa;
  --est-surface: #ffffff;
  --est-border: rgba(16, 24, 40, 0.08);
  --est-separator: rgba(16, 24, 40, 0.06);
  --est-text: #101828;
  --est-muted: #667085;
  --est-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
  --est-radius: 14px;
  --est-hover: rgba(16, 24, 40, 0.03);
  --est-primary: #4f46e5;
  --sort-types-header-row-height: 36px;
  --sort-types-body-row-height: 20px;
  font-family: "Inter", "SF Pro Text", "SF Pro Display", "Segoe UI", Tahoma, sans-serif;
  background: var(--est-bg);
  min-height: 100vh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
}

body[data-page="sort-types"] .page-content {
  margin-top: 0;
  height: auto;
  overflow: visible;
}

body[data-page="sort-types"] .card.sort-types-shell {
  background: var(--est-surface);
  border-radius: var(--est-radius);
  border: 1px solid var(--est-border);
  box-shadow: var(--est-shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: auto;
  min-height: 0;
}

body[data-page="sort-types"] .sort-types-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #c7cfda transparent;
}

body[data-page="sort-types"] .sort-types-list::-webkit-scrollbar {
  width: 8px;
}

body[data-page="sort-types"] .sort-types-list::-webkit-scrollbar-thumb {
  background: #c7cfda;
  border-radius: 999px;
}

body[data-page="sort-types"] .sort-types-header h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

body[data-page="sort-types"] .sort-types-header .table-note {
  margin: 2px 0;
  color: var(--est-muted);
}

body[data-page="sort-types"] .sort-types-add-bar {
  background: #f8fafc;
  border: 1px solid var(--est-border);
  border-radius: 12px;
  padding: 10px;
  gap: 10px;
}

body[data-page="sort-types"] .sort-types-add-bar input,
body[data-page="sort-types"] .sort-type-name {
  height: 34px;
  border: 1px solid #d0d9e5;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 0.88rem;
  color: #101828;
  background: #ffffff;
}

body[data-page="sort-types"] .sort-types-add-bar input:focus,
body[data-page="sort-types"] .sort-type-name:focus,
body[data-page="sort-types"] .sort-types-table td input:focus {
  outline: 2px solid #bfd9f3;
  border-color: #96c0e6;
}

body[data-page="sort-types"] .sort-types-add-bar button {
  height: 34px;
  border: 1px solid var(--app-primary-btn-border);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--app-primary-btn-start) 0%, var(--app-primary-btn-end) 100%);
  color: var(--app-primary-btn-text);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 14px;
  cursor: pointer;
}

body[data-page="sort-types"] .sort-type-card {
  border: 1px solid var(--est-border);
  border-radius: 12px;
  background: var(--est-surface);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: auto;
  min-height: 0;
  max-height: none;
}

body[data-page="sort-types"] .sort-type-card[data-collapsed="0"] {
  min-height: 0;
}

body[data-page="sort-types"] .sort-type-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

body[data-page="sort-types"] .sort-type-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

body[data-page="sort-types"] .sort-type-remove,
body[data-page="sort-types"] .sort-type-item-remove,
body[data-page="sort-types"] .sort-type-item-add-button {
  height: 30px;
  border: 1px solid #d2dbe8;
  border-radius: 9px;
  background: #ffffff;
  color: #385778;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0 10px;
  cursor: pointer;
}

body[data-page="sort-types"] .sort-type-remove:hover,
body[data-page="sort-types"] .sort-type-item-remove:hover,
body[data-page="sort-types"] .sort-type-item-add-button:hover {
  background: #f5f8fd;
}

body[data-page="sort-types"] .sort-type-icon-button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body[data-page="sort-types"] .sort-type-icon-button svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-page="sort-types"] .sort-types-grid-wrap {
  background: var(--est-surface);
  border: 1px solid var(--est-border);
  border-radius: 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: #c7cfda transparent;
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  max-height: none;
}

body[data-page="sort-types"] .sort-types-grid-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body[data-page="sort-types"] .sort-types-grid-wrap::-webkit-scrollbar-track {
  background: transparent;
}

body[data-page="sort-types"] .sort-types-grid-wrap::-webkit-scrollbar-thumb {
  background: #c7cfda;
  border-radius: 999px;
}

body[data-page="sort-types"] .sort-types-table {
  width: 100%;
  min-width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  border: 0;
  border-radius: 0;
}

body[data-page="sort-types"] .sort-types-table th[data-column-key="notes"],
body[data-page="sort-types"] .sort-types-table td[data-column-key="notes"] {
  width: 100%;
  min-width: 260px;
}

body[data-page="sort-types"] .sort-types-table.sort-types-underfill-edge {
  border-right: 1px solid var(--est-border);
}

body[data-page="sort-types"] .sort-types-table.sort-types-underfill-edge thead th:last-child {
  border-top-right-radius: 12px;
}

body[data-page="sort-types"] .sort-types-table.sort-types-underfill-edge tbody tr:last-child td:last-child {
  border-bottom-right-radius: 12px;
}

body[data-page="sort-types"] .sort-types-table th,
body[data-page="sort-types"] .sort-types-table td {
  border-bottom: 1px solid var(--est-separator);
  border-left: 0;
  border-right: 0;
  padding: 0 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

body[data-page="sort-types"] .sort-types-table th {
  background: #f5f6ff;
  border-bottom: 1px solid var(--est-border);
  color: #000000;
  font-size: 12.5px;
  font-weight: 400;
  line-height: var(--sort-types-header-row-height);
  height: var(--sort-types-header-row-height);
  position: sticky;
  top: 0;
  z-index: 12;
}

body[data-page="sort-types"] .sort-types-table thead th.sort-types-selection-col {
  z-index: 13;
}

body[data-page="sort-types"] .sort-types-table td {
  background: var(--est-surface);
  color: var(--est-text);
  font-size: 0.8rem;
  font-weight: 400;
  height: var(--sort-types-body-row-height);
  line-height: var(--sort-types-body-row-height);
}

body[data-page="sort-types"] .sort-types-table tbody td.sort-types-selection-col {
  z-index: 3;
}

body[data-page="sort-types"] .sort-types-table tbody tr:hover td {
  background: #f8fbff;
}

body[data-page="sort-types"] .sort-types-table tbody tr:nth-child(even) td {
  background: var(--est-surface);
}

body[data-page="sort-types"] .sort-types-table tbody tr {
  height: var(--sort-types-body-row-height);
}

body[data-page="sort-types"] .sort-types-table td input {
  width: 100%;
  height: var(--sort-types-body-row-height);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 0.8rem;
  padding: 0;
  line-height: var(--sort-types-body-row-height);
}

body[data-page="sort-types"] .sort-types-table td.numeric {
  text-align: right;
}

body[data-page="sort-types"] .sort-types-table td.numeric input {
  text-align: right;
}

body[data-page="sort-types"] .sort-types-table td.sort-types-action-cell {
  text-align: center;
  vertical-align: middle;
}

body[data-page="sort-types"] .sort-types-table tbody tr td,
body[data-page="sort-types"] .sort-types-table tbody tr td * {
  font-size: 0.8rem !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  color: var(--est-text) !important;
}

body[data-page="sort-types"] .sort-types-table td,
body[data-page="sort-types"] .sort-types-table td * {
  font-family: "Roboto", "Segoe UI", Tahoma, Arial, sans-serif !important;
}

body[data-page="sort-types"] .sort-types-table td input:focus {
  outline: none;
  background: transparent;
}

body[data-page="sort-types"] .sort-types-table td.sort-types-cell-editable {
  cursor: default !important;
  outline: none !important;
  vertical-align: middle !important;
  line-height: var(--sort-types-body-row-height) !important;
  caret-color: var(--est-text) !important;
}

body[data-page="sort-types"] .sort-types-table td.sort-types-cell-editable:focus {
  outline: none !important;
  background: transparent !important;
}

body[data-page="sort-types"] .sort-types-table td.sort-types-cell-editable.is-editing {
  cursor: text !important;
  background: #ffffff !important;
  outline: 2px solid #bfdbfe !important;
  outline-offset: -2px;
  overflow: visible !important;
  text-overflow: clip !important;
}


body[data-page="sort-types"] .sort-types-table .sort-types-total-cell output {
  display: inline-block;
  min-width: 88px;
  text-align: right;
  color: var(--est-text);
  font-weight: 400;
  line-height: var(--sort-types-body-row-height);
}

body[data-page="sort-types"] .sort-types-selection-col {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  position: sticky;
  left: 0;
  z-index: 4;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}

body[data-page="sort-types"] .sort-types-select-all,
body[data-page="sort-types"] .sort-types-row-select {
  width: 14px;
  height: 14px;
  accent-color: var(--est-primary);
}

body[data-page="sort-types"] .sort-types-table tbody tr.is-selected td {
  background: rgba(66, 92, 255, 0.08);
}

body[data-page="sort-types"] .sort-types-table tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--est-primary);
}

body[data-page="sort-types"] .sort-types-table tbody tr.sort-types-insert-target td {
  box-shadow: inset 0 -2px 0 #4f46e5;
  background: #f3f4ff !important;
}

body[data-page="sort-types"] .sort-types-table tbody tr.sort-types-insert-target td.sort-types-cell-drag-selected {
  box-shadow: var(--sort-types-drag-edge-top), var(--sort-types-drag-edge-right), var(--sort-types-drag-edge-bottom), var(--sort-types-drag-edge-left), inset 0 -2px 0 #4f46e5 !important;
}

body[data-page="sort-types"] .sort-types-table tbody td.sort-types-cell-drag-selected {
  background: rgba(79, 70, 229, 0.14) !important;
  --sort-types-drag-edge-top: inset 0 0 0 transparent;
  --sort-types-drag-edge-right: inset 0 0 0 transparent;
  --sort-types-drag-edge-bottom: inset 0 0 0 transparent;
  --sort-types-drag-edge-left: inset 0 0 0 transparent;
  box-shadow: var(--sort-types-drag-edge-top), var(--sort-types-drag-edge-right), var(--sort-types-drag-edge-bottom), var(--sort-types-drag-edge-left);
}

body[data-page="sort-types"] .sort-types-table tbody tr:hover td.sort-types-cell-drag-selected {
  box-shadow: var(--sort-types-drag-edge-top), var(--sort-types-drag-edge-right), var(--sort-types-drag-edge-bottom), var(--sort-types-drag-edge-left) !important;
}

body[data-page="sort-types"] .sort-types-table tbody td.sort-types-cell-drag-edge-top {
  --sort-types-drag-edge-top: inset 0 2px 0 #4f46e5;
}

body[data-page="sort-types"] .sort-types-table tbody td.sort-types-cell-drag-edge-right {
  --sort-types-drag-edge-right: inset -2px 0 0 #4f46e5;
}

body[data-page="sort-types"] .sort-types-table tbody td.sort-types-cell-drag-edge-bottom {
  --sort-types-drag-edge-bottom: inset 0 -2px 0 #4f46e5;
}

body[data-page="sort-types"] .sort-types-table tbody td.sort-types-cell-drag-edge-left {
  --sort-types-drag-edge-left: inset 2px 0 0 #4f46e5;
}

body.is-drag-selecting-sort-types-cells[data-page="sort-types"] .sort-types-table,
body.is-drag-selecting-sort-types-cells[data-page="sort-types"] .sort-types-table * {
  user-select: none !important;
  -webkit-user-select: none !important;
}

body[data-page="sort-types"] .sort-types-context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 180px;
  background: #ffffff;
  border: 1px solid rgba(16, 24, 40, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.18);
  padding: 6px;
  display: grid;
  gap: 4px;
}

body[data-page="sort-types"] .sort-types-context-menu-item {
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  color: #1f344b;
  font-size: 0.8rem;
  text-align: left;
  padding: 0 10px;
  cursor: pointer;
}

body[data-page="sort-types"] .sort-types-context-menu-item:hover {
  background: #f3f7ff;
}

body[data-page="sort-types"] .sort-types-context-menu-item:disabled {
  color: #9aa7b8;
  background: #ffffff;
  cursor: not-allowed;
}

body[data-page="sort-types"] .sort-types-context-menu-item.sort-types-context-menu-item-danger {
  background: #fff1f2;
  color: #b42318;
}

body[data-page="sort-types"] .sort-types-context-menu-item.sort-types-context-menu-item-danger:hover {
  background: #ffe4e8;
}

body[data-page="sort-types"] .sort-types-context-menu-add-rows {
  display: grid;
  grid-template-columns: auto 58px auto;
  align-items: center;
  gap: 6px;
  height: auto;
  min-height: 30px;
  padding: 4px 8px;
  cursor: default;
}

body[data-page="sort-types"] .sort-types-context-menu-add-rows:hover {
  background: #ffffff;
}

body[data-page="sort-types"] .sort-types-context-menu-add-rows-input {
  width: 100%;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 0.76rem;
  text-align: center;
  color: #1f344b;
  background: transparent;
}

body[data-page="sort-types"] .sort-types-context-menu-add-rows-input:focus {
  outline: 2px solid #c7d7ff;
  border-color: #aebde6;
}

body[data-page="sort-types"] .sort-types-context-menu-add-rows-apply {
  height: 22px;
  width: 22px;
  min-width: 22px;
  border: 1px solid #d0d9e5;
  border-radius: 6px;
  background: #ffffff;
  color: #1f344b;
  font-size: 0.9rem;
  line-height: 1;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

body[data-page="sort-types"] .sort-types-context-menu-add-rows-apply:hover {
  background: #f3f7ff;
}

body[data-page="sort-types"] #sort-types-add-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
}

body[data-page="sort-types"] #sort-types-add-modal[hidden] {
  display: none !important;
}

body[data-page="sort-types"] #sort-types-add-modal .assembly-modal-dialog {
  width: min(980px, 96vw);
  max-height: 88vh;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid #d8e0ec;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 28px 56px rgba(15, 23, 42, 0.25);
  padding: 16px;
}

body[data-page="sort-types"] #sort-types-add-modal .assembly-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

body[data-page="sort-types"] #sort-types-add-modal .assembly-modal-header h4 {
  margin: 0;
  color: #1f3a55;
  font-size: 1.02rem;
}

body[data-page="sort-types"] #sort-types-add-modal .assembly-close-btn {
  border: 1px solid #d3dde9;
  background: #ffffff;
  color: #375778;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 9px;
  padding: 6px 10px;
  cursor: pointer;
}

body[data-page="sort-types"] #sort-types-add-modal .assembly-close-btn:hover {
  background: #f5f9ff;
}

body[data-page="sort-types"] #sort-types-add-modal .assembly-helper {
  margin: 6px 0 12px;
  color: #667085;
  font-size: 0.86rem;
}

body[data-page="sort-types"] #sort-types-add-form-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

body[data-page="sort-types"] #sort-types-add-form-fields label {
  display: grid;
  gap: 5px;
  color: #475467;
  font-size: 0.78rem;
  font-weight: 500;
}

body[data-page="sort-types"] #sort-types-add-form-fields input,
body[data-page="sort-types"] #sort-types-add-form-fields select {
  width: 100%;
  height: 34px;
  border: 1px solid #d4dce8;
  border-radius: 9px;
  padding: 0 10px;
  background: #ffffff;
  color: #1f2937;
  font-size: 0.82rem;
}

body[data-page="sort-types"] #sort-types-add-form-fields input:focus,
body[data-page="sort-types"] #sort-types-add-form-fields select:focus {
  outline: 2px solid #c7d7ff;
  border-color: #aebde6;
}

body[data-page="sort-types"] #sort-types-add-modal .assembly-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

body[data-page="sort-types"] #sort-types-save-add-modal {
  min-width: 120px;
}

body[data-page="sort-types"] .sort-types-table th.sort-types-dragging {
  opacity: 0.7;
}

body[data-page="sort-types"] .sort-types-table th.sort-types-drag-over-left {
  box-shadow: inset 2px 0 0 #3d67ff;
}

body[data-page="sort-types"] .sort-types-table th.sort-types-drag-over-right {
  box-shadow: inset -2px 0 0 #3d67ff;
}

body[data-page="sort-types"] .sort-types-column-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}

body[data-page="sort-types"] .sort-types-column-resize-handle::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 3px;
  width: 1px;
  background: transparent;
}

body[data-page="sort-types"] .sort-types-table th:hover .sort-types-column-resize-handle::before {
  background: rgba(102, 112, 133, 0.45);
}

@media (max-width: 900px) {
  body[data-page="sort-types"] .page-content {
    margin: 0 10px;
    height: auto;
  }

  body[data-page="sort-types"] .card.sort-types-shell {
    padding: 12px;
    border-radius: 12px;
  }
}

/* Canonical Sort Types row metrics */

body[data-page="sort-types"] .sort-types-table thead tr,
body[data-page="sort-types"] .sort-types-table thead th {
  height: var(--sort-types-header-row-height) !important;
  min-height: var(--sort-types-header-row-height) !important;
  max-height: var(--sort-types-header-row-height) !important;
  line-height: var(--sort-types-header-row-height) !important;
}

body[data-page="sort-types"] .sort-types-table thead th {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

body[data-page="sort-types"] .sort-types-table tbody tr.sort-type-row,
body[data-page="sort-types"] .sort-types-table tbody tr.sort-type-row td,
body[data-page="sort-types"] .sort-types-table tbody tr.sort-type-row td.sort-types-cell-editable {
  height: var(--sort-types-body-row-height) !important;
  min-height: var(--sort-types-body-row-height) !important;
  max-height: var(--sort-types-body-row-height) !important;
}

body[data-page="sort-types"] .sort-types-table tbody tr.sort-type-row td {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: var(--sort-types-body-row-height) !important;
  border-right: 1px solid rgba(15, 23, 42, 0.06) !important;
}

body[data-page="sort-types"] .sort-types-table tbody tr.sort-type-row td.sort-types-cell-editable {
  line-height: var(--sort-types-body-row-height) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

body[data-page="sort-types"] .sort-types-table tbody tr.sort-type-row td {
  white-space: nowrap !important;
}

body[data-page="sort-types"] .sort-types-table tbody tr.sort-type-row td:last-child {
  border-right: 0 !important;
}

body[data-page="sort-types"] .sort-types-table tbody tr.sort-types-add-row td.sort-types-add-row-cell {
  padding: 6px 10px !important;
  border-right: 0 !important;
  background: #f8fbff !important;
  text-align: center;
  cursor: pointer;
}

body[data-page="sort-types"] .sort-types-table tbody td {
  border-bottom-color: rgba(16, 24, 40, 0.035) !important;
}

body[data-page="sort-types"] .sort-types-table tbody tr.sort-types-add-row:hover td.sort-types-add-row-cell {
  background: #f3f8ff !important;
}

/* Takeoff WebGL2 PDF Workspace */
body[data-page="takeoff"] {
  --takeoff-bg: #edf3fb;
  --takeoff-surface: #ffffff;
  --takeoff-border: #d0dcec;
  --takeoff-shadow: 0 14px 26px rgba(16, 42, 70, 0.12);
  --takeoff-text: #1b2a3a;
  --takeoff-muted: #62748a;
  --takeoff-accent: #1f5f95;
  --takeoff-accent-strong: #17486f;
  font-family: "Avenir Next", "Manrope", "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at 0% 0%, #d9e8fb 0%, #d9e8fb 12%, transparent 34%),
    linear-gradient(180deg, #f2f7fd 0%, var(--takeoff-bg) 55%, #eef4fc 100%);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body[data-page="takeoff"] .page-content {
  margin: 0 22px 0 22px;
  padding-bottom: 22px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

body[data-page="takeoff"] .takeoff-embed-shell {
  height: 100%;
  min-height: 0;
  border: 1px solid var(--takeoff-border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--takeoff-shadow);
  overflow: hidden;
}

body[data-page="takeoff"] .takeoff-viewer-embed {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

body[data-page="takeoff"] .takeoff-shell {
  display: grid;
  grid-template-columns: 272px 1fr 304px;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

body[data-page="takeoff"] .takeoff-left-panel,
body[data-page="takeoff"] .takeoff-right-panel,
body[data-page="takeoff"] .takeoff-main-view {
  border: 1px solid var(--takeoff-border);
  border-radius: 16px;
  background: var(--takeoff-surface);
  box-shadow: var(--takeoff-shadow);
}

body[data-page="takeoff"] .takeoff-left-panel,
body[data-page="takeoff"] .takeoff-right-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  overflow: hidden;
}

body[data-page="takeoff"] .takeoff-main-view {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  overflow: hidden;
}

body[data-page="takeoff"] .takeoff-panel-toolbar,
body[data-page="takeoff"] .takeoff-viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #dbe5f2;
  padding: 10px;
  background: linear-gradient(180deg, #f7fbff 0%, #f1f7ff 100%);
}

body[data-page="takeoff"] .takeoff-tool-btn {
  height: 34px;
  border: 1px solid #c4d2e4;
  background: #ffffff;
  color: #2b4a67;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0 12px;
  cursor: pointer;
}

body[data-page="takeoff"] .takeoff-tool-btn:hover:not(:disabled) {
  background: #f0f6ff;
  border-color: #a9bdd5;
}

body[data-page="takeoff"] .takeoff-tool-btn.active {
  color: #ffffff;
  border-color: var(--takeoff-accent);
  background: linear-gradient(135deg, var(--takeoff-accent) 0%, var(--takeoff-accent-strong) 100%);
}

body[data-page="takeoff"] .takeoff-tool-btn:disabled {
  opacity: 0.52;
  cursor: default;
}

body[data-page="takeoff"] .takeoff-thumbnail-list {
  padding: 10px;
  display: grid;
  gap: 10px;
  align-content: start;
  overflow: auto;
  background: #f6fafe;
}

body[data-page="takeoff"] .takeoff-thumb-item {
  border: 1px solid #cddceb;
  background: #ffffff;
  border-radius: 12px;
  cursor: pointer;
  padding: 8px;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

body[data-page="takeoff"] .takeoff-thumb-item.active {
  border-color: #4f7fb0;
  box-shadow: inset 0 0 0 1px #4f7fb0;
}

body[data-page="takeoff"] .takeoff-thumb-item:hover {
  background: #f2f8ff;
}

body[data-page="takeoff"] .takeoff-thumb-canvas {
  width: 100%;
  max-width: 180px;
  height: auto;
  border: 1px solid #dde8f5;
  border-radius: 8px;
  background: #ffffff;
}

body[data-page="takeoff"] .takeoff-thumb-label {
  font-size: 0.78rem;
  color: #2f4b66;
  font-weight: 700;
}

body[data-page="takeoff"] .takeoff-thumbnail-list[data-mode="list"] .takeoff-thumb-item {
  grid-template-columns: 56px 1fr;
  align-items: center;
  justify-items: start;
  text-align: left;
}

body[data-page="takeoff"] .takeoff-thumbnail-list[data-mode="list"] .takeoff-thumb-canvas {
  width: 56px;
  max-width: 56px;
}

body[data-page="takeoff"] .takeoff-viewer-toolbar {
  flex-wrap: wrap;
}

body[data-page="takeoff"] .takeoff-file-picker-label {
  height: 34px;
  border: 1px solid #2d5f8b;
  border-radius: 10px;
  background: linear-gradient(135deg, #2c6799 0%, #1f567f 100%);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

body[data-page="takeoff"] #takeoff-pdf-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

body[data-page="takeoff"] .takeoff-page-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #44607c;
  font-weight: 700;
}

body[data-page="takeoff"] #takeoff-page-input {
  width: 64px;
  height: 34px;
  border: 1px solid #ccd9ea;
  border-radius: 10px;
  padding: 0 8px;
}

body[data-page="takeoff"] .takeoff-page-total,
body[data-page="takeoff"] .takeoff-zoom-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #355270;
}

body[data-page="takeoff"] .takeoff-canvas-stage {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.74)),
    repeating-linear-gradient(45deg, #e9f0fa 0, #e9f0fa 14px, #edf4fd 14px, #edf4fd 28px);
  padding: 14px;
  min-height: 0;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: contain;
}

body[data-page="takeoff"] #takeoff-webgl-canvas {
  display: block;
  box-sizing: content-box;
  border: 0;
  outline: 1px solid #d5e0ed;
  transform-origin: 0 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 40, 67, 0.16);
}

body[data-page="takeoff"] .takeoff-canvas-stage.is-panning {
  cursor: grabbing;
}

body[data-page="takeoff"] .takeoff-empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  color: var(--takeoff-text);
}

body[data-page="takeoff"] .takeoff-empty-state h2 {
  margin: 0;
  color: #20466b;
}

body[data-page="takeoff"] .takeoff-right-panel {
  grid-template-rows: auto 1fr;
}

body[data-page="takeoff"] .takeoff-right-section {
  padding: 14px;
  overflow: auto;
}

body[data-page="takeoff"] .takeoff-right-section h3 {
  margin: 0 0 10px;
  color: #1f466a;
}

body[data-page="takeoff"] .takeoff-right-section .table-note {
  margin: 4px 0;
}

body[data-page="takeoff"] .takeoff-right-section .projects-manager {
  max-width: none;
  margin: 0;
}

body[data-page="takeoff"] .takeoff-right-section .projects-manager textarea {
  min-height: 260px;
  resize: vertical;
}

@media (max-width: 1320px) {
  body[data-page="takeoff"] .takeoff-shell {
    grid-template-columns: 240px 1fr 260px;
  }
}

@media (max-width: 1080px) {
  body[data-page="takeoff"] .page-content {
    margin: 0 12px;
  }

  body[data-page="takeoff"] .takeoff-embed-shell {
    border-radius: 12px;
  }

  body[data-page="takeoff"] .takeoff-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(460px, 1fr);
  }

  body[data-page="takeoff"] .takeoff-left-panel {
    order: 1;
    min-height: 220px;
  }

  body[data-page="takeoff"] .takeoff-right-panel {
    order: 2;
    min-height: 220px;
  }

  body[data-page="takeoff"] .takeoff-main-view {
    order: 3;
    min-height: 540px;
  }
}

/* Database catalog/member tables aligned to Sort Types visual system */
body[data-page="database"] #assembly-catalog-table,
body[data-page="database"] #crew-labor-catalog-table,
body[data-page="database"] #crew-equipment-catalog-table,
body[data-page="database"] #crew-members-table {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: auto !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 0 !important;
}

body[data-page="database"] #assembly-catalog-table thead th,
body[data-page="database"] #crew-labor-catalog-table thead th,
body[data-page="database"] #crew-equipment-catalog-table thead th,
body[data-page="database"] #crew-members-table thead th {
  background: #f5f6ff !important;
  color: #000000 !important;
  font-size: 12.5px !important;
  font-weight: 400 !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  line-height: 36px !important;
  padding: 0 14px !important;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

body[data-page="database"] #assembly-catalog-table tbody td,
body[data-page="database"] #crew-labor-catalog-table tbody td,
body[data-page="database"] #crew-equipment-catalog-table tbody td,
body[data-page="database"] #crew-members-table tbody td {
  background: #ffffff !important;
  color: #101828 !important;
  font-size: 0.8rem !important;
  font-weight: 400 !important;
  height: 20px !important;
  min-height: 20px !important;
  max-height: 20px !important;
  line-height: 20px !important;
  padding: 0 14px !important;
  border-bottom: 1px solid rgba(16, 24, 40, 0.06) !important;
  white-space: nowrap !important;
  width: auto !important;
}

body[data-page="database"] #assembly-catalog-table tbody tr:hover td,
body[data-page="database"] #crew-labor-catalog-table tbody tr:hover td,
body[data-page="database"] #crew-equipment-catalog-table tbody tr:hover td,
body[data-page="database"] #crew-members-table tbody tr:hover td {
  background: #f8fbff !important;
}

body[data-page="database"] #assembly-catalog-table tbody tr.catalog-row-selected td,
body[data-page="database"] #crew-labor-catalog-table tbody tr.catalog-row-selected td,
body[data-page="database"] #crew-equipment-catalog-table tbody tr.catalog-row-selected td,
body[data-page="database"] #crew-members-table tbody tr.is-selected td {
  background: rgba(66, 92, 255, 0.08) !important;
}

body[data-page="database"] #assembly-catalog-table tbody tr.catalog-row-selected td:first-child,
body[data-page="database"] #crew-labor-catalog-table tbody tr.catalog-row-selected td:first-child,
body[data-page="database"] #crew-equipment-catalog-table tbody tr.catalog-row-selected td:first-child,
body[data-page="database"] #crew-members-table tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 #4f46e5 !important;
}

body[data-page="database"] #assembly-catalog-table thead th:first-child,
body[data-page="database"] #assembly-catalog-table tbody td:first-child,
body[data-page="database"] #crew-labor-catalog-table thead th:first-child,
body[data-page="database"] #crew-labor-catalog-table tbody td:first-child,
body[data-page="database"] #crew-equipment-catalog-table thead th:first-child,
body[data-page="database"] #crew-equipment-catalog-table tbody td:first-child {
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  padding-left: 8px !important;
  padding-right: 8px !important;
  text-align: center !important;
}

body[data-page="database"] #crew-members-table tbody input {
  height: 20px !important;
  min-height: 20px !important;
  max-height: 20px !important;
  line-height: 20px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #101828 !important;
  font-size: 0.8rem !important;
  padding: 0 !important;
}

body[data-page="database"] #assembly-catalog-table tbody td {
  height: 18px !important;
  min-height: 18px !important;
  max-height: 18px !important;
  line-height: 18px !important;
  font-size: 0.76rem !important;
}

body[data-page="database"] #assembly-catalog-table .assembly-catalog-select {
  width: 12px;
  height: 12px;
}

body[data-page="database"] #assembly-builder #assembly-items-table {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: auto !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 0 !important;
}

body[data-page="database"] #assembly-builder #assembly-items-table thead th {
  background: #f5f6ff !important;
  color: #000000 !important;
  font-size: 12.5px !important;
  font-weight: 400 !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  line-height: 36px !important;
  padding: 0 14px !important;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

body[data-page="database"] #assembly-builder #assembly-items-table tbody td {
  background: #ffffff !important;
  color: #101828 !important;
  font-size: 0.76rem !important;
  font-weight: 400 !important;
  height: 18px !important;
  min-height: 18px !important;
  max-height: 18px !important;
  line-height: 18px !important;
  padding: 0 14px !important;
  border-bottom: 1px solid rgba(16, 24, 40, 0.06) !important;
  white-space: nowrap !important;
}

body[data-page="database"] #assembly-builder #assembly-items-table tbody tr:hover td {
  background: #f8fbff !important;
}

body[data-page="database"] #assembly-builder #assembly-items-table tbody input {
  height: 18px !important;
  min-height: 18px !important;
  max-height: 18px !important;
  line-height: 18px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #101828 !important;
  font-size: 0.76rem !important;
  padding: 0 !important;
}

body[data-page="database"] .assembly-builder input:not([type="checkbox"]):not([type="radio"]):focus,
body[data-page="database"] .assembly-builder select:focus,
body[data-page="database"] .assembly-builder textarea:focus {
  outline: 2px solid #c7d7ff !important;
  border-color: #aebde6 !important;
  box-shadow: none !important;
}

body[data-page="database"] #crew-builder #crew-members-rows .crew-member-quantity-input:focus,
body[data-page="database"] #crew-builder #crew-members-rows .crew-member-cost-input:focus {
  outline: 2px solid #c7d7ff !important;
  border-bottom-color: #aebde6 !important;
}

.auth-session-controls {
  margin-top: auto;
  display: grid;
  gap: 0.45rem;
  padding-top: 0.8rem;
}

.auth-session-user {
  font-size: 0.75rem;
  color: #344054;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-session-logout {
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #101828;
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  font-size: 0.72rem;
  cursor: pointer;
}

.auth-login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  display: grid;
  place-items: center;
  z-index: 1200;
}

.auth-login-card {
  width: min(420px, calc(100vw - 2rem));
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.34);
  padding: 1.1rem 1.1rem 1rem;
}

.auth-login-card h2 {
  margin: 0 0 0.35rem;
}

.auth-login-card p {
  margin: 0 0 0.85rem;
  color: #475467;
}

.auth-login-card form {
  display: grid;
  gap: 0.6rem;
}

.auth-login-card label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.88rem;
}

.auth-login-card input {
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
}

.auth-login-card button {
  border: 1px solid #0f172a;
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}

.auth-access-denied {
  max-width: 720px;
}

.admin-shell {
  display: grid;
  gap: 1rem;
}

.admin-create-user-card,
.admin-users-card {
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  padding: 0.8rem;
  background: #fff;
}

.admin-create-user-form {
  display: grid;
  gap: 0.65rem;
  max-width: 540px;
}

.admin-create-user-form label {
  display: grid;
  gap: 0.3rem;
}

.admin-create-user-form input,
.admin-create-user-form select {
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
}

.admin-create-user-form button {
  width: fit-content;
  border: 1px solid #0f172a;
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

.admin-users-table td .admin-role-select {
  min-width: 150px;
  min-height: 76px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
}

.admin-actions {
  display: flex;
  gap: 0.4rem;
}

.admin-actions button {
  border: 1px solid #d0d5dd;
  background: #fff;
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
}
