:root {
  --bg: #0e1116;
  --bg-elev: #161b22;
  --bg-elev2: #1f262f;
  --line: #2a313c;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #ff7a59;
  --accent-2: #4cc2ff;
  --ok: #3fb950;
  --err: #ff6b6b;
  --warn: #d29922;
  --radius: 10px;
  --shadow: 0 4px 12px rgba(0,0,0,0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.brand h1 { margin: 0; font-size: 16px; letter-spacing: 0.3px; }
.top-nav { display: flex; gap: 12px; align-items: center; }
.top-nav a { color: var(--text-dim); padding: 4px 10px; border-radius: 6px; }
.top-nav a:hover { color: var(--text); background: var(--bg-elev2); text-decoration: none; }
.who { color: var(--text-dim); font-size: 13px; }

button {
  font: inherit; cursor: pointer; border: 1px solid transparent;
  border-radius: 6px; padding: 7px 14px; transition: all .12s ease;
}
button.primary {
  background: var(--accent); color: #111; font-weight: 600; border-color: var(--accent);
}
button.primary:hover { filter: brightness(1.08); }
button.ghost {
  background: transparent; color: var(--text-dim); border-color: var(--line);
}
button.ghost:hover { color: var(--text); border-color: var(--text-dim); }
button.ghost.small { padding: 4px 10px; font-size: 12px; }

.container { max-width: 860px; margin: 32px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 20px; }

.card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h2 { margin: 0; font-size: 14px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab {
  background: transparent; color: var(--text-dim); border: none;
  padding: 8px 12px; border-bottom: 2px solid transparent; border-radius: 0;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.drop-zone {
  display: block; border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 36px; text-align: center; cursor: pointer; transition: all .15s ease;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--accent); background: rgba(255,122,89,0.04); }
.drop-inner strong { display: block; margin-bottom: 6px; }
.drop-inner small { color: var(--text-dim); }

input[type="text"], input[type="password"] {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 9px 12px; color: var(--text); font: inherit;
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: none; border-color: var(--accent-2);
}
#panel-youtube { display: flex; gap: 10px; }
#panel-youtube input { flex: 1; }

.model-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.model-row label { color: var(--text-dim); font-size: 13px; }
.model-row select {
  flex: 1; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px;
}

.job-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.job-id { color: var(--text-dim); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.progress { background: var(--bg); border-radius: 6px; height: 8px; overflow: hidden; }
.progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  height: 100%; width: 0%; transition: width .3s ease;
}
.job-message { color: var(--text-dim); margin: 8px 0 0; font-size: 13px; }
.job-error { color: var(--err); font-size: 13px; margin: 8px 0 0; }
.link { color: var(--accent); }

.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list .empty { color: var(--text-dim); padding: 8px 0; font-size: 13px; }
/* Recent list */
.recent-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.recent-row:first-child { border-top: none; }
.r-title { display: flex; flex-direction: column; gap: 2px; }
.r-meta { color: var(--text-dim); font-size: 12px; }
.r-when { color: var(--text-dim); }

.muted { color: var(--text-dim); font-size: 13px; }
.badge {
  display: inline-block; padding: 1px 8px; margin-left: 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px;
  border-radius: 10px; vertical-align: middle;
  background: var(--bg); color: var(--text-dim); border: 1px solid var(--line);
}
.badge.shared { color: var(--accent-2); border-color: rgba(93,184,255,0.4); }
.badge.role-admin  { color: #ffd86b; border-color: rgba(255,216,107,0.4); }
.badge.role-user   { color: var(--text-dim); }
.badge.role-viewer { color: var(--accent-2); border-color: rgba(93,184,255,0.4); }

/* Multi-file queue: a stack of progress cards */
.progress-list { display: flex; flex-direction: column; gap: 10px; }
.progress-list:empty { display: none; }
.progress-card .job-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.progress-card .job-id { color: var(--text-dim); font-family: ui-monospace, monospace; font-size: 11px; }
.progress-card .job-dismiss {
  margin-left: auto; padding: 0 8px; font-size: 16px; line-height: 1.4;
}
.ip { color: var(--accent-2); font-family: ui-monospace, monospace; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 4px; }
.tag.err { background: rgba(255,107,107,0.15); color: var(--err); }
.tag.run { background: rgba(76,194,255,0.15); color: var(--accent-2); }

/* Modal */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: grid; place-items: center; z-index: 100;
}
.modal-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; width: 360px;
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 4px; font-size: 18px; }
.modal-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 16px; }
.modal-card input { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
