:root {
  --bg: #0f1218;
  --panel: #171c26;
  --panel-soft: #1f2633;
  --text: #e8edf5;
  --muted: #93a0b5;
  --line: #2b3444;
  --accent: #5b8cff;
  --accent-strong: #3f6fe8;
  --ok: #39b67a;
  --warn: #e0a13c;
  --bad: #e05c5c;
  --radius: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR",
    "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  line-height: 1.5;
}

body { min-height: 100vh; }

.site-header {
  padding: 20px 16px 4px;
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.site-header h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.account {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.button.small {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.8rem;
}

.layout {
  display: grid;
  gap: 16px;
  padding: 16px;
  max-width: 1120px;
  margin: 0 auto;
}

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

.panel h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.login-panel {
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}

.login-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

#google-button { min-height: 40px; }

.field {
  display: block;
  margin: 0 0 14px;
  border: 0;
  padding: 0;
}

.field > span,
.field legend {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

input[type="text"]:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

textarea { resize: vertical; min-height: 120px; }

.counter {
  margin: -8px 0 14px;
  text-align: right;
  color: var(--muted);
  font-size: 0.78rem;
}

.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 18px;
  color: var(--text);
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.consent input { margin-top: 3px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { border-color: var(--accent); }

.button.primary {
  width: 100%;
  border-color: transparent;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.button.primary:hover { background: var(--accent-strong); }
.button:disabled { opacity: 0.55; cursor: default; }

.alert {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(224, 92, 92, 0.14);
  color: #ffb3b3;
  font-size: 0.85rem;
}

.list-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.list-head h2 { margin: 0; }

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

.worker.online { color: var(--ok); }
.worker.offline { color: var(--warn); }

.empty {
  margin: 18px 0;
  color: var(--muted);
  text-align: center;
}

.jobs { display: grid; gap: 12px; }

.job-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.job-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.job-title {
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.badge {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(147, 160, 181, 0.16);
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.status-done .badge { background: rgba(57, 182, 122, 0.18); color: #7ee2b4; }
.status-running .badge { background: rgba(91, 140, 255, 0.2); color: #a9c2ff; }
.status-fail .badge,
.status-blocked .badge { background: rgba(224, 92, 92, 0.18); color: #ffb1b1; }
.status-cancelled .badge { background: rgba(224, 161, 60, 0.16); color: #f0c98a; }

.job-meta {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

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

.bar {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #82a7ff);
  transition: width 0.3s ease;
}

.progress-text {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.storyboard {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.84rem;
}

.storyboard li { margin: 3px 0; overflow-wrap: anywhere; }

.job-card video {
  display: block;
  width: 100%;
  margin-top: 12px;
  border-radius: 10px;
  background: #000;
}

.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.job-actions .button { min-height: 36px; }

@media (min-width: 900px) {
  .site-header { padding: 32px 32px 8px; }
  .site-header h1 { font-size: 1.9rem; }
  .layout {
    grid-template-columns: minmax(320px, 5fr) minmax(420px, 7fr);
    align-items: start;
    gap: 24px;
    padding: 24px 32px 48px;
  }
  .panel { padding: 22px; }
  #create-panel { position: sticky; top: 24px; }
}
