* { box-sizing: border-box; }

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e3e5e9;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 1.1rem; margin: 0; }

.link { color: var(--primary); text-decoration: none; font-size: 0.9rem; }
.link:hover { text-decoration: underline; }

h2 { font-size: 1.1rem; margin: 24px 0 12px; }

.muted { color: var(--muted); font-weight: normal; }
.small { font-size: 0.85rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 12px 0 4px;
}

input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

select { appearance: auto; }

.mode-toggle {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

.mode-option input { margin-top: 3px; }

#cost-note {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: #fef9c3;
  border-radius: 6px;
  color: #713f12;
}

input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.btn {
  display: inline-block;
  width: 100%;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--muted); cursor: not-allowed; }

.btn-secondary { background: #eef2ff; color: var(--primary-dark); width: auto; margin-top: 8px; }

.error { color: var(--danger); font-size: 0.9rem; }

.job-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  background: #eef2ff;
  border-radius: 8px;
  font-size: 0.9rem;
}

.hidden { display: none; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #c7d2fe;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

.draft-card video {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: #000;
  display: block;
  margin: 0 auto 12px;
}

.draft-card h3 { font-size: 1rem; margin: 0 0 4px; }

.badge {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-top: 8px;
}

.export-list { list-style: none; padding: 0; }
.export-list li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}
.export-list a { color: var(--primary); text-decoration: none; word-break: break-all; }
.export-list a:hover { text-decoration: underline; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 1.3rem; margin: 0 0 8px; text-align: center; }
