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

.muted {
  color: var(--muted);
}

.notice {
  margin-bottom: 14px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: #fff7f7;
  color: var(--red);
  padding: 10px 12px;
  font-weight: 600;
}

.empty {
  padding: 42px 16px;
  color: var(--muted);
  text-align: center;
}

.empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--dark);
}

.toolbar-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 34px;
  padding: 4px 32px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background-color: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease;
}

.toolbar-select:hover {
  border-color: #b8c0cc;
}

.toolbar-select:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.table-note {
  margin: 12px 18px;
  color: var(--muted);
  font-size: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 12px 18px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pagination-input {
  width: 52px;
  min-height: 0;
  padding: 4px 6px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  appearance: textfield;
}

.pagination-input::-webkit-outer-spin-button,
.pagination-input::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--backdrop);
  padding: 24px;
  backdrop-filter: blur(2px);
  animation: fade-in 140ms ease;
  overflow-y: auto;
}

.modal {
  width: min(440px, 100%);
  border-radius: 12px;
  background: var(--panel);
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  animation: pop-in 140ms ease;
}

.modal-form {
  width: min(960px, calc(100vw - 48px));
  padding: 0;
  overflow: hidden;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  margin: 0 0 4px;
  color: var(--dark);
  font-size: 17px;
  font-weight: 700;
}

.modal-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.modal-body {
  display: grid;
  gap: 18px;
  padding: 18px 22px;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.confirm-modal {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  width: min(440px, 100%);
  border-radius: 12px;
  background: var(--panel);
  padding: 22px 24px 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  animation: pop-in 140ms ease;
}

.confirm-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  /* Fallback so the masked ::after glyph stays visible if no tone class is applied. */
  color: var(--red);
}

.confirm-icon::after {
  content: "";
  width: 22px;
  height: 22px;
  background: currentColor;
  -webkit-mask: var(--confirm-icon-url) center / 22px no-repeat;
  mask: var(--confirm-icon-url) center / 22px no-repeat;
}

.confirm-icon-danger {
  --confirm-icon-url: url("/admin-ui/icons/trash.svg");
  background: #fdecea;
  color: var(--red);
}

.confirm-icon-primary {
  --confirm-icon-url: url("/admin-ui/icons/check.svg");
  background: var(--green-soft);
  color: var(--green);
}

.confirm-body {
  min-width: 0;
}

.confirm-title {
  margin: 2px 0 6px;
  color: var(--dark);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.confirm-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.confirm-actions button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 110;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  background: var(--dark);
  color: #ffffff;
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  font-size: 13px;
  font-weight: 500;
  animation: toast-in 200ms ease;
}

.toast::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-soft);
}

.toast-success::before {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

.toast-error {
  background: var(--red);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.modal-alert {
  margin: 14px 22px 0;
  padding: 10px 12px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: #fff7f7;
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.modal-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.modal-toolbar-spacer {
  flex: 1 1 auto;
}

.modal-preview-body {
  padding: 0;
  overflow-y: auto;
}

.modal-preview-body .table-wrap {
  max-height: 60vh;
  overflow: auto;
}

.modal-preview-body .table-note {
  margin: 12px 22px;
}

.icon-close {
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

.form-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.form-section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.match-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 360px);
  align-items: end;
  gap: 12px;
}

.match-picker-search,
.match-picker-id {
  min-width: 0;
}

.match-picker-or {
  position: relative;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.match-picker-or span {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

@media (max-width: 720px) {
  .match-picker {
    grid-template-columns: 1fr;
  }
  .match-picker-or {
    height: auto;
    justify-content: flex-start;
  }
}

.combobox {
  position: relative;
}

.combobox-input {
  width: 100%;
}

.combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  max-height: 280px;
  overflow-y: auto;
}

.combobox-item {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.combobox-item:hover,
.combobox-item-active {
  background: var(--panel-soft);
}

.combobox-item-name {
  color: var(--dark);
  font-weight: 600;
}

.combobox-item-meta {
  color: var(--muted);
  font-size: 12px;
}

.combobox-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.combobox-help {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.combobox-selected {
  margin-top: 4px;
  color: var(--green);
  font-size: 12.5px;
  font-weight: 500;
}

.combobox-selected:empty {
  display: none;
}

.form-hint {
  color: var(--muted-soft);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* Not a scrollable data table, so it must ignore the global table min-width. */
.baseline-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.baseline-table thead th {
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
}

.baseline-table thead th.numeric {
  width: 30%;
  text-align: left;
}

.baseline-table tbody td {
  border-bottom: 1px solid var(--line-soft);
  padding: 7px 12px;
}

.baseline-table tbody tr:last-child td {
  border-bottom: 0;
}

.baseline-table .baseline-name-cell {
  color: var(--dark);
  font-weight: 600;
  white-space: nowrap;
}

.baseline-table input {
  min-height: 34px;
  padding: 6px 10px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 680px) {
  .baseline-table thead th,
  .baseline-table tbody td {
    padding: 8px;
  }

  .baseline-table thead th.numeric {
    width: 32%;
  }

  .baseline-table .baseline-name-cell {
    white-space: normal;
  }

  .baseline-table input {
    padding: 6px 8px;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
