.kcm-attachment-upload-shell {
  display: grid;
  gap: 1rem;
}

[data-kcm-record-attachments-page="1"],
[data-kcm-record-attachments-page="1"] [data-kcm-attachment-upload-root="1"],
[data-kcm-record-attachments-page="1"] [data-kcm-attachment-list="1"],
[data-kcm-record-attachments-page="1"] .kindredbi-list-visual,
[data-kcm-record-attachments-page="1"] .kindredbi-list-visual__frame {
  min-width: 0;
  max-width: 100%;
}

[data-kcm-record-attachments-page="1"] .kindredbi-list-visual__surface {
  max-width: 100%;
  overflow-x: auto;
}

[data-kcm-record-attachments-page="1"] .kindredbi-list-visual__table {
  width: max-content;
  min-width: 100%;
  max-width: none;
  overflow-x: visible;
}

.kcm-attachment-upload-shell__copy,
.kcm-attachment-upload-item,
.kcm-attachment-upload-item__identity {
  display: grid;
  gap: 0.35rem;
}

.kcm-attachment-upload-shell__header,
.kcm-attachment-upload-item__header,
.kcm-attachment-upload-item__meta,
.kcm-attachment-upload-item__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.kcm-attachment-upload-shell__dropzone {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 10rem;
  padding: 1.4rem;
  border: 2px dashed color-mix(in srgb, var(--kcm-color-primary) 24%, var(--kcm-color-border) 76%);
  border-radius: var(--kcm-form-radius-md);
  background: color-mix(in srgb, var(--kcm-color-surface-muted) 24%, var(--kcm-color-surface) 76%);
  cursor: pointer;
  text-align: center;
  overflow-wrap: anywhere;
}

.kcm-attachment-upload-queue {
  display: grid;
  gap: 0.875rem;
  width: 100%;
  max-width: 72rem;
}

.kcm-attachment-upload-item {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--kcm-color-border) 78%, transparent);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--kcm-color-surface) 92%, white 8%);
}

.kcm-attachment-upload-item__state {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
}

.kcm-attachment-upload-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  margin-right: 0.45rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--kcm-color-info) 12%, var(--kcm-color-surface) 88%);
  color: var(--kcm-color-text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kcm-attachment-upload-item__meta {
  color: var(--kcm-color-text-secondary);
  font-size: 0.9rem;
}

.kcm-attachment-upload-item__progress-track {
  min-height: 1rem;
  overflow: hidden;
  width: 100%;
  border-radius: 999px;
  background: color-mix(in srgb, var(--kcm-color-border) 48%, var(--kcm-color-surface) 52%);
}

.kcm-attachment-upload-item__progress-bar {
  height: 100%;
  transition: width 160ms linear;
  width: 0;
  background: linear-gradient(90deg, var(--kcm-color-primary) 0%, color-mix(in srgb, var(--kcm-color-accent) 48%, var(--kcm-color-primary) 52%) 100%);
}

.kcm-attachment-upload-item__error {
  color: var(--kcm-color-danger);
  font-size: 0.92rem;
}

.kcm-attachment-preview-layer[hidden] {
  display: none;
}

.kcm-attachment-preview-layer {
  position: fixed;
  inset: 0;
  z-index: 95;
}

.kcm-attachment-preview-layer__backdrop {
  position: absolute;
  inset: 0;
  display: block;
  border: 0;
  border-radius: 0;
  background: color-mix(in srgb, #08161a 58%, transparent);
  box-shadow: none;
  cursor: pointer;
  min-height: 0;
  padding: 0;
  transform: none;
}

.kcm-attachment-preview-layer__dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(96vw, 78rem);
  height: min(92vh, 92dvh);
  margin: 4vh auto;
  border-radius: 1.25rem;
  overflow: hidden;
  background: var(--kcm-color-surface);
  box-shadow: 0 1.5rem 3rem color-mix(in srgb, #000000 25%, transparent);
}

.kcm-attachment-preview-layer__header,
.kcm-attachment-preview-layer__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.kcm-attachment-preview-layer__header {
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--kcm-color-border) 78%, transparent);
}

.kcm-attachment-preview-layer__copy {
  display: grid;
  gap: 0.35rem;
}

.kcm-attachment-preview-layer__copy h3,
.kcm-attachment-preview-layer__copy p {
  margin: 0;
}

.kcm-attachment-preview-layer__state {
  color: var(--kcm-color-text-secondary);
  font-size: 0.9rem;
}

[data-kcm-preview-state="error"] .kcm-attachment-preview-layer__state {
  color: var(--kcm-color-danger);
  font-weight: 700;
}

.kcm-attachment-preview-layer__body {
  min-height: 0;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--kcm-color-background) 70%, black 30%);
}

.kcm-attachment-preview-layer__frame {
  width: 100%;
  height: 100%;
  min-height: 24rem;
  border: 0;
  border-radius: 0.9rem;
  background: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
  .kcm-attachment-upload-item__progress-bar {
    transition: none;
  }
}

@media (max-width: 767px) {
  .kcm-attachment-upload-shell__header,
  .kcm-attachment-upload-item__header,
  .kcm-attachment-upload-item__meta,
  .kcm-attachment-upload-item__actions,
  .kcm-attachment-preview-layer__header,
  .kcm-attachment-preview-layer__actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .kcm-attachment-preview-layer__dialog {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .kcm-attachment-preview-layer__header {
    padding:
      calc(var(--kcm-safe-area-top, 0px) + 0.9rem)
      1rem
      0.85rem
      1rem;
  }

  .kcm-attachment-preview-layer__body {
    padding:
      0.75rem
      0.75rem
      calc(var(--kcm-safe-area-bottom, 0px) + 0.75rem)
      0.75rem;
  }
}
