/* Runway Console — Vercel-style dark admin panel */

:root {
  --bg: #0a0a0c;
  --bg-elev: #111114;
  --bg-hover: #17171b;
  --surface: #131316;
  --border: #1f1f24;
  --border-strong: #2a2a31;
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --text-4: #52525b;

  --accent: #65f0c6;            /* mint — primary */
  --accent-2: #7dd3fc;           /* sky */
  --accent-soft: rgba(101, 240, 198, 0.12);
  --violet: #a78bfa;
  --amber: #fbbf24;
  --rose: #fb7185;
  --emerald: #34d399;
  --red: #f87171;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 0 0 rgba(255,255,255,0.02), 0 8px 32px -8px rgba(0,0,0,0.6);

  --mono: ui-monospace, 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; color: inherit; }

::selection { background: var(--accent-soft); color: var(--accent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a3a42; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(101,240,198,0.08), transparent 60%),
    radial-gradient(1000px 500px at 10% 110%, rgba(125,211,252,0.05), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-card .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: grid; place-items: center;
  color: #0a0a0c;
  font-weight: 700;
  font-size: 13px;
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.2px; }
.login-card h1 { font-size: 20px; font-weight: 600; margin: 4px 0; letter-spacing: -0.4px; }
.login-card p { color: var(--text-3); margin: 0 0 20px 0; font-size: 13px; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { margin: 4px 8px 24px 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px; font-weight: 500;
  transition: background 80ms, color 80ms;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); }
.nav a.active { background: var(--bg-hover); color: var(--text); }
.nav a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px; margin-top: 14px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer a { color: var(--text-3); }
.sidebar-footer a:hover { color: var(--accent); }
.grow { flex: 1 1 auto; }
.muted { color: var(--text-3); }
.text-xs { font-size: 12px; }

/* ---------- Main ---------- */
.main { padding: 28px 32px 60px 32px; min-width: 0; }
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; margin-bottom: 24px;
}
.page-title {
  font-size: 22px; font-weight: 600; letter-spacing: -0.4px;
  margin: 0 0 2px 0;
}
.page-subtitle { font-size: 13px; color: var(--text-3); }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-pad { padding: 20px; }
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.card-actions { display: flex; gap: 8px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat-value.accent { color: var(--accent); }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- Forms / inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.input, .select, .textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 80ms, box-shadow 80ms;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.mono, .textarea.mono { font-family: var(--mono); }
.textarea { min-height: 80px; resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.btn {
  appearance: none; border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text);
  padding: 7px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 80ms, border-color 80ms;
}
.btn:hover { background: var(--bg-hover); border-color: var(--text-4); }
.btn-primary { background: var(--accent); color: #0a0a0c; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: #57e3b8; border-color: #57e3b8; }
.btn-danger { background: transparent; color: var(--rose); border-color: rgba(251,113,133,0.3); }
.btn-danger:hover { background: rgba(251,113,133,0.1); border-color: var(--rose); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }
.btn-xs { padding: 4px 8px; font-size: 12px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
table.t th, table.t td {
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
table.t th {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--text-3);
  background: var(--bg-elev);
  position: sticky; top: 0;
}
table.t tr:last-child td { border-bottom: none; }
table.t tr:hover td { background: var(--bg-hover); }
table.t td.cell-mono { font-family: var(--mono); font-size: 12px; }
.cell-muted { color: var(--text-4); }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.pill-queued     { background: rgba(167,139,250,0.12); color: var(--violet);  border-color: rgba(167,139,250,0.25); }
.pill-uploading  { background: rgba(125,211,252,0.12); color: var(--accent-2);border-color: rgba(125,211,252,0.25); }
.pill-throttled  { background: rgba(251,191,36,0.12);  color: var(--amber);   border-color: rgba(251,191,36,0.25); }
.pill-running    { background: rgba(101,240,198,0.12); color: var(--accent);  border-color: rgba(101,240,198,0.25); }
.pill-succeeded  { background: rgba(52,211,153,0.12);  color: var(--emerald); border-color: rgba(52,211,153,0.25); }
.pill-failed     { background: rgba(248,113,113,0.12); color: var(--red);     border-color: rgba(248,113,113,0.25); }
.pill-canceled   { background: rgba(113,113,122,0.18); color: var(--text-3);  border-color: rgba(113,113,122,0.30); }
.pill-neutral    { background: var(--bg-elev); color: var(--text-3); }
.pill-on         { background: rgba(52,211,153,0.12);  color: var(--emerald); border-color: rgba(52,211,153,0.25); }
.pill-off        { background: rgba(113,113,122,0.18); color: var(--text-3);  border-color: rgba(113,113,122,0.30); }

/* ---------- Flash messages ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash {
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; border: 1px solid transparent;
}
.flash.success { background: rgba(52,211,153,0.08); border-color: rgba(52,211,153,0.25); color: var(--emerald); }
.flash.error   { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.25); color: var(--red); }
.flash.info    { background: rgba(125,211,252,0.08); border-color: rgba(125,211,252,0.25); color: var(--accent-2); }
.flash code { font-family: var(--mono); padding: 0 4px; border-radius: 3px; background: rgba(0,0,0,0.3); }

/* ---------- Filters bar ---------- */
.filters {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px; align-items: end;
}
.filters .field { margin: 0; min-width: 140px; }

/* ---------- Code blocks ---------- */
pre.code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  color: var(--text);
}
code { font-family: var(--mono); font-size: 12px; padding: 2px 5px; border-radius: 3px; background: var(--bg-elev); border: 1px solid var(--border); }

/* ---------- KV blocks (account detail, job detail) ---------- */
.kv {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px 18px;
  font-size: 13px;
}
.kv dt { color: var(--text-3); padding: 6px 0; }
.kv dd { margin: 0; padding: 6px 0; color: var(--text); word-break: break-all; }
.kv dd.mono { font-family: var(--mono); font-size: 12px; }

/* ---------- Misc ---------- */
.flex-row { display: flex; gap: 8px; align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: 8px; }
.row-gap-12 { row-gap: 12px; }
.spacer { height: 16px; }
hr.divider { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.empty {
  padding: 40px 24px; text-align: center;
  color: var(--text-3); font-size: 13px;
}

/* ---------- Detail dialog (jobs.php) ---------- */
.dlg-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: none; place-items: center;
  z-index: 50;
}
.dlg-backdrop.show { display: grid; }
.dlg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(800px, 92vw);
  max-height: 86vh; overflow: auto;
  box-shadow: var(--shadow);
}
.dlg-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.dlg-body { padding: 18px; }
.dlg-close { background: none; border: none; color: var(--text-3); font-size: 18px; cursor: pointer; padding: 4px; }
.dlg-close:hover { color: var(--text); }

/* ---------- Progress bar ---------- */
.progress {
  width: 100px; height: 6px;
  background: var(--bg-elev);
  border-radius: 3px; overflow: hidden;
  display: inline-block; vertical-align: middle;
}
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 200ms ease;
}
