:root {
  color-scheme: dark;
  --bg: #0c0d10;
  --panel: #15171c;
  --panel-raised: #1a1d23;
  --line: #2a2e36;
  --text: #f2f3f5;
  --muted: #9ba1ad;
  --accent: #1e3a8a;
  --accent-bright: #1d4ed8;
  --accent-soft: rgb(30 58 138 / 18%);
  --success: #69d49c;
  --warning: #f1c76e;
  --error: #ff827c;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% -10%, var(--accent-soft), transparent 30rem),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 5vw;
  border-bottom: 1px solid var(--line);
  background: rgb(12 13 16 / 86%);
  backdrop-filter: blur(18px);
}

.brand {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand span,
.eyebrow {
  color: var(--accent-bright);
}

.header-actions,
.connection-actions,
.section-heading,
.simple-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-actions form,
.connection-actions form,
.simple-list form {
  margin: 0;
}

.user-label,
.subtle,
.empty-copy {
  color: var(--muted);
}

.user-label {
  font-size: 0.84rem;
}

.page-shell {
  width: min(1180px, 90vw);
  margin: 0 auto;
  padding: 4.5rem 0;
}

.page-heading {
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0.6rem;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.panel,
.auth-card,
.error-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  box-shadow: 0 24px 80px rgb(0 0 0 / 18%);
}

.panel {
  margin-bottom: 1.25rem;
  padding: 1.4rem;
}

.auth-card,
.error-card {
  width: min(100%, 520px);
  margin: 8vh auto 0;
  padding: clamp(1.5rem, 5vw, 3rem);
}

.auth-card h1,
.error-card h1 {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
}

.stack {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.stack.compact {
  margin-top: 1.25rem;
}

label {
  display: grid;
  gap: 0.5rem;
  color: #c9cdd5;
  font-size: 0.83rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 0.85rem;
  border: 1px solid #353a44;
  border-radius: 10px;
  outline: none;
  background: #101216;
  color: var(--text);
  font: inherit;
}

input[type="file"] {
  padding: 0.65rem 0.8rem;
}

.checkbox-list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid #353a44;
  border-radius: 10px;
}

.checkbox-list legend {
  padding: 0 0.35rem;
  color: #c9cdd5;
  font-size: 0.83rem;
  font-weight: 700;
}

.checkbox-list label {
  display: flex;
  align-items: center;
}

.checkbox-list input[type="checkbox"] {
  width: 1rem;
  min-height: 1rem;
  margin: 0;
  accent-color: var(--accent);
}

progress {
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #292d35;
}

progress::-webkit-progress-bar {
  background: #292d35;
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.button-primary {
  background: var(--accent);
  color: white;
}

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

.button-quiet {
  min-height: 34px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.upload-form {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  align-items: end;
  gap: 1rem;
}

.upload-progress {
  grid-column: 1 / -1;
}

.drop-zone {
  padding: 0.75rem;
  border: 1px dashed #353a44;
  border-radius: 10px;
  transition: border-color 120ms ease, background 120ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--accent-bright);
  background: var(--accent-soft);
}

.drop-zone-copy,
.file-selection-message {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.file-selection-message {
  grid-column: 1 / -1;
  margin: 0;
}

.upload-wait-copy {
  display: grid;
  gap: 0.25rem;
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.upload-wait-copy strong {
  color: var(--warning);
}

.upload-progress-copy {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.upload-progress progress {
  display: block;
  width: 100%;
  height: 8px;
}

.queue-dashboard {
  display: grid;
  gap: 1rem;
}

.queue-card h3 {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
}

.queue-details {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0;
}

.queue-details div {
  min-width: 0;
}

.queue-details dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.queue-details dd {
  margin: 0.25rem 0 0;
  overflow: hidden;
  font-size: 0.86rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.simple-list {
  margin: 1.5rem 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.simple-list li {
  min-height: 44px;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}

.simple-list code {
  max-width: 48%;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.list-actions code {
  max-width: 14rem;
}

.admin-account-list {
  margin-bottom: 1.25rem;
}

.editor-accounts {
  display: grid;
  gap: 1rem;
}

.editor-account {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(12 13 16 / 35%);
}

.editor-account-heading,
.password-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.account-control {
  display: grid;
  gap: 0.65rem;
}

.password-field input {
  min-width: 0;
}

.password-eye {
  width: 46px;
  min-width: 46px;
  min-height: 46px;
  border: 1px solid #353a44;
  border-radius: 10px;
  cursor: pointer;
  background: #101216;
  color: var(--text);
  font: inherit;
}

.password-eye:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
}

.password-eye:disabled {
  cursor: wait;
  opacity: 0.6;
}

.tag {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #262a32;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.link-button {
  padding: 0;
  border: 0;
  cursor: pointer;
  background: none;
  color: var(--error);
  font: inherit;
}

.link-button-neutral {
  color: var(--accent-bright);
}

.table-actions {
  display: flex;
  gap: 0.75rem;
  white-space: nowrap;
}

.table-actions form {
  margin: 0;
}

.storage-meter progress {
  width: 100%;
  height: 10px;
}

.section-heading {
  margin-bottom: 1.2rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th,
td {
  padding: 0.85rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.filename {
  max-width: 360px;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-card-list {
  display: grid;
  gap: 0.85rem;
}

.upload-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(12 13 16 / 35%);
}

.upload-card-heading,
.upload-card-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.upload-card-heading time,
.upload-card-destination {
  color: var(--muted);
  font-size: 0.78rem;
}

.upload-card-heading time {
  flex: 0 0 auto;
}

.upload-card-destination {
  margin: 0;
}

.upload-card-status progress {
  width: min(50%, 28rem);
  height: 8px;
}

.status {
  display: inline-flex;
  padding: 0.3rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-uploaded_to_server {
  color: var(--warning);
}

.status-waiting_for_turn,
.status-preparing,
.status-stale,
.status-waiting,
.status-allowed_to_upload_waiting_for_file,
.status-allowed_to_upload,
.status-creating_frameio_file,
.status-uploading_to_server,
.status-waiting_for_frame {
  color: var(--warning);
}

.status-uploading,
.status-verifying,
.status-uploading_to_frame {
  color: var(--accent-bright);
}

.status-uploaded_to_frame,
.status-completed {
  color: var(--success);
}

.status-error,
.status-aborted,
.status-failed {
  color: var(--error);
}

.status-message {
  max-width: 260px;
  margin: 0.45rem 0 0;
  color: var(--error);
  font-size: 0.75rem;
  line-height: 1.35;
}

.notice {
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid;
  border-radius: 10px;
}

.notice-success {
  border-color: rgb(105 212 156 / 50%);
  background: rgb(105 212 156 / 10%);
  color: var(--success);
}

.notice-error {
  border-color: rgb(255 130 124 / 50%);
  background: rgb(255 130 124 / 10%);
  color: var(--error);
}

.empty-state {
  padding: 1.5rem 0;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

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

  .queue-details {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .site-header {
    padding: 0 1rem;
  }

  .page-shell {
    width: calc(100% - 2rem);
    padding: 2.5rem 0;
  }

  .user-label {
    display: none;
  }

  .panel {
    padding: 1rem;
  }

  .queue-details {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .upload-card-heading,
  .upload-card-status {
    align-items: flex-start;
    flex-direction: column;
  }

  .upload-card-status progress {
    width: 100%;
  }
}
