:root {
  --bg: #07111f;
  --bg-soft: rgba(255,255,255,0.08);
  --panel: rgba(255,255,255,0.10);
  --border: rgba(255,255,255,0.16);
  --text: #f4f7fb;
  --muted: #aac0d9;
  --accent: #79c0ff;
  --accent-2: #9b8cff;
  --success: #6ee7b7;
  --warning: #ffd166;
  --danger: #ff7b92;
  --shadow: 0 24px 70px rgba(0,0,0,0.32);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: 'Inter', system-ui, sans-serif; color: var(--text); background: radial-gradient(circle at top left, #123055, #07111f 40%, #040914 100%); }
body { position: relative; overflow-x: hidden; }
.bg-orb {
  position: fixed; border-radius: 999px; filter: blur(80px); opacity: 0.35; pointer-events: none;
}
.orb-1 { width: 360px; height: 360px; background: #3b82f6; top: -120px; left: -60px; }
.orb-2 { width: 320px; height: 320px; background: #8b5cf6; top: 20%; right: -60px; }
.orb-3 { width: 260px; height: 260px; background: #14b8a6; bottom: 10%; left: 15%; }
.app-shell { max-width: 1600px; margin: 0 auto; padding: 28px; position: relative; z-index: 2; }
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.13), rgba(255,255,255,0.08));
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.glass-soft {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
.hero { border-radius: 28px; padding: 28px; display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 22px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.18em; color: var(--accent); font-size: 12px; margin: 0 0 8px; }
.hero h1 { margin: 0; font-size: clamp(28px, 4vw, 46px); }
.hero-sub { margin: 10px 0 0; max-width: 900px; color: var(--muted); line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { padding: 12px 16px; border-radius: 14px; text-decoration: none; color: var(--text); border: 1px solid rgba(255,255,255,0.18); font-weight: 700; cursor: pointer; background: transparent; }
.btn-primary { background: linear-gradient(135deg, rgba(121,192,255,0.35), rgba(155,140,255,0.35)); }
.btn-secondary { background: rgba(255,255,255,0.08); }
.kpi-grid { display: grid; gap: 16px; margin-bottom: 22px; }
.kpi-grid-extended { grid-template-columns: repeat(9, 1fr); }
.kpi { border-radius: 24px; padding: 18px; min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; }
.kpi span { color: var(--muted); font-size: 14px; }
.kpi strong { font-size: 38px; line-height: 1; margin: 10px 0; }
.kpi small { color: #d1deeb; opacity: 0.8; }
.layout-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.top-grid { grid-template-columns: 1.05fr 1.95fr; }
.charts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bottom-grid { grid-template-columns: 1fr 1fr; }
.schedule-grid { grid-template-columns: 1.35fr 1fr; }
.workforce-charts-grid { margin-top: 18px; }
.workforce-tables-grid { margin-top: 18px; }
.panel { border-radius: 28px; padding: 20px; }
.wide-panel { min-height: 360px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-header h2 { margin: 0; font-size: 20px; }
.badge, .muted { color: var(--muted); font-size: 13px; }
.alerts-list { display: flex; flex-direction: column; gap: 12px; max-height: 420px; overflow: auto; }
.alert-item { padding: 14px; border-radius: 18px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); }
.alert-item strong { display: block; margin-bottom: 6px; }
.alert-item.warning { border-color: rgba(255,209,102,0.45); }
.alert-item.danger { border-color: rgba(255,123,146,0.45); }
.alert-item.info { border-color: rgba(121,192,255,0.45); }
.table-wrap { overflow: auto; }
.table-wrap.tall { max-height: 420px; }
.table-wrap.xl-tall { max-height: 720px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 14px; vertical-align: top; }
thead th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: rgba(7,17,31,0.88); backdrop-filter: blur(8px); z-index: 2; }
.status-pill, .ob-pill, .mini-pill { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-done { background: rgba(110,231,183,0.18); color: #b6f5da; }
.status-upcoming { background: rgba(121,192,255,0.18); color: #c6e3ff; }
.status-missing { background: rgba(255,123,146,0.18); color: #ffcada; }
.ob-pill { background: rgba(155,140,255,0.18); color: #ddd6ff; }
.mini-pill { background: rgba(255,255,255,0.08); color: #dce9f7; margin: 4px 6px 0 0; }
.mini-pill-wrap { margin-top: 10px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.summary-card { padding: 16px; border-radius: 20px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); }
.summary-card h3 { margin: 0 0 8px; font-size: 16px; }
.summary-card strong { font-size: 34px; display: block; margin-bottom: 6px; }
.footer-bar { padding: 14px 18px; border-radius: 20px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; margin-top: 18px; }
.empty-state { color: var(--muted); padding: 12px; }

.scroll-area, .alerts-list, .table-wrap, .timeline-wrap {
  scrollbar-gutter: stable both-edges;
  scrollbar-width: auto;
  scrollbar-color: rgba(121,192,255,0.7) rgba(255,255,255,0.08);
}
.scroll-area::-webkit-scrollbar,
.alerts-list::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.timeline-wrap::-webkit-scrollbar {
  width: 14px;
  height: 14px;
  -webkit-appearance: none;
}
.scroll-area::-webkit-scrollbar-thumb,
.alerts-list::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.timeline-wrap::-webkit-scrollbar-thumb {
  background: rgba(121,192,255,0.7);
  border-radius: 999px;
  border: 3px solid rgba(7,17,31,0.88);
}
.scroll-area::-webkit-scrollbar-track,
.alerts-list::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.timeline-wrap::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
}
.scroll-area::-webkit-scrollbar-corner,
.alerts-list::-webkit-scrollbar-corner,
.table-wrap::-webkit-scrollbar-corner,
.timeline-wrap::-webkit-scrollbar-corner {
  background: transparent;
}
canvas { width: 100% !important; height: 320px !important; }
.tabs-bar {
  display: inline-flex;
  gap: 10px;
  padding: 10px;
  border-radius: 22px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tab-btn {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
}
.tab-btn.active {
  background: linear-gradient(135deg, rgba(121,192,255,0.28), rgba(155,140,255,0.28));
  border-color: rgba(121,192,255,0.4);
}
.dashboard-tab { display: none; }
.dashboard-tab.active { display: block; }
.timeline-wrap {
  display: flex;
  flex-direction: row;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 6px 16px;
  margin: 0 -6px;
  scroll-snap-type: x proximity;
}
.timeline-day {
  border-radius: 24px;
  padding: 18px;
  min-width: 440px;
  max-width: 520px;
  flex: 0 0 460px;
  scroll-snap-align: start;
}
.timeline-day-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.timeline-day-header h3 { margin: 0; font-size: 18px; }
.timeline-day-header span { color: var(--muted); font-size: 13px; }
.timeline-items { display: flex; flex-direction: column; gap: 12px; }
.timeline-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
.timeline-item-missing { border-color: rgba(255,123,146,0.4); }
.timeline-time { color: var(--accent); font-weight: 800; font-size: 14px; }
.timeline-content { min-width: 0; }
.timeline-topline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.timeline-sub { color: var(--muted); line-height: 1.5; margin-bottom: 8px; }
.timeline-team { line-height: 1.5; }
.text-danger { color: #ffcada; }
@media (max-width: 1480px) {
  .kpi-grid-extended { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1280px) {
  .top-grid, .bottom-grid, .charts-grid, .schedule-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { padding: 16px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .kpi-grid-extended { grid-template-columns: repeat(2, 1fr); }
  .footer-bar { flex-direction: column; }
  .timeline-wrap { flex-direction: column; overflow-x: visible; }
  .timeline-day { min-width: 100%; max-width: 100%; flex-basis: auto; }
  .timeline-item { grid-template-columns: 1fr; }
  .tabs-bar { display: flex; }
}


/* Adaptive schedule layout fixes */
.schedule-grid-fixed {
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
  align-items: start;
}
.schedule-timeline-panel,
.coverage-panel {
  min-width: 0;
  width: 100%;
  overflow: hidden;
}
.schedule-timeline-panel .panel-header,
.coverage-panel .panel-header {
  min-width: 0;
}
.timeline-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 18px;
  margin: 0;
}
.timeline-day {
  min-width: clamp(280px, 28vw, 420px);
  max-width: clamp(280px, 28vw, 420px);
  flex: 0 0 clamp(280px, 28vw, 420px);
}
.coverage-panel .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
}
.coverage-panel table {
  min-width: 760px;
}
@media (max-width: 1280px) {
  .schedule-grid-fixed {
    grid-template-columns: 1fr;
  }
  .timeline-day {
    min-width: min(360px, 82vw);
    max-width: min(360px, 82vw);
    flex-basis: min(360px, 82vw);
  }
}
@media (max-width: 760px) {
  .schedule-grid-fixed {
    grid-template-columns: 1fr;
  }
  .timeline-wrap {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 18px;
  }
  .timeline-day {
    min-width: 85vw;
    max-width: 85vw;
    flex: 0 0 85vw;
  }
}


.chart-scroll-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px;
}
.chart-scroll-inner {
  min-width: 100%;
  height: 320px;
}
.chart-scroll-wrap canvas {
  height: 320px !important;
}

.filters-panel { margin-bottom: 18px; }
.filters-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}
.filter-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.filter-field span { color: var(--muted); font-size: 13px; }
.filter-field select,
.filter-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.filter-actions { display: flex; align-items: end; }
.chart-scroll-wrap { overflow-x: auto; overflow-y: hidden; padding-bottom: 10px; }
.chart-scroll-inner { min-width: 100%; }
.heatmap-wrap {
  overflow: auto;
  max-width: 100%;
  padding-bottom: 10px;
}
.heatmap-grid {
  display: grid;
  gap: 8px;
  min-width: max-content;
}
.heatmap-header,
.heatmap-row {
  display: grid;
  grid-template-columns: 170px repeat(var(--heatmap-cols), 44px);
  gap: 8px;
  align-items: center;
}
.heatmap-label {
  position: sticky;
  left: 0;
  z-index: 1;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(7,17,31,0.9);
  font-size: 13px;
  white-space: nowrap;
}
.heatmap-day-label {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.heatmap-cell {
  width: 44px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.heatmap-cell.level-0 { background: rgba(255,255,255,0.04); color: var(--muted); }
.heatmap-cell.level-1 { background: rgba(110,231,183,0.16); color: #cff8e8; }
.heatmap-cell.level-2 { background: rgba(121,192,255,0.18); color: #d7ecff; }
.heatmap-cell.level-3 { background: rgba(255,209,102,0.22); color: #ffeeb8; }
.heatmap-cell.level-4 { background: rgba(255,123,146,0.24); color: #ffd6e0; }
.heatmap-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.heatmap-legend .mini-pill { margin: 0; }
@media (max-width: 1280px) {
  .filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


.panel { display: flex; flex-direction: column; }
.panel > .table-wrap,
.panel > .chart-scroll-wrap,
.panel > .heatmap-wrap,
.panel > #scheduleTimeline { flex: 1 1 auto; min-height: 0; }

.filter-field select,
.filter-field input,
.filter-field select option {
  background: #122034;
  color: #eef6ff;
}
.filter-field select option { color: #eef6ff; }
.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: rgba(121,192,255,0.5);
  box-shadow: 0 0 0 3px rgba(121,192,255,0.16);
}

.table-wrap-wide {
  width: 100%;
  max-width: 100%;
  overflow: auto;
}
.table-wrap-wide table {
  min-width: 720px;
}
#projectSummaryTable { min-width: 100%; }

.chart-scroll-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px;
  scrollbar-gutter: stable both-edges;
}
.chart-scroll-inner {
  min-width: 100%;
  height: 320px;
}
.chart-scroll-inner canvas {
  display: block;
  width: 100% !important;
  height: 320px !important;
}

.chart-scroll-wrap,
.heatmap-wrap,
.table-wrap-wide {
  scrollbar-gutter: stable both-edges;
  scrollbar-width: auto;
  scrollbar-color: rgba(121,192,255,0.7) rgba(255,255,255,0.08);
}
.chart-scroll-wrap::-webkit-scrollbar,
.heatmap-wrap::-webkit-scrollbar,
.table-wrap-wide::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}
.chart-scroll-wrap::-webkit-scrollbar-thumb,
.heatmap-wrap::-webkit-scrollbar-thumb,
.table-wrap-wide::-webkit-scrollbar-thumb {
  background: rgba(121,192,255,0.7);
  border-radius: 999px;
  border: 3px solid rgba(7,17,31,0.88);
}
.chart-scroll-wrap::-webkit-scrollbar-track,
.heatmap-wrap::-webkit-scrollbar-track,
.table-wrap-wide::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
}

.schedule-grid-fixed {
  align-items: start;
}
.schedule-timeline-panel,
.coverage-panel {
  height: 100%;
}
.coverage-panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}
.coverage-panel table {
  min-width: 760px;
}

@media (max-width: 1280px) {
  .schedule-grid-fixed {
    grid-template-columns: 1fr;
  }
  .coverage-panel,
  .schedule-timeline-panel {
    height: auto;
  }
}


.planning-grid { margin-top: 18px; }
.availability-wrap .heatmap-grid {
  min-width: max-content;
}
.availability-wrap .heatmap-header,
.availability-wrap .heatmap-row {
  grid-template-columns: 170px repeat(var(--heatmap-cols), 72px);
}
.availability-wrap .heatmap-day-label {
  white-space: nowrap;
  font-size: 11px;
}
.availability-cell {
  width: 72px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
}
.availability-free { background: rgba(255,255,255,0.04); color: var(--muted); }
.availability-working { background: rgba(110,231,183,0.18); color: #d8ffef; }
.availability-busy { background: rgba(255,209,102,0.24); color: #ffeeb8; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 9, 20, 0.72);
  backdrop-filter: blur(10px);
}
.login-screen.hidden { display: none; }
.login-card {
  width: min(480px, 100%);
  border-radius: 28px;
  padding: 28px;
}
.login-card h2 { margin: 0 0 8px; font-size: 34px; }
.login-sub { margin: 0 0 18px; color: var(--muted); }
.login-form { display: grid; gap: 14px; }
.login-btn { width: 100%; margin-top: 6px; }
.login-error { min-height: 20px; color: #ffcada; font-size: 14px; }
.filter-field input, .filter-field select {
  width: 100%;
  background: rgba(5,16,35,0.95);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px 14px;
  outline: none;
}
.filter-field span {
  display: block;
  margin: 0 0 8px;
  color: #d3dfec;
  font-size: 14px;
  font-weight: 600;
}
.admin-grid { grid-template-columns: 1fr 1fr; }
.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.admin-submit { width: 100%; }
.admin-subtitle { margin: 0 0 10px; font-size: 16px; }
.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.permission-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}
.permission-grid-boxes { max-height: 320px; overflow: auto; padding-right: 6px; }
.hidden-by-role { display: none !important; }
.admin-only.hidden-by-role { display: none !important; }
.action-btn {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}
.action-btn + .action-btn { margin-left: 8px; }
@media (max-width: 1280px) {
  .admin-grid { grid-template-columns: 1fr; }
}

.admin-action-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.danger-btn {
  border-color: rgba(255, 90, 90, 0.35);
  color: #ffd3d3;
}
.admin-full-span {
  grid-column: 1 / -1;
}

.hero {
  align-items: flex-start;
}
.hero-actions {
  align-items: center;
  justify-content: flex-end;
}
.user-badge {
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.07);
  font-weight: 700;
  white-space: nowrap;
}
.schedule-stack-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}
.coverage-wrap {
  max-height: 520px;
}
#projectCrewMatrix,
.team-schedule-table {
  min-width: 980px;
}
#projectCrewMatrix,
#availabilityPlanner {
  width: 100%;
}
#availabilityPlanner {
  overflow: auto;
  max-height: 620px;
}
.calendar-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.calendar-month-label {
  font-size: 24px;
  font-weight: 800;
}
.calendar-shell {
  overflow: auto;
}
.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  min-width: 980px;
}
.calendar-weekdays div {
  padding: 12px;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.calendar-cell {
  min-height: 180px;
  border-right: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.calendar-cell-muted {
  opacity: 0.4;
}
.calendar-date {
  font-weight: 800;
  font-size: 16px;
}
.calendar-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.calendar-event {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(121,192,255,0.14);
  border: 1px solid rgba(121,192,255,0.22);
  font-size: 12px;
  line-height: 1.45;
}
.calendar-event span {
  color: var(--muted);
}
.calendar-more {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.todo-grid {
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
}
.month-input {
  min-width: 170px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.team-schedule-wrap {
  overflow: auto;
  max-height: 70vh;
}
.team-schedule-table {
  border-collapse: separate;
  border-spacing: 0;
}
.team-schedule-table th,
.team-schedule-table td {
  min-width: 44px;
  text-align: center;
  padding: 8px;
}
.sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: rgba(7,17,31,0.95);
  text-align: left !important;
  min-width: 180px !important;
}
.team-schedule-cell {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  cursor: pointer;
}
.team-schedule-cell:focus {
  outline: 2px solid rgba(121,192,255,0.65);
  outline-offset: 1px;
}
.team-schedule-cell.team-assigned {
  background: rgba(110,231,183,0.9);
  border-color: rgba(110,231,183,1);
}
.team-schedule-cell.team-off {
  background: rgba(255,123,146,0.9);
  border-color: rgba(255,123,146,1);
}
.table-wrap-wide,
.team-schedule-wrap,
.calendar-shell {
  scrollbar-gutter: stable both-edges;
}
@media (max-width: 1600px) {
  .kpi-grid-extended { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1180px) {
  .todo-grid,
  .bottom-grid,
  .charts-grid,
  .top-grid { grid-template-columns: 1fr; }
  .hero-actions {
    justify-content: flex-start;
  }
}
@media (max-width: 820px) {
  .app-shell { padding: 14px; }
  .hero { padding: 20px; }
  .hero h1 { font-size: clamp(24px, 6vw, 38px); }
  .kpi-grid-extended { grid-template-columns: repeat(2, 1fr); }
  .calendar-weekdays,
  .calendar-grid { min-width: 840px; }
  .sticky-col { min-width: 140px !important; }
}
@media (max-width: 520px) {
  .kpi-grid-extended { grid-template-columns: 1fr; }
  .user-badge { width: 100%; }
  .hero-actions { width: 100%; }
  .btn { width: 100%; }
  .calendar-toolbar { align-items: start; }
}

/* --- v3 layout + UX refinements --- */
.app-shell { max-width: 1720px; padding: 24px; }
.layout-grid { gap: 20px; }
.panel { min-width: 0; }
.hero-actions { row-gap: 10px; }
.user-badge { min-width: 220px; text-align: center; }
.charts-grid, .bottom-grid, .workforce-tables-grid, .planning-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.compact-chart-panel .chart-scroll-inner,
.compact-chart-panel .chart-scroll-inner canvas,
.compact-chart-panel canvas { height: 230px !important; }
.chart-scroll-inner { height: 260px; }
.chart-scroll-inner canvas, canvas { height: 260px !important; }
.wide-panel .chart-scroll-inner, .wide-panel .chart-scroll-inner canvas, .wide-panel canvas { height: 280px !important; }
.wide-panel { min-height: 320px; }
.schedule-stack-grid { grid-template-columns: 1fr; }
.schedule-timeline-panel { max-height: 820px; }
.timeline-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  max-height: 680px;
  overflow: auto;
  padding: 4px 2px 14px;
  margin: 0;
  scroll-snap-type: none;
}
.timeline-day { min-width: 0; max-width: none; flex: none; }
.timeline-items { gap: 14px; }
.coverage-panel .panel-header { align-items: center; }
.rows-control {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.rows-control select {
  background: rgba(5,16,35,0.95); color: var(--text);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 8px 12px;
}
.coverage-wrap { max-height: 640px; }
.coverage-wrap table { min-width: 1080px; }
.todo-grid { grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.3fr); align-items: start; }
.todo-form-panel, .todo-list-panel { min-height: 560px; }
.todo-list-shell { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.todo-list-head, .todo-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) 130px 110px 120px minmax(140px, 1.2fr) 120px;
  gap: 14px; align-items: center;
}
.todo-list-head {
  color: var(--muted); font-size: 12px; font-weight: 700;
  padding: 0 14px; text-transform: uppercase; letter-spacing: 0.05em;
}
.todo-list-body { display: flex; flex-direction: column; gap: 12px; max-height: 620px; overflow: auto; padding-right: 4px; }
.todo-row { padding: 14px; border-radius: 20px; background: rgba(255,255,255,0.06); border-left: 4px solid rgba(121,192,255,0.65); }
.todo-row-done { border-left-color: rgba(110,231,183,0.9); }
.todo-row-delayed { border-left-color: rgba(255,123,146,0.9); }
.todo-task-col strong { font-size: 15px; }
.todo-person, .todo-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 700;
}
.todo-person { background: rgba(155,140,255,0.18); color: #e5e0ff; }
.todo-badge-pending { background: rgba(255,209,102,0.22); color: #ffe9ae; }
.todo-badge-done { background: rgba(110,231,183,0.2); color: #cef8e7; }
.todo-badge-delayed { background: rgba(255,123,146,0.18); color: #ffd1db; }
.todo-notes-col, .todo-deadline-col, .todo-assignee-col, .todo-status-col { font-size: 13px; color: #dbe7f3; }
.todo-actions-col .action-stack { justify-content: flex-end; }
.team-schedule-wrap { max-height: 72vh; }
.team-schedule-table { min-width: 1220px; }
.team-schedule-table th, .team-schedule-table td { min-width: 48px; }
.team-schedule-cell { width: 24px; height: 24px; transition: transform 0.12s ease, background 0.18s ease; }
.team-schedule-cell:hover { transform: translateY(-1px); }
.availability-panel, .availability-panel .heatmap-wrap, #availabilityPlanner {
  min-width: 0; width: 100%; max-width: 100%; overflow: auto !important; padding-bottom: 14px;
}
.availability-panel .heatmap-grid { min-width: max-content; }
#projectCrewMatrix { min-width: 1120px; }
.planning-grid > .panel, .workforce-tables-grid > .panel, .charts-grid > .panel { min-width: 0; }
@media (max-width: 1180px) {
  .charts-grid, .bottom-grid, .workforce-tables-grid, .planning-grid, .todo-grid, .top-grid { grid-template-columns: 1fr; }
  .timeline-wrap { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .todo-list-head, .todo-row { grid-template-columns: 1.8fr 120px 100px 110px 1fr 110px; }
}
@media (max-width: 820px) {
  .app-shell { padding: 14px; }
  .todo-list-head { display: none; }
  .todo-row { grid-template-columns: 1fr; gap: 10px; }
  .todo-actions-col .action-stack { justify-content: flex-start; }
  .timeline-wrap { max-height: 620px; }
}


/* --- v4 targeted layout + interaction fixes --- */
.layout-grid { gap: 16px; }
.charts-grid, .bottom-grid, .workforce-tables-grid, .planning-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.workforce-charts-grid > .wide-panel:first-child { grid-column: 1 / 2; }
.workforce-charts-grid > .compact-chart-panel { min-height: 250px; }
.compact-chart-panel, .planning-grid > .panel, .workforce-tables-grid > .panel { align-self: start; }
.compact-chart-panel .chart-scroll-wrap,
.compact-chart-panel .chart-scroll-inner,
.compact-chart-panel canvas { min-height: 210px !important; height: 210px !important; }
#projectResourceBalanceChartWrap, #projectManDaysChartWrap, #employeeDaysChartWrap { height: 210px !important; }
.schedule-timeline-panel { min-height: 0; }
.timeline-wrap {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 14px;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  max-height: none;
  padding-bottom: 14px;
  align-items: start;
}
.timeline-day {
  flex: 0 0 300px;
  width: 300px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
}
.timeline-items {
  overflow-y: auto;
  overflow-x: visible;
  max-height: 520px;
  padding-right: 6px;
}
.timeline-item { position: relative; overflow: visible; }
.timeline-hover-target { position: relative; }
.crew-hover-card {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  min-width: 240px;
  max-width: 340px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 17, 24, 0.96);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 18px 50px rgba(0,0,0,0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  z-index: 30;
}
.timeline-hover-target:hover .crew-hover-card,
.timeline-hover-target:focus-within .crew-hover-card {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.crew-hover-title {
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 10px;
}
.calendar-cell { min-height: 190px; }
.calendar-event { position: relative; cursor: default; overflow: visible; }
.calendar-event .crew-hover-card { left: 12px; top: calc(100% + 6px); transform: translateX(0) translateY(4px); }
.calendar-event:hover .crew-hover-card { transform: translateX(0) translateY(0); }
.todo-inline-panel { min-height: 0; }
.todo-inline-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.todo-inline-wrap { max-height: 720px; }
.todo-inline-table { min-width: 1120px; }
.todo-inline-row td { vertical-align: middle; }
.todo-inline-input {
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 9px 12px;
}
.todo-inline-actions { justify-content: flex-start; }
.empty-state-cell {
  padding: 28px 20px;
  color: var(--muted);
  text-align: center;
}
#projectCrewMatrix, .team-schedule-table, #availabilityPlanner, .availability-panel .heatmap-grid { min-width: max-content; }
.table-wrap { overflow: auto !important; }
.availability-panel .heatmap-wrap { overflow: auto !important; }
@media (max-width: 1180px) {
  .charts-grid, .bottom-grid, .workforce-tables-grid, .planning-grid { grid-template-columns: 1fr; }
  .timeline-day { flex-basis: 280px; min-width: 280px; width: 280px; }
}
@media (max-width: 820px) {
  .todo-inline-toolbar { align-items: start; }
  .todo-inline-toolbar .btn { width: 100%; }
}


/* Sidebar navigation upgrade */
.app-shell {
  max-width: none;
  margin: 0;
  padding: 28px 28px 28px 236px;
}
.ops-sidebar {
  position: fixed;
  top: 8px;
  left: 8px;
  bottom: 8px;
  width: 200px;
  border-radius: 30px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 20;
}
.ops-sidebar-brand { padding: 2px 6px 0; }
.ops-sidebar-title { font-size: 15px; font-weight: 800; letter-spacing: .01em; }
.ops-sidebar-subtitle, .ops-sidebar-footer { color: var(--muted); font-size: 12px; }
.ops-sidebar-nav { display: flex; flex-direction: column; gap: 10px; }
.nav-tab-btn {
  width: 100%;
  text-align: left;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.nav-tab-btn:hover {
  transform: translateX(3px);
  background: rgba(255,255,255,0.07);
  border-color: rgba(121,192,255,0.24);
}
.nav-tab-btn.active {
  background: linear-gradient(135deg, rgba(121,192,255,0.24), rgba(155,140,255,0.24));
  border-color: rgba(121,192,255,0.4);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05), 0 10px 30px rgba(0,0,0,0.18);
}
.ops-sidebar-footer { margin-top: auto; padding: 0 6px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 16px; }
.tabs-bar { display:none !important; }
.todo-inline-panel .panel-header { align-items: flex-start; }
.todo-inline-wrap { max-height: none; }
.empty-state-cell { color: var(--muted); text-align:center; padding: 28px 16px; }
@media (max-width: 1100px) {
  .app-shell { padding: 18px; }
  .ops-sidebar { position: static; width: 100%; height: auto; margin-bottom: 18px; }
  .ops-sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-tab-btn { width: auto; }
}


/* --- v5 auth + layout polish --- */
body.auth-required .app-shell { filter: blur(8px); pointer-events: none; user-select: none; }
#signInBtn.hidden, #logoutBtn.hidden, #userIdentity.hidden { display:none !important; }
.coverage-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-left:auto; }
.schedule-timeline-panel { min-height: 1080px; }
.timeline-wrap { padding-bottom: 18px; }
.timeline-day { flex: 0 0 318px; width: 318px; min-width: 318px; }
.timeline-items { max-height: 780px; }
.coverage-wrap { max-height: 560px; }
.workforce-charts-grid { grid-template-columns: 1.18fr 0.82fr; align-items: start; }
.workforce-charts-grid > .wide-panel:first-child { min-height: 520px; }
#workloadHeatmap { max-height: 430px; }
.workforce-charts-grid > .compact-chart-panel { min-height: 280px; }
.workforce-tables-grid > .panel { min-height: 420px; }
.planning-grid > .panel { min-height: 320px; }
.hero-actions { align-items:center; }
@media (max-width: 1180px) { .workforce-charts-grid { grid-template-columns: 1fr; } .schedule-timeline-panel { min-height: auto; } .timeline-items { max-height: 620px; } }


/* --- v7 workforce adaptive layout + export actions --- */
.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}
.panel-actions .muted { margin-right: 4px; }

#tab-workforce .panel-header { align-items: center; gap: 10px; }
#tab-workforce .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
#tab-workforce .summary-card { min-height: 86px; }

.workforce-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px;
  align-items: start;
}
.workforce-charts-grid > .panel {
  min-height: 0 !important;
  height: auto;
  align-self: start;
  padding-bottom: 14px;
}
.workforce-charts-grid > .wide-panel:first-child {
  grid-column: auto;
  grid-row: auto;
  min-height: 0 !important;
}
.workforce-charts-grid > .compact-chart-panel:nth-child(2),
.workforce-charts-grid > .compact-chart-panel:nth-child(3),
.workforce-charts-grid > .compact-chart-panel:nth-child(4),
.workforce-charts-grid > .compact-chart-panel:nth-child(5),
.workforce-charts-grid > .compact-chart-panel:nth-child(6) {
  grid-column: auto;
}

#workloadHeatmap {
  max-height: 420px !important;
  min-height: 0;
  padding-right: 4px;
}
.workforce-charts-grid .chart-scroll-inner,
.workforce-charts-grid .chart-scroll-inner canvas,
.workforce-charts-grid canvas {
  height: 220px !important;
}
.workforce-charts-grid > .wide-panel:first-child .heatmap-wrap {
  min-height: 420px;
}
.workforce-charts-grid > .wide-panel:first-child,
.workforce-charts-grid > .compact-chart-panel:nth-child(2) {
  min-height: 320px;
}
.workforce-tables-grid,
.planning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.workforce-tables-grid > .panel,
.planning-grid > .panel {
  min-height: 0 !important;
  padding-bottom: 14px;
}
.workforce-tables-grid > .panel .table-wrap { max-height: 360px; }
.planning-grid > .availability-panel { min-height: 0 !important; }
.availability-panel .heatmap-wrap { max-height: 350px; }
#availabilityPlanner { max-height: 320px; }

.schedule-timeline-panel { min-height: 1180px; }
.timeline-items { max-height: 860px; }
.coverage-wrap { max-height: 600px; }

@media (max-width: 1400px) {
  .workforce-charts-grid,
  .workforce-tables-grid,
  .planning-grid {
    grid-template-columns: 1fr !important;
  }
  #workloadHeatmap,
  .workforce-charts-grid > .wide-panel:first-child .heatmap-wrap {
    max-height: 460px !important;
    min-height: 0;
  }
}
@media (max-width: 900px) {
  #tab-workforce .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-actions { width: 100%; margin-left: 0; }
}
@media (max-width: 640px) {
  #tab-workforce .summary-grid { grid-template-columns: 1fr; }
}


.dark-mode-toggle { display:inline-flex; align-items:center; gap:8px; padding:10px 12px; border-radius:12px; background:rgba(255,255,255,0.08); color:inherit; }
.dark-mode-toggle input { accent-color:#6ea8ff; }
.quick-actions { position: fixed; right: 22px; bottom: 22px; z-index: 30; display:flex; flex-direction:column; gap:10px; padding:14px; width: 220px; }
.quick-actions-title { font-weight: 700; font-size: 14px; opacity: 0.9; }
.summary-grid-compact { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.compact-filters { margin-bottom: 16px; }
.incident-form-grid { margin-bottom: 18px; }
.status-pill { display:inline-flex; align-items:center; justify-content:center; min-width:72px; padding:4px 10px; border-radius:999px; font-size:12px; font-weight:700; text-transform:capitalize; }
.status-low { background: rgba(100, 181, 246, 0.18); }
.status-medium { background: rgba(255, 213, 79, 0.18); }
.status-high { background: rgba(255, 138, 101, 0.18); }
.status-critical { background: rgba(239, 83, 80, 0.22); }
.theme-dark { background: #07111f; color: #e8edf7; }
.theme-dark .glass, .theme-dark .panel, .theme-dark .hero, .theme-dark .ops-sidebar, .theme-dark .kpi, .theme-dark .footer-bar, .theme-dark .login-card { background: rgba(9, 17, 31, 0.88) !important; color: #e8edf7; border-color: rgba(255,255,255,0.08) !important; }
.theme-dark table th, .theme-dark table td, .theme-dark .muted, .theme-dark .hero-sub, .theme-dark .ops-sidebar-subtitle, .theme-dark .ops-sidebar-footer { color: #d9e2f2; }
.theme-dark input, .theme-dark select, .theme-dark textarea { background: rgba(255,255,255,0.05); color:#fff; border-color: rgba(255,255,255,0.12); }
.theme-dark .btn.btn-secondary { background: rgba(255,255,255,0.08); }
@media (max-width: 1100px) { .quick-actions { position: static; width: 100%; margin: 20px 0; } }


/* Admin tables and logs readability */
#incidentTableBody td,
#obDeploymentTableBody td,
#systemLogBody td,
#activityLogsBody td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#incidentTableBody td:nth-child(5),
#obDeploymentTableBody td:nth-child(6),
#systemLogBody td:nth-child(5),
#activityLogsBody td:nth-child(5) {
  min-width: 220px;
}

#adminAnalyticsCards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}


.reporting-grid {
  grid-template-columns: 1fr;
  gap: 16px;
}
#tab-reporting .panel {
  min-width: 0;
}
#tab-reporting .table-wrap {
  max-height: 360px;
}


.overview-only.hidden-overview { display:none !important; }
.employee-days-panel { min-height: 420px !important; }
.employee-days-panel .chart-scroll-wrap { min-height: 300px; }
.employee-days-panel .chart-scroll-inner,
.employee-days-panel .chart-scroll-inner canvas,
.employee-days-panel canvas { height: 300px !important; }
.single-panel-grid { grid-template-columns: 1fr !important; }
.full-span-panel { width: 100%; }
#tab-availability .availability-month-panel { min-height: 0; }
#tab-availability #availabilityPlanner { max-height: 72vh; overflow: auto; }
.availability-month-grid { min-width: max-content; }
.availability-month-grid .heatmap-header,
.availability-month-grid .heatmap-row { min-width: max-content; }
.availability-month-grid .heatmap-day-label,
.availability-month-grid .availability-cell { min-width: 42px; }
.availability-month-wrap { padding-right: 4px; }

/* --- adaptive zoom + spacing hotfix (March 2026) --- */
html {
  overflow-x: auto;
  overflow-y: auto;
}
body {
  overflow-x: auto;
  min-width: 320px;
}

:root {
  --sidebar-width: clamp(190px, 16vw, 228px);
  --page-gap: clamp(14px, 1.3vw, 24px);
  --panel-radius: 24px;
}

.app-shell {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: var(--page-gap) var(--page-gap) var(--page-gap) calc(var(--sidebar-width) + (var(--page-gap) * 1.5));
}

.hero,
.panel,
.kpi,
.login-card,
.ops-sidebar,
.footer-bar {
  border-radius: var(--panel-radius);
}

.hero,
.layout-grid,
.kpi-grid,
.filters-panel,
.dashboard-tab,
.overview-only,
.panel,
.summary-grid,
.todo-list-shell,
.team-schedule-wrap,
.calendar-shell,
.heatmap-wrap,
.chart-scroll-wrap,
.table-wrap,
.timeline-wrap {
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, auto);
  align-items: start;
  gap: var(--page-gap);
}
.hero > div {
  min-width: 0;
}
.hero-actions {
  width: 100%;
  justify-content: flex-end;
  gap: 10px;
}
.hero-actions > * {
  flex-shrink: 1;
}
.user-badge {
  min-width: min(220px, 100%);
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.kpi-grid,
.kpi-grid-extended {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.kpi {
  min-width: 0;
  min-height: 124px;
}
.kpi strong {
  font-size: clamp(28px, 2.4vw, 38px);
}

.layout-grid,
.top-grid,
.charts-grid,
.bottom-grid,
.schedule-grid,
.schedule-grid-fixed,
.workforce-charts-grid,
.workforce-tables-grid,
.planning-grid,
.todo-grid,
.reporting-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--page-gap);
  align-items: start;
}

.wide-panel,
.full-span-panel,
.admin-full-span {
  grid-column: 1 / -1;
}

.panel {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: clamp(16px, 1.4vw, 20px);
}
.panel-header,
.todo-inline-toolbar,
.calendar-toolbar,
.coverage-toolbar {
  flex-wrap: wrap;
}
.panel-header h2,
.hero h1,
.ops-sidebar-title,
.summary-card h3,
.todo-task-col strong {
  overflow-wrap: anywhere;
}

.table-wrap,
.table-wrap-wide,
.coverage-wrap,
.team-schedule-wrap,
.calendar-shell,
.chart-scroll-wrap,
.heatmap-wrap,
.timeline-wrap,
.todo-list-body,
.alerts-list {
  width: 100%;
  max-width: 100%;
  overflow: auto;
}
.table-wrap table,
.table-wrap-wide table,
.coverage-wrap table,
.calendar-weekdays,
.calendar-grid,
#projectCrewMatrix,
.team-schedule-table,
#availabilityPlanner,
.availability-panel .heatmap-grid {
  min-width: max-content;
}

.chart-scroll-inner,
.chart-scroll-inner canvas,
canvas {
  min-width: 0;
}

.timeline-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  align-items: start;
  max-height: none;
}
.timeline-day {
  width: 100%;
  min-width: 0;
  max-width: none;
  flex: initial;
}
.timeline-items {
  max-height: none;
}
.timeline-item {
  grid-template-columns: minmax(82px, 96px) minmax(0, 1fr);
}

.todo-list-head,
.todo-row {
  grid-template-columns: minmax(220px, 2.2fr) 120px 110px 120px minmax(150px, 1.2fr) 110px;
}

.ops-sidebar {
  width: var(--sidebar-width);
  left: var(--page-gap);
  top: var(--page-gap);
  bottom: var(--page-gap);
  min-width: 0;
  overflow: hidden auto;
}
.ops-sidebar-nav {
  min-width: 0;
}
.nav-tab-btn {
  overflow-wrap: anywhere;
}

@media (max-width: 1400px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 1200px) {
  .app-shell {
    padding: var(--page-gap);
  }
  .ops-sidebar {
    position: static;
    width: 100%;
    max-height: none;
    margin-bottom: var(--page-gap);
  }
  .ops-sidebar-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  .nav-tab-btn {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .filters-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .todo-list-head,
  .todo-row {
    grid-template-columns: minmax(180px, 1.6fr) 110px 100px 110px minmax(120px, 1fr) 100px;
    gap: 10px;
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 12px;
  }
  .hero,
  .panel,
  .kpi,
  .ops-sidebar,
  .login-card {
    border-radius: 20px;
  }
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .hero-actions .btn,
  .hero-actions .dark-mode-toggle,
  .hero-actions .user-badge {
    width: 100%;
  }
  .timeline-item,
  .todo-list-head,
  .todo-row {
    grid-template-columns: 1fr;
  }
  .todo-list-head {
    display: none;
  }
  .sticky-col {
    min-width: 140px !important;
  }
}


/* --- UI alignment patch: sidebar actions, schedule stacking, availability scroll, chart spacing --- */
.ops-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-quick-actions {
  position: sticky;
  top: 24px;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 2;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  box-shadow: none;
}

.sidebar-quick-actions .btn {
  width: 100%;
}

.schedule-stack-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 18px !important;
  align-items: start !important;
}

.schedule-stack-grid > .panel,
.schedule-stack-grid > .coverage-panel,
.schedule-stack-grid > .schedule-timeline-panel {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  min-width: 0 !important;
}

.coverage-panel {
  margin-top: 0 !important;
}

.workforce-charts-grid {
  align-items: stretch !important;
}

.workforce-charts-grid > .panel,
.employee-days-panel {
  margin: 0 !important;
  align-self: stretch !important;
}

.employee-days-panel {
  min-height: 320px !important;
}

.employee-days-panel .chart-scroll-wrap {
  height: calc(100% - 52px);
  min-height: 250px;
}

.availability-wrap,
.availability-month-wrap,
#availabilityPlanner {
  overflow: auto !important;
  max-height: 72vh !important;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: auto;
  scrollbar-color: rgba(121,192,255,0.7) rgba(255,255,255,0.08);
}

.availability-wrap::-webkit-scrollbar,
.availability-month-wrap::-webkit-scrollbar,
#availabilityPlanner::-webkit-scrollbar {
  width: 14px;
  height: 14px;
  -webkit-appearance: none;
}

.availability-wrap::-webkit-scrollbar-thumb,
.availability-month-wrap::-webkit-scrollbar-thumb,
#availabilityPlanner::-webkit-scrollbar-thumb {
  background: rgba(121,192,255,0.7);
  border-radius: 999px;
  border: 3px solid rgba(7,17,31,0.88);
}

.availability-wrap::-webkit-scrollbar-track,
.availability-month-wrap::-webkit-scrollbar-track,
#availabilityPlanner::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
}

.availability-wrap::-webkit-scrollbar-corner,
.availability-month-wrap::-webkit-scrollbar-corner,
#availabilityPlanner::-webkit-scrollbar-corner {
  background: transparent;
}

@media (max-width: 1100px) {
  .sidebar-quick-actions {
    position: static;
    width: 100%;
    margin-top: 4px;
  }
}


/* --- March 2026 refinement patch: month timeline, darker selects, stronger availability scroll --- */
#scheduleTimeline.timeline-wrap {
  display: flex !important;
  flex-wrap: nowrap !important;
  grid-template-columns: none !important;
  gap: 16px;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  align-items: stretch;
  padding: 4px 6px 18px;
  margin: 0 -6px;
  max-width: 100%;
  max-height: none;
  scroll-snap-type: x proximity;
}

#scheduleTimeline .timeline-day {
  flex: 0 0 clamp(280px, 18vw, 360px) !important;
  width: clamp(280px, 18vw, 360px) !important;
  min-width: clamp(280px, 18vw, 360px) !important;
  max-width: clamp(280px, 18vw, 360px) !important;
  display: flex;
  flex-direction: column;
  min-height: 740px;
}

#scheduleTimeline .timeline-items {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 680px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

#scheduleTimeline .timeline-item {
  grid-template-columns: 88px minmax(0, 1fr) !important;
  align-items: start;
}

#scheduleTimeline .timeline-content,
#scheduleTimeline .timeline-sub,
#scheduleTimeline .timeline-team,
#scheduleTimeline .mini-pill-wrap {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#scheduleTimeline .mini-pill {
  max-width: 100%;
  white-space: normal;
}

.filter-field select,
.rows-control select,
.month-input,
.theme-dark select,
select {
  background: linear-gradient(180deg, rgba(6,16,31,0.96), rgba(9,20,38,0.96)) !important;
  color: #eef6ff !important;
  border-color: rgba(121,192,255,0.22) !important;
}

.filter-field select option,
.rows-control select option,
select option {
  background: #081424 !important;
  color: #eef6ff !important;
}

#tab-availability .availability-month-panel {
  overflow: hidden;
}

#tab-availability #availabilityPlanner,
#tab-availability .availability-wrap,
#tab-availability .availability-month-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 72vh !important;
  overflow: auto !important;
  padding-right: 8px;
  padding-bottom: 10px;
  scrollbar-gutter: stable both-edges;
}

#tab-availability #availabilityPlanner > .heatmap-grid,
#tab-availability .availability-grid,
#tab-availability .availability-month-grid {
  width: max-content;
  min-width: max-content;
}

#tab-availability #availabilityPlanner::-webkit-scrollbar,
#scheduleTimeline .timeline-items::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

#tab-availability #availabilityPlanner::-webkit-scrollbar-thumb,
#scheduleTimeline .timeline-items::-webkit-scrollbar-thumb {
  background: rgba(121,192,255,0.7);
  border-radius: 999px;
  border: 3px solid rgba(7,17,31,0.88);
}

#tab-availability #availabilityPlanner::-webkit-scrollbar-track,
#scheduleTimeline .timeline-items::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
}

@media (max-width: 1200px) {
  #scheduleTimeline .timeline-day {
    flex-basis: 320px !important;
    width: 320px !important;
    min-width: 320px !important;
    max-width: 320px !important;
  }
}

@media (max-width: 760px) {
  #scheduleTimeline.timeline-wrap {
    flex-direction: column !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  #scheduleTimeline .timeline-day {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    flex-basis: auto !important;
    min-height: 0;
  }

  #scheduleTimeline .timeline-items {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}


/* --- v3.1 availability scrollbar visibility fix --- */
#tab-availability,
#tab-availability .availability-month-panel {
  min-width: 0;
}

#tab-availability .availability-month-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#tab-availability .panel-header {
  flex: 0 0 auto;
}

#tab-availability #availabilityPlanner,
#tab-availability .availability-wrap,
#tab-availability .availability-month-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: min(72vh, calc(100vh - 210px));
  max-height: min(72vh, calc(100vh - 210px)) !important;
  overflow-x: scroll !important;
  overflow-y: scroll !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
}

#tab-availability #availabilityPlanner > .heatmap-grid,
#tab-availability .availability-grid,
#tab-availability .availability-month-grid {
  width: max-content;
  min-width: max-content;
  padding-bottom: 6px;
}

@media (max-width: 1100px) {
  #tab-availability #availabilityPlanner,
  #tab-availability .availability-wrap,
  #tab-availability .availability-month-wrap {
    height: min(68vh, calc(100vh - 190px));
    max-height: min(68vh, calc(100vh - 190px)) !important;
  }
}


/* --- v3.2 availability horizontal scrollbar fix --- */
#tab-availability #availabilityPlanner,
#tab-availability .availability-wrap,
#tab-availability .availability-month-wrap {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

#tab-availability .availability-viewport {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: min-content;
}

#tab-availability .availability-grid-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding-bottom: 10px;
  scrollbar-gutter: stable both-edges;
  -webkit-overflow-scrolling: touch;
}

#tab-availability .availability-grid-scroll::-webkit-scrollbar {
  height: 14px;
}

#tab-availability .availability-grid-scroll::-webkit-scrollbar-thumb {
  background: rgba(121,192,255,0.72);
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.06);
}

#tab-availability .availability-grid-scroll::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
}

#tab-availability .availability-grid-scroll > .heatmap-grid,
#tab-availability .availability-grid-scroll > .availability-grid,
#tab-availability .availability-grid-scroll > .availability-month-grid {
  width: max-content;
  min-width: max-content;
}


/* --- v3.3 availability planner overflow cleanup --- */
#tab-availability,
#tab-availability .availability-month-panel {
  min-width: 0;
  min-height: 0;
}

#tab-availability .availability-month-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#tab-availability .panel-header {
  flex: 0 0 auto;
}

#tab-availability #availabilityPlanner {
  flex: 1 1 auto;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: min(72vh, calc(100vh - 210px));
  max-height: min(72vh, calc(100vh - 210px));
  overflow-x: auto !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
  padding-right: 8px;
  padding-bottom: 12px;
}

#tab-availability #availabilityPlanner > .heatmap-grid,
#tab-availability #availabilityPlanner > .availability-grid,
#tab-availability #availabilityPlanner > .availability-month-grid {
  width: max-content !important;
  min-width: max-content !important;
  max-width: none !important;
}

#tab-availability #availabilityPlanner .heatmap-legend {
  width: max-content;
  min-width: 100%;
  margin-top: 12px;
  padding-bottom: 2px;
}

#tab-availability #availabilityPlanner::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

#tab-availability #availabilityPlanner::-webkit-scrollbar-thumb {
  background: rgba(121, 192, 255, 0.72);
  border-radius: 999px;
  border: 3px solid rgba(7, 17, 31, 0.9);
}

#tab-availability #availabilityPlanner::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

@media (max-width: 1100px) {
  #tab-availability #availabilityPlanner {
    height: min(68vh, calc(100vh - 190px));
    max-height: min(68vh, calc(100vh - 190px));
  }
}


/* --- v4.0 timeline normalization: apply Saturday 14 behavior to all days --- */
#scheduleTimeline.timeline-wrap {
  align-items: stretch !important;
}
#scheduleTimeline .timeline-day {
  display: flex !important;
  flex-direction: column !important;
  min-height: 740px !important;
  height: 740px !important;
}
#scheduleTimeline .timeline-items {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 8px !important;
  scrollbar-gutter: stable !important;
}
#scheduleTimeline .timeline-item {
  display: grid !important;
  grid-template-columns: 88px minmax(0, 1fr) !important;
  align-items: start !important;
  min-height: max-content !important;
}
#scheduleTimeline .timeline-content {
  min-width: 0 !important;
}
#scheduleTimeline .timeline-sub {
  margin-bottom: 10px !important;
}
#scheduleTimeline .timeline-team {
  display: none !important;
}
#scheduleTimeline .mini-pill-wrap {
  margin-top: 8px !important;
}
#scheduleTimeline .mini-pill-wrap:empty {
  display: none !important;
}


.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.link-card {
  border-radius: 22px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.link-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.link-card-header h3 {
  margin: 0;
  font-size: 18px;
}
.link-url {
  color: var(--muted);
  word-break: break-word;
  line-height: 1.5;
}
.link-open-btn {
  width: fit-content;
}
.inline-actions {
  flex-direction: row;
}
.hidden {
  display: none !important;
}

.db-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.db-form-grid .full-span {
  grid-column: 1 / -1;
}
.form-actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.db-subpanel {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
}
.panel-header.compact {
  margin-bottom: 10px;
}
.assignment-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.assignment-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.database-grid-phase1 {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}
.action-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 900px) {
  .assignment-row {
    grid-template-columns: 1fr;
  }
}

.inline-status-select {
  min-width: 120px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  color: #f5f7ff;
  font-weight: 700;
}
.inline-status-select.status-planned { border-color: rgba(255,255,255,0.22); }
.inline-status-select.status-ready { border-color: rgba(89,156,255,0.55); color: #a9c8ff; }
.inline-status-select.status-live { border-color: rgba(255,176,59,0.65); color: #ffd08a; }
.inline-status-select.status-done { border-color: rgba(71,201,126,0.65); color: #95f0b8; }
.inline-status-select.status-cancelled { border-color: rgba(255,107,107,0.65); color: #ffabab; }


.saved-matches-filters { display:grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; align-items: end; }
.match-conflict-banner { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(255,176,59,0.4); background: rgba(255,176,59,0.08); color: #ffd08a; }
.match-conflict-banner.hidden { display:none; }
.match-conflict-banner strong { display:block; margin-bottom: 6px; }
.assignment-row .btn { align-self: end; }
.assignment-employee-search { min-width: 220px; }
.assignment-id-input { display:none; }


.smart-crew-assistant {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}
.smart-crew-card {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
}
.smart-crew-card h4 { margin: 0 0 8px; font-size: 0.95rem; }
.smart-crew-card .smart-value { font-size: 1.35rem; font-weight: 800; margin-bottom: 6px; }
.smart-crew-card .muted { font-size: 0.84rem; line-height: 1.4; }
.smart-crew-recommendations { display: flex; flex-direction: column; gap: 8px; }
.smart-crew-recommendation { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 8px 10px; background: rgba(255,255,255,0.03); }
.smart-crew-name { font-weight: 700; }
.smart-crew-meta { font-size: 0.8rem; color: #b8bfd8; }
.conflict-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.01em; }
.conflict-pill.high { background: rgba(255,107,107,0.16); color: #ffb0b0; border: 1px solid rgba(255,107,107,0.38); }
.conflict-pill.medium { background: rgba(255,176,59,0.14); color: #ffd08a; border: 1px solid rgba(255,176,59,0.34); }
.conflict-pill.low { background: rgba(89,156,255,0.14); color: #a9c8ff; border: 1px solid rgba(89,156,255,0.34); }
.match-conflict-banner .conflict-line { margin-top: 6px; }


.hidden-by-role { display: none !important; }
.timeline-view-toolbar { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.timeline-view-legend { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.timeline-day-header-right { display:flex; gap:8px; flex-wrap:wrap; }
.timeline-planner { display:flex; flex-direction:column; gap:18px; }
.timeline-planner-day { border-radius:24px; padding:18px; overflow:hidden; }
.timeline-planner-day-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.timeline-planner-day-header h3 { margin:0 0 4px; font-size:18px; }
.timeline-planner-day-header span { color: var(--muted); font-size:13px; }
.timeline-hour-ruler { display:grid; grid-template-columns:repeat(24, minmax(70px,1fr)); gap:0; font-size:11px; color:var(--muted); margin-bottom:8px; min-width:1680px; }
.timeline-hour-ruler > div { padding:0 6px 6px; border-left:1px solid rgba(255,255,255,0.08); }
.timeline-planner-track { position:relative; min-width:1680px; border-radius:20px; background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08); overflow:hidden; }
.timeline-grid-lines { position:absolute; inset:0; background-image:linear-gradient(to right, rgba(255,255,255,0.08) 1px, transparent 1px); background-size:calc(100% / 24) 100%; pointer-events:none; }
.timeline-planner-card { position:absolute; min-height:72px; padding:10px 12px; border-radius:16px; background:linear-gradient(135deg, rgba(121,192,255,0.32), rgba(121,192,255,0.18)); border:1px solid rgba(121,192,255,0.45); box-shadow:0 12px 30px rgba(0,0,0,0.22); overflow:hidden; }
.timeline-planner-card-meta-row { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; }
.timeline-card-badge { display:inline-flex; align-items:center; padding:4px 8px; border-radius:999px; font-size:11px; font-weight:800; letter-spacing:0.01em; border:1px solid rgba(255,255,255,0.14); background:rgba(255,255,255,0.08); color:#eef6ff; white-space:nowrap; }
.timeline-card-badge.high { background:rgba(255,107,107,0.18); color:#ffd0d0; border-color:rgba(255,127,127,0.36); }
.timeline-card-badge.medium { background:rgba(255,176,59,0.18); color:#ffe0a8; border-color:rgba(255,176,59,0.34); }
.timeline-card-badge.low { background:rgba(121,192,255,0.18); color:#cfe4ff; border-color:rgba(121,192,255,0.34); }
.timeline-card-badge.none { background:rgba(121,192,255,0.12); color:#dce9f7; border-color:rgba(121,192,255,0.24); }
.timeline-card-badge.ob { background:rgba(255,255,255,0.12); color:#f4f8ff; border-color:rgba(255,255,255,0.24); }
.timeline-planner-card-conflict { background:linear-gradient(135deg, rgba(255,123,146,0.32), rgba(255,123,146,0.18)); border-color:rgba(255,123,146,0.5); }
.timeline-planner-card-time { font-size:12px; color:#dce9f7; margin-bottom:4px; font-weight:700; }
.timeline-planner-card strong { display:block; font-size:14px; margin-bottom:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.timeline-planner-card-sub { font-size:12px; color:#dbe7f2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.timeline-unscheduled-list { display:flex; flex-wrap:wrap; gap:10px; margin-top:14px; }
.timeline-unscheduled-item { padding:10px 12px; border-radius:14px; background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.08); min-width:240px; }
.timeline-unscheduled-item strong { display:block; margin-bottom:4px; font-size:13px; }
.timeline-unscheduled-item span { color:var(--muted); font-size:12px; }
#timelinePlanner { overflow-x:auto; padding-bottom:4px; }
@media (max-width: 900px) { .timeline-view-toolbar { flex-direction:column; align-items:flex-start; } }


/* Phase 2C.1 timeline readability upgrade */
.timeline-view-toolbar-left { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.timeline-date-filter { display:flex; align-items:center; gap:8px; padding:8px 12px; border-radius:14px; background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.08); }
.timeline-date-filter input[type="date"], .timeline-select-filter select { min-height:38px; padding:8px 10px; border-radius:10px; border:1px solid rgba(255,255,255,0.12); background:rgba(7,13,22,0.78); color:#eef6ff; }
.timeline-select-filter select { min-width:150px; }
.small-btn { padding:10px 14px; min-height:40px; }
.timeline-planner-day { padding:22px; }
.timeline-hour-ruler { grid-template-columns:repeat(24, minmax(82px,1fr)); min-width:1968px; font-size:12px; }
.timeline-hour-ruler > div { padding:0 8px 8px; }
.timeline-planner-track { min-width:1968px; }
.timeline-planner-card-high { outline:1px solid rgba(255,127,127,0.42); }
.timeline-planner-card-medium { outline:1px solid rgba(255,196,92,0.34); }
.timeline-planner-card-low { outline:1px solid rgba(121,192,255,0.30); }
.timeline-planner-card { min-height:118px; padding:12px 14px; overflow:hidden; }
.timeline-planner-card strong { font-size:15px; white-space:normal; overflow:visible; text-overflow:clip; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; line-height:1.35; max-height:2.7em; }
.timeline-planner-card-sub { font-size:12px; white-space:normal; overflow:visible; text-overflow:clip; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; line-height:1.45; max-height:2.9em; }
#timelinePlanner { overflow-x:auto; overflow-y:visible; padding-bottom:10px; }
@media (max-width: 900px) { .timeline-view-toolbar-left { width:100%; } .timeline-date-filter { width:100%; justify-content:space-between; } }

.mcr-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mcr-toolbar,
.mcr-toolbar-left,
.mcr-toolbar-right,
.mcr-status-grid,
.mcr-focus-grid,
.mcr-card-head,
.mcr-big-card-top,
.mcr-run-topline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mcr-toolbar,
.mcr-card-head,
.mcr-big-card-top,
.mcr-run-topline {
  justify-content: space-between;
}

.mcr-toolbar {
  flex-wrap: wrap;
}

.mcr-toolbar-left,
.mcr-toolbar-right {
  flex-wrap: wrap;
}

.mcr-clock {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(7, 14, 25, 0.65);
}

.mcr-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.mcr-status-card,
.mcr-focus-card,
.mcr-runlist-card,
.mcr-big-card,
.mcr-run-card {
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
}

.mcr-status-card {
  padding: 18px;
  background: rgba(8, 16, 30, 0.72);
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mcr-status-card span,
.mcr-status-card small {
  color: rgba(224, 234, 255, 0.78);
}

.mcr-status-card strong {
  font-size: 2rem;
  line-height: 1;
}

.mcr-live { box-shadow: inset 0 0 0 1px rgba(255,107,107,0.18); }
.mcr-ready { box-shadow: inset 0 0 0 1px rgba(121,192,255,0.18); }
.mcr-delayed { box-shadow: inset 0 0 0 1px rgba(255,176,59,0.18); }
.mcr-finished { box-shadow: inset 0 0 0 1px rgba(118,221,152,0.18); }

.mcr-focus-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.mcr-focus-card,
.mcr-runlist-card {
  background: rgba(8, 16, 30, 0.68);
  padding: 18px;
}

.mcr-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(121,192,255,0.18);
  border: 1px solid rgba(121,192,255,0.36);
  font-size: 0.78rem;
  font-weight: 700;
}

.muted-badge {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
}

.mcr-badge-live { background: rgba(255,107,107,0.18); border-color: rgba(255,107,107,0.4); }
.mcr-badge-ready, .mcr-badge-scheduled { background: rgba(121,192,255,0.18); border-color: rgba(121,192,255,0.38); }
.mcr-badge-delayed { background: rgba(255,176,59,0.18); border-color: rgba(255,176,59,0.38); }
.mcr-badge-finished { background: rgba(118,221,152,0.18); border-color: rgba(118,221,152,0.38); }
.mcr-badge-cancelled { background: rgba(153,162,179,0.18); border-color: rgba(153,162,179,0.3); }

.mcr-big-card {
  min-height: 210px;
  padding: 22px;
  background: linear-gradient(135deg, rgba(18,35,63,0.9), rgba(8,16,30,0.84));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mcr-big-card h3 {
  margin: 6px 0 0;
  font-size: 1.45rem;
}

.mcr-big-time {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.mcr-big-status,
.mcr-run-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mcr-big-status.live, .mcr-run-pill.state-live { background: rgba(255,107,107,0.18); color: #ffd4d4; }
.mcr-big-status.ready, .mcr-big-status.scheduled, .mcr-run-pill.state-ready, .mcr-run-pill.state-scheduled { background: rgba(121,192,255,0.18); color: #d9ecff; }
.mcr-big-status.delayed, .mcr-run-pill.state-delayed { background: rgba(255,176,59,0.18); color: #ffe4b0; }
.mcr-big-status.finished, .mcr-run-pill.state-finished { background: rgba(118,221,152,0.18); color: #ddffe7; }
.mcr-big-status.cancelled, .mcr-run-pill.state-cancelled { background: rgba(153,162,179,0.18); color: #d5dce9; }

.mcr-big-meta,
.mcr-run-meta {
  color: rgba(224, 234, 255, 0.82);
  line-height: 1.5;
}

.mcr-big-card-live { box-shadow: 0 16px 34px rgba(255,107,107,0.16); }
.mcr-big-card-ready, .mcr-big-card-scheduled { box-shadow: 0 16px 34px rgba(121,192,255,0.14); }
.mcr-big-card-delayed { box-shadow: 0 16px 34px rgba(255,176,59,0.14); }
.mcr-big-card-finished { box-shadow: 0 16px 34px rgba(118,221,152,0.14); }
.mcr-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(224, 234, 255, 0.68);
  font-size: 1.05rem;
}

.mcr-runlist {
  display: grid;
  gap: 12px;
  max-height: 540px;
  overflow: auto;
  padding-right: 4px;
}

.mcr-run-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  padding: 16px;
  background: rgba(10, 18, 32, 0.72);
}

.mcr-run-order {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  background: rgba(121,192,255,0.14);
}

.mcr-run-card h4 {
  margin: 4px 0 8px;
  font-size: 1.08rem;
}

.mcr-run-card.tone-live { box-shadow: inset 0 0 0 1px rgba(255,107,107,0.18); }
.mcr-run-card.tone-ready, .mcr-run-card.tone-scheduled { box-shadow: inset 0 0 0 1px rgba(121,192,255,0.14); }
.mcr-run-card.tone-delayed { box-shadow: inset 0 0 0 1px rgba(255,176,59,0.16); }
.mcr-run-card.tone-finished { box-shadow: inset 0 0 0 1px rgba(118,221,152,0.16); }

.mcr-empty-row {
  padding: 18px;
  border-radius: 16px;
  background: rgba(10, 18, 32, 0.64);
  color: rgba(224, 234, 255, 0.68);
}

@media (max-width: 1200px) {
  .mcr-status-grid,
  .mcr-focus-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .mcr-status-grid,
  .mcr-focus-grid {
    grid-template-columns: 1fr;
  }

  .mcr-run-card {
    grid-template-columns: 1fr;
  }

  .mcr-run-order {
    width: 52px;
    height: 52px;
  }
}


.auto-plan-status{margin:8px 0 12px;display:block;}
.level3-report-grid{align-items:end;}
.export-format-compact{min-width:150px;}
.export-format-compact span{font-size:11px;}
#reportCenterPanel .filter-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end;}
#reportCenterPanel .btn{white-space:nowrap;}
