/* runway console — dark control-plane theme, same structure as the
   account-pool reference console (admin.css), Runway-branded accent. */
:root {
  --bg: #0c0e14;
  --bg-elev: #12151e;
  --card: #161a26;
  --border: #232a3d;
  --text: #e8ecf4;
  --muted: #8b93a8;
  --brand: #b04df2;
  --brand-2: #e5178b;
  --ok: #2ecc8f;
  --warn: #f2b53d;
  --danger: #e5484d;
  --info: #4d9ff5;
  --radius: 10px;
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 70% -10%, #2a1450 0%, var(--bg) 60%);
}
.login-card {
  width: 360px;
  padding: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-card .kicker { margin: 0 0 20px; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.login-card .form-group { margin-bottom: 14px; }
.login-card label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.login-card input {
  width: 100%; padding: 10px 12px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--brand); }
.login-card .msg { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-card .hint { margin-top: 16px; color: var(--muted); font-size: 12px; }

/* Shell */
/* Shell: fluid width so the console uses the full viewport on wide screens
     (previously capped at 1240px and centered, leaving large side gaps).
     Padding scales with the viewport; tables scroll horizontally on narrow
     screens via .table-wrapper's overflow-x. */
.shell {
  width: 100%;
  max-width: none;
  padding: 24px clamp(16px, 3vw, 48px) 60px;
}
.app-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.app-header h1 { margin: 0; font-size: 22px; }
.kicker { color: var(--muted); font-size: 12px; letter-spacing: .12em; margin: 0 0 4px; }
.muted { color: var(--muted); }

.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-btn {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  padding: 10px 16px; font-size: 14px; border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--brand); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; }

.command-band { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.command-band h2 { margin: 0; }

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

button {
  border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 13px;
}
button.secondary { background: #232a3d; color: var(--text); }
button.danger { background: var(--danger); }
button.small { padding: 5px 10px; font-size: 12px; }
button:disabled { opacity: .45; cursor: default; }

input[type=text], input[type=password], input[type=number], input[type=email],
select, textarea {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 8px 10px; font-size: 13px;
}
select.input-select { min-width: 130px; }
textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }

.help { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.msg { color: var(--danger); font-size: 13px; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.token-summary { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.token-summary strong { color: var(--text); }

.operations-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.metric-item {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px;
}
.metric-item span { display: block; color: var(--muted); font-size: 12px; }
.metric-item strong { font-size: 20px; }
.metric-item.warning strong { color: var(--warn); }
.metric-item.danger strong { color: var(--danger); }

.batch-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 14px; font-size: 13px;
}
.batch-toolbar .batch-selection { color: var(--muted); }

.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.empty-state { text-align: center; color: var(--muted); padding: 28px 0; }

/* status badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.badge.active { background: rgba(46,204,143,.16); color: var(--ok); }
.badge.disabled { background: rgba(139,147,168,.16); color: var(--muted); }
.badge.exhausted { background: rgba(242,181,61,.16); color: var(--warn); }
.badge.invalid { background: rgba(229,72,77,.16); color: var(--danger); }
.badge.error { background: rgba(229,72,77,.13); color: #f08388; }
.badge.pending { background: rgba(77,159,245,.15); color: var(--info); }
.badge.succeeded { background: rgba(46,204,143,.16); color: var(--ok); }
.badge.failed { background: rgba(229,72,77,.16); color: var(--danger); }
.badge.running { background: rgba(77,159,245,.15); color: var(--info); }

.quota-ok { color: var(--ok); }
.quota-warning { color: var(--warn); }
.quota-exhausted { color: var(--danger); }

/* pagination */
.logs-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.logs-pagination span { color: var(--muted); font-size: 13px; }

/* config forms */
.config-form .form-group { margin-bottom: 16px; }
.config-form label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.config-form input[type=text], .config-form input[type=password],
.config-form input[type=number], .config-form select { width: 100%; max-width: 480px; }
.config-form textarea { max-width: 640px; }
.config-inline-row { display: flex; gap: 24px; flex-wrap: wrap; }
.config-inline-row .form-group { flex: 1; min-width: 220px; }
.config-cat-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.config-cat-btn {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--muted);
  border-radius: 20px; padding: 6px 14px; font-size: 13px;
}
.config-cat-btn.active { color: var(--text); border-color: var(--brand); }
.config-cat-pane { display: none; }
.config-cat-pane.active { display: block; }

/* stats grid for logs */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 600; }

/* playground */
.play-form { display: grid; grid-template-columns: 1fr; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }
.ref-list { margin-top: 8px; }
.ref-item { display: flex; align-items: center; gap: 8px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin-bottom: 6px; font-size: 13px; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: #000; }
.task-card { display: flex; gap: 14px; align-items: flex-start; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 10px; }
.task-card .thumb { width: 96px; height: 96px; flex: none; }
.task-info { flex: 1; min-width: 0; }
.task-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-prompt { color: var(--muted); font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }
.progress-bar { height: 6px; background: var(--bg); border-radius: 6px; margin-top: 8px; overflow: hidden; }
.progress-bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .6s; }

/* modals */
.dialog-modal, .preview-modal {
  display: none; position: fixed; inset: 0; z-index: 50;
  background: rgba(6,8,14,.72); align-items: flex-start; justify-content: center; padding: 40px 16px;
}
.dialog-modal.open, .preview-modal.open { display: flex; }
.dialog-card {
  width: 560px; max-width: 100%; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
/* multi-select account list in the bind modal */
.bind-account-list {
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); padding: 6px;
}
.bind-account-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.bind-account-item:hover { background: var(--card); }
.bind-account-item .help { margin: 0; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* dev docs tab */
.docs { max-width: 960px; }
.docs h3 { margin: 22px 0 8px; font-size: 14px; }
.docs p, .docs li { font-size: 13px; color: var(--text); }
.docs code {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-size: 12px; font-family: ui-monospace, Menlo, monospace;
}
.docs pre {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; font-size: 12px; line-height: 1.6;
  font-family: ui-monospace, Menlo, monospace; color: var(--text);
}
.docs table { font-size: 12.5px; }
.docs th { font-size: 12px; }
.docs .ok-fields strong { color: var(--ok); }
.docs .warn-note {
  border-left: 3px solid var(--warn); background: rgba(242,181,61,.08);
  padding: 8px 12px; border-radius: 6px; font-size: 12.5px; color: var(--muted);
}
.preview-modal-dialog { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; max-width: 960px; max-height: 90vh; overflow: auto; }
.preview-modal-dialog img, .preview-modal-dialog video { max-width: 100%; border-radius: 8px; }
.preview-actions { margin-top: 12px; display: flex; gap: 10px; }
.preview-download { display: inline-block; background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 8px; padding: 8px 14px; font-size: 13px; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elev); border: 1px solid var(--border); border-left: 3px solid var(--brand);
  color: var(--text); padding: 10px 18px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4); display: none; z-index: 100; max-width: 80vw;
}

/* Narrow screens: stack instead of squeeze; wide tables keep their own
   horizontal scroll from .table-wrapper. */
@media (max-width: 720px) {
  .shell { padding: 18px 14px 48px; }
  .app-header { flex-wrap: wrap; }
  .tabs { flex-wrap: wrap; }
  .dialog-card { padding: 16px; }
}