:root {
  --excel-blue-100: #e8f1fa;
  --excel-blue-200: #d6e4f0;
  --excel-blue-500: #4e79a7;
  --excel-line: #c8d5e3;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f4f7fb 0%, #ffffff 280px);
  color: #1f2d3d;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.excel-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px 24px;
}

.excel-header {
  background: var(--excel-blue-100);
  border: 1px solid var(--excel-blue-500);
  padding: 12px 14px;
}

.excel-header-layout {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
}

.excel-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.excel-header-title {
  text-align: center;
}

.excel-header-actions {
  min-width: 0;
}

.excel-header p {
  font-size: 0.9rem;
  color: #375470;
}

.excel-note {
  margin-top: 0.35rem;
  margin-bottom: 0;
  font-size: 0.8rem;
  color: #476580;
}

.excel-card {
  border: 1px solid var(--excel-line);
  background: white;
  padding: 14px;
}

.excel-section-title {
  font-size: 0.95rem;
  margin-bottom: 0.7rem;
  color: #2f4e6f;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.excel-label {
  font-weight: 600;
  font-size: 0.86rem;
  color: #334b63;
  margin-bottom: 0.25rem;
}

.excel-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.excel-vertical-form {
  display: grid;
  grid-template-columns: minmax(260px, 520px);
  gap: 10px;
}

.excel-client-grid {
  display: grid;
  grid-template-columns: minmax(260px, 520px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.excel-client-results {
  min-width: 0;
  border: 1px solid var(--excel-line);
  background: #fbfdff;
}

.excel-client-results-scroll {
  max-height: 458px;
  overflow: auto;
}

.excel-client-results .excel-results-table {
  table-layout: fixed;
  width: 100%;
}

.excel-client-results .excel-results-table th,
.excel-client-results .excel-results-table td {
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
}

.excel-client-results .excel-results-table th:nth-child(1),
.excel-client-results .excel-results-table td:nth-child(1) {
  min-width: 110px;
}

.excel-client-results .excel-results-table th:nth-child(2),
.excel-client-results .excel-results-table td:nth-child(2) {
  min-width: 130px;
  white-space: normal;
}

.excel-client-results .excel-results-table th:nth-child(n + 3),
.excel-client-results .excel-results-table td:nth-child(n + 3) {
  min-width: 88px;
}

.select2-container {
  width: 100% !important;
}

.select2-container .select2-selection--single {
  height: calc(1.5em + 0.75rem + 2px);
  border: 1px solid #ced4da;
}

.select2-container .select2-selection--single .select2-selection__rendered {
  line-height: calc(1.5em + 0.75rem);
  padding-left: 0.75rem;
  padding-right: 2rem;
}

.select2-container .select2-selection--single .select2-selection__arrow {
  height: calc(1.5em + 0.75rem + 2px);
  right: 0.35rem;
}

.excel-main-grid {
  display: grid;
  grid-template-columns: minmax(560px, 560px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.excel-top-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.excel-actions-panel {
  border: 1px solid #d6e4f0;
  background: #f8fbff;
  padding: 10px;
}

.excel-company-selector-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.excel-left-pane {
  justify-self: start;
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f4f8fc;
}

.excel-left-table {
  max-width: 500px;
}

.excel-left-table .excel-input-table th:first-child {
  width: 72px;
}

.excel-left-table .form-control,
.excel-left-table .form-select {
  max-width: 98px;
  min-width: 78px;
  padding: 0.2rem 0.35rem;
  font-size: 0.78rem;
}

.excel-company-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.excel-right-pane {
  min-width: 0;
  overflow-x: auto;
}

.excel-company-table th,
.excel-company-table td {
  min-width: 140px;
}

.excel-sub-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  color: #2f4e6f;
  margin: 0.4rem 0;
}

.excel-offer-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 225px;
  gap: 12px;
  width: max-content;
  padding-bottom: 6px;
}

.excel-offer-pane {
  border: 1px solid #d6e4f0;
  background: #fbfdff;
  padding: 8px;
}

.excel-offer-pane .excel-left-table {
  max-width: 100%;
}

.excel-offer-pane .excel-left-table .form-control,
.excel-offer-pane .excel-left-table .form-select {
  max-width: 98px;
  min-width: 78px;
  padding: 0.2rem 0.35rem;
  font-size: 0.78rem;
  height: 28px;
}

.excel-offer-pane .form-control {
  max-width: 200px;
  min-width: 78px;
  padding: 0.2rem 0.35rem;
  font-size: 0.78rem;
  height: 30px;
}

.excel-offer-pane .excel-offer-energy-title {
  font-size: 0.82rem;
  margin-bottom: 0.45rem;
}

.excel-offer-pane .excel-offer-totals-title {
    margin-top: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

.excel-billing-totals-form .form-control,
.excel-billing-totals-form .form-select {
  height: 30px;
}

.excel-vertical-form-compact {
    grid-template-columns: minmax(180px, 320px);
    gap: 8px;
}

.excel-vertical-form-compact .form-control,
.excel-vertical-form-compact .form-select {
  max-width: 180px;
  min-width: 120px;
  height: 30px;
}

.excel-input-table,
.excel-results-table {
  border: 1px solid var(--excel-line);
}

.excel-input-table thead th,
.excel-results-table thead th {
  background: var(--excel-blue-200);
  border-bottom: 1px solid var(--excel-line);
  color: #2d4f73;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.excel-input-table th,
.excel-input-table td,
.excel-results-table th,
.excel-results-table td {
    border: 1px solid #e5edf5;
    vertical-align: middle;
}

.excel-input-table tbody th {
  background: #f7fbff;
  width: 130px;
}

.excel-input-table tbody tr {
  height: 38px;
}

.excel-vertical-form > div,
.excel-vertical-form-compact > div {
  min-height: 56px;
}

.excel-input-table td {
  min-width: 92px;
}

.excel-results-table th,
.excel-results-table td {
  white-space: nowrap;
}

.excel-client-results .excel-results-table {
  border: 0;
}

.excel-client-results .excel-results-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.excel-results-table tbody tr:nth-child(odd) {
  background: #fbfdff;
}

@media (max-width: 900px) {
  .excel-grid-3 {
    grid-template-columns: 1fr;
  }

  .excel-main-grid {
    grid-template-columns: 1fr;
  }

  .excel-client-grid {
    grid-template-columns: 1fr;
  }

  .excel-left-pane {
    position: static;
  }

  .excel-top-grid {
    grid-template-columns: 1fr;
  }

  .excel-right-pane {
    position: static;
  }

  .excel-vertical-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .excel-left-pane {
    min-width: 0;
    width: 100%;
  }

  .excel-left-table {
    max-width: 100%;
  }

  .excel-client-results .excel-results-table th,
  .excel-client-results .excel-results-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .excel-client-results .excel-results-table th:nth-child(1),
  .excel-client-results .excel-results-table td:nth-child(1),
  .excel-client-results .excel-results-table th:nth-child(2),
  .excel-client-results .excel-results-table td:nth-child(2),
  .excel-client-results .excel-results-table th:nth-child(n + 3),
  .excel-client-results .excel-results-table td:nth-child(n + 3) {
    min-width: 0;
  }
}

@media (max-width: 576px) {
  .excel-header-layout,
  .excel-actions-panel .d-flex,
  .excel-card .d-flex.justify-content-between,
  .excel-card .d-flex.align-items-center.justify-content-end {
    display: flex;
    flex-direction: column;
    align-items: stretch !important;
  }

  .excel-header-title {
    text-align: left;
  }

  .excel-left-table .form-control,
  .excel-left-table .form-select,
  .excel-offer-pane .excel-left-table .form-control,
  .excel-offer-pane .excel-left-table .form-select,
  .excel-offer-pane .form-control {
    min-width: 64px;
    max-width: 100%;
    font-size: 0.74rem;
  }

  .excel-input-table thead th,
  .excel-results-table thead th,
  .excel-input-table th,
  .excel-input-table td,
  .excel-results-table th,
  .excel-results-table td {
    padding: 0.35rem;
    font-size: 0.74rem;
  }

  .excel-input-table td {
    min-width: 72px;
  }

  .excel-offer-grid {
    grid-auto-columns: minmax(205px, 82vw);
  }
}
