:root {
  --bg: #0f1419;
  --surface: #171d25;
  --surface-2: #1f2732;
  --border: #2a3441;
  --text: #e7edf4;
  --muted: #8b98a8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top, #152033 0%, var(--bg) 45%);
  color: var(--text);
}

.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 0.875rem; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}
.brand h1 { margin: 0; font-size: 1.15rem; }
.subtitle { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.85rem; }

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.badge {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-auth { background: rgba(34, 197, 94, 0.15); color: var(--success); }

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem 1.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.layout.has-preview { grid-template-columns: 1.2fr 0.8fr; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.panel-header h2 { margin: 0; font-size: 1rem; }
.panel-tools { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.92rem;
}

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

.breadcrumb button:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--muted); }

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font: inherit;
  cursor: pointer;
  transition: 0.15s ease;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }

.drop-zone {
  margin: 1rem;
  padding: 1.5rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  transition: 0.15s ease;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
  color: var(--text);
}

.drop-zone input[type="file"] { display: none; }

.upload-queue {
  margin: 0 1rem 1rem;
  display: grid;
  gap: 0.5rem;
}

.upload-item {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.88rem;
}

.upload-item .bar {
  margin-top: 0.4rem;
  height: 6px;
  background: #111827;
  border-radius: 999px;
  overflow: hidden;
}

.upload-item .bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s ease;
}

.file-list { padding: 0.5rem; }

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
}

.file-row:hover { background: var(--surface-2); border-color: var(--border); }

.file-name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.file-name button {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  background: #111827;
  color: var(--muted);
  flex-shrink: 0;
}

.file-meta { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.file-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

.preview-content {
  padding: 1rem;
  min-height: 240px;
}

.preview-content video,
.preview-content img {
  max-width: 100%;
  border-radius: 8px;
  background: #000;
}

.preview-meta {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.preview-delete {
  margin-top: 0.75rem;
}

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 1.25rem;
  width: min(420px, calc(100vw - 2rem));
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.55); }

dialog form { display: grid; gap: 0.85rem; }
dialog h2 { margin: 0; font-size: 1.1rem; }
dialog label { display: grid; gap: 0.35rem; font-size: 0.88rem; color: var(--muted); }
dialog input {
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

.hint, .error, .warning { margin: 0; font-size: 0.85rem; }
.error { color: #fca5a5; }
.warning { color: #fcd34d; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

.gdrive-status {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.88rem;
}

.gdrive-progress .bar {
  height: 8px;
  background: #111827;
  border-radius: 999px;
  overflow: hidden;
}

.gdrive-progress .bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.gdrive-progress { display: grid; gap: 0.5rem; }

.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
}

#pyramid-summary p { margin: 0.35rem 0; font-size: 0.9rem; }

.channel-fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  margin: 0.75rem 0;
}

.channel-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.channel-checklist {
  display: grid;
  gap: 0.35rem;
  max-height: 10rem;
  overflow-y: auto;
}

.channel-check { margin: 0; }

.share-email code {
  display: block;
  padding: 0.5rem 0.65rem;
  background: #111827;
  border-radius: 6px;
  font-size: 0.82rem;
  word-break: break-all;
  color: #93c5fd;
}

@media (max-width: 960px) {
  .layout.has-preview { grid-template-columns: 1fr; }
  .file-row { grid-template-columns: 1fr; }
  .file-actions { justify-content: flex-start; }
}
