/* ──────────────────────────────────────────────────────────────
   Dreams.CI dashboard — obsidian theme, Inter
   ────────────────────────────────────────────────────────────── */
:root {
  /* Brand gradients */
  --g-primary: linear-gradient(110deg, #5B8CFF 0%, #8A63FF 45%, #B14BFF 75%, #E27BFF 100%);
  --g-violet:  linear-gradient(135deg, #B17CFF, #6B3BFF);
  --g-blue:    linear-gradient(135deg, #4DA3FF, #0E3FB0);
  --g-amber:   linear-gradient(135deg, #FFC371, #FF6A3D);

  /* Brand solids */
  --ink:      #FFFFFF;
  --fog:      #E3E3E8;
  --ash:      #7A7A85;
  --iron:     #3A3A45;
  --obsidian: #14141D;

  /* Surfaces (derived from obsidian) */
  --bg:        #0B0B12;
  --surface:   #14141D;
  --surface-2: #1B1B26;
  --surface-3: #232330;
  --border:    #2A2A38;
  --border-soft: #1F1F2B;

  /* Text */
  --text:      var(--fog);
  --text-strong: var(--ink);
  --text-dim:  #9A9AA6;
  --text-mut:  #62626E;

  /* Accents */
  --accent:      #8A63FF;
  --accent-blue: #5B8CFF;
  --accent-soft: rgba(138,99,255,.14);

  /* Semantic (tuned to the obsidian/violet palette) */
  --ok:   #3DD68C;
  --bad:  #FF5D6C;
  --warn: #FFA24D;
  --info: #5B8CFF;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow:    0 1px 2px rgba(0,0,0,.5), 0 12px 32px rgba(0,0,0,.35);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);

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

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a { color: inherit; }

/* ── App shell ─────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  padding: 18px 14px;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
}
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(138,99,255,.28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 18px; font-weight: 700; color: var(--text-strong); letter-spacing: -.02em; }
.brand-dot {
  background: var(--g-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub { font-size: 11px; color: var(--text-mut); text-transform: uppercase; letter-spacing: .14em; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; margin-top: 6px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-icon { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.nav-item.active {
  color: var(--text-strong);
  background: var(--accent-soft);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--g-primary);
}
.nav-item.active .nav-icon { opacity: 1; color: var(--accent); }
.nav-badge {
  margin-left: auto;
  min-width: 18px; height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--g-primary);
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border-soft);
  margin-top: 6px;
}
.host-line { display: flex; flex-direction: column; min-width: 0; }
.host-name { font-family: var(--mono); font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.host-up { font-size: 11px; color: var(--text-mut); }
.refresh { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ok); white-space: nowrap; }
.refresh-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite ease-in-out; }
.refresh.stale { color: var(--bad); }
.refresh.stale .refresh-dot { background: var(--bad); animation: none; }
.refresh-label { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.sidebar-scrim { display: none; }

/* ── Main column ───────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  background: rgba(11,11,18,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.page-title { font-size: 20px; font-weight: 600; color: var(--text-strong); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.nav-toggle { display: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--text); border-color: var(--iron); }

.content {
  flex: 1;
  padding: 24px 28px 48px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}
.view { display: flex; flex-direction: column; gap: 18px; }
.view[hidden] { display: none; }

/* ── Layout helpers ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.span-2 { grid-column: 1 / -1; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); font-weight: 600; }

.muted { color: var(--text-mut); }
.muted.ok { color: var(--ok); }
.muted.warn { color: var(--warn); }

/* ── Stat cards (overview) ─────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: 3px;
  background: var(--g-primary);
  opacity: .9;
}
.stat-card:nth-child(2)::after { background: var(--g-amber); }
.stat-card:nth-child(3)::after { background: var(--g-blue); }
.stat-card:nth-child(4)::after { background: var(--g-violet); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-meta { font-size: 12px; color: var(--text-mut); }

/* ── Metrics ───────────────────────────────────────────────── */
.metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.metric { display: flex; flex-direction: column; gap: 8px; }
.metric-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); }
.metric-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.metric-value-sm { font-size: 15px; font-family: var(--mono); }
.metric-sub { font-size: 11px; color: var(--text-mut); font-variant-numeric: tabular-nums; }
.bar { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 999px; background: var(--g-primary); transition: width .4s ease; }
.bar-fill.warn { background: var(--g-amber); }
.bar-fill.bad  { background: linear-gradient(135deg, #FF8A4D, #FF5D6C); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  font-family: var(--font);
  transition: background-color .15s ease, border-color .15s ease, opacity .15s ease, transform .05s ease;
}
.btn:hover { border-color: var(--iron); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--g-primary);
  border: none;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(138,99,255,.3);
}
.btn-primary:hover { background: var(--g-primary); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { color: var(--bad); border-color: rgba(255,93,108,.35); background: transparent; }
.btn-danger:hover { background: rgba(255,93,108,.1); border-color: var(--bad); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; align-items: end; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.form-grid input, .form-grid select,
.search-input,
.panel-field input, .panel-field select {
  width: 100%;
  padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-grid input::placeholder { color: var(--text-mut); }
.form-grid input:focus, .form-grid select:focus,
.search-input:focus,
.panel-field input:focus, .panel-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-note { margin: 0; font-size: 12px; color: var(--warn); }
.bordered-bottom { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-soft); }
.search-input { width: auto; min-width: 200px; }

/* ── Queue ─────────────────────────────────────────────────── */
.queue-running { margin-bottom: 10px; }
.queue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.queue-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s ease;
}
.queue-item:hover { border-color: var(--iron); }
.queue-item.running { border-color: rgba(138,99,255,.45); background: var(--accent-soft); }
.queue-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.queue-title { font-family: var(--mono); font-size: 12px; word-break: break-all; color: var(--text); }
.queue-sub { font-size: 11px; color: var(--text-mut); }
.queue-empty { color: var(--text-mut); font-size: 13px; padding: 6px 0; }
.queue-cancel { margin-left: 8px; }

/* ── Status badge ──────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-queued    { color: var(--ash); border-color: rgba(122,122,133,.35); }
.status-running   { color: var(--info); border-color: rgba(91,140,255,.45); background: rgba(91,140,255,.1); }
.status-running::before { animation: pulse 1.2s infinite ease-in-out; }
.status-success   { color: var(--ok); border-color: rgba(61,214,140,.4); background: rgba(61,214,140,.08); }
.status-failed    { color: var(--bad); border-color: rgba(255,93,108,.4); background: rgba(255,93,108,.08); }
.status-cancelled { color: var(--text-dim); border-color: var(--border); background: rgba(122,122,133,.08); }

/* ── Build phases (git / import / tests / build / publish) ──── */
.live-phases { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 2px; }
.phase-pill {
  display: inline-flex; align-items: baseline; gap: 5px;
  font-size: 11px; color: var(--text-dim);
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border-soft); background: var(--surface);
  white-space: nowrap;
}
.phase-pill b { color: var(--text); font-weight: 600; font-family: var(--mono); }
.phase-pill.active { color: var(--info); border-color: rgba(91,140,255,.45); background: rgba(91,140,255,.1); }
.phase-tag { color: var(--accent-blue); }

/* ── Chips ─────────────────────────────────────────────────── */
.chip {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-dim); white-space: nowrap;
}
.chip.on  { color: var(--ok); border-color: rgba(61,214,140,.4); background: rgba(61,214,140,.08); }
.chip.off { color: var(--text-mut); }

/* ── Live log ──────────────────────────────────────────────── */
.live-id { font-family: var(--mono); font-size: 12px; color: var(--text-mut); text-transform: none; letter-spacing: 0; margin-left: 8px; }
.live-head-right { display: flex; align-items: center; gap: 10px; }
.log {
  margin: 0;
  background: #07070C;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px; line-height: 1.55;
  color: #C6C6D2;
  max-height: 440px; min-height: 160px;
  overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.log:focus { outline: 1px solid var(--accent); }
.log-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data-table th {
  text-align: left;
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-mut); font-weight: 600;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  white-space: nowrap;
  color: var(--text);
}
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: rgba(255,255,255,.02); }
.mono { font-family: var(--mono); font-size: 11.5px; }
.tg-sent { color: var(--ok); }
.tg-link { color: var(--info); }
.tg-failed { color: var(--bad); }
.tg-skipped { color: var(--text-mut); }
.dl-link { color: var(--accent-blue); text-decoration: none; }
.dl-link:hover { text-decoration: underline; }
.repo-link { color: var(--accent-blue); text-decoration: none; }
.repo-link:hover { text-decoration: underline; }

/* ── Editor / info lists (server) ──────────────────────────── */
.editor-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.editor-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.editor-ver { font-family: var(--mono); font-size: 13px; color: var(--text); }
.editor-path { font-size: 11px; color: var(--text-mut); font-family: var(--mono); word-break: break-all; }

.info-list { margin: 0; display: flex; flex-direction: column; gap: 1px; }
.info-list > div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 2px; border-bottom: 1px solid var(--border-soft); }
.info-list > div:last-child { border-bottom: none; }
.info-list dt { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.info-list dd { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--text); text-align: right; }

/* ── Projects ──────────────────────────────────────────────── */
.projects-list { display: flex; flex-direction: column; gap: 12px; }
.project-row {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.project-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.project-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.project-name { font-weight: 600; font-size: 15px; color: var(--text-strong); }
.project-sub { font-size: 12px; color: var(--text-mut); }
.project-badges { display: flex; gap: 8px; }
.project-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.project-cap { margin-top: 10px; font-size: 12px; display: flex; gap: 16px; flex-wrap: wrap; }
.cap.ok { color: var(--ok); }
.cap.warn { color: var(--warn); }
.project-fetch { margin-top: 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.project-fetch.running { color: var(--info); }
.project-fetch.failed { color: var(--bad); }

.project-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 12px; }
.panel-field { display: flex; flex-direction: column; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.panel-field input, .panel-field select { background: var(--surface); }
.panel-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.panel-checks { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); text-transform: none; letter-spacing: normal; }
.chk input { width: auto; accent-color: var(--accent); }
.dist-store-label { font-weight: 600; font-size: 13px; margin-bottom: 10px; color: var(--text-strong); }

.stores-list { display: flex; flex-direction: column; gap: 12px; }

/* ── Toasts ────────────────────────────────────────────────── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: slidein .2s ease;
}
.toast.error   { border-color: rgba(255,93,108,.5); }
.toast.warn    { border-color: rgba(255,162,77,.5); }
.toast.success { border-color: rgba(61,214,140,.5); }
.toast-title { font-weight: 600; margin-bottom: 2px; color: var(--text-strong); }
.toast-body { color: var(--text-dim); }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; min-width: 0; flex-wrap: wrap; }
.breadcrumb .crumb { color: var(--text-strong); white-space: nowrap; }
.breadcrumb a.crumb { color: var(--text-dim); text-decoration: none; cursor: pointer; }
.breadcrumb a.crumb:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-mut); font-weight: 400; }

/* ── View head ─────────────────────────────────────────────── */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-title { font-size: 17px; color: var(--text-strong); }
.view-desc { margin: 4px 0 0; font-size: 13px; color: var(--text-mut); }

/* ── Projects grid (cards) ─────────────────────────────────── */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.project-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s ease, transform .08s ease, box-shadow .15s ease;
}
.project-card:hover { border-color: var(--iron); transform: translateY(-2px); box-shadow: var(--shadow); }
.project-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.project-card-name { font-size: 16px; font-weight: 600; color: var(--text-strong); }
.project-card-repo { font-size: 12px; color: var(--text-mut); font-family: var(--mono); word-break: break-all; }
.project-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-dim); }
.project-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.branch-tag { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 999px; padding: 2px 9px; }

/* ── Workspace head + tabs ─────────────────────────────────── */
.ws-head { display: flex; flex-direction: column; gap: 14px; }
.ws-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ws-title { font-size: 20px; font-weight: 700; color: var(--text-strong); }
.ws-sub { font-size: 12.5px; color: var(--text-mut); font-family: var(--mono); }
.ws-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); }
.ws-tab {
  border: none; background: transparent; cursor: pointer;
  font-family: var(--font); font-size: 13.5px; font-weight: 500;
  color: var(--text-dim);
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}
.ws-tab:hover { color: var(--text); }
.ws-tab.active { color: var(--text-strong); border-bottom-color: transparent; background-image: var(--g-primary); background-repeat: no-repeat; background-position: bottom; background-size: 100% 2px; }

/* ── Git status panel ──────────────────────────────────────── */
.git-status {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 14px 16px; margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.git-status.warn { border-color: rgba(255,162,77,.4); background: rgba(255,162,77,.06); }
.git-status.bad { border-color: rgba(255,93,108,.4); background: rgba(255,93,108,.06); }
.git-status.ok { border-color: rgba(61,214,140,.3); }
.git-status-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.git-status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.git-status-title { font-weight: 600; color: var(--text-strong); }
.git-commit { font-size: 12px; color: var(--text-mut); font-family: var(--mono); word-break: break-word; }
.git-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.git-pill.behind { color: var(--warn); border-color: rgba(255,162,77,.4); background: rgba(255,162,77,.08); }
.git-pill.clean { color: var(--ok); border-color: rgba(61,214,140,.4); background: rgba(61,214,140,.08); }
.git-pill.branch { font-family: var(--mono); color: var(--text); }
.git-status-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* tooltip on a disabled build button via title attr is native; add a soft hint row */
.gate-note { margin: 0; font-size: 12px; }
.gate-note.warn { color: var(--warn); }
.gate-note.bad { color: var(--bad); }
.gate-note.muted { color: var(--text-mut); }

/* ── Settings sections ─────────────────────────────────────── */
.settings-section { margin-bottom: 16px; }
.settings-section .card-head h2 { font-size: 13px; }
.danger-zone { border-color: rgba(255,93,108,.3); }
.danger-zone .card-head h2 { color: var(--bad); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.settings-row-text { font-size: 13px; color: var(--text-dim); }

/* ── History row actions ───────────────────────────────────── */
.row-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.live-card { margin-bottom: 18px; }

/* ── Login page ────────────────────────────────────────────── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(138,99,255,.18), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(91,140,255,.16), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 30px;
  text-align: center;
}
.login-logo { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 6px 18px rgba(138,99,255,.3); }
.login-title { font-size: 24px; font-weight: 700; margin-top: 14px; color: var(--text-strong); letter-spacing: -.02em; }
.login-sub { margin: 4px 0 24px; color: var(--text-mut); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.login-form input[type="text"], .login-form input[type="password"] {
  width: 100%; padding: 11px 13px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font); font-size: 14px; text-transform: none; letter-spacing: normal;
}
.login-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-remember { flex-direction: row !important; align-items: center; gap: 9px !important; text-transform: none !important; letter-spacing: normal !important; font-size: 13px !important; color: var(--text-dim) !important; }
.login-remember input { width: auto; accent-color: var(--accent); }
.login-btn { width: 100%; padding: 12px; font-size: 14px; margin-top: 4px; }
.login-error { margin: 0; color: var(--bad); font-size: 13px; text-align: center; }
.login-foot { margin: 20px 0 0; font-size: 11.5px; color: var(--text-mut); }

/* ── Sidebar user chip ─────────────────────────────────────── */
.sidebar-user {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.su-info { display: flex; flex-direction: column; min-width: 0; }
.su-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-role { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.su-role.user { color: var(--text-mut); }
.nav-sep { height: 1px; background: var(--border-soft); margin: 8px 4px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .sidebar-scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 35;
  }
  .nav-toggle { display: inline-flex; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 14px 16px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 520px) {
  .stat-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
