* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --accent: #2f6fed;
  --accent-light: #6fb1ff;
  --accent-dark: #1d4fb8;
  --accent-gradient: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 55%, var(--accent-dark) 100%);
  --accent-glow: 0 0 14px rgba(47, 111, 237, 0.5);
  --accent-glow-soft: 0 0 0 3px rgba(47, 111, 237, 0.15), 0 0 8px rgba(47, 111, 237, 0.35);
}
body { background: #f1f1ee; font-family: Arial, Helvetica, sans-serif; color: #1c1c1a; }
a { color: inherit; text-decoration: none; }

/* ===== Header ===== */
.header {
  background: #000000;
  display: flex;
  align-items: center;
  padding: 10px 24px;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--accent-dark), var(--accent-light), var(--accent-dark)) 1;
  box-shadow: 0 2px 14px rgba(47, 111, 237, 0.4);
  position: relative;
  z-index: 1;
}
.header .logo-img { height: 120px; display: block; }
.header .divider {
  width: 1px; height: 22px; background: rgba(255,255,255,0.3); margin: 0 16px;
}
.header .module-name { color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 1.5px; }
.header .spacer { flex: 1; }
.new-project-btn {
  background: var(--accent-gradient); color: #fff; font-size: 13px; font-weight: 700;
  border: none; border-radius: 16px; padding: 9px 18px; cursor: pointer;
  transition: box-shadow .15s;
}
.new-project-btn:hover { box-shadow: var(--accent-glow); }

.user-badge {
  display: flex; align-items: center; gap: 8px;
  background: #1f1f1f; border-radius: 18px; padding: 5px 12px 5px 5px; margin-right: 14px;
}
.user-badge .avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-gradient);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-badge .name { color: #fff; font-size: 13px; font-weight: 500; }
.user-badge .role {
  background: #2f5fb0; color: #fff; font-size: 10px; font-weight: 700;
  letter-spacing: 0.5px; border-radius: 10px; padding: 2px 8px; margin-left: 4px;
}
.logout-link { color: #a8a8a8; font-size: 12px; cursor: pointer; margin-right: 4px; }

/* ===== Layout ===== */
.layout { display: flex; min-height: calc(100vh - 49px); }

/* ===== Sidebar ===== */
.sidebar { width: 260px; background: #1c1c1a; flex-shrink: 0; padding: 16px 14px; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 10px; border-radius: 6px; font-size: 13px; color: #d8d8d4; cursor: pointer; margin-bottom: 2px;
}
.nav-item.active { background: #000; color: #fff; font-weight: 600; }
.nav-item:hover:not(.active) { background: #26262300; }

.nav-label {
  font-size: 11px; color: #76766f; letter-spacing: 0.5px; font-weight: 700;
  margin: 16px 10px 6px;
}

.tree-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 6px; font-size: 13px; color: #d8d8d4; cursor: pointer; margin-bottom: 2px;
}
.tree-toggle .t-label { display: flex; align-items: center; gap: 6px; }
.tree-toggle .chevron { font-size: 15px; color: #8a8a84; transition: transform 0.15s; flex-shrink: 0; }
.tree-toggle.open .chevron { transform: rotate(90deg); }
.tree-toggle.level-1 { font-weight: 600; }
.tree-toggle.level-2 { padding-left: 22px; font-size: 12.5px; color: #c8c8c4; }
.tree-children { display: none; }
.tree-children.open { display: block; }
.tree-leaf {
  padding: 7px 10px 7px 34px; border-radius: 6px; cursor: pointer;
}
.tree-leaf:hover { background: #26262300; }
.tree-leaf .l-name { font-size: 12.5px; color: #c8c8c4; }
.tree-leaf .l-code { font-size: 11px; color: #76766f; margin-top: 1px; }

/* ===== Main content ===== */
.main { flex: 1; min-width: 0; padding: 26px 32px; }
.page-title { font-size: 26px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: #6b6b66; margin-top: 4px; margin-bottom: 22px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat-card { background: #fff; border-radius: 8px; border: 1px solid #e4e4df; padding: 16px 18px; }
.stat-card .label { font-size: 12px; color: #6b6b66; font-weight: 600; letter-spacing: 0.3px; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 6px; }

/* Project Overview tab summary cards */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.overview-card {
  background: #fff; border: 1px solid #e4e4df; border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 14px 16px; cursor: pointer; transition: box-shadow .15s;
}
.overview-card:hover { box-shadow: var(--accent-glow); }
.overview-card .oc-label { font-size: 11px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; color: #8a8a84; }
.overview-card .oc-value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.overview-card .oc-sub { font-size: 12px; color: #6b6b66; margin-top: 4px; }
.overview-card .oc-sub-red { color: #b3261e; font-weight: 700; }

/* Dashboard job tiles */
.job-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.job-tile {
  background: #fff; border-radius: 8px; border: 1px solid #e4e4df; border-left: 4px solid var(--accent); padding: 16px 18px 16px 16px;
  cursor: pointer; transition: box-shadow .15s;
}
.job-tile:hover { box-shadow: var(--accent-glow); }
.jt-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.jt-customer { font-size: 11px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.jt-customer-logo { height: 36px; max-width: 120px; object-fit: contain; border-radius: 2px; }
.jt-name { font-size: 16px; font-weight: 700; margin-top: 8px; }
.jt-number { font-size: 12px; color: #6b6b66; margin-top: 2px; }
.jt-alerts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.jt-alert { font-size: 11px; font-weight: 700; border-radius: 10px; padding: 3px 9px; }
.jt-alert-red { background: #fce0df; color: #b3261e; }
.jt-alert-accent { background: #eaf2ff; color: var(--accent-dark); }
.jt-stats { margin-top: 12px; padding-top: 12px; border-top: 1px solid #efefea; display: flex; flex-direction: column; gap: 6px; }
.jt-stat { font-size: 12.5px; color: #3a3a36; }
.jt-stat-num { font-weight: 700; }
.jt-stat-sub { color: #6b6b66; }
.jt-stat.jt-stat-red { color: #b3261e; }
.jt-stat.jt-stat-red .jt-stat-num { color: #b3261e; }
.jt-stat.jt-stat-red .jt-stat-sub { color: #b3261e; font-weight: 700; }
.stat-card .sub { font-size: 12px; margin-top: 4px; }
.sub.up { color: #2a8a4a; }
.sub.warn { color: #b5790a; }
.sub.flat { color: #8a8a84; }

/* Section header */
.section-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.section-header h2 { font-size: 19px; font-weight: 700; }
.section-header .link { font-size: 13px; color: #6b6b66; }
.add-btn {
  background: var(--accent-gradient); color: #fff; font-size: 13px; font-weight: 700;
  border: none; border-radius: 16px; padding: 8px 16px; cursor: pointer;
  transition: box-shadow .15s;
}
.add-btn:hover { box-shadow: var(--accent-glow); }

/* Tables / panels */
.panel { background: #fff; border-radius: 8px; border: 1px solid #e4e4df; overflow: hidden; margin-bottom: 28px; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #232320; }
thead th {
  color: #c8c8c4; font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  text-align: left; padding: 10px 16px;
}
tbody td { padding: 13px 16px; font-size: 13px; border-bottom: 1px solid #efefea; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
.proj-name { font-weight: 600; }
.proj-code { font-size: 11px; color: #8a8a84; margin-top: 2px; }

.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar { width: 80px; height: 6px; background: #ececea; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: #58b35a; }
.progress-pct { font-size: 12px; color: #555; min-width: 30px; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 12px;
}
.pill.green { background: #e3f3df; color: #2a7a32; }
.pill.amber { background: #fcefd9; color: #a06800; }
.pill.red { background: #fce0df; color: #b3261e; }
.pill.gray { background: #eceae3; color: #6b6b66; }
.pill.orange { background: #fde3cf; color: #c2560a; }
.pill.yellow { background: #fdf6c9; color: #8a7500; }
.pill-select {
  border: none; font-family: inherit; cursor: pointer; appearance: none;
  padding-right: 20px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b6b66'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center;
}

/* Two-column lower section */
.lower-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }

.approval-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #efefea;
}
.approval-item:last-child { border-bottom: none; }
.approval-item .a-name { font-size: 13px; font-weight: 600; }
.approval-item .a-meta { font-size: 12px; color: #8a8a84; margin-top: 2px; }
.approval-btn {
  font-size: 12px; font-weight: 600; border-radius: 14px; padding: 6px 12px;
  border: 1px solid #d8d8d2; cursor: pointer; background: #fff;
}

.milestone-item { padding: 12px 16px; border-bottom: 1px solid #efefea; }
.milestone-item:last-child { border-bottom: none; }
.milestone-item .m-top { display: flex; justify-content: space-between; align-items: center; }
.milestone-item .m-name { font-size: 13px; font-weight: 600; }
.milestone-item .m-date { font-size: 12px; color: #8a8a84; }
.milestone-item .m-proj { font-size: 12px; color: #6b6b66; margin-top: 2px; }

/* ===== Project detail page ===== */
.proj-header {
  background: #fff; border: 1px solid #e4e4df; border-radius: 8px;
  padding: 18px 22px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.proj-header .ph-name { font-size: 22px; font-weight: 700; }
.proj-header .ph-meta { font-size: 13px; color: #6b6b66; margin-top: 4px; }
.proj-header .ph-right { display: flex; align-items: center; gap: 14px; }
.proj-header .ph-progress { display: flex; align-items: center; gap: 8px; }
.proj-header .progress-bar { width: 110px; }

.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid #e4e4df; margin-bottom: 20px; overflow-x: auto;
}
.tab-btn {
  background: none; border: none; font-size: 14px; font-weight: 600; color: #6b6b66;
  padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab-btn.active { color: #1c1c1a; border-bottom: 2px solid transparent; border-image: linear-gradient(90deg, var(--accent-light), var(--accent)) 1; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.info-card { background: #fff; border: 1px solid #e4e4df; border-radius: 8px; padding: 14px 16px; }
.info-card .label { font-size: 11px; font-weight: 700; letter-spacing: 0.3px; color: #6b6b66; }
.info-card .value { font-size: 20px; font-weight: 700; margin-top: 4px; }
.info-card .sub { font-size: 12px; color: #8a8a84; margin-top: 3px; }

.activity-item { padding: 10px 16px; border-bottom: 1px solid #efefea; font-size: 13px; }
.activity-item:last-child { border-bottom: none; }
.activity-item .ai-meta { font-size: 11px; color: #8a8a84; margin-top: 2px; }

.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.team-card { background: #fff; border: 1px solid #e4e4df; border-radius: 8px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.team-card .avatar {
  width: 38px; height: 38px; border-radius: 50%; background: #232320;
  color: #6fb1ff; font-size: 13px; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.team-card .t-name { font-size: 14px; font-weight: 600; }
.team-card .t-role { font-size: 12px; color: #6b6b66; margin-top: 2px; }

.doc-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #efefea; font-size: 13px;
}
.note-item, .permit-item, .equipment-item, .subcontractor-item, .doc-item {
  border-left: 3px solid var(--accent);
}
.doc-item:last-child { border-bottom: none; }
.doc-item .d-name { font-weight: 600; }
.doc-item .d-meta { font-size: 12px; color: #8a8a84; margin-top: 2px; }
.doc-item .d-link { font-size: 12px; color: #1c1c1a; font-weight: 600; border: 1px solid #d8d8d2; border-radius: 14px; padding: 5px 12px; cursor: pointer; background: #fff; }
.doc-item.folder { cursor: pointer; }
.doc-item .d-icon { margin-right: 8px; }
.doc-item .d-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.doc-breadcrumb { font-size: 13px; color: #6b6b66; margin-bottom: 12px; }
.doc-breadcrumb .crumb { cursor: pointer; color: #1c1c1a; font-weight: 600; }
.doc-breadcrumb .crumb:hover { text-decoration: underline; }
.doc-breadcrumb .sep { margin: 0 6px; color: #b5b5ae; }

.budget-summary { display: flex; gap: 24px; margin-bottom: 18px; }
.budget-summary .bs-item { font-size: 13px; color: #6b6b66; }
.budget-summary .bs-item .bs-value { font-size: 18px; font-weight: 700; color: #1c1c1a; display: block; margin-top: 2px; }

/* ===== Daily Notes ===== */
.note-form { background: #fff; border: 1px solid #e4e4df; border-radius: 8px; padding: 16px; margin-bottom: 20px; }
.note-form textarea {
  width: 100%; min-height: 76px; border: 1px solid #d8d8d2; border-radius: 6px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; outline: none; resize: vertical;
}
.note-form textarea:focus { border-color: var(--accent); box-shadow: var(--accent-glow-soft); outline: none; }
.note-form .note-form-footer { display: flex; justify-content: flex-end; margin-top: 10px; }
.note-item { padding: 14px 16px; border-bottom: 1px solid #efefea; font-size: 13px; }
.note-item:last-child { border-bottom: none; }
.note-item .n-body { white-space: pre-wrap; line-height: 1.5; }
.note-item .n-meta { font-size: 11px; color: #8a8a84; margin-top: 6px; display: flex; align-items: center; gap: 10px; }

/* ===== Permits ===== */
.permit-item { padding: 14px 16px; border-bottom: 1px solid #efefea; font-size: 13px; }
.permit-item:last-child { border-bottom: none; }
.permit-item .p-top { display: flex; align-items: center; justify-content: space-between; }
.permit-item .p-type { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.permit-item .p-notes { margin-top: 8px; color: #3a3a36; white-space: pre-wrap; word-break: break-word; }
.permit-item .p-meta { font-size: 11px; color: #8a8a84; margin-top: 6px; }
.permit-item .p-actions { display: flex; gap: 6px; }

/* ===== Project Equipment ===== */
.equipment-item { padding: 14px 16px; border-bottom: 1px solid #efefea; font-size: 13px; }
.equipment-item:last-child { border-bottom: none; }
.equipment-item .p-top { display: flex; align-items: center; justify-content: space-between; }
.equipment-item .p-type {
  font-weight: 700; display: grid; align-items: center; gap: 8px;
  grid-template-columns: 24px minmax(120px, 1fr) minmax(160px, 1fr) 150px 110px 60px 90px;
  flex: 1; min-width: 0;
}
.p-type-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.p-type-desc { font-weight: 400; color: #6b6b66; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.p-type-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.p-type-count { text-align: center; font-weight: 600; color: #6b6b66; }
.sow-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: #2a7a32; }
.sow-checkbox:disabled { cursor: default; }

/* Column-label header row above the equipment / subcontractor lists */
.list-col-header {
  padding: 8px 16px; background: #fafaf9; border-bottom: 1px solid #e4e4df;
}
.list-col-header .p-top { display: flex; align-items: center; justify-content: space-between; }
.list-col-header .p-actions { display: flex; gap: 6px; }
.list-col-header .lch-main {
  flex: 1; min-width: 0; display: grid; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; color: #8a8a84;
}
#equipment-panel .lch-main { grid-template-columns: 24px minmax(120px, 1fr) minmax(160px, 1fr) 150px 110px 60px 90px; }
#subcontractors-panel .lch-main { grid-template-columns: 24px minmax(120px, 1fr) minmax(160px, 1fr) 130px 150px 130px 90px 60px 90px; }
#changeorders-panel .lch-main { grid-template-columns: 24px minmax(100px, 1fr) 110px 130px 100px 90px 60px 90px; }
.list-col-header .lch-spacer { flex-shrink: 0; width: 170px; }
.equipment-item .p-notes { margin-top: 8px; color: #3a3a36; white-space: pre-wrap; word-break: break-word; }
.equipment-item .p-meta { font-size: 11px; color: #8a8a84; margin-top: 6px; }
.equipment-item .p-actions { display: flex; gap: 6px; }

.eq-item-toprow { display: flex; align-items: stretch; gap: 14px; }
.eq-item-header { flex: 1; min-width: 0; }

.eq-date-box {
  flex-shrink: 0; width: 170px; border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.eq-date-label { font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; opacity: 0.75; }
.eq-date-value { font-size: 14px; font-weight: 700; }
.eq-date-input {
  border: none; background: transparent; font-size: 14px; font-weight: 700; font-family: inherit;
  padding: 0; outline: none; color: inherit; width: 100%;
}
.eq-date-box.eq-date-green  { background: #e3f3df; color: #2a7a32; }
.eq-date-box.eq-date-yellow { background: #fdf6c9; color: #8a7500; }
.eq-date-box.eq-date-red    { background: #fce0df; color: #b3261e; }
.eq-date-box.eq-date-none   { background: #eceae3; color: #6b6b66; }

/* Contact details shown to the right of an equipment / subcontractor row */
.contact-card-side {
  flex-shrink: 0; width: 210px; border-radius: 8px; padding: 10px 12px;
  background: #f7f7f4; border: 1px solid #ececE6; display: flex; flex-direction: column; justify-content: center;
}
.contact-card-side.empty { color: #8a8a84; }
.contact-card-side .ccs-label { font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; color: #8a8a84; }
.contact-card-side .ccs-name { font-size: 13px; font-weight: 700; margin-top: 3px; }
.contact-card-side .ccs-title { font-size: 11px; color: #6b6b66; }
.contact-card-side .ccs-line { font-size: 11px; margin-top: 3px; word-break: break-all; }
.contact-card-side .ccs-line a { color: #1a4fa0; text-decoration: none; }
.contact-card-side .ccs-line a:hover { text-decoration: underline; }
.contact-card-side .ccs-none { font-size: 12px; margin-top: 3px; }

/* ===== Subcontractors (shares the equipment item / note styling) ===== */
.subcontractor-item { padding: 14px 16px; border-bottom: 1px solid #efefea; font-size: 13px; }
.subcontractor-item:last-child { border-bottom: none; }
.subcontractor-item .p-top { display: flex; align-items: center; justify-content: space-between; }
.subcontractor-item .p-type {
  font-weight: 700; display: grid; align-items: center; gap: 8px;
  grid-template-columns: 24px minmax(120px, 1fr) minmax(160px, 1fr) 130px 150px 130px 90px 60px 90px;
  flex: 1; min-width: 0;
}
.subcontractor-item .p-meta { font-size: 11px; color: #8a8a84; margin-top: 6px; }
.subcontractor-item .p-actions { display: flex; gap: 6px; }
.sub-warning { color: #b3261e; font-weight: 700; font-size: 12px; margin-top: 8px; }

/* ===== Change Orders (shares the equipment item / note styling) ===== */
.change-order-item { padding: 14px 16px; border-bottom: 1px solid #efefea; font-size: 13px; }
.change-order-item:last-child { border-bottom: none; }
.change-order-item .p-top { display: flex; align-items: center; justify-content: space-between; }
.change-order-item .p-type {
  font-weight: 700; display: grid; align-items: center; gap: 8px;
  grid-template-columns: 24px minmax(100px, 1fr) 110px 130px 100px 90px 60px 90px;
  flex: 1; min-width: 0;
}
.change-order-item .p-meta { font-size: 11px; color: #8a8a84; margin-top: 6px; }
.change-order-item .p-actions { display: flex; gap: 6px; }
.change-order-item .p-notes { color: #3a3a36; white-space: pre-wrap; word-break: break-word; margin-bottom: 10px; }

/* Change Orders grouped by company — collapsible group header above each company's rows */
.co-company-header {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer;
  background: #f2f2ee; border-bottom: 1px solid #e4e4df; font-weight: 700; font-size: 13px;
}
.co-company-header:hover { background: #ececE6; }
.co-company-chevron { font-size: 13px; }
.co-company-name { flex: 1; }
.co-company-count { font-size: 11px; font-weight: 600; color: #8a8a84; text-transform: none; letter-spacing: 0; }

/* ===== Modal (add company + contact) ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(28,28,26,0.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: #fff; border-radius: 10px; padding: 22px 24px; width: 440px;
  max-width: 100%; max-height: 90vh; overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-close { cursor: pointer; color: #8a8a84; font-size: 14px; }
.modal-close:hover { color: #1c1c1a; }

.eq-notes-block { margin-top: 10px; padding-left: 22px; border-left: 2px solid #efefea; }
.eq-notes-toggle {
  display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  color: #6b6b66; cursor: pointer; user-select: none;
}
.eq-notes-toggle:hover { color: #1c1c1a; }
.eq-notes-chevron { font-size: 12px; color: #8a8a84; transition: transform 0.15s; display: inline-block; }
.eq-notes-chevron.open { transform: rotate(90deg); }
.eq-note-list { margin-top: 8px; flex: 1; min-width: 0; }
.eq-details-expanded { display: flex; gap: 14px; margin-top: 8px; align-items: flex-start; }
.eq-details-expanded .contact-card-side { margin-top: 0; }
.permit-doc-dropzone { margin-top: 8px; padding: 14px 12px; }
.eq-doc-section { margin-top: 10px; padding-top: 10px; border-top: 1px solid #efefea; }
.eq-doc-label { font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; color: #8a8a84; margin-bottom: 4px; }
.eq-note-count {
  font-size: 10px; font-weight: 700; color: #8a8a84; background: #eceae3;
  border-radius: 8px; padding: 2px 6px; align-self: center;
}
.eq-notes-toggle-btn { font-size: 15px; }
.eq-notes-toggle-btn .eq-notes-chevron { font-size: 24px; }
.eq-note-item { padding: 8px 0; border-top: 1px solid #f0f0ea; font-size: 12px; }
.eq-note-item .eqn-body { white-space: pre-wrap; word-break: break-word; color: #3a3a36; }
.eq-note-item .eqn-meta { font-size: 11px; color: #8a8a84; margin-top: 3px; display: flex; align-items: center; gap: 8px; }
.eq-note-item .eqn-delete { color: #b3261e; cursor: pointer; }
.eq-note-composer { display: flex; gap: 8px; margin-top: 8px; }
.eq-note-composer textarea {
  flex: 1; min-height: 36px; max-height: 90px; border: 1px solid #d8d8d2; border-radius: 6px;
  padding: 7px 10px; font-size: 12px; font-family: inherit; outline: none; resize: vertical;
}
.eq-note-composer textarea:focus { border-color: var(--accent); box-shadow: var(--accent-glow-soft); outline: none; }
.eq-note-composer button {
  background: var(--accent-gradient); color: #fff; font-size: 12px; font-weight: 700;
  border: none; border-radius: 14px; padding: 0 14px; cursor: pointer; flex-shrink: 0;
  transition: box-shadow .15s;
}
.eq-note-composer button:hover { box-shadow: var(--accent-glow); }
.note-item .n-delete { color: #b3261e; cursor: pointer; }

/* ===== File upload (drag & drop / browse) — reused anywhere a file is added ===== */
.file-drop-zone {
  border: 2px dashed #d8d8d2; border-radius: 8px; padding: 26px 16px; text-align: center;
  cursor: pointer; font-size: 13px; color: #6b6b66; background: #fafaf8; margin-bottom: 14px; transition: border-color .15s, background .15s;
}
.file-drop-zone:hover, .file-drop-zone.dragover { border-color: var(--accent); background: #eaf2ff; box-shadow: var(--accent-glow-soft); }
.file-drop-zone .fdz-icon { font-size: 22px; margin-bottom: 6px; }
.file-drop-zone .fdz-browse { color: #1c1c1a; font-weight: 700; text-decoration: underline; }
.file-drop-zone .fdz-file { font-weight: 600; color: #1c1c1a; margin-top: 8px; }
.file-drop-zone .fdz-file .fdz-size { font-weight: 400; color: #8a8a84; }

/* ===== Contacts ===== */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.contact-card {
  background: #fff;
  border: 1px solid #e4e4df;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
}
.contact-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: #232320; color: #6fb1ff;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 14px; font-weight: 700; }
.contact-title { font-size: 12px; color: #6b6b66; margin-top: 1px; }
.contact-company { font-size: 12px; color: #8a8a84; margin-top: 1px; font-style: italic; }
.contact-detail {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #3a3a36; margin-top: 6px;
}
.contact-detail a { color: #1a4fa0; text-decoration: none; }
.contact-detail a:hover { text-decoration: underline; }
.contact-notes {
  font-size: 11px; color: #8a8a84; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid #f0f0ea;
  white-space: pre-wrap; word-break: break-word;
}
.contact-actions {
  display: flex; gap: 6px; position: absolute; top: 12px; right: 12px;
}
.icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: #c8c8c4; padding: 2px 4px;
  border-radius: 4px; line-height: 1;
}
.icon-btn:hover { color: #6b6b66; background: #f0f0ea; }
.search-bar {
  width: 100%; max-width: 340px;
  border: 1px solid #d8d8d2; border-radius: 8px;
  padding: 9px 14px; font-size: 13px; outline: none;
  font-family: inherit;
}
.search-bar:focus { border-color: var(--accent); box-shadow: var(--accent-glow-soft); outline: none; }

/* ===== Login page ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #1c1c1a;
}
.login-card {
  background: #fff; border-radius: 10px; padding: 40px 44px; width: 360px;
}
.login-card .logo-wrap { text-align: center; margin-bottom: 28px; }
.login-card .logo-wrap img { height: 144px; background: #000; border-radius: 6px; padding: 8px 14px; box-shadow: var(--accent-glow); }
.login-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 24px; text-align: center; }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 12px; font-weight: 700; color: #6b6b66; margin-bottom: 6px; letter-spacing: 0.3px; }
.form-field input {
  width: 100%; border: 1px solid #d8d8d2; border-radius: 6px;
  padding: 10px 12px; font-size: 14px; outline: none;
}
.form-field input:focus { border-color: var(--accent); box-shadow: var(--accent-glow-soft); outline: none; }
.form-field .checkbox-field {
  display: flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 0;
}
.form-field .checkbox-field input[type="checkbox"] {
  width: 16px; height: 16px; flex-shrink: 0; padding: 0; border: 1px solid #d8d8d2;
}
.form-field .checkbox-field span {
  font-size: 12px; font-weight: 700; color: #6b6b66; letter-spacing: 0.3px;
}
.form-field.checkbox-row { display: flex; flex-wrap: wrap; gap: 18px; }

.checklist {
  border: 1px solid #d8d8d2; border-radius: 6px; padding: 10px 12px; max-height: 180px; overflow-y: auto;
}
.checklist .checkbox-field { margin-bottom: 8px; }
.checklist .checkbox-field:last-child { margin-bottom: 0; }
.checklist-empty { font-size: 12px; color: #8a8a84; }

/* Contact category tags (Vendor / Subcontractor / Rentals) */
.contact-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.contact-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase;
  border-radius: 10px; padding: 2px 8px; background: #eceae3; color: #6b6b66;
}
.contact-tag.vendor { background: #e8f0ff; color: #1a4fa0; }
.contact-tag.subcontractor { background: #e3f3df; color: #2a7a32; }
.contact-tag.rentals { background: #fdf6c9; color: #8a7500; }
.contact-tag.customer { background: #f3e8ff; color: #6a1b9a; }

/* ===== Bulk categorize table ===== */
/* overflow:hidden on .panel (used elsewhere to clip rounded corners) breaks
   position:sticky, since it makes .panel itself the sticky containing block
   instead of the page. This table needs to scroll with the page, so override it. */
.bulk-panel { overflow: visible; }
.bulk-table thead th { position: sticky; top: 0; z-index: 2; background: #232320; }
.bulk-table thead th.bulk-col { text-align: center; width: 120px; }
.bulk-table tbody td { padding: 0; }
.bulk-table td.bulk-col { text-align: center; }
.bulk-table .bulk-box { width: 16px; height: 16px; cursor: pointer; margin: 0; }
.bulk-company-row td { background: #f4f4f0; border-bottom: 1px solid #e4e4df; padding: 9px 16px; }
.bulk-company-row .bulk-company { font-weight: 700; font-size: 13px; }
.bulk-company-row .bulk-count { font-size: 11px; color: #8a8a84; margin-left: 8px; }
.bulk-person-row td { padding: 7px 16px; border-bottom: 1px solid #f4f4f0; }
.bulk-person-row:hover td { background: #fbfbf9; }
.bulk-person-row .bulk-person { font-size: 13px; padding-left: 18px; }
.bulk-person-row .bulk-title { font-size: 11px; color: #8a8a84; margin-left: 8px; }

.save-flash {
  font-size: 12px; font-weight: 700; color: #2a7a32; opacity: 0; transition: opacity .2s;
}
.save-flash.show { opacity: 1; }
.login-btn {
  width: 100%; background: var(--accent-gradient); color: #fff; font-size: 14px; font-weight: 700;
  border: none; border-radius: 8px; padding: 12px; cursor: pointer; margin-top: 8px;
  transition: box-shadow .15s;
}
.login-btn:hover { box-shadow: var(--accent-glow); }
.login-error { color: #b3261e; font-size: 13px; margin-top: 12px; text-align: center; min-height: 20px; }

/* ===== Utilities ===== */
.empty-state { padding: 32px 16px; text-align: center; color: #8a8a84; font-size: 13px; }

/* ===== Responsive (phones / tablets) ===== */
.hamburger-btn {
  display: none; background: none; border: none; color: #fff; font-size: 24px;
  cursor: pointer; margin-right: 14px; padding: 4px 6px; line-height: 1;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}

@media (max-width: 900px) {
  .hamburger-btn { display: inline-block; }
  .header .logo-img { height: 60px; }
  .header .divider { display: none; }

  .layout { position: relative; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 50; width: 260px;
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 3px 0 24px rgba(0,0,0,0.35);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }

  .main { padding: 18px; }
  .proj-header { flex-wrap: wrap; gap: 14px; }
  .proj-header .ph-right { flex-wrap: wrap; }

  /* The equipment/subcontractor/change-order grid rows are wider than a tablet screen at their
     full fixed-column width. Below 640px they switch to a stacked flex layout instead (see that
     breakpoint), but up to here just let them scroll horizontally so nothing is silently clipped
     by .panel's default overflow:hidden. */
  .panel:not(.bulk-panel) { overflow-x: auto; }
}

@media (max-width: 640px) {
  .header { padding: 8px 14px; }
  .header .logo-img { height: 44px; }
  .header .module-name { display: none; }
  .user-badge { padding: 4px 10px 4px 4px; margin-right: 6px; }
  .user-badge .name { display: none; }
  .logout-link { display: none; }

  .main { padding: 14px; }
  .page-title { font-size: 21px; }
  .section-header { flex-wrap: wrap; gap: 10px; }
  .section-header > div { width: 100%; flex-wrap: wrap; }
  .section-header select, .section-header .add-btn { width: 100%; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .job-tile-grid, .contact-grid { grid-template-columns: 1fr; }

  .proj-header { padding: 14px; }
  .proj-header .ph-name { font-size: 18px; }
  .proj-header .ph-right { width: 100%; justify-content: space-between; }

  /* Column-grid item rows (equipment/subcontractor/change-order) can't fit their fixed-width
     columns on a phone screen — drop the grid and let each field wrap onto its own line instead.
     The column-label header row above them only makes sense with the grid, so hide it too. */
  .list-col-header { display: none; }
  .equipment-item .p-type,
  .subcontractor-item .p-type,
  .change-order-item .p-type {
    display: flex; flex-wrap: wrap; row-gap: 6px;
  }
  .equipment-item .p-type-name, .subcontractor-item .p-type-name, .change-order-item .p-type-name,
  .equipment-item .p-type-desc, .subcontractor-item .p-type-desc, .change-order-item .p-type-desc {
    white-space: normal; flex-basis: 100%;
  }
  .permit-item .p-type { flex-wrap: wrap; row-gap: 6px; }
  .eq-item-toprow { flex-wrap: wrap; }
  .eq-date-box { margin-top: 10px; }

  .note-form { padding: 14px; }
  .note-form-footer .add-btn { width: 100%; text-align: center; }
  .login-card { width: 100%; max-width: 340px; padding: 28px 22px; }
  .login-card .logo-wrap img { height: 96px; }
}
