:root{
  --bg: #0b1220;
  --card: rgba(255,255,255,.04);
  --card2: rgba(255,255,255,.02);
  --text: #e9eefc;
  --muted: #a9b4d0;
  --border: rgba(255,255,255,.10);
  --focus: rgba(44,123,229,.35);
  --btn: #2c7be5;
  --btn2:#1f66c8;
  --danger: #ff6b6b;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 14px;
}

* { box-sizing: border-box; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 15% 10%, rgba(44,123,229,.18), transparent 60%),
    radial-gradient(900px 700px at 95% 45%, rgba(50,210,150,.10), transparent 55%),
    var(--bg);
}

.wrap{
  max-width: 980px;
  margin: 26px auto 70px;
  padding: 0 18px;
}

.topbar{
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 14px;
  margin-bottom: 16px;
}

.topbar h1{
  margin:0;
  font-size: 20px;
  letter-spacing: .2px;
}

.meta{
  margin-top: 10px;
  display:flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(44,123,229,.15);
  border: 1px solid rgba(44,123,229,.30);
  color: var(--btn);
  font-weight: 600;
}

.field.full {
  grid-column: 1 / -1;
}

.card{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), var(--card2));
  box-shadow: var(--shadow);
  margin: 14px 0;
  overflow: visible;
}

.card-h{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}

.card-h .left{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
}

.icon{
  width: 34px;
  height: 34px;
  display:grid;
  place-items:center;
  border-radius: 10px;
  background: rgba(44,123,229,.18);
  border: 1px solid rgba(44,123,229,.25);
  font-size: 18px;
  flex: 0 0 auto;
}

.htext{
  display:flex;
  flex-direction:column;
  gap: 2px;
  min-width: 0;
}

.htext .h1{
  font-weight: 750;
  font-size: 15px;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.htext .h2{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-b{
  padding: 14px 16px 16px;
}

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}

@media (max-width: 780px){
  .grid{ grid-template-columns: 1fr; }
}

.field{
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02);
  border-radius: 12px;
  padding: 10px;
}

label{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text);
}

.req{
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

input[type="text"], input[type="number"], input[type="date"], textarea, select{
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,16,30,.55);
  color: var(--text);
  padding: 10px 10px;
  outline: none;
  font-size: 14px;
  transition: box-shadow .15s ease, border-color .15s ease;
}

textarea{ min-height: 96px; resize: vertical; }

input:focus, textarea:focus, select:focus{
  border-color: rgba(44,123,229,.55);
  box-shadow: 0 0 0 4px var(--focus);
}

.actions{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items:center;
  margin-top: 6px;
}

.btn{
  appearance:none;
  border:none;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--btn);
  color: white;
  font-weight: 800;
  cursor:pointer;
  box-shadow: 0 10px 20px rgba(44,123,229,.20);
}

.btn:hover{ background: var(--btn2); }

.btn-secondary{
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow:none;
  color: var(--text);
  text-decoration:none;
  display:inline-flex;
  align-items:center;
}

.btn-secondary:hover{ background: rgba(255,255,255,.12); }

.hint{
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

.uploadbox{
  margin-top: 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px dashed rgba(255,255,255,.18);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}

.uploadbox .t1{ font-weight: 800; }
.uploadbox .t2{ color: var(--muted); font-size: 13px; margin-top: 2px; }

/* SOW buttons */
[data-add-item], [data-del-area], [data-del-item], [data-dup-item], [data-add-area-scope]{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor:pointer;
}
[data-add-item]:hover, [data-del-area]:hover, [data-del-item]:hover, [data-dup-item]:hover, [data-add-area-scope]:hover{
  background: rgba(255,255,255,.10);
}

/* Multi-scope SOW controls */
#sow_tpl_picker{ min-width:200px; }
#btn_add_scope{
  border:1px solid rgba(44,123,229,.3);
  background:rgba(44,123,229,.15);
  color: var(--text);
  border-radius:10px;
  padding:8px 14px;
  cursor:pointer;
  font-weight:700;
}
#btn_add_scope:hover{ background:rgba(44,123,229,.25); }

.sow-scope-block{
  border:2px solid rgba(44,123,229,.25);
  padding:14px;
  border-radius:14px;
  margin:14px 0;
  background:rgba(44,123,229,.04);
}
.sow-remove-scope{
  border:1px solid rgba(255,60,60,.3);
  background:rgba(255,60,60,.1);
  color:#ff6b6b;
  border-radius:10px;
  padding:6px 12px;
  cursor:pointer;
  font-size:13px;
}
.sow-remove-scope:hover{ background:rgba(255,60,60,.2); }

/* When qty is disabled (NO_QTY_SURFACES selected), make it look intentionally disabled */
input[disabled]{
  opacity: .55;
  cursor: not-allowed;
}

/* Revision banner */
.revision-banner{
  background: rgba(44,123,229,.12);
  border: 1px solid rgba(44,123,229,.35);
  color: #93c5fd;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  line-height: 1.45;
  font-weight: 600;
}

/* Server-side validation errors */
.error-banner{
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.35);
  color: #fca5a5;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  line-height: 1.45;
}
.error-banner strong{ color: #ff6b6b; }
.error-banner ul{ margin: 6px 0 0; padding-left: 18px; }

.field.has-error input,
.field.has-error select,
.field.has-error textarea{
  border-color: rgba(239,68,68,.6);
  box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}
.field-error{
  color: #fca5a5;
  font-size: 12px;
  margin-top: 4px;
}

/* Multi-select dropdown */
.ms-wrap{
  position: relative;
}

.ms-trigger{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,16,30,.55);
  color: var(--text);
  cursor: pointer;
  transition: box-shadow .15s ease, border-color .15s ease;
}

.ms-trigger:focus,
.ms-wrap.open .ms-trigger{
  border-color: rgba(44,123,229,.55);
  box-shadow: 0 0 0 4px var(--focus);
}

.ms-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.ms-placeholder{
  color: var(--muted);
  font-size: 14px;
}

.ms-chip{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(44,123,229,.22);
  border: 1px solid rgba(44,123,229,.30);
  font-size: 12px;
  white-space: nowrap;
}

.ms-chip-x{
  cursor: pointer;
  opacity: .7;
  font-size: 14px;
  line-height: 1;
}
.ms-chip-x:hover{ opacity: 1; }

.ms-arrow{
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  transition: transform .15s ease;
}
.ms-wrap.open .ms-arrow{ transform: rotate(180deg); }

.ms-dropdown{
  display: none;
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.15);
  background: #111827;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}

.ms-wrap.open .ms-dropdown{ display: block; }

.ms-option{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background .1s ease;
  margin-bottom: 0;
  justify-content: flex-start;
  border-bottom: 1px solid rgba(255,255,255,.05);
}

.ms-option:last-child{ border-bottom: none; }
.ms-option:hover{ background: rgba(255,255,255,.06); }

.ms-option input[type="checkbox"]{
  width: 16px;
  height: 16px;
  accent-color: var(--btn);
  flex-shrink: 0;
}

/* External select (searchable single-select dropdown) */
.es-wrap{ position: relative; }

.es-trigger{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,16,30,.55);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: box-shadow .15s ease, border-color .15s ease;
}

.es-trigger:focus,
.es-wrap.open .es-trigger{
  border-color: rgba(44,123,229,.55);
  box-shadow: 0 0 0 4px var(--focus);
}

.es-selected{
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.es-selected.has-value{ color: var(--text); }

.es-arrow{
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  transition: transform .15s ease;
}
.es-wrap.open .es-arrow{ transform: rotate(180deg); }

.es-dropdown{
  display: none;
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.15);
  background: #111827;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  overflow: hidden;
}

.es-wrap.open .es-dropdown{ display: block; }

.es-search-box{
  padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.es-search{
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,16,30,.55);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.es-search::placeholder{ color: var(--muted); }
.es-search:focus{
  border-color: rgba(44,123,229,.55);
}

.es-options{
  max-height: 220px;
  overflow-y: auto;
}

.es-option{
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background .1s ease;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.es-option:last-child{ border-bottom: none; }
.es-option:hover{ background: rgba(255,255,255,.06); }
.es-option.selected{ background: rgba(44,123,229,.15); }

/* Google Places Autocomplete dark theme */
.pac-container{
  background: #111827;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  font-family: inherit;
  margin-top: 4px;
  z-index: 60;
}

.pac-item{
  border-bottom: 1px solid rgba(255,255,255,.05);
  color: #e9eefc;
  padding: 9px 12px;
  cursor: pointer;
  line-height: 1.4;
  font-size: 13px;
}

.pac-item:hover,
.pac-item-selected{
  background: rgba(255,255,255,.06);
}

.pac-icon{ display: none; }
.pac-item-query{ color: #e9eefc; font-weight: 600; }
.pac-matched{ font-weight: 700; color: var(--btn); }

/* Prefix + Input combo */
.prefix-input-wrap{
  display: flex; gap: 8px; align-items: center;
}
.prefix-input-wrap select.prefix-select{
  flex: 0 0 auto; width: auto; min-width: 110px; max-width: 140px;
}
.prefix-input-wrap input.prefix-value{
  flex: 1 1 auto; width: auto; min-width: 60px;
}

/* Side-by-side location panels (intersection + medical) */
.location-panels{
  display: flex; gap: 12px; margin-top: 10px;
}
@media (max-width: 700px){
  .location-panels{ flex-direction: column; }
}

/* Nearest Intersection panel */
.ni-panel{
  flex: 1;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  padding: 12px;
  overflow: hidden;
}
.ni-header{
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-bottom: 6px;
}
.ni-text{
  font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px;
}
.ni-map{
  width: 100%; height: auto;
  border-radius: 8px; border: 1px solid rgba(255,255,255,.08);
}

/* Nearest Medical Provider panel */
.mp-panel{
  flex: 1;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  padding: 12px;
  overflow: hidden;
}
.mp-header{
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-bottom: 8px;
}
.mp-provider{
  margin-bottom: 10px; padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.mp-provider:last-child{ margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.mp-provider .mp-specialty{
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--accent); margin-bottom: 3px;
}
.mp-provider .mp-name{
  font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px;
}
.mp-provider .mp-addr{
  font-size: 12px; color: var(--muted); line-height: 1.3;
}
.mp-provider .mp-phone{
  font-size: 12px; color: var(--accent); text-decoration: none;
}
.mp-provider .mp-phone:hover{ text-decoration: underline; }
.mp-provider .mp-dist{
  font-size: 11px; color: var(--muted); margin-top: 2px;
}

/* Flatpickr dark theme overrides */
.flatpickr-calendar{
  background: #111827 !important;
  border: 1px solid rgba(255,255,255,.15) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 32px rgba(0,0,0,.5) !important;
  font-family: inherit !important;
}
.flatpickr-months,
.flatpickr-weekdays{
  background: transparent !important;
}
.flatpickr-months .flatpickr-month{
  color: #e9eefc !important;
  fill: #e9eefc !important;
}
span.flatpickr-weekday{
  color: var(--muted) !important;
  font-weight: 600 !important;
}
.flatpickr-day{
  color: #e9eefc !important;
  border-radius: 8px !important;
}
.flatpickr-day:hover{
  background: rgba(255,255,255,.08) !important;
  border-color: transparent !important;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover{
  background: var(--btn) !important;
  border-color: var(--btn) !important;
  color: #fff !important;
}
.flatpickr-day.today{
  border-color: var(--btn) !important;
}
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay{
  color: rgba(255,255,255,.25) !important;
}
.flatpickr-current-month input.cur-year,
.flatpickr-current-month .flatpickr-monthDropdown-months{
  color: #e9eefc !important;
  background: transparent !important;
}
.flatpickr-time input,
.flatpickr-time .flatpickr-am-pm{
  color: #e9eefc !important;
  background: rgba(255,255,255,.05) !important;
  border: none !important;
  border-radius: 6px !important;
}
.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover{
  background: rgba(255,255,255,.1) !important;
}
.flatpickr-time .flatpickr-time-separator{
  color: var(--muted) !important;
}
.numInputWrapper span{
  border: none !important;
}
.numInputWrapper span svg path{
  fill: rgba(255,255,255,.5) !important;
}
.numInputWrapper span:hover svg path{
  fill: #e9eefc !important;
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg{
  fill: #e9eefc !important;
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg{
  fill: var(--btn) !important;
}

/* Inline upload */
.iu-wrap{ width: 100%; }
.iu-wrap .hidden{ display: none !important; }
.iu-dropzone{
  border: 2px dashed rgba(255,255,255,.15);
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.iu-dropzone:hover{
  border-color: var(--btn);
  background: rgba(44,123,229,.06);
}
.iu-placeholder{
  color: var(--muted);
  font-size: 13px;
}
.iu-hint{
  color: var(--muted);
  font-size: 11px;
  opacity: .6;
  margin-top: 4px;
}
.iu-dragover{
  border-color: var(--btn) !important;
  background: rgba(44,123,229,.1) !important;
}
.iu-wrap:focus{ outline: none; }
.iu-file{ display: none; }
.iu-preview{
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 10px 14px;
}
.iu-thumb{
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(0,0,0,.3);
}
.iu-info{
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.iu-name{
  font-size: 13px;
  color: #e9eefc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.iu-remove{
  background: rgba(255,60,60,.15);
  color: #ff6b6b;
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.iu-remove:hover{ background: rgba(255,60,60,.3); }
.iu-progress{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}
.iu-bar{
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,.08);
  border-radius: 3px;
  overflow: hidden;
}
.iu-fill{
  height: 100%;
  width: 0;
  background: var(--btn);
  border-radius: 3px;
  transition: width .3s;
}
.iu-pct{
  font-size: 12px;
  color: var(--muted);
  min-width: 36px;
  text-align: right;
}
.iu-error{
  color: #ff6b6b;
  font-size: 12px;
  margin-top: 6px;
  padding: 8px 12px;
  background: rgba(255,60,60,.08);
  border-radius: 8px;
}

/* Result page */
.result-icon{
  font-size: 48px;
  margin-bottom: 8px;
}

.result-title{
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 4px;
}

.result-sub{
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 18px;
}

.data-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.data-row{
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  font-size: 13px;
  line-height: 1.4;
}

.data-row .dk{
  color: var(--muted);
  min-width: 140px;
  flex-shrink: 0;
  font-weight: 600;
}

.data-row .dv{
  word-break: break-word;
}

/* Estimate cards */
.est-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: border-color .2s;
}
.est-card:hover{ border-color: rgba(255,255,255,.18); }

.est-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.est-code{
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--btn);
}
.est-badge{
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 4px 10px;
  border-radius: 6px;
}
.est-approved{
  background: rgba(34,197,94,.15);
  color: #22c55e;
}
.est-pending{
  background: rgba(255,255,255,.08);
  color: var(--muted);
}

.est-body{ margin-bottom: 14px; }
.est-row{
  display: flex;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
  line-height: 1.5;
}
.est-label{
  color: var(--muted);
  min-width: 90px;
  flex-shrink: 0;
  font-weight: 600;
}
.est-value{ word-break: break-word; }
.est-amount{ font-weight: 700; font-size: 14px; }

.est-actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-sm{
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 8px;
}
.btn-approve{
  background: rgba(34,197,94,.15);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,.3);
}
.btn-approve:hover{
  background: rgba(34,197,94,.25);
}
.btn-danger{
  background: rgba(255,60,60,.12);
  color: #ff6b6b;
  border: 1px solid rgba(255,60,60,.25);
}
.btn-danger:hover{
  background: rgba(255,60,60,.22);
}

.est-history-panel{
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.est-history-panel.hidden{ display: none; }

.est-history-list{ display: flex; flex-direction: column; gap: 6px; }
.est-history-item{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,.03);
}
.est-history-icon{ font-size: 14px; flex-shrink: 0; }
.est-history-text{ flex: 1; }
.est-history-date{ color: var(--muted); flex-shrink: 0; }

/* Modal overlay */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden{ display: none; }

.modal-box{
  background: #111827;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
  width: 100%;
  max-width: 420px;
  overflow: visible;
}

.modal-title{
  font-size: 16px;
  font-weight: 750;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.modal-body{
  padding: 16px 18px;
}

.modal-actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,.10);
}

/* Company search (new company mode) */
.cs-new-mode{
  display: flex;
  gap: 8px;
  align-items: center;
}
.cs-new-input{
  flex: 1;
}
.cs-back-btn{
  appearance: none;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.cs-back-btn:hover{
  background: rgba(255,255,255,.10);
  color: var(--text);
}

/* ── SDR Builder styles ──────────────────────────────────────────────── */

/* Card header right actions */
.card-h .right{ flex-shrink: 0; }

/* Small variant for builder dropdowns */
.es-wrap-sm .es-trigger{ min-height: 34px; padding: 6px 10px; font-size: 13px; }

/* Empty state */
.sdr-empty{
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
  text-align: center;
}

/* Crew builder */
.crew-row{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.crew-row:last-of-type{ border-bottom: none; }
.crew-name{ flex: 1; min-width: 0; }
.crew-hours{ width: 80px; flex-shrink: 0; }
.crew-hours input{
  width: 100%;
  text-align: center;
  padding: 6px 8px;
  font-size: 13px;
}

/* OT total bar */
.ot-total-bar{
  padding: 12px 20px;
  font-size: 14px;
  color: var(--text);
  text-align: right;
  border-top: 1px solid var(--border);
  background: rgba(44,123,229,.06);
  border-radius: 0 0 12px 12px;
}
.ot-total-bar strong{
  color: var(--btn);
  font-size: 15px;
}

/* OT dashboard cards */
.ot-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
}
.ot-card-header{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.ot-card-header .ot-project{
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.ot-card-header .ot-meta{
  font-size: 12px;
  color: var(--muted);
}
.ot-badge{
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.ot-badge-pending{ background: rgba(245,158,11,.15); color: #f59e0b; }
.ot-badge-approved{ background: rgba(34,197,94,.15); color: #22c55e; }
.ot-badge-rejected{ background: rgba(239,68,68,.15); color: #ef4444; }
.ot-detail-row{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}
.ot-detail-row strong{ color: var(--text); }
.ot-emp-list{
  font-size: 13px;
  color: var(--text);
  margin: 8px 0;
}
.ot-justification{
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0;
  padding: 8px 12px;
  background: rgba(255,255,255,.03);
  border-radius: 8px;
  border-left: 3px solid var(--btn);
}
.ot-actions{
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.ot-history{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.ot-event{
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
}
.ot-event strong{ color: var(--text); }
.ot-empty{
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* Icon buttons */
.btn-icon{
  appearance: none;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--muted);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 14px;
}
.btn-icon:hover{ background: rgba(255,255,255,.10); color: var(--text); }
.btn-icon.btn-remove{ border-color: rgba(255,60,60,.2); color: #ff6b6b; background: rgba(255,60,60,.08); }
.btn-icon.btn-remove:hover{ background: rgba(255,60,60,.18); }
.btn-icon.btn-remove-sm{ width: 26px; height: 26px; font-size: 12px; }

/* Small buttons */
.btn-xs{
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}
.btn-xs:hover{ background: rgba(255,255,255,.10); }

/* Area builder */
.area-block{
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: rgba(255,255,255,.02);
}

.area-header{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.area-name-input{
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}

.area-item-row{
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.item-task{ flex: 2; min-width: 0; font-size: 13px; }
.item-pct{ width: 75px; flex-shrink: 0; font-size: 13px; padding: 8px 6px; }
.item-material{ flex: 1; min-width: 0; font-size: 13px; }

.area-actions{
  margin-top: 8px;
}

/* Photos */
.area-photos{ margin-top: 10px; }
.photo-upload-row{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.photo-upload-label{ cursor: pointer; }
.photo-count{ font-size: 12px; color: var(--muted); }

.photo-grid{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.photo-thumb{
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
}
.photo-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-remove{
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,.65);
  color: #ff6b6b;
  border: none;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-remove:hover{ background: rgba(255,60,60,.4); }

.photo-grid-sm .photo-thumb{ width: 52px; height: 52px; }
.photo-thumb-sm .photo-remove{ width: 16px; height: 16px; font-size: 10px; }

/* Photo button in supp items */
.photo-btn{
  cursor: pointer;
  font-size: 16px;
  border-color: rgba(44,123,229,.25);
  color: var(--btn);
}
.photo-btn:hover{ background: rgba(44,123,229,.12); }

/* Supplemental builder */
.supp-block{
  border: 2px solid rgba(44,123,229,.2);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: rgba(44,123,229,.03);
}

.supp-header{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.supp-name-input{
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}

.supp-area{
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255,255,255,.02);
}

.supp-area-header{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.supp-area-name{
  flex: 1;
  font-weight: 600;
  font-size: 13px;
}

/* Supplemental item — two-row layout */
.supp-item-block{
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: rgba(255,255,255,.02);
}

.si-row-top{
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.si-row-top .si-desc{
  flex: 1;
  min-width: 0;
  font-size: 13px;
  resize: vertical;
  min-height: 80px;
}
.si-top-actions{
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.si-row-bottom{
  display: flex;
  gap: 6px;
  align-items: center;
}
.si-row-bottom input[type="text"],
.si-row-bottom input[type="number"],
.si-row-bottom select{ width: auto; padding: 6px 8px; height: 32px; font-size: 13px; box-sizing: border-box; }
input[type="text"].si-mat{ flex: 1; min-width: 60px; width: auto; }
input[type="number"].si-qty{ width: 72px; flex: 0 0 72px; text-align: center; }
select.si-unit{ width: 72px; flex: 0 0 72px; }

.supp-area-actions, .supp-actions{ margin-top: 8px; }

/* Documentation upload button (prominent, full-width) */
.doc-upload-btn{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin-top: 10px;
  padding: 16px 12px;
  border: 2px dashed rgba(59,130,246,.5);
  border-radius: 10px;
  background: rgba(59,130,246,.06);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-align: center;
}
.doc-upload-btn:hover, .doc-upload-btn:focus-within{
  background: rgba(59,130,246,.12);
  border-color: rgba(59,130,246,.8);
}
.doc-upload-icon{ font-size: 28px; line-height: 1; }
.doc-upload-text{
  font-size: 15px;
  font-weight: 600;
  color: #93c5fd;
}
.doc-upload-hint{
  font-size: 12px;
  color: #f87171;
  font-weight: 500;
}
.doc-upload-count{
  text-align: center;
  font-size: 13px;
  color: #22c55e;
  margin-top: 6px;
  font-weight: 500;
}
.doc-upload-btn-sm{
  padding: 12px 10px;
  margin-top: 8px;
}
.doc-upload-btn-sm .doc-upload-icon{ font-size: 22px; }
.doc-upload-btn-sm .doc-upload-text{ font-size: 13px; }
.doc-upload-btn-sm .doc-upload-hint{ font-size: 11px; }

/* Project Stage checkboxes */
.stage-checkboxes{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.stage-check{
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 0;
  transition: background .15s, border-color .15s;
}
.stage-check:hover{ background: rgba(255,255,255,.06); }
.stage-check input[type="checkbox"]{
  width: 16px;
  height: 16px;
  accent-color: var(--btn);
  margin: 0;
}
.stage-check input:checked + span{ color: var(--btn); font-weight: 700; }

/* End date friendly label */
.end-date-friendly{
  font-size: 14px;
  font-weight: 700;
  color: var(--btn);
  margin-bottom: 6px;
}
input[type="date"]{ cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator{ opacity:0; position:absolute; inset:0; width:100%; cursor:pointer; }

/* Actions card (submit button) */
.actions-card{
  text-align: center;
  padding: 16px 0;
}

/* Gallery */
.gallery-day{ margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.gallery-day:last-child{ border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.gallery-day-header{
  font-size: 14px; font-weight: 600; color: #93c5fd;
  margin-bottom: 14px; padding: 8px 12px;
  background: rgba(59,130,246,.08); border-radius: 8px;
}
.gallery-section{ margin-bottom: 20px; }
.gallery-section:last-child{ margin-bottom: 0; }
.gallery-section-title{ font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.gallery-grid{ display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-thumb{
  display: block; width: 120px; height: 120px;
  border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  cursor: pointer; transition: opacity .15s;
}
.gallery-thumb:hover{ opacity: .8; }
.gallery-thumb img{ width: 100%; height: 100%; object-fit: cover; display: block; }

/* Lightbox */
.lightbox{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  display: none; align-items: center; justify-content: center;
  z-index: 9999; cursor: pointer;
}
.lightbox.active{ display: flex; }
/* Hide both by default, show via class toggle */
.lightbox img, .lightbox mux-player{ display: none; }
.lightbox.show-img img{ display: block; }
.lightbox.show-mux mux-player{ display: block; }
.lightbox img{
  max-width: 92vw; max-height: 92vh;
  border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.lightbox mux-player{
  width: 92vw; height: 80vh;
  max-width: 920px; max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.lightbox .lb-close{
  position: absolute; top: 12px; right: 12px;
  font-size: 28px; background: rgba(0,0,0,.6); color: #fff;
  border: none; border-radius: 50%; width: 44px; height: 44px;
  cursor: pointer; z-index: 1;
  display: flex; align-items: center; justify-content: center;
}
.lightbox .lb-nav{
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 42px; background: rgba(0,0,0,.5); color: #fff;
  border: none; border-radius: 12px; padding: 8px 14px;
  cursor: pointer; z-index: 1;
}
.lightbox .lb-prev{ left: 16px; }
.lightbox .lb-next{ right: 16px; }
@media (max-width: 600px){
  .lightbox .lb-nav{ font-size: 32px; padding: 6px 10px; }
  .lightbox .lb-prev{ left: 8px; }
  .lightbox .lb-next{ right: 8px; }
}

/* Video badge (play icon on thumbnails) */
.video-thumb{ position: relative; }
.video-badge{
  position: absolute; bottom: 4px; left: 4px;
  background: rgba(0,0,0,.7); color: #fff;
  font-size: 10px; padding: 2px 6px;
  border-radius: 4px; pointer-events: none;
}

/* Upload placeholder (spinner while uploading) */
.upload-placeholder{
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(44,123,229,.1);
  border: 1px dashed rgba(44,123,229,.4);
}
.upload-spinner{
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: var(--btn);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.upload-label{
  font-size: 9px; color: var(--muted);
  margin-top: 4px; text-align: center;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* ── Superintendent Dashboard ─────────────────────────── */
.dash-stage-section{ margin-bottom: 28px; }
.dash-stage-header{
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; margin-bottom: 14px;
  border-left: 4px solid #6b7280;
  background: rgba(255,255,255,.03); border-radius: 0 8px 8px 0;
}
.dash-stage-label{ font-size: 16px; font-weight: 700; color: var(--text); }
.dash-stage-count{
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: rgba(255,255,255,.08); padding: 2px 8px; border-radius: 10px;
}
.dash-stage-empty{ color: var(--muted); font-size: 13px; padding: 0 16px; }
.dash-cards-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.dash-project-card{
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color .15s;
}
.dash-project-card:hover{ border-color: rgba(255,255,255,.22); }
.dash-card-top{ display: flex; flex-direction: column; gap: 6px; flex: 1; }
.dash-card-name{ font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.3; }
.dash-card-address{ font-size: 13px; color: var(--muted); line-height: 1.3; }
.dash-badge{
  display: inline-block; width: fit-content;
  font-size: 11px; font-weight: 700; color: #fff;
  padding: 3px 10px; border-radius: 12px; margin-top: 4px;
  text-transform: uppercase; letter-spacing: .3px;
}
.dash-card-btn{
  display: block; text-align: center;
  padding: 10px 16px; border-radius: 8px;
  background: var(--btn); color: #fff;
  font-size: 14px; font-weight: 600;
  text-decoration: none; transition: background .15s;
}
.dash-card-btn:hover{ background: var(--btn2); }

/* ── Searchable dropdown ──────────────────────────────── */
.search-select{ position: relative; }
.search-dropdown{
  display: none; position: absolute; left: 0; right: 0; top: 100%;
  margin-top: 4px; max-height: 240px; overflow-y: auto;
  background: #1a2332; border: 1px solid var(--border);
  border-radius: 10px; z-index: 50;
  box-shadow: var(--shadow);
}
.search-dropdown.open{ display: block; }
.search-dropdown-item{
  padding: 10px 14px; font-size: 14px; color: var(--text);
  cursor: pointer; transition: background .1s;
}
.search-dropdown-item:hover{ background: rgba(44,123,229,.15); }
.search-dropdown-item:first-child{ border-radius: 10px 10px 0 0; }
.search-dropdown-item:last-child{ border-radius: 0 0 10px 10px; }

/* User bar (auth) */
.user-bar{
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--muted);
}
.user-bar a{
  color: var(--btn);
  text-decoration: none;
  font-size: 12px;
}
.user-bar a:hover{ text-decoration: underline; }
