/* ============================================================
   AVFX SHOW CALENDAR — styles.css
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0d1117;
  --surface:      #161b22;
  --surface2:     #1c2128;
  --surface3:     #21262d;
  --border:       #30363d;
  --border-light: #21262d;
  --text:         #e6edf3;
  --text-muted:   #7d8590;
  --text-dim:     #484f58;
  --accent:       #58a6ff;
  --accent-dim:   rgba(88,166,255,0.12);
  --today-color:  #f78166;
  --weekend-bg:   rgba(255,255,255,0.022);
  --sidebar-w:    310px;
  --row-h:        54px;
  --header-h:     56px;
  --gantt-hdr-h:  54px;
  --day-w:        34px;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-size: 14px;
}

.hidden { display: none !important; }

/* ─── SCROLLBAR STYLING ─────────────────────────────────── */
::-webkit-scrollbar              { width: 8px; height: 8px; }
::-webkit-scrollbar-track        { background: var(--bg); }
::-webkit-scrollbar-thumb        { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover  { background: #484f58; }
::-webkit-scrollbar-corner       { background: var(--bg); }

/* ─── LOGIN ─────────────────────────────────────────────── */
.view-center {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 44px 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.logo-img       { height: 44px; width: auto; flex-shrink: 0; }
.logo-img-small { height: 24px; width: auto; flex-shrink: 0; }

.logo-text  { display: flex; flex-direction: column; gap: 2px; }
.logo-sub   { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: 0.3px; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
.field input::placeholder { color: var(--text-dim); }

.error-msg {
  background: rgba(248,81,73,0.12);
  border: 1px solid rgba(248,81,73,0.35);
  color: #f85149;
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 13px;
  margin-bottom: 14px;
}

#login-btn {
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
}
#login-btn:hover:not(:disabled) { opacity: 0.88; }
#login-btn:active:not(:disabled) { transform: scale(0.99); }
#login-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ─── APP LAYOUT ─────────────────────────────────────────── */
#app-view {
  display: flex;
  flex-direction: row;   /* sidebar + main side-by-side */
  height: 100vh;
  overflow: hidden;
}

/* ─── LEFT SIDEBAR ───────────────────────────────────────── */
.left-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
  transition: width 0.22s cubic-bezier(0.4,0,0.2,1),
              border-right-width 0.22s;
  z-index: 20;
}
.left-sidebar.collapsed {
  width: 0;
  border-right-width: 0;
}

.lsb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: var(--header-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.lsb-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  white-space: nowrap;
}
.lsb-close {
  width: 26px; height: 26px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.lsb-close:hover { background: var(--surface2); color: var(--text); }

.lsb-section {
  padding: 14px 12px 12px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.lsb-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 8px;
  white-space: nowrap;
}

/* Page nav tabs (vertical) */
.lsb-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  margin-bottom: 2px;
}
.lsb-tab:hover  { background: var(--surface2); color: var(--text); }
.lsb-tab.active { background: var(--accent-dim); color: var(--accent); }

/* Month nav row inside sidebar */
.lsb-month-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.lsb-month-nav .period-label {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  text-align: center;
}
.lsb-today {
  width: 100%;
  text-align: center;
  margin: 0;
}

/* Filters inside sidebar */
.lsb-search {
  width: 100%;
  margin-bottom: 10px;
}
.lsb-search .search-input        { width: 100%; }
.lsb-search .search-input:focus  { width: 100%; }

.lsb-filter-row {
  margin-bottom: 8px;
}
.lsb-filter-row .filter-label  { display: block; margin-bottom: 4px; }
.lsb-filter-row .filter-select { width: 100%; min-width: 0; }

/* Sidebar toggle button (in header) */
.lsb-toggle {
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.lsb-toggle:hover          { background: var(--surface2); color: var(--text); }
.lsb-toggle.active         { background: var(--accent-dim); color: var(--accent); border-color: rgba(88,166,255,0.4); }

/* ─── MAIN CONTENT WRAPPER ───────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

/* ─── HEADER ─────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 16px 0 12px;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto;
}

.nav-btn {
  width: 34px; height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.nav-btn:hover { background: var(--surface3); border-color: #484f58; }

.period-label {
  font-size: 17px;
  font-weight: 700;
  min-width: 175px;
  text-align: center;
  color: var(--text);
  letter-spacing: -0.01em;
}

.today-btn {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-left: 4px;
}
.today-btn:hover { background: var(--accent-dim); }

.header-filters {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
  line-height: 1;
}

.search-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  padding: 6px 30px 6px 30px;
  outline: none;
  width: 210px;
  transition: border-color 0.15s, width 0.2s, box-shadow 0.15s;
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.12);
  width: 240px;
}

.search-clear {
  position: absolute;
  right: 7px;
  width: 18px;
  height: 18px;
  background: var(--surface3);
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.search-clear:hover { background: var(--border); color: var(--text); }

.filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.filter-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  padding: 6px 28px 6px 10px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237d8590' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: border-color 0.15s;
  min-width: 150px;
}
.filter-select:focus  { border-color: var(--accent); }
.filter-select:hover  { border-color: #484f58; }
.filter-select option { background: var(--surface2); color: var(--text); }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.job-count {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.icon-btn {
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.logout-btn:hover { color: #f85149; border-color: rgba(248,81,73,0.4); }

/* ─── LOADING OVERLAY ────────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: var(--header-h) 0 0 0;
  background: rgba(13,17,23,0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 90;
  font-size: 13px;
  color: var(--text-muted);
  backdrop-filter: blur(2px);
}

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ─── APP ERROR BANNER ───────────────────────────────────── */
.app-error {
  background: rgba(248,81,73,0.1);
  border-bottom: 1px solid rgba(248,81,73,0.3);
  color: #f85149;
  padding: 10px 20px;
  font-size: 13px;
  flex-shrink: 0;
}

/* ─── GANTT WRAPPER ──────────────────────────────────────── */
.gantt-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ─── LEFT PANEL (Sidebar) ───────────────────────────────── */
.gantt-left {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--border);
  z-index: 20;
  box-shadow: 3px 0 12px rgba(0,0,0,0.35);
}

.gantt-corner {
  height: var(--gantt-hdr-h);
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  padding: 0 16px 10px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.sidebar-body {
  flex: 1;
  overflow: hidden; /* scrolled via JS */
  background: var(--bg);
}

#sidebar-rows { width: 100%; }

/* Sidebar job rows */
.sidebar-row {
  height: var(--row-h);
  display: flex;
  align-items: center;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
  overflow: hidden;
  position: relative;
}
.sidebar-row:hover        { background: rgba(88,166,255,0.07); }
.sidebar-row.even         { background: rgba(255,255,255,0.018); }
.sidebar-row.even:hover   { background: rgba(88,166,255,0.07); }
.sidebar-row.active       { background: var(--accent-dim) !important; }

.sidebar-color-bar {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  margin-right: 10px;
  flex-shrink: 0;
}

.sidebar-info {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

.job-num {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.job-status {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px 2px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.status-active     { background: rgba(35,134,54,0.22);  color: #3fb950; }
.status-tentative  { background: rgba(187,128,9,0.22);  color: #d29922; }
.status-hold       { background: rgba(139,148,158,0.2); color: #8b949e; }
.status-cancelled  { background: rgba(248,81,73,0.18);  color: #f85149; }
.status-quote      { background: rgba(88,166,255,0.18); color: #58a6ff; }

.job-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.job-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── RIGHT PANEL (Timeline) ─────────────────────────────── */
.gantt-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Date header */
.timeline-header-wrap {
  height: var(--gantt-hdr-h);
  flex-shrink: 0;
  overflow: hidden; /* scrolled via JS */
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

#date-header {
  height: var(--gantt-hdr-h);
  display: flex;
  flex-direction: column;
}

.week-band {
  display: flex;
  height: 22px;
  border-bottom: 1px solid var(--border-light);
  overflow: hidden;
}

.week-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  padding-left: 5px;
  border-right: 1px solid var(--border-light);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.day-band {
  display: flex;
  height: 32px;
}

.day-cell {
  width: var(--day-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  border-right: 1px solid rgba(48,54,61,0.75);
  user-select: none;
  gap: 1px;
}
.day-cell .dow-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.day-cell.weekend         { background: var(--weekend-bg); }
.day-cell.weekend .dow-label,
.day-cell.weekend         { color: var(--text-dim); }
.day-cell.today-header    { color: var(--today-color) !important; }
.day-cell.today-header .dow-label { color: var(--today-color) !important; }

/* Timeline body */
.timeline-body-wrap {
  flex: 1;
  overflow: auto; /* main scroll — both axes */
  position: relative;
}

#timeline-rows {
  position: relative;
  background-image: repeating-linear-gradient(
    to right,
    transparent 0px,
    transparent calc(var(--day-w) - 1px),
    rgba(48,54,61,0.65) calc(var(--day-w) - 1px),
    rgba(48,54,61,0.65) var(--day-w)
  );
}

/* Timeline rows */
.timeline-row {
  height: var(--row-h);
  border-bottom: 1px solid var(--border-light);
  position: relative;
  cursor: pointer;
  transition: background 0.1s;
  overflow: visible;
}
.timeline-row:hover      { background: rgba(88,166,255,0.05); }
.timeline-row.even       { background: rgba(255,255,255,0.015); }
.timeline-row.even:hover { background: rgba(88,166,255,0.05); }
.timeline-row.active     { background: var(--accent-dim) !important; }

/* Weekend stripe */
.weekend-stripe {
  position: absolute;
  top: 0; bottom: 0;
  width: var(--day-w);
  background: var(--weekend-bg);
  pointer-events: none;
  z-index: 0;
}

/* Today line */
.today-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--today-color);
  opacity: 0.7;
  pointer-events: none;
  z-index: 3;
}

/* Grid lines */
.grid-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(88,120,160,0.35);
  pointer-events: none;
  z-index: 1;
}

/* Gantt bar */
.gantt-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 30px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  overflow: hidden;
  z-index: 4;
  box-shadow: 0 2px 6px rgba(0,0,0,0.45);
  transition: filter 0.15s, box-shadow 0.15s;
  cursor: pointer;
  min-width: 6px;
}
.gantt-bar:hover {
  filter: brightness(1.18);
  box-shadow: 0 3px 10px rgba(0,0,0,0.5);
}

.bar-label {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  letter-spacing: 0.01em;
}

/* Missing-date bar — striped red, full width */
.gantt-bar-missing {
  opacity: 0.75;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 6px,
    rgba(0,0,0,0.2) 6px,
    rgba(0,0,0,0.2) 12px
  ) !important;
  border: 1px solid rgba(252,165,165,0.4);
}
.gantt-bar-missing:hover { opacity: 0.9; }

/* Milestone carets — sit at the top of the bar, never overlap the label */
.milestone {
  position: absolute;
  top: 3px;
  width: 0;
  height: 0;
  transform: translateX(-5px);
  background: none;
  box-shadow: none;
  border-radius: 0;
  z-index: 5;
  pointer-events: none;
}
.milestone::after {
  content: '▼';
  display: block;
  font-size: 9px;
  line-height: 1;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 4px rgba(0,0,0,0.65);
}

/* ─── OFFICE SECTION HEADER ──────────────────────────────── */
.office-header-row {
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: rgba(30, 40, 58, 0.85);
  border-top: 2px solid rgba(88,166,255,0.35);
  border-bottom: 1px solid rgba(88,166,255,0.2);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: sticky;
  left: 0;
  cursor: pointer;
  user-select: none;
}
.office-header-row:hover { background: rgba(40, 55, 80, 0.95); }

.office-header-timeline {
  height: 54px;
  background: rgba(88,166,255,0.04);
  border-top: 2px solid rgba(88,166,255,0.35);
  border-bottom: 1px solid rgba(88,166,255,0.2);
  flex-shrink: 0;
}

/* Section divider — "Date Range Data Missing" */
.section-header-row {
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: rgba(127,29,29,0.25);
  border-top: 2px solid rgba(248,81,73,0.5);
  border-bottom: 1px solid rgba(248,81,73,0.3);
  font-size: 11px;
  font-weight: 700;
  color: #fca5a5;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  gap: 8px;
  position: sticky;
  left: 0;
  cursor: pointer;
  user-select: none;
}
.section-header-row:hover { background: rgba(160,30,30,0.35); }

.section-header-icon {
  font-size: 13px;
}

.section-chevron {
  display: inline-block;
  margin-right: 7px;
  font-size: 12px;
  transition: transform 0.18s ease;
  line-height: 1;
}
.office-header-row.collapsed  .section-chevron,
.section-header-row.collapsed .section-chevron { transform: rotate(-90deg); }

/* ─── DATE CROSSHAIR & HOVER TOOLTIP ─────────────────────── */
.date-crosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.22);
  pointer-events: none;
  z-index: 12;
  display: none;
}

.date-hover-tip {
  position: fixed;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.section-header-timeline {
  height: 54px;
  background: rgba(127,29,29,0.15);
  border-top: 2px solid rgba(248,81,73,0.5);
  border-bottom: 1px solid rgba(248,81,73,0.3);
  flex-shrink: 0;
}

/* Empty state */
.empty-state {
  padding: 80px 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── DETAIL PANEL ───────────────────────────────────────── */
.detail-panel {
  position: fixed;
  right: 0;
  top: var(--header-h);
  bottom: 0;
  width: 360px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  z-index: 50;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 28px rgba(0,0,0,0.45);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}

.detail-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-top: 5px;
}

.detail-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.detail-close {
  width: 28px; height: 28px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  margin-top: 2px;
}
.detail-close:hover { background: var(--border); color: var(--text); }

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

/* Detail sections */
.detail-section {
  margin-bottom: 20px;
}
.detail-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.detail-item.full { grid-column: 1 / -1; }

.detail-item label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.detail-item span {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
}
.detail-item span.muted { color: var(--text-muted); font-style: italic; }

/* Date row in detail */
.date-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 12px;
}
.date-bar-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.date-bar-label { color: var(--text-muted); flex-shrink: 0; }
.date-bar-value { color: var(--text); font-weight: 600; }
.date-bar-arrow { color: var(--text-dim); font-size: 14px; }

/* ─── LIGHTNING LINK ────────────────────────────────────── */
.lightning-link {
  display: inline-block;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 3px 9px;
  border: 1px solid rgba(88,166,255,0.3);
  border-radius: 5px;
  transition: background 0.15s, border-color 0.15s;
}
.lightning-link:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.card-lightning-link {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.card-lightning-link:hover { opacity: 1; }

/* ─── PROJECT ROW — count pill ──────────────────────────── */
.proj-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px 2px;
  border-radius: 10px;
  background: rgba(35,134,54,0.22);
  color: #3fb950;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ─── PROJECT DETAIL — per-show cards ───────────────────── */
.proj-job-card {
  background: var(--surface2);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.proj-job-card-top {
  display: flex;
}

.proj-job-accent {
  width: 4px;
  flex-shrink: 0;
  border-radius: 0;
}

.proj-job-card-info {
  flex: 1;
  padding: 9px 11px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.proj-job-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
}

.proj-job-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proj-job-dates {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.proj-job-venue {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Financials */
.fin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.fin-row:last-child { border-bottom: none; }
.fin-label { color: var(--text-muted); }
.fin-value { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.fin-row.total .fin-label { color: var(--text); font-weight: 700; }
.fin-row.total .fin-value { color: #3fb950; font-size: 14px; }

/* ─── COMPACT MODE ───────────────────────────────────────── */
.view-toggle-btn {
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.view-toggle-btn:hover       { background: var(--surface2); color: var(--text); }
.view-toggle-btn.active      { background: var(--accent-dim); color: var(--accent); border-color: rgba(88,166,255,0.4); }

/* Compact rows */
body.compact .sidebar-row,
body.compact .timeline-row   { height: var(--row-h-compact, 28px) !important; }

body.compact .gantt-corner,
body.compact .timeline-header-wrap { height: var(--gantt-hdr-h); } /* header unchanged */

body.compact .job-meta       { display: none; }
body.compact .sidebar-top    { display: none; }
body.compact .job-name       { font-size: 11px; font-weight: 600; }
body.compact .sidebar-color-bar { border-radius: 0; }

body.compact .gantt-bar      { height: 18px; }
body.compact .bar-label      { font-size: 10px; }
body.compact .milestone      { top: 2px; }
body.compact .milestone::after { font-size: 7px; }

body.compact .office-header-row,
body.compact .office-header-timeline,
body.compact .section-header-row,
body.compact .section-header-timeline { height: 28px !important; font-size: 10px; }

body.compact .proj-count     { font-size: 9px; padding: 1px 5px; }

/* ─── PAGE TABS (Show Calendar ↔ Heat Map) ───────────────── */
.page-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.page-tab {
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.page-tab:hover  { background: var(--surface2); color: var(--text); }
.page-tab.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(88,166,255,0.3); }

/* ─── MAP CONTAINER ──────────────────────────────────────── */
#map-container {
  flex: 1;
  width: 100%;
  min-height: 0;
  position: relative;
  z-index: 0;
}

/* ─── RESERVE VEHICLE BUTTON ─────────────────────────────── */
.btn-new-reservation {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #0d1117;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.btn-new-reservation:hover { opacity: 0.85; }

/* ─── VEHICLE TIMELINE ───────────────────────────────────── */
/* Date header cells */
.vtl-day-header-cell {
  width: var(--day-w);
  flex-shrink: 0;
  border-right: 1px solid rgba(48,54,61,0.75);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  border-right: 1px solid rgba(48,54,61,0.45);
  user-select: none;
  gap: 1px;
  height: 100%;
}
.vtl-day-header-cell .dow-label  { font-size: 9px; color: var(--text-dim); text-transform: uppercase; }
.vtl-day-header-cell.weekend      { background: var(--weekend-bg); color: var(--text-dim); }
.vtl-day-header-cell.today-header { color: var(--today-color) !important; }
.vtl-day-header-cell.today-header .dow-label { color: var(--today-color) !important; }

/* Office header row (sidebar + timeline) */
.vtl-office-hdr {
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: rgba(22,32,46,0.9);
  border-top: 2px solid;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}
.vtl-office-hdr:not(.vtl-office-hdr-timeline):hover { background: rgba(30,46,70,0.95); }
.vtl-office-hdr.collapsed .section-chevron { transform: rotate(-90deg); }
.vtl-office-hdr-timeline {
  background: rgba(88,166,255,0.03);
  position: relative;
  cursor: default;
}

#vtl-bars-rows {
  background-image: repeating-linear-gradient(
    to right,
    transparent 0px,
    transparent calc(var(--day-w) - 1px),
    rgba(48,54,61,0.65) calc(var(--day-w) - 1px),
    rgba(48,54,61,0.65) var(--day-w)
  );
}

/* Vehicle sidebar row */
.vtl-vehicle-row {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--border-light);
  overflow: hidden;
}
.vtl-vehicle-icon  { font-size: 22px; flex-shrink: 0; line-height: 1; }
.vtl-vehicle-info  { min-width: 0; }
.vtl-vehicle-name  {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vtl-vehicle-sub   {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Vehicle timeline row */
.vtl-timeline-row {
  height: 60px;
  border-bottom: 1px solid var(--border-light);
  position: relative;
  cursor: pointer;
  overflow: visible;
  transition: background 0.1s;
}
.vtl-timeline-row:hover { background: rgba(255,255,255,0.025); }

/* Reservation bars */
.vtl-bar {
  position: absolute;
  top: 11px;
  height: 38px;
  border-radius: 7px;
  border: 1px solid;
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  z-index: 3;
  transition: filter 0.12s, transform 0.12s;
  min-width: 6px;
}
.vtl-bar:hover       { filter: brightness(1.18); transform: scaleY(1.04); }
.vtl-bar-clip-left   { border-radius: 0 7px 7px 0; }
.vtl-bar-clip-right  { border-radius: 7px 0 0 7px; }

.vtl-bar-label {
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Legend in sidebar */
.vtl-legend       { display: flex; flex-direction: column; gap: 7px; }
.vtl-legend-item  { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.vtl-legend-dot   { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* ─── RESERVATION MODAL ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 520px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  box-shadow: 0 28px 70px rgba(0,0,0,0.65);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
  width: 28px; height: 28px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-row-2col {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 12px;
}

.modal-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.modal-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  font-size: 11px;
}

.modal-input, .modal-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  width: 100%;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-input:focus, .modal-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.12);
}
.modal-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237d8590' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}
.modal-select option { background: var(--surface2); color: var(--text); }
.modal-textarea      { resize: vertical; min-height: 72px; }

.modal-dates {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-dates .modal-input { flex: 1; }
.modal-date-arrow { color: var(--text-muted); font-size: 16px; flex-shrink: 0; }

/* Job search dropdown */
.modal-search-wrap       { position: relative; }
.modal-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  z-index: 200;
  max-height: 270px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}
.modal-search-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.modal-search-item:last-child { border-bottom: none; }
.modal-search-item:hover      { background: var(--surface3); }
.modal-search-top   { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.modal-search-name  { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.modal-search-dates { font-size: 11px; color: var(--text-muted); }
.modal-search-office { font-size: 10px; color: var(--text-dim); margin-left: auto; white-space: nowrap; }
.modal-search-msg   { padding: 14px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Linked job card */
.modal-job-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
  position: relative;
}
.modal-job-top      { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.modal-job-name     { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.modal-job-proj     { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.modal-job-dates    { font-size: 11px; color: var(--accent); }
.modal-job-office-tag { font-size: 10px; color: var(--text-dim); margin-left: auto; }
.modal-job-clear {
  position: absolute;
  top: 9px; right: 9px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.modal-job-clear:hover { background: var(--surface3); color: var(--text); }

/* Conflict alert */
.modal-conflict {
  background: rgba(248,81,73,0.1);
  border: 1px solid rgba(248,81,73,0.3);
  border-radius: 8px;
  color: #f85149;
  font-size: 12px;
  line-height: 1.5;
  padding: 9px 12px;
}

/* Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-footer-right  { display: flex; gap: 8px; }
.modal-delete-btn {
  background: transparent;
  border: 1px solid rgba(248,81,73,0.4);
  border-radius: 8px;
  color: #f85149;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.modal-delete-btn:hover { background: rgba(248,81,73,0.1); }
.modal-cancel-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.modal-cancel-btn:hover { background: var(--surface2); color: var(--text); }
.modal-save-btn {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #0d1117;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 20px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.modal-save-btn:hover:not(:disabled)  { opacity: 0.85; }
.modal-save-btn:disabled              { opacity: 0.38; cursor: not-allowed; }
