html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus, .form-select:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(18, 84, 102, 0.25);
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background:
    radial-gradient(circle at top right, rgba(27, 94, 32, 0.08), transparent 24rem),
    linear-gradient(180deg, #f3f1e9 0%, #fcfbf7 100%);
  color: #1f2a20;
}

.page-container-wide {
  max-width: none;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

@media (min-width: 992px) {
  .page-container-wide {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }
}

@media (min-width: 1400px) {
  .page-container-wide {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
}

.card {
  border: 1px solid rgba(31, 42, 32, 0.08);
}

.detail-panel {
  padding: 1.5rem;
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(245, 247, 242, 0.96));
  border: 1px solid rgba(31, 42, 32, 0.08);
  box-shadow: 0 18px 36px rgba(24, 43, 31, 0.08);
}

.detail-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.detail-eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #5c6b5f;
}

.row-selected {
  --bs-table-accent-bg: rgba(43, 90, 61, 0.10);
}

.analysis-summary {
  min-height: 10rem;
  white-space: pre-wrap;
  line-height: 1.5;
}

.empty-state {
  color: #6c757d;
}

#documentsBody td {
  vertical-align: middle;
}

.auction-details-page .card {
  border-radius: 1rem;
}

.auction-details-page {
  max-width: 100%;
}

.auction-details-page .card-body {
  padding: 0.85rem;
}

.auction-details-stack {
  display: grid;
  gap: 0.6rem;
}

@media (min-width: 1200px) {
  .auction-details-page .row {
    --bs-gutter-x: 0.85rem;
    --bs-gutter-y: 0.85rem;
  }
}

.auction-header-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.auction-score-summary {
  display: inline-flex;
  align-items: stretch;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(31, 42, 32, 0.08);
  box-shadow: 0 10px 20px rgba(24, 43, 31, 0.06);
}

.auction-score-group {
  display: grid;
  gap: 0.25rem;
  justify-items: center;
}

.auction-score-group__icons {
  display: flex;
  gap: 0.25rem;
}

.auction-score-group__label,
.auction-total-stars__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #65736a;
}

.score-icon,
.auction-total-stars__icon,
.metric-icon,
.grid-total-stars__icon {
  display: inline-grid;
  place-items: center;
}

.score-icon svg,
.auction-total-stars__icon svg,
.metric-icon::before,
.grid-total-stars__icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.score-icon svg,
.auction-total-stars__icon svg,
.grid-total-stars__icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.score-icon.is-active {
  color: #1b5e20;
}

.score-icon.is-inactive {
  color: #c4cec6;
}

.auction-total-stars {
  display: grid;
  justify-items: center;
  align-content: center;
  min-width: 4rem;
  padding-left: 0.25rem;
  border-left: 1px solid rgba(31, 42, 32, 0.08);
}

.auction-total-stars__value {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}

.task-summary {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding-bottom: 0.85rem;
  margin-bottom: -0.85rem;
}

.task-summary__chips {
  display: inline-flex;
  gap: 0.45rem;
  padding: 0.35rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(31, 42, 32, 0.08);
  box-shadow: 0 10px 20px rgba(24, 43, 31, 0.06);
}

.task-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.74rem;
  color: #fff;
}

.task-count--ok {
  background: #2e7d32;
}

.task-count--pending {
  background: #1565c0;
}

.task-count--error {
  background: #c62828;
}

.task-summary-grid {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.1rem 0;
}

.task-popover {
  position: absolute;
  top: calc(100% + 0.15rem);
  right: 0;
  z-index: 20;
  display: none;
  width: min(34rem, 80vw);
  max-height: 26rem;
  padding: 1rem;
  overflow: auto;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(31, 42, 32, 0.1);
  box-shadow: 0 24px 40px rgba(24, 43, 31, 0.14);
}

.task-summary:hover .task-popover,
.task-summary:focus-within .task-popover {
  display: block;
}

.task-popover__header {
  margin-bottom: 0.85rem;
  font-weight: 700;
}

.task-popover__list {
  display: grid;
  gap: 0.75rem;
}

.task-popover__item {
  padding: 0.85rem;
  border-radius: 0.85rem;
  background: #f8f8f4;
  border: 1px solid rgba(31, 42, 32, 0.06);
}

.task-popover__detail {
  color: #344034;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-popover__detail--ok {
  color: #2e7d32;
}

.task-popover__detail--pending {
  color: #1565c0;
}

.task-popover__detail--error {
  color: #c62828;
}

.task-popover__detail--cancelled {
  color: #5c6b5f;
}

.tasks-status-page .card {
  border-radius: 1rem;
}

.multi-option-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(31, 42, 32, 0.12);
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.filter-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(27, 94, 32, 0.35);
}

.filter-pill.is-active {
  background: rgba(31, 98, 56, 0.12);
  border-color: rgba(27, 94, 32, 0.45);
  box-shadow: 0 10px 18px rgba(24, 43, 31, 0.08);
}

.filter-pill input {
  margin: 0;
}

.tasks-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(31, 42, 32, 0.08);
}

.tasks-heatmap-shell {
  overflow-x: auto;
}

.tasks-heatmap-table table {
  min-width: 420px;
}

.tasks-heatmap-table th {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #627066;
  white-space: nowrap;
}

.tasks-heatmap-table td,
.tasks-heatmap-table th {
  padding: 0.22rem;
}

.heatmap-cell {
  display: grid;
  place-items: center;
  min-width: 3.3rem;
  min-height: 2.15rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(31, 42, 32, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.heatmap-cell__count {
  font-size: 0.9rem;
  font-weight: 700;
  color: #203226;
  line-height: 1;
}

.tasks-grid-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid transparent;
}

.tasks-grid-status-badge--pending {
  color: #7c4d00;
  background: rgba(255, 224, 178, 0.8);
  border-color: rgba(245, 124, 0, 0.2);
}

.tasks-grid-status-badge--progress {
  color: #0d47a1;
  background: rgba(187, 222, 251, 0.82);
  border-color: rgba(30, 136, 229, 0.22);
}

.tasks-grid-status-badge--ok {
  color: #1b5e20;
  background: rgba(200, 230, 201, 0.86);
  border-color: rgba(46, 125, 50, 0.22);
}

.tasks-grid-status-badge--error {
  color: #b71c1c;
  background: rgba(255, 205, 210, 0.85);
  border-color: rgba(198, 40, 40, 0.22);
}

.tasks-grid-status-badge--retry {
  color: #5d4037;
  background: rgba(215, 204, 200, 0.82);
  border-color: rgba(109, 76, 65, 0.2);
}

.tasks-grid-status-badge--cancelled {
  color: #424242;
  background: rgba(238, 238, 238, 0.9);
  border-color: rgba(117, 117, 117, 0.18);
}

@media (max-width: 767.98px) {
  .heatmap-cell {
    min-width: 2.85rem;
    min-height: 1.9rem;
  }

  .heatmap-cell__count {
    font-size: 0.8rem;
  }
}

.task-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.task-status-badge--ok {
  background: rgba(46, 125, 50, 0.15);
  color: #2e7d32;
}

.task-status-badge--pending {
  background: rgba(21, 101, 192, 0.14);
  color: #1565c0;
}

.task-status-badge--error {
  background: rgba(198, 40, 40, 0.14);
  color: #c62828;
}

.task-status-badge--cancelled {
  background: rgba(92, 107, 95, 0.14);
  color: #5c6b5f;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 16rem);
}

.login-card {
  width: min(100%, 34rem);
  border-radius: 1.25rem;
}

.auction-state-toggle-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.auction-status-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.1;
}

.auction-status-tag--active {
  background: rgba(46, 125, 50, 0.14);
  color: #2e7d32;
}

.auction-status-tag--closed {
  background: rgba(198, 40, 40, 0.14);
  color: #c62828;
}

.group-row-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1f2a20;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.15;
}

.group-row-toggle__icon {
  color: #1565c0;
  font-size: 0.72rem;
}

.group-row-toggle__label {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-row-toggle__count {
  display: inline-grid;
  place-items: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(21, 101, 192, 0.12);
  color: #1565c0;
  font-size: 0.68rem;
}

.quick-filter-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quick-filter-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(31, 42, 32, 0.12);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  user-select: none;
}

.quick-filter-field input {
  margin: 0;
}

.quick-filter-field.is-active {
  background: rgba(21, 101, 192, 0.1);
  border-color: rgba(21, 101, 192, 0.35);
  color: #0f4d93;
}

.ag-grid-shell {
  width: 100%;
  height: 70vh;
  min-height: 34rem;
  border-radius: 0.9rem;
  overflow: hidden;
}

.ag-grid-shell .ag-header-cell,
.ag-grid-shell .ag-header-group-cell {
  font-size: 0.74rem;
}

.ag-grid-shell .ag-header-cell-label {
  line-height: 1.1;
}

.ag-grid-shell .ag-cell {
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.2;
}

.ag-grid-shell .btn.btn-sm {
  --bs-btn-padding-y: 0.14rem;
  --bs-btn-padding-x: 0.45rem;
  --bs-btn-font-size: 0.72rem;
  --bs-btn-border-radius: 0.4rem;
}

.auction-meta-item {
  height: 100%;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(31, 42, 32, 0.08);
}

.auction-meta-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.auction-meta-card {
  height: 100%;
  padding: 0.8rem 0.85rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(31, 42, 32, 0.08);
}

.auction-meta-card__title {
  margin-bottom: 0.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
}

.auction-meta-card__grid {
  display: grid;
  gap: 0;
}

.auction-meta-item__label {
  margin-bottom: 0.15rem;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #65736a;
  line-height: 1.2;
}

.auction-meta-item__value {
  color: #1f2a20;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.auction-location-card {
  display: grid;
  gap: 0.55rem;
}

.auction-location-card__item {
  padding: 0.7rem 0.8rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(31, 42, 32, 0.08);
}

.auction-location-card__label {
  margin-bottom: 0.15rem;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #65736a;
}

.auction-location-card__value {
  color: #1f2a20;
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.25;
}

.auction-description-card {
  min-height: 8rem;
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(31, 42, 32, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 246, 241, 0.96));
}

.auction-description-card__text {
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: normal;
}

.metric-icon::before {
  content: "";
  display: block;
  background: currentColor;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-size: contain;
          mask-repeat: no-repeat;
          mask-position: center;
}

.metric-icon--population {
  color: #1b5e20;
}

.metric-icon--population::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2.5 2.8 5.67 6.26.91-4.53 4.42 1.07 6.25L12 16.82 6.4 19.75l1.07-6.25L2.94 9.08l6.26-.91L12 2.5Z'/%3E%3Ccircle cx='8.2' cy='10.1' r='1.4'/%3E%3Ccircle cx='12' cy='9.2' r='1.55'/%3E%3Ccircle cx='15.8' cy='10.1' r='1.4'/%3E%3Cpath d='M6.5 14.8c.8-1 2-1.5 3.2-1.5s2.3.5 3.1 1.5m-2.1-.6c.9-1.1 2.1-1.7 3.4-1.7 1.2 0 2.4.6 3.2 1.7'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2.5 2.8 5.67 6.26.91-4.53 4.42 1.07 6.25L12 16.82 6.4 19.75l1.07-6.25L2.94 9.08l6.26-.91L12 2.5Z'/%3E%3Ccircle cx='8.2' cy='10.1' r='1.4'/%3E%3Ccircle cx='12' cy='9.2' r='1.55'/%3E%3Ccircle cx='15.8' cy='10.1' r='1.4'/%3E%3Cpath d='M6.5 14.8c.8-1 2-1.5 3.2-1.5s2.3.5 3.1 1.5m-2.1-.6c.9-1.1 2.1-1.7 3.4-1.7 1.2 0 2.4.6 3.2 1.7'/%3E%3C/svg%3E");
}

.population-trend-card {
  min-height: 18rem;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(31, 42, 32, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 246, 241, 0.96));
}

.population-trend-card.empty-state {
  display: grid;
  place-items: center;
}

.population-trend-card__summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.population-metric {
  display: grid;
  gap: 0.2rem;
}

.population-metric__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #65736a;
}

.population-metric__value {
  font-size: 1rem;
  font-weight: 700;
}

.population-trend-chart {
  width: 100%;
  height: 14rem;
  overflow: visible;
}

.population-trend-chart__axis {
  fill: none;
  stroke: rgba(31, 42, 32, 0.16);
  stroke-width: 1.4;
}

.population-trend-chart__line {
  fill: none;
  stroke: #1b5e20;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.population-trend-chart circle {
  fill: #1b5e20;
}

.population-trend-chart text {
  fill: #65736a;
  font-size: 11px;
}

.legal-analysis-panel {
  min-height: 15rem;
  padding: 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(31, 42, 32, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 246, 241, 0.96));
}

.legal-analysis-panel.empty-state {
  display: grid;
  place-items: center;
}

.legal-analysis-panel__text {
  line-height: 1.65;
  white-space: normal;
}

.analysis-json-dialog {
  width: min(56rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid rgba(31, 42, 32, 0.12);
  border-radius: 1rem;
  box-shadow: 0 24px 60px rgba(24, 43, 31, 0.18);
}

.analysis-json-dialog::backdrop {
  background: rgba(18, 24, 20, 0.42);
}

.analysis-json-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(31, 42, 32, 0.08);
}

.analysis-json-dialog__content {
  max-height: calc(100vh - 10rem);
  margin: 0;
  padding: 1.25rem;
  overflow: auto;
  background: #f7f8f5;
  color: #223228;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.document-list {
  display: grid;
  gap: 0.85rem;
}

.document-list__item {
  width: 100%;
  min-width: 0;
  padding: 1rem;
  text-align: left;
  overflow: hidden;
  border: 1px solid rgba(31, 42, 32, 0.08);
  border-radius: 0.9rem;
  background: #fff;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.document-list__item:hover,
.document-list__item.is-active {
  border-color: rgba(43, 90, 61, 0.35);
  box-shadow: 0 12px 28px rgba(24, 43, 31, 0.08);
  transform: translateY(-1px);
}

.document-list__title {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  word-break: break-word;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.document-list__source {
  min-width: 0;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  overflow: hidden;
  word-break: break-word;
}

.document-list__source a {
  color: inherit;
  text-decoration: none;
}

.document-list__source a:hover {
  text-decoration: underline;
}

.document-preview {
  min-height: 34rem;
  border-radius: 1rem;
  border: 1px dashed rgba(31, 42, 32, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 246, 241, 0.96));
  overflow: hidden;
}

.document-preview.empty-state {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.document-preview__frame,
.document-preview__image-wrap,
.document-preview__fallback {
  width: 100%;
  height: 100%;
  min-height: 34rem;
}

.document-preview__frame {
  border: 0;
}

.document-preview__image-wrap {
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.document-preview__image {
  max-width: 100%;
  max-height: 31rem;
  object-fit: contain;
  border-radius: 0.75rem;
  box-shadow: 0 16px 30px rgba(24, 43, 31, 0.12);
}

.document-preview__text {
  margin: 0;
  padding: 1.25rem;
  height: 34rem;
  overflow: auto;
  background: transparent;
  white-space: pre-wrap;
  word-break: break-word;
}

.document-preview__fallback {
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
}

.grid-total-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(27, 94, 32, 0.08);
  color: #1b5e20;
  font-weight: 700;
}
