/* Gradlog — Modern Dashboard Styles */

/* --- Tokens -------------------------------------------------------- */
:root {
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --bg: #f8f9fb;
  --surface: #fff;
  --surface-alt: #f3f4f6;
  --surface-hover: #eef0f3;
  --border: #e5e7eb;
  --border-hover: #d1d5db;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --accent: #4f46e5;
  --accent-h: #4338ca;
  --accent-bg: rgba(79, 70, 229, .06);
  --accent-ring: rgba(79, 70, 229, .18);
  --green: #059669;
  --green-bg: rgba(5, 150, 105, .08);
  --red: #dc2626;
  --red-bg: rgba(220, 38, 38, .06);
  --amber: #d97706;
  --amber-bg: rgba(217, 119, 6, .08);
  --blue: #2563eb;
  --blue-bg: rgba(37, 99, 235, .06);
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.03);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --topbar-h: 52px;
  --chart-line-1: #4f46e5;
  --chart-line-2: #059669;
  --chart-line-3: #d97706;
  --chart-line-4: #dc2626;
  --chart-line-5: #2563eb;
  --chart-line-6: #7c3aed;
  --toast-bg: #111827;
  --toast-fg: #ffffff;
  --toast-error-bg: #dc2626;
}

[data-theme="dark"] {
  --bg: #0a0a0f;
  --surface: #141419;
  --surface-alt: #1c1c24;
  --surface-hover: #24242e;
  --border: #2a2a35;
  --border-hover: #3a3a48;
  --text: #f0f0f5;
  --text-2: #a0a0b0;
  --text-3: #606070;
  --accent: #818cf8;
  --accent-h: #a5b4fc;
  --accent-bg: rgba(129, 140, 248, .1);
  --accent-ring: rgba(129, 140, 248, .2);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, .1);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, .08);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, .1);
  --blue: #60a5fa;
  --blue-bg: rgba(96, 165, 250, .08);
  --shadow-xs: 0 1px 2px rgba(0,0,0,.2);
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.4);
  --chart-line-1: #818cf8;
  --chart-line-2: #34d399;
  --chart-line-3: #fbbf24;
  --chart-line-4: #f87171;
  --chart-line-5: #60a5fa;
  --chart-line-6: #a78bfa;
  --toast-bg: #0b0b10;
  --toast-fg: #f5f5ff;
  --toast-error-bg: #ef4444;
}

/* --- Reset --------------------------------------------------------- */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{height:100%;overflow:hidden;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
body{height:100%;overflow:hidden;font-family:var(--font);font-size:13px;line-height:1.5;color:var(--text);background:var(--bg)}
ul{list-style:none}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}

/* --- Auth ---------------------------------------------------------- */
.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(253, 186, 59, .28), transparent 28%),
    radial-gradient(circle at bottom left, rgba(14, 165, 233, .24), transparent 34%),
    linear-gradient(145deg, #f4f7fb 0%, #eef2ff 46%, #f8fafc 100%);
}
[data-theme="dark"] .auth-screen {
  background:
    radial-gradient(circle at top left, rgba(253, 186, 59, .14), transparent 24%),
    radial-gradient(circle at bottom left, rgba(14, 165, 233, .14), transparent 30%),
    linear-gradient(145deg, #080b14 0%, #0f172a 46%, #111827 100%);
}
.auth-card {
  width: 100%;
  max-width: 460px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 84%, white);
  border-radius: 24px;
  padding: 42px 36px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  backdrop-filter: blur(18px);
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;
}
.auth-logo-mark {
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 10px 22px rgba(15, 23, 42, .18));
}
.auth-logo-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.auth-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.auth-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--text);
}
.auth-subtitle {
  color: var(--text-2);
  font-size: 14px;
  margin: 0 0 28px;
}
.auth-body { display: flex; flex-direction: column; gap: 14px; }
.auth-repo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 120ms ease;
}
.auth-repo-link:hover {
  background: var(--surface-alt);
  border-color: var(--border-hover);
  color: var(--text);
}
.auth-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--red);
  min-height: 18px;
}

/* --- Buttons ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 12px;
  border: none;
  border-radius: var(--r);
  padding: 7px 14px;
  cursor: pointer;
  transition: all 120ms ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary { background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent-ring); }
.btn-secondary:hover { background: var(--accent-ring); }
.btn-ghost { background: none; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-alt); border-color: var(--border-hover); color: var(--text); }
.btn.is-loading { opacity: .85; cursor: wait; }
.btn:disabled { opacity: .65; cursor: not-allowed; }
.spin { animation: spin 900ms linear infinite; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-full { width: 100%; }

/* --- Inputs -------------------------------------------------------- */
input, textarea, select {
  width: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 12px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
textarea { resize: vertical; min-height: 48px; }
select { cursor: pointer; }
.select-sm { padding: 5px 8px; font-size: 12px; width: auto; min-width: 100px; }

/* --- Icon buttons -------------------------------------------------- */
.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  transition: all 120ms;
}
.icon-btn:hover { background: var(--surface-alt); border-color: var(--border-hover); color: var(--text); }
.icon-btn-sm {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  transition: all 120ms;
}
.icon-btn-sm:hover { background: var(--accent-bg); border-color: var(--accent-ring); color: var(--accent); }
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* --- App shell ----------------------------------------------------- */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

/* --- Top bar ------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-logo {
  width: 24px;
  height: 24px;
  display: block;
}
.topbar-brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--accent);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* --- User menu ----------------------------------------------------- */
.user-menu { position: relative; }
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: all 120ms;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
}
.user-menu-btn:hover { background: var(--surface-alt); border-color: var(--border-hover); }
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--accent-bg);
}
.user-name { font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
}
.dropdown-header { padding: 12px 14px; }
.dropdown-email { font-size: 12px; color: var(--text-2); }
.dropdown-divider { height: 1px; background: var(--border); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 80ms;
}
.dropdown-item:hover { background: var(--surface-alt); }
.dropdown-item-danger { color: var(--red); }
.dropdown-item-danger:hover { background: var(--red-bg); }

/* --- Badge --------------------------------------------------------- */
.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.badge-offline { background: var(--red-bg); color: var(--red); }
.badge-online { background: var(--green-bg); color: var(--green); }

/* --- App body ------------------------------------------------------ */
.app-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* --- Sidebar ------------------------------------------------------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: all 120ms;
  border-bottom: 2px solid transparent;
}
.sidebar-tab:hover { color: var(--text-2); background: var(--surface-alt); }
.sidebar-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sidebar-tab-content { display: none; flex: 1; overflow-y: auto; }
.sidebar-tab-content.active { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }

.sidebar-panel {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-panel:last-child { border-bottom: none; }
.sidebar-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
}

/* --- Sidebar forms ------------------------------------------------- */
.sf-wrap { margin-bottom: 8px; }
.sf {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.sf-actions { display: flex; gap: 6px; }

/* --- Settings nav -------------------------------------------------- */
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 80ms;
}
.settings-nav-btn:hover { background: var(--surface-alt); color: var(--text); }
.settings-nav-btn.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

/* --- Nav list ------------------------------------------------------ */
.nav-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 220px;
  overflow-y: auto;
}
.nav-list::-webkit-scrollbar { width: 4px; }
.nav-list::-webkit-scrollbar-track { background: transparent; }
.nav-list::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 999px; }

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 80ms;
}
.item-row:hover { background: var(--surface-alt); }
.item-row.active { background: var(--accent-bg); }
.item-row.active .item-label { color: var(--accent); font-weight: 600; }
.item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  text-align: left;
}
.item-label:hover { color: var(--text); }
.item-action-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  flex-shrink: 0;
}
.item-action-btn:hover {
  color: var(--red);
  border-color: var(--red-bg);
  background: var(--red-bg);
}
.hint { color: var(--text-3); font-size: 11px; padding: 6px 8px; font-style: italic; }

/* --- Content ------------------------------------------------------- */
.content {
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.view { display: none; flex-direction: column; gap: 16px; }
.view.active { display: flex; }

/* --- Content header ------------------------------------------------ */
.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.content-header-left { display: flex; flex-direction: column; gap: 2px; }
.content-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.content-subtitle { font-size: 13px; color: var(--text-3); }
.content-header-right { display: flex; align-items: center; gap: 8px; }
.inline-form { display: flex; align-items: center; gap: 6px; }

/* --- Scope banners ------------------------------------------------- */
.scope-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.scope-project { background: var(--accent-bg); border-color: var(--accent-ring); }
.scope-account { background: var(--blue-bg); border-color: rgba(37, 99, 235, .12); }
.scope-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
}
.scope-banner strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.scope-note {
  font-size: 12px;
  color: var(--text-2);
}

/* --- Run info grid ------------------------------------------------- */
.run-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}
.info-card-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-bottom: 4px;
}
.info-card-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.info-card-value.mono { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--text-2); word-break: break-all; }

/* --- Params/Tags row ----------------------------------------------- */
.params-tags-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 12px;
}
.kv-key { font-weight: 600; color: var(--text-2); }
.kv-val { font-family: var(--mono); font-size: 11px; color: var(--text); word-break: break-all; }

/* --- Card ---------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}
.card-compact { padding: 14px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
}
.card-title-sm {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 8px;
}

/* --- Charts -------------------------------------------------------- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}
.chart-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
}
.chart-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}
.chart-canvas-wrap {
  position: relative;
  height: 220px;
}
.chart-canvas-wrap canvas { width: 100% !important; height: 100% !important; }

/* --- Metrics table ------------------------------------------------- */
.metrics-table-section { margin-top: 8px; }
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl thead { background: var(--surface-alt); }
.tbl th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--surface-alt); }

/* --- Artifacts ----------------------------------------------------- */
.artifact-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.artifact-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: all 80ms;
}
.artifact-row:hover { background: var(--surface-alt); border-color: var(--border-hover); }
.artifact-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-bg);
  color: var(--accent);
  flex-shrink: 0;
}
.artifact-info { flex: 1; min-width: 0; }
.artifact-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.artifact-meta { font-size: 11px; color: var(--text-3); }
.artifact-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* --- Upload -------------------------------------------------------- */
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px dashed var(--border-hover);
  border-radius: var(--r);
  background: var(--surface-alt);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms;
}
.upload-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.upload-progress { margin-bottom: 12px; }
.upload-progress-bar {
  height: 4px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}
.upload-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0%;
  transition: width 200ms;
}
.upload-text { font-size: 11px; color: var(--text-3); }

/* --- Download -------------------------------------------------------- */
.download-progress { margin-bottom: 12px; }
.download-progress-bar {
  height: 4px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}
.download-bar {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  width: 0%;
  transition: width 200ms;
}
.download-text { font-size: 11px; color: var(--text-3); }

/* --- Members ------------------------------------------------------- */
.member-form { margin-bottom: 16px; }
.member-form-row { display: flex; gap: 8px; align-items: center; }
.member-form-row input { flex: 1; }
.member-form-row select { width: auto; min-width: 100px; }
.member-list { display: flex; flex-direction: column; gap: 4px; }
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.member-row:hover { background: var(--surface-alt); }
.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--accent-bg);
}
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 13px; font-weight: 500; color: var(--text); }
.member-email { font-size: 11px; color: var(--text-3); }
.member-role {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 999px;
}
.role-owner { background: var(--accent-bg); color: var(--accent); }
.role-admin { background: var(--amber-bg); color: var(--amber); }
.role-member { background: var(--green-bg); color: var(--green); }
.role-viewer { background: var(--blue-bg); color: var(--blue); }
.member-action-btn { min-width: 72px; }
.member-action-leave {
  color: var(--blue);
  border-color: rgba(37, 99, 235, .14);
}
.member-action-leave:hover {
  background: var(--blue-bg);
  border-color: rgba(37, 99, 235, .2);
  color: var(--blue);
}

/* --- API Keys ------------------------------------------------------ */
.apikey-form { margin-bottom: 16px; }
.apikey-form-row { display: flex; gap: 8px; align-items: center; }
.apikey-form-row input { flex: 1; }
.new-key-box {
  background: var(--green-bg);
  border: 1px solid rgba(5, 150, 105, .2);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.new-key-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--green);
  margin-bottom: 8px;
}
.new-key-value {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.new-key-value code {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}
.apikey-list { display: flex; flex-direction: column; gap: 4px; }
.apikey-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.apikey-row:hover { background: var(--surface-alt); }
.apikey-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-bg);
  color: var(--accent);
  flex-shrink: 0;
}
.apikey-info { flex: 1; min-width: 0; }
.apikey-name { font-size: 13px; font-weight: 500; color: var(--text); }
.apikey-meta { font-size: 11px; color: var(--text-3); }

/* --- Status pill --------------------------------------------------- */
.status-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.status-running { background: var(--accent-bg); color: var(--accent); }
.status-completed { background: var(--green-bg); color: var(--green); }
.status-failed { background: var(--red-bg); color: var(--red); }
.status-killed { background: var(--amber-bg); color: var(--amber); }

/* --- Modal --------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 150ms ease;
}
.modal-header { margin-bottom: 12px; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-message { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.artifact-preview-modal {
  max-width: min(92vw, 980px);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
}
.artifact-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.artifact-preview-modal-body {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background:
    linear-gradient(45deg, transparent 25%, rgba(148, 163, 184, .12) 25%, rgba(148, 163, 184, .12) 50%, transparent 50%, transparent 75%, rgba(148, 163, 184, .12) 75%),
    var(--surface-alt);
  background-size: 16px 16px;
  overflow: auto;
}
.artifact-preview-modal-body img {
  display: block;
  max-width: 100%;
  max-height: calc(88vh - 180px);
  object-fit: contain;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.artifact-preview-modal-loading,
.artifact-preview-modal-error {
  min-height: 220px;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  font-size: 13px;
}
.artifact-preview-modal-loading { color: var(--text-3); }
.artifact-preview-modal-error { color: var(--red); }

/* --- Toast --------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  padding: 10px 18px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  color: var(--toast-fg);
  background: var(--toast-bg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 180ms ease;
}
.toast.toast-error {
  color: var(--toast-fg);
  background: var(--toast-error-bg);
}

/* --- Empty state --------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text-3);
  font-size: 14px;
  text-align: center;
}

/* --- Utility ------------------------------------------------------- */
.hidden { display: none !important; }
.mono { font-family: var(--mono); }

/* --- Animations ---------------------------------------------------- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}

/* --- Responsive ---------------------------------------------------- */
@media (max-width: 768px) {
  .app-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); max-height: 40vh; overflow-y: auto; }
  .content { padding: 16px; }
  .charts-grid { grid-template-columns: 1fr; }
  .params-tags-row { grid-template-columns: 1fr; }
  .run-info-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-logo { flex-direction: column; gap: 12px; }
  .auth-logo-copy { align-items: center; text-align: center; }
  .artifact-row { grid-template-columns: auto 1fr; }
  .artifact-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 480px) {
  .topbar { padding: 0 10px; }
  .auth-card { padding: 32px 20px 24px; }
  .member-form-row, .apikey-form-row { flex-direction: column; }
  .member-form-row input, .apikey-form-row input { min-width: 0; }
  .run-info-grid { grid-template-columns: 1fr; }
  .artifact-preview-header { align-items: flex-start; flex-direction: column; }
  .artifact-preview-modal { padding: 18px; }
}
