:root {
  color-scheme: light;
  --bg: #f3efe6;
  --panel: #fffdf8;
  --panel-strong: #f5efe4;
  --line: rgba(78, 57, 35, 0.12);
  --text: #2d2118;
  --muted: #7a6a5d;
  --accent: #bd5f2d;
  --accent-strong: #8f3f14;
  --accent-soft: #f4d9c8;
  --shadow: 0 24px 60px rgba(96, 61, 24, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --mono: "SFMono-Regular", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(244, 217, 200, 0.9), transparent 28%),
    linear-gradient(135deg, #efe6d6 0%, #f7f2e8 40%, #efe8dc 100%);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

.admin-shell {
  padding: 24px;
}

.admin-shell-login {
  display: grid;
  place-items: center;
}

.login-layout {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 24px;
  align-items: stretch;
}

.login-hero,
.panel-card,
.sidebar,
.content-card {
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-hero,
.panel-card,
.sidebar,
.content-card {
  border-radius: var(--radius-lg);
}

.login-hero {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-hero h1,
.sidebar h1 {
  margin: 12px 0 16px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.sidebar h1 {
  font-size: clamp(2.2rem, 2.6vw, 3.3rem);
  line-height: 0.92;
  text-wrap: balance;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lead,
.muted,
.form-message,
.session-user {
  color: var(--muted);
}

.login-panel {
  display: grid;
}

.panel-card {
  padding: 36px;
}

.panel-card h2,
.content-card h2 {
  margin: 0 0 20px;
  font-size: 1.5rem;
}

.stack-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.95rem;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid rgba(122, 106, 93, 0.24);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(189, 95, 45, 0.24);
  border-color: var(--accent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

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

.button-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
}

.button-secondary {
  background: var(--panel-strong);
  color: var(--text);
  border: 1px solid var(--line);
}

.button-ghost {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid rgba(189, 95, 45, 0.2);
}

.button-small {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.form-message {
  min-height: 24px;
  margin: 0;
}

.form-message.is-error {
  color: #b42318;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(340px, 380px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sidebar {
  padding: 28px;
  display: grid;
  gap: 24px;
}

.filter-form {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.sidebar-footer {
  display: grid;
  gap: 12px;
  align-self: end;
}

.content {
  display: grid;
  grid-template-columns: minmax(620px, 1.3fr) minmax(420px, 0.95fr);
  gap: 24px;
  min-width: 0;
}

.content-card {
  padding: 24px;
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.card-header h2 {
  margin-bottom: 8px;
}

.tab-group {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.tab-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}

.tab-button:hover {
  transform: translateY(-1px);
}

.tab-button.is-active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
}

.table-wrapper {
  overflow: auto;
  min-width: 0;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.file-table th,
.file-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.file-table th {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.file-table tbody tr {
  transition: background 120ms ease;
}

.file-table tbody tr:hover,
.file-table tbody tr.is-active {
  background: rgba(244, 217, 200, 0.36);
}

.file-name-cell strong {
  font-family: var(--mono);
  font-size: 0.9rem;
  word-break: break-all;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-stage {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #160f0b;
  aspect-ratio: 16 / 10;
}

#preview-meta {
  overflow-wrap: anywhere;
}

.preview-stage video {
  width: 100%;
  height: 100%;
  display: block;
  background: #160f0b;
}

.preview-actions {
  margin-top: 16px;
}

.loading-state,
.empty-state {
  padding: 18px 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .dashboard-layout,
  .content,
  .login-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1480px) {
  .dashboard-layout {
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  }

  .content {
    grid-template-columns: 1fr;
  }

  .preview-card {
    order: -1;
  }
}

@media (max-width: 1280px) {
  .sidebar h1 {
    font-size: clamp(2rem, 4.8vw, 3rem);
  }

  .file-table {
    min-width: 620px;
  }
}

@media (max-width: 720px) {
  .admin-shell {
    padding: 16px;
  }

  .login-hero,
  .panel-card,
  .sidebar,
  .content-card {
    padding: 20px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-actions {
    width: 100%;
  }

  .tab-group {
    width: 100%;
  }

  .tab-button {
    flex: 1;
  }

  .dashboard-layout {
    gap: 16px;
  }

  .content {
    gap: 16px;
  }

  .file-table {
    min-width: 560px;
  }
}
