.flash {
  margin-bottom: 1rem;
  box-shadow: var(--app-shadow-sm);
  border-width: 1px;
}

.flash.alert-success {
  border-left: 0.26rem solid #1cc88a;
}

.flash-info {
  margin-top: 0.75rem;
  border: 1px solid rgba(var(--bs-primary-rgb), 0.35);
  border-left: 0.28rem solid var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), 0.07);
  color: var(--bs-primary-dark);
  border-radius: 0.45rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.94rem;
  font-weight: 600;
}

.entity-modal-dialog {
  max-width: min(1120px, calc(100vw - 1.5rem));
}

#entity-modal .modal-content {
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow);
}

#entity-modal .modal-header {
  border-bottom-color: var(--app-border);
}

#entity-modal .modal-body {
  background: var(--app-bg);
}

#reminder-completion-modal.reminder-completion-modal-stacked {
  z-index: 1070;
}

.modal-backdrop.reminder-completion-backdrop-stacked {
  z-index: 1060;
}

.modal-loading {
  color: var(--app-muted);
  font-weight: 600;
  padding: 0.5rem 0;
}

.import-field-list {
  gap: 0.75rem;
}

.import-field-card {
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  background: #fff;
}

.import-field-card summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
}

.import-field-card-body {
  padding: 0 1rem 1rem;
}

.import-summary-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.import-summary-list div {
  display: grid;
  grid-template-columns: minmax(160px, 0.35fr) 1fr;
  gap: 1rem;
}

.import-summary-list dt,
.import-summary-list dd {
  margin: 0;
}

.app-loading-indicator {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: none;
  align-items: center;
  gap: 0.55rem;
  max-width: min(22rem, calc(100vw - 2rem));
  border: 1px solid var(--app-border-strong);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--app-text);
  box-shadow: var(--app-shadow);
  padding: 0.65rem 0.85rem;
  font-weight: 700;
}

.app-loading-indicator.is-visible {
  display: inline-flex;
}

.loading-spinner {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  border: 0.16rem solid rgba(var(--bs-primary-rgb), 0.24);
  border-top-color: var(--bs-primary);
  border-radius: 999px;
  animation: loading-spinner-rotate 0.75s linear infinite;
}

.button-loading-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
}

.button-loading-content .loading-spinner {
  width: 0.9rem;
  height: 0.9rem;
  border-width: 0.14rem;
  border-color: rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
}

@keyframes loading-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

.archive-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.card > summary::-webkit-details-marker,
.archive-panel summary::-webkit-details-marker {
  display: none;
}

.archive-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(var(--bs-primary-rgb), 0.1);
  color: var(--bs-primary);
  font-size: 0.85rem;
}

.card {
  border: 1px solid var(--app-border);
  border-radius: 0.55rem;
  background: var(--app-surface);
  box-shadow: var(--app-shadow-sm);
  margin-bottom: 1rem;
  padding: 1.1rem;
}

.card-soft {
  background: linear-gradient(180deg, #ffffff 0%, var(--app-surface-soft) 100%);
}

.header-card {
  border-top: 0.25rem solid var(--bs-primary);
}

.hero {
  border-left: 0.25rem solid var(--bs-primary);
  background: linear-gradient(125deg, #ffffff 0%, rgba(var(--bs-primary-rgb), 0.07) 100%);
}

button,
.btn {
  border-radius: 0.42rem;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

button:not(.btn):not(.btn-close) {
  border: 1px solid var(--bs-primary);
  background: var(--bs-primary);
  color: #fff;
  padding: 0.46rem 0.88rem;
  box-shadow: 0 0.1rem 0.35rem rgba(var(--bs-primary-rgb), 0.22);
}

button:not(.btn):not(.btn-close):hover {
  background: var(--bs-primary-dark);
  border-color: var(--bs-primary-dark);
  transform: translateY(-1px);
}

.btn-primary {
  border-color: var(--bs-primary);
  background: var(--bs-primary);
  color: #fff;
}

.btn-primary:hover {
  border-color: var(--bs-primary-dark);
  background: var(--bs-primary-dark);
  color: #fff;
}

.btn-success {
  border-color: #1cc88a;
  background: #1cc88a;
  color: #fff;
}

.btn-success:hover {
  border-color: #17a673;
  background: #17a673;
  color: #fff;
}

.btn-outline-primary {
  border-color: var(--bs-secondary);
  color: var(--bs-secondary);
}

.btn-outline-primary:hover {
  border-color: var(--bs-secondary);
  background: var(--bs-secondary);
  color: #fff;
}

button.secondary,
.btn-secondary {
  border-color: var(--bs-secondary);
  background: var(--bs-secondary);
  color: #fff;
}

button.secondary:hover,
.btn-secondary:hover {
  background: var(--bs-secondary-dark);
  border-color: var(--bs-secondary-dark);
}

button[disabled],
.btn[disabled] {
  opacity: 0.65;
}

.add-button {
  border-color: var(--bs-primary);
  background: var(--bs-primary);
}

.add-button:hover {
  border-color: var(--bs-primary-dark);
  background: var(--bs-primary-dark);
}

.save-button {
  border-color: var(--color-save);
  background: var(--color-save);
}

.save-button:hover {
  border-color: var(--color-save-dark);
  background: var(--color-save-dark);
}

.delete-button {
  border-color: var(--color-delete);
  background: var(--color-delete);
}

.delete-button:hover {
  border-color: var(--color-delete-dark);
  background: var(--color-delete-dark);
}

.icon-button {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.38rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.stats-strip {
  background-color: var(--bs-primary);
  color: #e6efff;
  border-radius: 0.5rem;
  padding: 0.65rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.55rem;
}

.stats-item {
  text-align: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.4rem;
  padding: 0.85rem 0.7rem;
}

.stats-value {
  display: block;
  color: #fff;
  font-size: 1.95rem;
  font-weight: 700;
  line-height: 1.1;
}

.stats-label {
  display: block;
  color: #edf3ff;
  font-size: 0.98rem;
  font-weight: 600;
}

.kpi-meta {
  display: block;
  margin-top: 0.2rem;
  color: var(--app-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.kpi-grid,
.app-grid,
.form-grid,
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.app-grid--2col {
  grid-template-columns: repeat(2, 1fr);
}

.kpi {
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.9rem;
  box-shadow: var(--app-shadow-sm);
}

.kpi .value {
  font-size: 1.45rem;
  line-height: 1.05;
  color: var(--bs-primary);
  font-weight: 700;
  display: block;
}

.selection-list {
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  background: #fff;
  max-height: 320px;
  overflow: auto;
  padding: 0.65rem;
}

.selection-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0.35rem 0;
  padding: 0.62rem 0.7rem;
  border: 1px solid #e0e6f2;
  border-radius: 0.48rem;
  background: #fff;
  font-weight: 600;
  color: var(--app-text-soft);
  cursor: pointer;
}

.selection-item:hover {
  border-color: #b3c2e0;
  background: #f8fbff;
}

.quick-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.quick-link-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border: 1px solid var(--app-border);
  border-radius: 0.55rem;
  padding: 0.95rem 1rem;
  background: linear-gradient(180deg, #fff 0%, var(--app-surface-soft) 100%);
  color: var(--app-text);
  box-shadow: var(--app-shadow-sm);
}

.quick-link-card strong {
  color: var(--bs-primary);
}

.quick-link-card span {
  color: var(--app-muted);
  font-size: 0.92rem;
}

.quick-link-card:hover {
  color: var(--app-text);
  border-color: rgba(var(--bs-primary-rgb), 0.45);
  transform: translateY(-1px);
}

.callout-card {
  display: grid;
  gap: 0.2rem;
  border-radius: 0.55rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--app-border);
}

.callout-card span {
  color: var(--app-muted);
}

.callout-card-warning {
  background: #fff7e9;
  border-color: #f6d79b;
}

.callout-card-info {
  background: rgba(var(--bs-primary-rgb), 0.06);
  border-color: rgba(var(--bs-primary-rgb), 0.28);
}

.list-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--app-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

a.status-pill {
  text-decoration: none;
}

a.status-pill:hover,
a.status-pill:focus-visible {
  text-decoration: none;
  filter: brightness(0.96);
}

.status-pill-primary {
  background: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--bs-primary);
}

.status-pill-success {
  background: #e8faf2;
  color: #0f7b54;
}

.status-pill-warning {
  background: #fff5df;
  color: #9d6a00;
}

.status-pill-secondary,
.status-pill-light {
  background: #eef1f6;
  color: #56657c;
}

.status-pill-info {
  background: #e8f8fb;
  color: #0d7280;
}

.tab-content {
  border-color: var(--app-border) !important;
  background: #fff !important;
  box-shadow: var(--app-shadow-sm);
}
