.admin-body {
  background-position: center;
}

.admin-body::before {
  background: rgba(9, 15, 27, 0.78);
  backdrop-filter: blur(4px);
}

.admin-shell {
  width: min(1240px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 50px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 96px;
  color: #fff;
}

.admin-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-header-actions a,
.text-button {
  padding: 9px 13px;
  color: inherit;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.auth-card,
.upload-card,
.file-section {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.auth-card {
  width: min(440px, 100%);
  margin: 12vh auto 0;
  padding: clamp(28px, 5vw, 46px);
  border-radius: 24px;
}

.auth-card h1,
.dashboard-heading h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.055em;
  line-height: 1;
}

.auth-card > p:not(.eyebrow),
.dashboard-heading p:not(.eyebrow) {
  color: var(--muted);
}

.auth-card form {
  display: grid;
  gap: 13px;
  margin-top: 28px;
}

label {
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 10px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 48%, transparent);
  outline-offset: 2px;
}

.admin-primary-button {
  min-height: 48px;
  padding: 10px 18px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
}

.admin-primary-button:hover {
  background: var(--accent-strong);
}

.admin-primary-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.form-message {
  min-height: 1.25em;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.form-message.error {
  color: var(--offline);
}

.form-message.success {
  color: var(--online);
}

.dashboard-heading {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 64px 0 28px;
  color: #fff;
}

.dashboard-heading .text-button {
  flex: 0 0 auto;
}

.dashboard-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.upload-card {
  display: grid;
  grid-template-columns: 180px minmax(240px, 1fr) auto auto;
  gap: 16px;
  align-items: end;
  padding: 22px;
  border-radius: 20px;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-group small {
  color: var(--muted);
}

.file-field input {
  padding: 8px;
}

.check-field {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  color: var(--muted);
  white-space: nowrap;
}

.check-field input {
  width: 18px;
  min-height: 18px;
}

.upload-progress,
.upload-card > .form-message {
  grid-column: 1 / -1;
}

.upload-progress {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress progress {
  width: 100%;
  accent-color: var(--accent);
}

.upload-progress span {
  color: var(--muted);
  font-size: 0.78rem;
}

.file-sections {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.file-section {
  overflow: hidden;
  border-radius: 20px;
}

.file-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.file-section-header h2 {
  font-size: 1.1rem;
}

.file-count {
  color: var(--muted);
  font-size: 0.78rem;
}

.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 110px 170px auto;
  gap: 14px;
  align-items: center;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
}

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

.file-name {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: transparent;
  border: 0;
  font-weight: 750;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-trigger {
  cursor: pointer;
}

.file-preview-trigger:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.file-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.small-button {
  padding: 7px 9px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 750;
  cursor: pointer;
}

.small-button.danger {
  color: var(--offline);
}

.small-button.restore {
  color: var(--online);
}

.asset-preview-dialog {
  width: min(680px, calc(100% - 28px));
  max-height: min(86vh, 760px);
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.asset-preview-dialog::backdrop {
  background: rgba(4, 8, 16, 0.78);
  backdrop-filter: blur(5px);
}

.asset-preview-panel {
  display: grid;
  max-height: min(86vh, 760px);
}

.asset-preview-header,
.asset-preview-footer {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
}

.asset-preview-header {
  border-bottom: 1px solid var(--line);
}

.asset-preview-header h2 {
  max-width: min(70vw, 540px);
  margin-top: 3px;
  overflow: hidden;
  font-size: 1.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-preview-header .eyebrow {
  margin: 0;
}

.preview-close {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.asset-preview-content {
  display: grid;
  min-height: 240px;
  padding: clamp(20px, 5vw, 42px);
  overflow: auto;
  place-items: center;
  background: color-mix(in srgb, var(--page) 82%, transparent);
}

.skin-preview-image {
  width: min(384px, 76vw);
  max-height: 54vh;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.38));
}

.flat-skin-preview,
.skin-viewer-shell {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: 100%;
}

.skin-viewer-canvas {
  display: block;
  width: min(360px, 76vw);
  height: auto;
  max-height: 56vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.38);
  cursor: grab;
  touch-action: none;
}

.skin-viewer-canvas:active {
  cursor: grabbing;
}

.skin-viewer-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.audio-preview-player {
  width: min(100%, 540px);
}

.resourcepack-preview {
  max-width: 480px;
  text-align: center;
}

.resourcepack-preview p {
  margin: 0 0 10px;
}

.asset-preview-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.asset-preview-footer .small-button {
  text-decoration: none;
}

.file-empty {
  margin: 0;
  padding: 26px 20px;
  color: var(--muted);
  text-align: center;
}

.asset-history-dialog {
  width: min(860px, calc(100% - 28px));
}

.asset-history-content {
  min-height: 220px;
  padding: 0;
  overflow: auto;
  background: color-mix(in srgb, var(--page) 82%, transparent);
}

.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

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

.history-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.history-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-hash {
  overflow: hidden;
  color: color-mix(in srgb, var(--muted) 82%, transparent);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-restored {
  width: fit-content;
  padding: 3px 7px;
  color: var(--online);
  background: color-mix(in srgb, var(--online) 12%, transparent);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 750;
}

@media (max-width: 850px) {
  .upload-card {
    grid-template-columns: 1fr 1fr;
  }

  .file-field {
    grid-column: 1 / -1;
  }

  .file-row {
    grid-template-columns: minmax(140px, 1fr) 90px auto;
  }

  .file-row .file-meta.modified {
    display: none;
  }
}

@media (max-width: 580px) {
  .admin-shell {
    width: min(100% - 20px, 1240px);
  }

  .brand small,
  .admin-header-actions a {
    display: none;
  }

  .dashboard-heading {
    align-items: flex-start;
    padding-top: 34px;
  }

  .dashboard-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-card {
    grid-template-columns: 1fr;
  }

  .file-field,
  .upload-progress,
  .upload-card > .form-message {
    grid-column: auto;
  }

  .file-row {
    grid-template-columns: minmax(120px, 1fr) auto;
  }

  .file-row .file-meta {
    display: none;
  }

  .history-row {
    grid-template-columns: 1fr;
  }

  .history-row .file-actions {
    justify-content: flex-start;
  }
}
