/* The shared pieces: cards, buttons, fields, badges, chips, the waiting and empty states, dialogs and notices. */

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.icon-small {
  width: 14px;
  height: 14px;
}

.card {
  min-width: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--line),
    var(--shadow);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}

.card-heading {
  min-width: 0;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.card-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.card-extra {
  flex: none;
}

.card-body {
  padding: 16px 20px 20px;
}

.card-flush > .card-body {
  padding: 12px 0 0;
}

.card-flush > .card-body .toolbar {
  padding: 4px 16px 12px;
}

.card-flush > .card-body > .state {
  padding-bottom: 32px;
}

/* Buttons: ink for the one thing a page asks, a hairline for the rest, red only for what cannot be undone. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-small);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.12s,
    opacity 0.12s;
}

.button:disabled {
  opacity: 0.45;
  cursor: default;
}

.button-small {
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 13px;
}

.button-primary {
  background: var(--button-ink);
  color: var(--button-text);
}

.button-primary:hover:not(:disabled) {
  opacity: 0.88;
}

.button-secondary,
.button-quiet {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  background: var(--surface-hover);
}

.button-danger {
  background: var(--critical);
  color: #ffffff;
}

.button-danger:hover:not(:disabled) {
  opacity: 0.9;
}

.button-danger-quiet {
  background: var(--surface);
  color: var(--critical-ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.button-danger-quiet:hover:not(:disabled) {
  background: var(--critical-soft);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

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

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

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

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

.badge-quiet {
  background: var(--surface-hover);
  color: var(--ink-2);
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}

.chip:hover {
  color: var(--ink);
}

.chip.is-on {
  background: var(--button-ink);
  color: var(--button-text);
  box-shadow: none;
}

.chip-count {
  font-size: 12px;
  opacity: 0.65;
}

/* Pager */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.pager-text {
  font-size: 13px;
  color: var(--ink-3);
}

.pager-buttons {
  display: flex;
  gap: 6px;
}

/* Waiting, empty and failed */
.skeleton {
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    var(--surface-hover) 0%,
    var(--surface-sunk) 50%,
    var(--surface-hover) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

.skeleton-page,
.skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.skeleton-stack {
  padding: 16px;
}

.skeleton-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--gap);
}

.skeleton-row-two {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.skeleton.tile {
  height: 112px;
}

.skeleton.panel {
  height: 260px;
}

.skeleton.line {
  height: 36px;
}

.skeleton.title {
  width: 40%;
  height: 18px;
}

.skeleton.chart {
  height: 220px;
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 20px;
  text-align: center;
}

.state-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: var(--surface-hover);
  color: var(--ink-3);
}

.state-icon .icon {
  width: 22px;
  height: 22px;
}

.state-title {
  font-size: 14.5px;
  font-weight: 600;
}

.state-text {
  max-width: 420px;
  font-size: 13.5px;
  color: var(--ink-3);
}

.state .button {
  margin-top: 10px;
}

.state-error .state-icon {
  background: var(--critical-soft);
  color: var(--critical-ink);
}

.page-body > .state-error,
.list-holder > .state-error {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.inline-error {
  font-size: 13px;
  color: var(--critical-ink);
}

.is-refreshing {
  opacity: 0.55;
  transition: opacity 0.15s;
  pointer-events: none;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ink-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Dialogs */
.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 22px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}

.dialog::backdrop {
  background: rgba(10, 10, 12, 0.4);
}

.dialog-title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.dialog-text {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}

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

.dialog-viewer {
  width: fit-content;
  max-width: calc(100vw - 32px);
  padding: 12px;
  background: var(--surface);
}

/* As large as the screen allows and no larger than the picture; the height leads, since studio pictures are tall. */
.viewer-image {
  width: auto;
  height: min(calc(100vh - 120px), 960px);
  max-width: min(720px, calc(100vw - 56px));
  margin: 0 auto;
  border-radius: 10px;
  object-fit: contain;
}

.viewer-caption {
  padding: 10px 4px 2px;
  font-size: 13px;
  color: var(--ink-2);
}

.viewer-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  cursor: pointer;
}

/* Notices */
.toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

@media (max-width: 860px) {
  .toasts {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
}

.toast {
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--button-ink);
  color: var(--button-text);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lift);
  animation: rise 0.18s ease-out;
  transition: opacity 0.3s;
}

.toast-bad {
  background: var(--critical);
  color: #ffffff;
}

.toast.is-leaving {
  opacity: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Details lists and small text */
.details {
  display: grid;
  gap: 0;
  margin: 0;
}

.details-row {
  display: grid;
  grid-template-columns: minmax(110px, 38%) 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.details-row:last-child {
  border-bottom: 0;
}

.details dt {
  font-size: 13px;
  color: var(--ink-3);
}

.details dd {
  min-width: 0;
  margin: 0;
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

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

.note {
  font-size: 13px;
  color: var(--ink-2);
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.wrap {
  overflow-wrap: anywhere;
}

.order {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

a.order {
  color: var(--accent-ink);
}

.text-bad {
  color: var(--critical-ink);
}

.tone-good {
  color: var(--good-ink);
}

.tone-bad {
  color: var(--critical-ink);
}

.tone-warning {
  color: var(--warning-ink);
}

.tone-neutral {
  color: var(--ink-3);
}

.minor-title {
  margin: 4px 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.stack-gap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.plain-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 550;
}
