* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--build-accent, #f5f7fb);
  color: #1c2333;
}

.page {
  max-width: none;
  margin: 0;
  padding: 24px 28px 60px;
  width: 100%;
}

.header h1 {
  margin-bottom: 6px;
}

.header p {
  margin-top: 0;
  color: #4c5870;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.nav-links a {
  color: #2c4cb2;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}

.nav-links a:hover {
  text-decoration: underline;
}

.build-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #1c2333;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}

.badge {
  background: #e8eefc;
  color: #2c4cb2;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(30, 47, 80, 0.08);
  margin-bottom: 20px;
}

/* Distinct styling for the live-data card/table only. */
#liveCompareCard {
  background: #eef6ff;
  border: 1px solid #c7dcff;
}

#liveCompareCard .table-wrap {
  border-color: #bcd3fa;
}

/* Keep live date-range inputs compact across all source pages. */
#liveCompareCard #liveFromDateInput,
#liveCompareCard #liveToDateInput {
  width: 220px;
  max-width: 100%;
}

#liveCompareTable thead {
  background: #dceaff;
}

#liveCompareTable tbody tr:nth-child(even) {
  background: #f3f8ff;
}

#liveCompareTable tbody tr:nth-child(odd) {
  background: #ffffff;
}

.ivan-sync-panel {
  margin-top: 12px;
  background: #ffffff;
}

.ivan-sync-panel .actions {
  gap: 8px;
  flex-wrap: wrap;
}

.ivan-sync-panel .column-list {
  max-height: 160px;
}

.ivan-sync-panel #ivanLiveSyncColumns label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 2px;
  font-size: 13px;
}

.ivan-sync-advanced summary.help {
  cursor: pointer;
  user-select: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}

.modal-card {
  width: min(980px, 98vw);
  max-height: min(86vh, 920px);
  overflow: auto;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #d7deee;
  box-shadow: 0 16px 50px rgba(20, 30, 55, 0.25);
  padding: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.modal-card select[multiple] {
  border-radius: 10px;
  border: 1px solid #d2d8e5;
  padding: 8px;
  background: #ffffff;
}

.card h2 {
  margin-top: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.panel {
  border: 1px solid #e1e6f0;
  border-radius: 12px;
  padding: 16px;
  background: #f9fbff;
}

.panel h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 16px;
}

.column-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid #e1e6f0;
  border-radius: 10px;
  padding: 8px;
  background: #ffffff;
}

.column-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  font-size: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.floating-actions {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#pageSelect {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d2d8e5;
}

.date-filter {
  font-size: 12px;
}

.date-filter summary {
  cursor: pointer;
  list-style: none;
  color: #2c4cb2;
}

.date-filter-actions {
  margin: 6px 0;
}

.date-filter-list {
  max-height: 140px;
  overflow: auto;
  border: 1px solid #e1e6f0;
  border-radius: 8px;
  padding: 6px;
  background: #ffffff;
  margin-bottom: 6px;
}

.date-filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

.date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 6px;
}

.date-grid-cell {
  border: 1px solid #d2d8e5;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2a44;
  padding: 4px 0;
  font-size: 11px;
}

.date-grid-cell:disabled {
  color: #a0a7b5;
  background: #f5f6fa;
}

.date-grid-cell.selected {
  background: #2c4cb2;
  color: #ffffff;
  border-color: #2c4cb2;
}

.date-filter-search {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d2d8e5;
  border-radius: 6px;
  margin-bottom: 6px;
}

.date-filter-empty {
  padding: 6px 0;
  color: #6b7280;
  font-size: 12px;
}

.date-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.date-tree-summary {
  list-style: none;
  cursor: pointer;
}

.date-tree-summary::-webkit-details-marker {
  display: none;
}

.date-tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 0;
}

.date-tree-row.indent-1 {
  margin-left: 12px;
}

.date-tree-row.indent-2 {
  margin-left: 22px;
}

.date-tree input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.date-tree-summary {
  margin: 2px 0;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  padding: 4px 8px;
  font-size: 12px;
}
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

#loadStatus {
  display: inline-flex;
  align-items: center;
  color: #5b6782;
  font-weight: 600;
}

.filters,
.uploads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d2d8e5;
  border-radius: 8px;
  font-size: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

button {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: #2c4cb2;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: #e6ebf7;
  color: #2c4cb2;
}

 .link-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.help {
  margin-top: 10px;
  color: #5b6782;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.summary .pill {
  background: #f0f3fb;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #e1e6f0;
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

thead {
  background: #f2f5fb;
}

th,
td {
  padding: 8px 12px;
  border-bottom: 1px solid #e1e6f0;
  font-size: 13px;
  vertical-align: top;
  text-align: left;
}

/* Keep header labels in one line for prefixed short names. */
#reportTable thead th,
#savedTable thead th,
#sourceTable thead th,
#liveCompareTable thead th {
  white-space: nowrap;
  vertical-align: middle;
}

/* Keep filter controls aligned under non-wrapping headers. */
#reportTable .filter-row th,
#savedTable .filter-row th,
#sourceTable .filter-row th,
#liveCompareTable .filter-row th {
  vertical-align: middle;
}

.filter-row input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d2d8e5;
  border-radius: 6px;
  font-size: 12px;
}

#saveMessage a {
  color: #2c4cb2;
  text-decoration: none;
  font-weight: 600;
}

#importMessage {
  margin-top: 8px;
}

tbody tr:nth-child(even) {
  background: #fafbfe;
}

.duplicate-row {
  background: #ffd6d6;
}

#savedTable .duplicate-row {
  background: #ffd6d6;
}

#reportTable .filter-row select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d2d8e5;
  border-radius: 6px;
  font-size: 12px;
  background: #ffffff;
}

#savedTable .filter-row select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d2d8e5;
  border-radius: 6px;
  font-size: 12px;
  background: #ffffff;
}

#liveCompareTable .filter-row select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d2d8e5;
  border-radius: 6px;
  font-size: 12px;
  background: #ffffff;
}

.live-logs {
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  background: #1c2333;
  color: #e8eefc;
  font-size: 12px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-all;
}
