/* ── Design tokens — dark mode defaults ─────────────────────────────────── */
:root {
  --sidebar-w:      190px;
  --bg-sidebar:     #0f0f0f;
  --bg-body:        #1a1a1a;
  --bg-card:        #252525;
  --bg-card-header: rgba(255,255,255,0.03);
  --bg-hover:       rgba(255,255,255,0.05);
  --border:         rgba(255,255,255,0.08);
  --accent:         #4f46e5;
  --accent-2:       #818cf8;
  --accent-glow:    rgba(79,70,229,0.25);
  --green:          #10b981;
  --green-dark:     #059669;
  --text-1:         #f1f5f9;
  --text-2:         #94a3b8;
  --text-3:         #64748b;
}

/* ── Light mode token overrides ─────────────────────────────────────────── */
[data-bs-theme="light"] {
  --bg-sidebar:     #f0f2f5;
  --bg-body:        #f5f7fa;
  --bg-card:        #ffffff;
  --bg-card-header: rgba(0,0,0,0.04);
  --bg-hover:       rgba(0,0,0,0.06);
  --border:         rgba(0,0,0,0.12);
  --accent-2:       #4338ca;
  --accent-glow:    rgba(79,70,229,0.15);
  --text-1:         #1e293b;
  --text-2:         #475569;
  --text-3:         #6b7280;
}

/* ── Light mode component overrides ─────────────────────────────────────── */
[data-bs-theme="light"] .bg-light {
  background-color: rgba(0,0,0,0.03) !important;
}
[data-bs-theme="light"] .table {
  --bs-table-hover-bg: rgba(0,0,0,0.04);
}
[data-bs-theme="light"] .table-light {
  --bs-table-bg:           rgba(0,0,0,0.02);
  --bs-table-color:        var(--text-2);
  --bs-table-border-color: var(--border);
}
[data-bs-theme="light"] .stage-step {
  border-top-color: rgba(0,0,0,0.12);
}
[data-bs-theme="light"] .stage-step::before {
  background: rgba(0,0,0,0.1);
}
[data-bs-theme="light"] .dot-none {
  background: rgba(0,0,0,0.15);
}
[data-bs-theme="light"] .survey-cal-month td.other-month {
  background-color: rgba(0,0,0,0.02);
}
[data-bs-theme="light"] .survey-cal-week .time-col {
  background: rgba(0,0,0,0.02);
}
/* Invert white logo to near-black on light sidebar */
[data-bs-theme="light"] .sidebar-logo-full {
  filter: brightness(0);
}
/* PNG mini logo has an opaque dark background; invert() flips it light so it blends with the sidebar */
[data-bs-theme="light"] .sidebar-logo-mini {
  filter: invert(1);
}

/* ── Base ──────────────────────────────────────────────────────────────── */
body {
  background: var(--bg-body);
  color: var(--text-1);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.sidebar-nav {
  list-style: none;
  padding: 10px 8px;
  margin: 0;
  flex: 1;
}

.sidebar-nav li { margin-bottom: 2px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}

.sidebar-link.active {
  background: rgba(79,70,229,0.15);
  color: var(--accent-2);
}

.sidebar-link .bi {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link-return {
  background: rgba(16,185,129,0.1);
  color: var(--green) !important;
  border: 1px solid rgba(16,185,129,0.2);
  line-height: 1.2;
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: 8px;
}

.sidebar-link-return:hover {
  background: rgba(16,185,129,0.18) !important;
  color: #34d399 !important;
}

.sidebar-link-return .bi {
  margin-top: 1px;
  flex-shrink: 0;
}

.sidebar-return-ewo {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.8rem;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-transform: uppercase;
  padding: 14px 12px 4px;
  display: block;
}

.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 14px 12px 4px;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.15s;
}

.sidebar-section-toggle:hover { color: var(--text-2); }

.sidebar-section-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.sidebar-section-toggle[aria-expanded="false"] .sidebar-section-chevron {
  transform: rotate(-90deg);
}

.sidebar-section-body {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.sidebar-section-body li { margin-bottom: 2px; }

.sidebar-section-body.collapsed { display: none; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-3);
  text-align: center;
  flex-shrink: 0;
}

.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sidebar-user-icon {
  font-size: 1.1rem;
  color: var(--text-2);
  flex-shrink: 0;
  margin-top: 2px;
}

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-meta {
  margin-top: 2px;
}

body.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding: 12px 0;
}

body.sidebar-collapsed .sidebar-user-icon {
  font-size: 1.2rem;
}

/* ── Sidebar toggle button ─────────────────────────────────────────────── */
.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  color: var(--text-1);
  background: var(--bg-hover);
}

/* ── Theme toggle button ───────────────────────────────────────────────── */
.sidebar-theme-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}

.sidebar-theme-btn:hover {
  color: var(--text-1);
  background: var(--bg-hover);
}

.sidebar-theme-btn .bi {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

body.sidebar-collapsed .sidebar-theme-btn {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}

body.sidebar-collapsed .sidebar-theme-btn .bi {
  width: auto;
  font-size: 1.05rem;
}

/* ── Sidebar transitions ───────────────────────────────────────────────── */
#sidebar      { transition: width 0.22s ease; }
#main-wrapper { transition: margin-left 0.22s ease; }

/* ── Collapsed state ───────────────────────────────────────────────────── */
body.sidebar-collapsed #sidebar      { width: 60px; }
body.sidebar-collapsed #main-wrapper { margin-left: 60px; }

/* Hide text labels, section labels, footer text */
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-section-label,
body.sidebar-collapsed .sidebar-return-text { display: none; }

/* In icon-only mode: hide section toggles, always show section bodies */
body.sidebar-collapsed .sidebar-section-toggle { display: none; }
body.sidebar-collapsed .sidebar-section-body { display: block !important; }

/* Center icons, remove gap */
body.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}

body.sidebar-collapsed .sidebar-link .bi {
  width: auto;
  font-size: 1.05rem;
}

/* Logo: show full logo when expanded, hide when collapsed (just clip) */
.sidebar-logo-mini { display: none; }

body.sidebar-collapsed .sidebar-logo-full { display: none; }
body.sidebar-collapsed .sidebar-logo-mini { display: inline; }

body.sidebar-collapsed .sidebar-logo {
  display: flex;
  justify-content: center;
}

/* Return link in collapsed state — just the icon */
body.sidebar-collapsed .sidebar-link-return {
  justify-content: center;
  padding: 10px 0;
}

/* ── Main wrapper ──────────────────────────────────────────────────────── */
#main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.topbar {
  padding: 0 24px;
}

main.content {
  padding: 20px 24px 48px;
}

/* ── Page header ───────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
}

.page-header-sub {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Breadcrumb ────────────────────────────────────────────────────────── */
.breadcrumb {
  --bs-breadcrumb-divider-color: var(--text-3);
  --bs-breadcrumb-item-active-color: var(--text-2);
  font-size: 0.8rem;
  margin-bottom: 16px;
}

.breadcrumb-item a {
  color: var(--accent-2);
  text-decoration: none;
}

.breadcrumb-item a:hover { text-decoration: underline; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  --bs-card-bg: var(--bg-card);
  border-color: var(--border);
  border-radius: 10px;
}

.card-header {
  background: var(--bg-card-header);
  border-bottom-color: var(--border);
  font-weight: 600;
  font-size: 0.875rem;
}

/* ── Tables ────────────────────────────────────────────────────────────── */
.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: rgba(255,255,255,0.04);
  --bs-table-border-color: var(--border);
}

.table thead th {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  border-bottom-color: var(--border) !important;
  padding-top: 10px;
  padding-bottom: 10px;
}

.table-light {
  --bs-table-bg: rgba(255,255,255,0.025);
  --bs-table-color: var(--text-3);
  --bs-table-border-color: var(--border);
}

/* Sortable column header links */
.table th a {
  color: var(--text-3) !important;
  text-decoration: none;
}

.table th a:hover { color: var(--text-1) !important; }

.table th { white-space: nowrap; }
.table th a { white-space: nowrap; }

/* Dashboard tables scroll horizontally rather than compressing columns */
.dashboard-table {
  width: max-content;
  min-width: 100%;
}

/* Give dashboard table cells comfortable padding (overrides table-sm) */
.dashboard-table td,
.dashboard-table th {
  padding: .45rem .75rem;
}

/* Per-column minimum widths so columns are never squeezed below usable size */
.dashboard-table th[data-col-key="ewo_number"]            { min-width: 140px; }
.dashboard-table th[data-col-key="market"]                { min-width:  75px; }
.dashboard-table th[data-col-key="wire_center"]           { min-width: 150px; }
.dashboard-table th[data-col-key="project_address"]       { min-width: 230px; }
.dashboard-table th[data-col-key="total_units"]           { min-width:  70px; }
.dashboard-table th[data-col-key="current_stage"]         { min-width: 170px; }
.dashboard-table th[data-col-key="status"]                { min-width: 140px; }
.dashboard-table th[data-col-key="created_date"]          { min-width: 110px; }
.dashboard-table th[data-col-key="priority"]              { min-width:  90px; }
.dashboard-table th[data-col-key="track_type"]            { min-width: 110px; }
.dashboard-table th[data-col-key="billable"]              { min-width:  80px; }
.dashboard-table th[data-col-key="not_billable_reason"]   { min-width: 170px; }
.dashboard-table th[data-col-key="state"]                 { min-width:  65px; }
.dashboard-table th[data-col-key="parallel_isp_status"]   { min-width: 140px; }
.dashboard-table th[data-col-key="parallel_pa_status"]    { min-width: 140px; }
.dashboard-table th[data-col-key="parallel_osp_status"]   { min-width: 140px; }
.dashboard-table th[data-col-key="surveyor"]              { min-width: 140px; }
.dashboard-table th[data-col-key="isp_designer"]          { min-width: 140px; }
.dashboard-table th[data-col-key="osp_designer"]          { min-width: 140px; }
.dashboard-table th[data-col-key="qc_engineer"]           { min-width: 140px; }
.dashboard-table th[data-col-key="vz_coordinator"]        { min-width: 160px; }
.dashboard-table th[data-col-key="wo_assigned_date"]      { min-width: 130px; }
.dashboard-table th[data-col-key="survey_scheduled_date"] { min-width: 145px; }
.dashboard-table th[data-col-key="survey_completed_date"] { min-width: 145px; }
.dashboard-table th[data-col-key="isp_design_assigned_date"] { min-width: 155px; }
.dashboard-table th[data-col-key="isp_design_complete_date"] { min-width: 140px; }
.dashboard-table th[data-col-key="property_approval_date"]{ min-width: 120px; }
.dashboard-table th[data-col-key="osp_design_assigned_date"] { min-width: 155px; }
.dashboard-table th[data-col-key="osp_design_date"]       { min-width: 140px; }
.dashboard-table th[data-col-key="final_submittal_date"]  { min-width: 140px; }
.dashboard-table th[data-col-key="invoice_date"]          { min-width: 120px; }
.dashboard-table th[data-col-key="due_date"]              { min-width: 110px; }
.dashboard-table th[data-col-key="sub_contractor_costs"]  { min-width: 110px; }
.dashboard-table th[data-col-key="pre_rake_amount"]       { min-width: 110px; }
.dashboard-table th[data-col-key="final_rake_amount"]     { min-width: 110px; }
.dashboard-table th[data-col-key="bdms_pid"]              { min-width: 110px; }
.dashboard-table th[data-col-key="vsap_number"]           { min-width: 100px; }
.dashboard-table th[data-col-key="line_of_business"]      { min-width: 110px; }
.dashboard-table th[data-col-key="install_type"]          { min-width: 110px; }
.dashboard-table th[data-col-key="billing_type"]          { min-width: 110px; }
.dashboard-table th[data-col-key="design_phase"]          { min-width: 120px; }
.dashboard-table th[data-col-key="par_wpid"]              { min-width: 110px; }
.dashboard-table th[data-col-key="vz_assignment_notes"]   { min-width: 200px; }
.dashboard-table th[data-col-key="notes"]                 { min-width: 200px; }
.dashboard-table th[data-col-key="actions"]               { min-width:  90px; }

/* Sticky filter/toolbar area at top of dashboard pages */
.dashboard-sticky-top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-body);
  padding-bottom: 4px;
}

/* Scrollable table container — scrolls both axes so thead sticky works */
.drag-scroll {
  cursor: grab;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
}
.drag-scroll:active { cursor: grabbing; }

/* Sticky column headers within the scrollable container */
.drag-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: var(--bg-card);
}

/* ── Cell copy buttons (appear on row hover) ────────────────────────────── */
.ewo-copy-btn,
.cell-copy-btn {
  opacity: 0;
  transition: opacity .15s;
  border: none;
  background: none;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  color: var(--text-2);
  font-size: .75em;
}
tr:hover .ewo-copy-btn,
tr:hover .cell-copy-btn,
.ewo-copy-btn:focus-visible,
.cell-copy-btn:focus-visible {
  opacity: 1;
}
/* EWO button stays inline; generic buttons are absolutely positioned
   so they never affect cell height or content flow */
.ewo-copy-btn {
  vertical-align: middle;
  padding-left: 3px;
}
.cell-copy-btn {
  vertical-align: middle;
  padding-left: 3px;
}
.dashboard-table tbody td {
  position: relative;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  --bs-btn-bg:           var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg:     #4338ca;
  --bs-btn-hover-border-color: #4338ca;
  --bs-btn-active-bg:    #3730a3;
}

/* ── Nav tabs ──────────────────────────────────────────────────────────── */
.nav-tabs {
  --bs-nav-tabs-border-color: var(--border);
  --bs-nav-tabs-link-active-bg: var(--bg-card);
  --bs-nav-tabs-link-active-border-color: var(--border) var(--border) var(--bg-card);
  --bs-nav-tabs-link-active-color: var(--accent-2);
}

.nav-tabs .nav-link {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-tabs .nav-link.active { font-weight: 600; }

.nav-tabs .nav-link:hover:not(.active) {
  color: var(--text-1);
  border-color: transparent transparent var(--border);
}

/* ── Form controls ─────────────────────────────────────────────────────── */
.form-control, .form-select {
  --bs-border-color: var(--border);
}

/* ── Alert tweaks ──────────────────────────────────────────────────────── */
.alert { border-radius: 8px; }

/* bg-light override — used in collapse panels, status bars */
.bg-light {
  background-color: rgba(255,255,255,0.04) !important;
}

/* ── Stage progress stepper ────────────────────────────────────────────── */
.stage-stepper {
  display: flex;
  overflow-x: auto;
  padding: 20px 0 12px;
  gap: 0;
}

.stage-step {
  flex: 1;
  min-width: 90px;
  text-align: center;
  padding: 6px 4px 4px;
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--text-3);
  border-top: 3px solid rgba(255,255,255,0.1);
  position: relative;
  cursor: default;
}

.stage-step::before {
  content: '';
  width: 12px;
  height: 12px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
}

.stage-step.completed {
  color: var(--green);
  border-top-color: var(--green-dark);
}

.stage-step.completed::before {
  background: var(--green-dark);
}

.stage-step.current {
  color: var(--accent-2);
  border-top-color: var(--accent);
  font-weight: 700;
}

.stage-step.current::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Status badge colors ───────────────────────────────────────────────── */
.badge-active           { background-color: #059669; }
.badge-active-refusal   { background-color: #dc2626; }
.badge-passive-refusal  { background-color: #d97706; }
.badge-on-hold          { background-color: #475569; }
.badge-canceled         { background-color: #1e293b; border: 1px solid var(--border); }
.badge-revision         { background-color: #0891b2; }

/* ── Misc ──────────────────────────────────────────────────────────────── */
.ewo-badge {
  font-family: 'Roboto Mono', monospace;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

.permit-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot-none      { background: rgba(255,255,255,0.2); }
.dot-created   { background: #f59e0b; }
.dot-submitted { background: var(--accent); }
.dot-approved  { background: var(--green); }

/* card top-border accent */
.card-accent-blue   { border-top: 3px solid var(--accent); }
.card-accent-green  { border-top: 3px solid var(--green); }
.card-accent-orange { border-top: 3px solid #f59e0b; }
.card-accent-red    { border-top: 3px solid #ef4444; }

/* ── Calendar ───────────────────────────────────────────────────────────── */
.cal-event {
  background: var(--accent);
  color: #fff !important;
  border-radius: 4px;
  padding: 3px 5px;
  font-size: 0.7rem;
  line-height: 1.3;
}

.cal-event:hover { background: #4338ca; }

.cal-event-pre-con { background: #0891b2; }
.cal-event-pre-con:hover { background: #0e7490; }
.cal-event-exploratory { background: #7c3aed; }
.cal-event-exploratory:hover { background: #6d28d9; }
.cal-event-resurvey { background: #ea580c; }
.cal-event-resurvey:hover { background: #c2410c; }
.cal-event-par { background: #f59e0b; }
.cal-event-par:hover { background: #d97706; }
.cal-event-holiday { background: rgba(255,193,7,0.15); color: #ffc107; border: 1px solid rgba(255,193,7,0.35); font-size: 0.68rem; font-weight: 600; padding: 1px 5px; border-radius: 3px; cursor: default; }
.cal-event-pto { background: #16a34a; }
.cal-event-pto:hover { background: #15803d; }
.cal-event-sick { background: #ca8a04; }
.cal-event-sick:hover { background: #a16207; }
.cal-event-bereavement { background: #6b7280; }
.cal-event-bereavement:hover { background: #4b5563; }
.to-editable  { cursor: pointer; }
.survey-editable { cursor: pointer; }
.cal-time     { font-weight: 700; opacity: .85; }
.cal-surveyor { font-weight: 600; }
.cal-project  { opacity: .85; }
.cal-duration { font-size: 0.7rem; opacity: .7; }

.cal-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  background: transparent;
  color: var(--text-3);
  font-size: 0.78rem;
  cursor: pointer;
  opacity: 0.55;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.cal-toggle-btn.active {
  border-color: var(--cal-color);
  color: var(--text-1);
  opacity: 1;
}
.cal-toggle-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--cal-color);
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s;
}
.cal-toggle-btn.active .cal-toggle-dot {
  background: var(--cal-color);
}
.cal-hidden { display: none !important; }

/* Monthly */
.survey-cal-month {
  table-layout: fixed;
  min-width: 700px;
}

.survey-cal-month thead th {
  min-width: 100px;
}

.survey-cal-month td.survey-cal-day {
  vertical-align: top;
  min-height: 90px;
  height: 90px;
  padding: 4px;
  min-width: 100px;
  overflow: hidden;
}

.survey-cal-month .day-num {
  font-size: 0.8rem;
  margin-bottom: 3px;
}

.survey-cal-month td.other-month { background-color: rgba(255,255,255,0.02); }
.survey-cal-month td.is-today    { background-color: rgba(79,70,229,0.12); }

/* Weekly */
.survey-cal-week {
  table-layout: fixed;
  min-width: 630px;
}

.survey-cal-week .time-col {
  width: 70px;
  min-width: 70px;
  background: rgba(255,255,255,0.02);
}

.survey-cal-week thead th:not(.time-col) {
  min-width: 80px;
}

.survey-cal-week td.weekly-cell {
  vertical-align: top;
  min-height: 52px;
  height: 52px;
  padding: 3px;
  min-width: 80px;
  overflow: hidden;
}

.survey-cal-week td.today-col { background-color: rgba(79,70,229,0.12); }

/* ── Inactive table row ────────────────────────────────────────────────── */
tr.row-inactive td {
  opacity: 0.5;
}

/* ── Milestone lock / edit ─────────────────────────────────────────────── */
#milestonesForm.milestones-locked .milestone-edit-control { display: none !important; }
#milestonesForm.milestones-locked .milestone-save-row     { display: none !important; }
#milestonesForm:not(.milestones-locked) .milestone-locked-text { display: none !important; }

/* ── Tom Select — dark mode ────────────────────────────────────────────── */
/* The Bootstrap 5 theme Tom Select ships does not read BS 5.3 dark-mode   */
/* variables, so we override every surface explicitly.                      */

/* Control (the closed "input" box) */
[data-bs-theme="dark"] .ts-control {
  background-color: var(--bg-card) !important;
  color: var(--text-1) !important;
  border-color: var(--border) !important;
}

/* The live search input inside the control */
[data-bs-theme="dark"] .ts-control input {
  color: var(--text-1) !important;
}
[data-bs-theme="dark"] .ts-control input::placeholder {
  color: var(--text-3) !important;
}

/* The rendered selected-item text */
[data-bs-theme="dark"] .ts-control .item {
  color: var(--text-1) !important;
}

/* Placeholder text when nothing is selected */
[data-bs-theme="dark"] .ts-wrapper.single .ts-control:not(.rtl) .placeholder,
[data-bs-theme="dark"] .ts-control .placeholder {
  color: var(--text-3) !important;
}

/* The dropdown panel */
[data-bs-theme="dark"] .ts-dropdown {
  background-color: var(--bg-card) !important;
  border-color: var(--border) !important;
  color: var(--text-1) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5) !important;
}

/* Individual options */
[data-bs-theme="dark"] .ts-dropdown .option,
[data-bs-theme="dark"] .ts-dropdown .ts-option {
  color: var(--text-1) !important;
  background-color: transparent !important;
}

/* Hovered / keyboard-focused option */
[data-bs-theme="dark"] .ts-dropdown .option.active,
[data-bs-theme="dark"] .ts-dropdown .ts-option.active {
  background-color: var(--accent) !important;
  color: #fff !important;
}

/* Currently selected option shown inside the open list */
[data-bs-theme="dark"] .ts-dropdown .option.selected,
[data-bs-theme="dark"] .ts-dropdown .ts-option.selected {
  background-color: rgba(79,70,229,0.18) !important;
  color: var(--text-1) !important;
}

/* Selected + active (hovered while selected) */
[data-bs-theme="dark"] .ts-dropdown .option.selected.active,
[data-bs-theme="dark"] .ts-dropdown .ts-option.selected.active {
  background-color: var(--accent) !important;
  color: #fff !important;
}

/* Optgroup header */
[data-bs-theme="dark"] .ts-dropdown .optgroup-header {
  color: var(--text-3) !important;
  background-color: var(--bg-card) !important;
}

/* "No results" message */
[data-bs-theme="dark"] .ts-dropdown .no-results {
  color: var(--text-3) !important;
  background-color: transparent !important;
}

/* Caret / arrow icon */
[data-bs-theme="dark"] .ts-wrapper.single .ts-control::after {
  border-top-color: var(--text-2) !important;
}

/* Focus ring to match other form controls */
[data-bs-theme="dark"] .ts-wrapper.focus .ts-control,
[data-bs-theme="dark"] .ts-control:focus-within {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 0.2rem var(--accent-glow) !important;
}

/* ── Tom Select — light mode ────────────────────────────────────────────── */
/* Light mode already renders well with the Bootstrap 5 theme; only tweak  */
/* the focus ring to match the app accent colour.                           */
[data-bs-theme="light"] .ts-wrapper.focus .ts-control,
[data-bs-theme="light"] .ts-control:focus-within {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 0.2rem var(--accent-glow) !important;
}

/* ── Holiday mini-calendar ──────────────────────────────────────────────── */
.hcal-table thead th {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-2);
  padding: 2px 0;
  text-align: center;
}
.hcal-table tbody td {
  padding: 1px 0;
  text-align: center;
}
.hcal-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1;
}
.hcal-other {
  opacity: 0.18;
}
.hcal-holiday {
  background: rgba(255, 193, 7, 0.22);
  color: #ffc107;
  font-weight: 700;
  cursor: default;
}
.hcal-today {
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  font-weight: 600;
}

