.panel,
.surface-card,
.link-card,
.report-card,
.settings-spoiler {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.panel {
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.panel--flush {
  padding: 0;
  overflow: hidden;
}

.surface-card,
.link-card,
.report-card,
.settings-spoiler {
  border-radius: var(--radius-lg);
}

.surface-card--soft {
  background: var(--color-surface-soft);
}

.disclosure,
.settings-spoiler {
  margin-bottom: var(--space-4);
  overflow: hidden;
}

.disclosure__summary,
.settings-spoiler-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.disclosure__summary::-webkit-details-marker,
.settings-spoiler-summary::-webkit-details-marker {
  display: none;
}

.disclosure__summary:focus-visible,
.settings-spoiler-summary:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.disclosure__content,
.settings-spoiler-content {
  padding: 0 var(--space-4) var(--space-4);
}

.disclosure__icon,
.settings-spoiler-arrow {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.disclosure[open] .disclosure__icon,
.settings-spoiler[open] .settings-spoiler-arrow {
  transform: rotate(180deg);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.section-heading h2,
.section-heading h3,
.section-heading p {
  margin: 0;
}

.report-meta {
  margin-bottom: var(--space-2);
}

.report-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.report-color-help {
  margin-top: 10px;
  color: var(--color-text-muted);
}

.report-color-help summary {
  width: fit-content;
  color: var(--color-text);
  font-weight: 600;
  cursor: pointer;
}

.report-color-legend {
  display: flex;
  max-width: 980px;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  color: var(--color-text-muted);
}

.report-color-legend-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.report-color-swatch {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.report-color-swatch-yellow {
  background: var(--color-warning-soft);
}

.report-color-swatch-red {
  background: var(--color-danger-soft);
}

.report-color-swatch-neutral {
  background: var(--color-surface-strong);
}

.badge,
.request-status-badge {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-soft);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.badge--square,
.request-status-badge {
  border-radius: var(--radius-sm);
}

.badge--info {
  background: var(--color-info-soft);
  color: var(--color-info);
}

.badge--success {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge--warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge--danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.badge--dynamic,
.request-status-badge {
  background: var(--badge-color, var(--color-text-muted));
  color: var(--color-on-solid);
  box-shadow: var(--shadow-badge);
}

.count-badge {
  display: inline-flex;
  min-width: 27px;
  min-height: 27px;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-soft);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
}

.alert {
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  color: var(--color-text);
  font-size: 13px;
  line-height: 1.45;
}

.alert--warning {
  border-color: var(--color-warning-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.alert--danger {
  border-color: color-mix(in srgb, var(--color-danger-strong) 55%, var(--color-border));
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.alert--success {
  border-color: color-mix(in srgb, var(--color-success-strong) 55%, var(--color-border));
  background: var(--color-success-soft);
  color: var(--color-success);
}

.empty-state {
  padding: 32px 20px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  color: var(--color-text-muted);
  font-size: 13px;
  text-align: center;
}

.link-card-grid,
.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.link-card-grid--stacked,
.report-cards.stacked {
  grid-template-columns: minmax(0, 1fr);
}

.link-card,
.report-card {
  display: block;
  padding: 18px;
  color: var(--color-text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.link-card:hover,
.report-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.link-card__title,
.report-card-title {
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 700;
}

.link-card__description,
.report-card-desc {
  color: var(--color-text-muted);
  font-size: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.pagination-info {
  color: var(--color-text-muted);
  font-size: 13px;
}

.pagination-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pagination .btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.6;
  cursor: not-allowed;
}

.deleted-record-row {
  color: var(--color-text-muted);
}

.deleted-record-label {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.messages {
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.messages li {
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.messages li.success {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.messages li.error {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.loader-backdrop {
  position: fixed;
  z-index: 9999;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--color-overlay);
}

.loader-backdrop.active {
  display: flex;
}

.loader-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
}

.loader-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--color-surface-strong);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.tabs {
  display: flex;
  min-width: 0;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: thin;
}

.tabs__item {
  min-height: 54px;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.tabs__item:hover {
  color: var(--color-text);
}

.tabs__item:focus-visible {
  border-radius: var(--radius-sm);
  outline: 2px solid var(--color-accent);
  outline-offset: -4px;
}

.tabs__item.is-active,
.tabs__item.active {
  border-bottom-color: var(--color-accent);
  color: var(--color-accent);
  font-weight: 650;
}

.tabs--contained {
  padding: 0 28px;
  background: var(--color-surface-soft);
}

.tabs--contained .tabs__item.is-active,
.tabs--contained .tabs__item.active {
  background: var(--color-surface);
  color: var(--color-text);
}

.tabs--pills {
  gap: var(--space-2);
  border-bottom: 0;
  flex-wrap: wrap;
}

.tabs--pills .tabs__item {
  min-height: var(--control-height-md);
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-size: 13px;
}

.tabs--pills .tabs__item.is-active,
.tabs--pills .tabs__item.active {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-on-solid);
}

.tab-panel[hidden] {
  display: none;
}

.select-menu {
  position: relative;
  min-width: 0;
}

.select-menu__toggle {
  display: flex;
  width: 100%;
  min-height: var(--control-height-lg);
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 9px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  background: var(--color-control);
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.select-menu__toggle:hover,
.select-menu__toggle:focus-visible,
.select-menu__search:focus-visible {
  border-color: var(--color-accent);
}

.select-menu__toggle:focus-visible,
.select-menu__search:focus-visible,
.select-menu__option:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 1px;
}

.select-menu__toggle img {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  transition: transform 0.16s ease;
}

.select-menu__toggle[aria-expanded="true"] img {
  transform: rotate(180deg);
}

.select-menu__menu {
  position: absolute;
  z-index: var(--z-dropdown);
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: min(320px, calc(100vw - 40px));
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.select-menu__search {
  display: block;
  width: 100%;
  min-height: 36px;
  margin: 0 0 6px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  background: var(--color-control);
  color: var(--color-text);
  font: inherit;
}

.select-menu__options {
  max-height: 260px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.select-menu__option {
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
}

.select-menu__option:hover,
.select-menu__option:focus-visible {
  background: var(--color-surface-hover);
}

.select-menu__empty {
  padding: 10px;
  color: var(--color-text-muted);
  font-size: 13px;
  text-align: center;
}

.select-menu--compact .select-menu__toggle {
  min-height: 38px;
  padding: 8px 10px;
  border-color: var(--color-border);
  font-size: 14px;
}

.select-menu--compact .select-menu__menu {
  border-radius: var(--radius-md);
}

.select-menu--medium .select-menu__toggle {
  min-height: 40px;
  padding: 9px 10px;
  border-color: var(--color-border);
}

.inline-edit-input,
.inline-edit-row .rate-input,
.inline-edit-row .schedule-input,
.inline-edit-actions .inline-edit-save,
.inline-edit-actions .inline-edit-cancel,
.inline-edit-actions .inline-edit-delete,
.inline-edit-actions .btn-save,
.inline-edit-actions .btn-cancel,
.inline-edit-actions .btn-delete {
  display: none;
}

.inline-edit-row.editing .inline-edit-input,
.inline-edit-row.editing .rate-input,
.inline-edit-row.editing .schedule-input {
  display: inline-block;
}

.inline-edit-row.editing .inline-edit-actions .inline-edit-save,
.inline-edit-row.editing .inline-edit-actions .inline-edit-cancel,
.inline-edit-row.editing .inline-edit-actions .inline-edit-delete,
.inline-edit-row.editing .inline-edit-actions .btn-save,
.inline-edit-row.editing .inline-edit-actions .btn-cancel,
.inline-edit-row.editing .inline-edit-actions .btn-delete {
  display: inline-flex;
}

.inline-edit-row.editing .inline-edit-display,
.inline-edit-row.editing .rate-display,
.inline-edit-row.editing .schedule-display,
.inline-edit-row.editing .inline-edit-actions .inline-edit-start,
.inline-edit-row.editing .inline-edit-actions .btn-edit {
  display: none;
}

.inline-edit-actions {
  white-space: nowrap;
}

:where(img[src$=".svg"]) {
  filter: var(--icon-filter);
}

@media (max-width: 768px) {
  .panel {
    padding: var(--space-4);
    overflow-x: auto;
  }
}

@media (max-width: 560px) {
  .tabs--contained {
    padding: 0 10px;
  }

  .select-menu__menu {
    min-width: 100%;
  }
}
