.admin-module[data-admin-module="excel"] {
  grid-template-rows: minmax(0, 1fr);
  padding-bottom: 0;
}

.admin-excel-page {
  --excel-brand: #00afe9;
  --excel-danger: #cd140f;
  --excel-success: #03b144;
  --excel-ink: #111827;
  --excel-muted: #667085;
  --excel-line: #e4eaf2;
  --excel-soft: #f7f9fc;
  height: 100%;
  min-height: 0;
  padding: 24px;
  overflow: auto;
  color: var(--excel-ink);
  background: #f7fbff;
}

.admin-excel-page-header,
.admin-excel-section-head,
.admin-excel-history-toolbar,
.admin-excel-summary-row,
.admin-excel-sheet-title,
.admin-excel-inline-checks,
.admin-excel-history-filters,
.admin-excel-row-actions {
  display: flex;
  align-items: center;
}

.admin-excel-page-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.admin-excel-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
}

.admin-excel-admin-badge {
  display: inline-flex;
  min-height: 32px;
  padding: 0 12px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #dce4ee;
  border-radius: 999px;
  color: #475467;
  background: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.admin-excel-admin-badge svg {
  width: 14px;
  height: 14px;
}

.admin-excel-message {
  min-height: 20px;
  margin: -8px 0 12px;
  font-size: 13px;
  line-height: 20px;
}

.admin-excel-message:empty {
  display: none;
}

.admin-excel-message[data-tone="success"] {
  color: var(--excel-success);
}

.admin-excel-message[data-tone="error"] {
  color: var(--excel-danger);
}

.admin-excel-compose-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 356px);
  gap: 16px;
  align-items: start;
}

.admin-excel-card {
  border: 1px solid var(--excel-line);
  border-radius: var(--rect-radius, 8px);
  background: #fff;
  box-shadow: 0 4px 16px rgba(33, 43, 67, 0.04);
}

.admin-excel-settings,
.admin-excel-summary {
  padding: 20px;
}

.admin-excel-summary {
  position: sticky;
  top: 0;
}

.admin-excel-section-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-excel-section-head h4,
.admin-excel-history-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.admin-excel-section-note,
.admin-excel-sheet-note,
.admin-excel-filter-hint {
  color: var(--excel-muted);
  font-size: 12px;
  line-height: 1.5;
}

.admin-excel-setting-block + .admin-excel-setting-block {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #edf1f6;
}

.admin-excel-setting-label {
  display: block;
  margin-bottom: 10px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.admin-excel-period-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--excel-line);
  border-radius: var(--rect-radius, 8px);
  background: var(--excel-soft);
}

.admin-excel-period-row {
  display: grid;
  grid-template-columns: max-content minmax(220px, 1fr);
  align-items: end;
  gap: 12px;
}

.admin-excel-period-button {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  color: #475467;
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.admin-excel-period-button.is-active {
  color: #087fa8;
  background: #fff;
  box-shadow: 0 1px 4px rgba(33, 43, 67, 0.1);
}

.admin-excel-period-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.admin-excel-period-fields.is-month {
  grid-template-columns: minmax(220px, 1fr);
  max-width: 320px;
}

.admin-excel-field {
  display: grid;
  gap: 7px;
}

.admin-excel-field > span {
  color: #475467;
  font-size: 12px;
}

.admin-excel-control {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #d8e0ea;
  border-radius: var(--rect-radius, 8px);
  outline: 0;
  color: #202938;
  background: #fff;
  font: inherit;
  font-size: 13px;
}

.admin-excel-control:focus {
  border-color: var(--excel-brand);
  box-shadow: 0 0 0 3px rgba(0, 175, 233, 0.1);
}

.admin-excel-sheet-title {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.admin-excel-sheet-title .admin-excel-setting-label {
  margin: 0;
}

.admin-excel-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-excel-sheet-option,
.admin-excel-check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.admin-excel-sheet-option {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #dfe6ef;
  border-radius: var(--rect-radius, 8px);
  color: #344054;
  background: #fff;
  font-size: 13px;
}

.admin-excel-sheet-option:has(input:checked) {
  border-color: rgba(0, 175, 233, 0.48);
  background: #eefaff;
}

.admin-excel-sheet-option input[type="checkbox"],
.admin-excel-check-option input[type="checkbox"],
.admin-excel-field-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid #98a2b3;
  border-radius: 3px;
  background-color: #fff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 12px 10px;
}

.admin-excel-sheet-option input[type="checkbox"]:checked,
.admin-excel-check-option input[type="checkbox"]:checked,
.admin-excel-field-option input[type="checkbox"]:checked {
  border-color: var(--excel-brand);
  background-color: var(--excel-brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='12' viewBox='0 0 14 12'%3E%3Cpath d='M2 6l3 3 7-7' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.admin-excel-sheet-option input[type="checkbox"]:checked:disabled,
.admin-excel-check-option input[type="checkbox"]:checked:disabled,
.admin-excel-field-option input[type="checkbox"]:checked:disabled {
  border-color: #d0d5dd;
  background-color: #d0d5dd;
  opacity: 1;
}

.admin-excel-sheet-option input[type="checkbox"]:focus-visible,
.admin-excel-check-option input[type="checkbox"]:focus-visible,
.admin-excel-field-option input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(0, 175, 233, 0.3);
  outline-offset: 2px;
}

.admin-excel-details {
  border: 1px solid #e5ebf2;
  border-radius: var(--rect-radius, 8px);
  background: #fbfcfe;
}

.admin-excel-details summary {
  min-height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.admin-excel-details summary::-webkit-details-marker {
  display: none;
}

.admin-excel-details summary::after {
  content: "+";
  color: #98a2b3;
  font-size: 18px;
  font-weight: 400;
}

.admin-excel-details summary > span {
  margin-left: auto;
  margin-right: 10px;
  color: var(--excel-muted);
  font-size: 12px;
  font-weight: 400;
}

.admin-excel-details[open] summary::after {
  content: "−";
}

.admin-excel-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border-top: 1px solid #e9eef4;
}

.admin-excel-inline-checks {
  min-height: 40px;
  gap: 16px;
}

.admin-excel-check-option {
  color: #475467;
  font-size: 13px;
}

.admin-excel-filter-hint {
  grid-column: 1 / -1;
  margin: 0;
}

.admin-excel-field-groups {
  max-height: 320px;
  padding: 12px;
  overflow-y: auto;
  border-top: 1px solid #e9eef4;
}

.admin-excel-field-group + .admin-excel-field-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #edf1f6;
}

.admin-excel-field-group-head {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.admin-excel-field-group-title {
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.admin-excel-field-group-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-excel-field-group-action {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #d8e0ea;
  border-radius: var(--rect-radius, 8px);
  color: #475467;
  background: #fff;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.admin-excel-field-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 12px;
}

.admin-excel-field-option {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #475467;
  font-size: 12px;
}

.admin-excel-field-option input {
  width: 15px;
  height: 15px;
  margin: 0;
}

.admin-excel-field-required {
  color: #98a2b3;
  font-size: 10px;
}

.admin-excel-summary-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.admin-excel-summary-row {
  justify-content: space-between;
  gap: 16px;
  min-height: 43px;
  border-bottom: 1px solid #edf1f6;
}

.admin-excel-summary-row dt {
  color: var(--excel-muted);
  font-size: 12px;
}

.admin-excel-summary-row dd {
  margin: 0;
  color: var(--excel-muted);
  font-size: 13px;
  font-weight: 400;
  text-align: right;
}

.admin-excel-filename {
  display: grid;
  gap: 6px;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid #dfe6ef;
  border-radius: var(--rect-radius, 8px);
  background: #f8fafc;
}

.admin-excel-filename span {
  color: var(--excel-muted);
  font-size: 12px;
}

.admin-excel-filename strong {
  overflow-wrap: anywhere;
  color: #344054;
  font-size: 13px;
  line-height: 1.55;
}

.admin-excel-generate {
  width: 100%;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--excel-brand);
  border-radius: var(--rect-radius, 8px);
  color: #fff;
  background: var(--excel-brand);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.admin-excel-generate:disabled {
  border-color: #cbd5e1;
  color: #98a2b3;
  background: #eef2f6;
  cursor: not-allowed;
}

.admin-excel-background-note {
  margin: 10px 0 0;
  color: var(--excel-muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.admin-excel-history {
  margin-top: 16px;
  overflow: hidden;
}

.admin-excel-history-toolbar {
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--excel-line);
}

.admin-excel-history-title-wrap {
  display: grid;
  gap: 4px;
}

.admin-excel-history-count {
  color: var(--excel-muted);
  font-size: 12px;
}

.admin-excel-history-filters {
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-excel-history-filters .admin-excel-control {
  width: 138px;
}

.admin-excel-history-filters input[type="search"] {
  width: 210px;
}

.admin-excel-refresh {
  min-width: 40px;
  min-height: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8e0ea;
  border-radius: var(--rect-radius, 8px);
  color: #475467;
  background: #fff;
  cursor: pointer;
}

.admin-excel-refresh svg {
  width: 16px;
  height: 16px;
}

.admin-excel-history-state {
  padding: 10px 20px 0;
  color: var(--excel-muted);
  font-size: 12px;
}

.admin-excel-table-wrap {
  overflow-x: auto;
}

.admin-excel-history-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: fixed;
}

.admin-excel-history-table th,
.admin-excel-history-table td {
  padding: 13px 12px;
  border-bottom: 1px solid #edf1f6;
  color: #475467;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  vertical-align: middle;
}

.admin-excel-history-table th {
  color: #667085;
  background: #f8fafc;
  font-weight: 600;
}

.admin-excel-history-table th:nth-child(1) { width: 260px; }
.admin-excel-history-table th:nth-child(2) { width: 150px; }
.admin-excel-history-table th:nth-child(3) { width: 110px; }
.admin-excel-history-table th:nth-child(4) { width: 150px; }
.admin-excel-history-table th:nth-child(5) { width: 150px; }
.admin-excel-history-table th:nth-child(6) { width: 140px; }
.admin-excel-history-table th:nth-child(7) { width: 220px; }

.admin-excel-file-cell strong,
.admin-excel-file-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-excel-file-cell strong {
  color: #202938;
  font-size: 12px;
  font-weight: 600;
}

.admin-excel-file-cell span {
  margin-top: 4px;
  color: #98a2b3;
  font-size: 11px;
}

.admin-excel-status-stack {
  display: grid;
  gap: 5px;
  justify-items: start;
}

.admin-excel-status {
  display: inline-flex;
  min-height: 26px;
  padding: 0 9px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #475467;
  background: #eef2f6;
  font-size: 11px;
  font-weight: 600;
}

.admin-excel-status.is-completed {
  color: #087fa8;
  background: #e8f8fe;
}

.admin-excel-status.is-generating {
  color: #087b36;
  background: #eaf9f0;
}

.admin-excel-status.is-failed {
  color: var(--excel-danger);
  background: #fff0ee;
}

.admin-excel-progress {
  color: var(--excel-muted);
  font-size: 11px;
}

.admin-excel-progress.is-error {
  color: var(--excel-danger);
}

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

.admin-excel-row-action {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid #d8e0ea;
  border-radius: var(--rect-radius, 8px);
  color: #344054;
  background: #fff;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.admin-excel-row-action.is-danger {
  border-color: rgba(205, 20, 15, 0.25);
  color: var(--excel-danger);
}

.admin-excel-history-empty {
  padding: 32px 20px;
  color: var(--excel-muted);
  font-size: 13px;
  text-align: center;
}

.admin-excel-history-pagination {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--excel-line);
}

.admin-excel-history-pagination[hidden] {
  display: none;
}

.admin-excel-history-pagination button {
  min-width: 64px;
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8e0ea;
  border-radius: var(--rect-radius, 8px);
  color: #344054;
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
}

.admin-excel-history-pagination button:disabled {
  color: #98a2b3;
  background: #f8fafc;
  cursor: not-allowed;
}

.admin-excel-history-pagination span {
  min-width: 48px;
  color: var(--excel-muted);
  font-size: 12px;
  font-weight: 400;
  text-align: center;
}

@media (max-width: 1550px) {
  .admin-excel-compose-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-excel-summary {
    position: static;
  }

  .admin-excel-summary-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .admin-excel-summary-row {
    min-height: 64px;
    padding: 8px 10px;
    display: grid;
    align-content: center;
    border: 1px solid #edf1f6;
    border-radius: var(--rect-radius, 8px);
  }

  .admin-excel-summary-row dd {
    text-align: left;
  }
}

@media (max-width: 1280px) {
  .admin-excel-page {
    padding: 16px;
  }

  .admin-excel-sheet-grid,
  .admin-excel-summary-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-excel-history-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-excel-field-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-excel-history-filters {
    width: 100%;
    justify-content: flex-start;
  }
}
