/* AIsist Deploy Console — hand-rolled, no build step. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1c2430;
  --muted: #5b6572;
  --line: #e3e7ec;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --danger: #c92a2a;
  --ok: #1a7f37;
  --warn: #9a6700;
  --log-bg: #10151c;
  --log-ink: #d7e0ea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.danger-title { color: var(--danger); }

/* ---------------- top bar ---------------- */

.topbar {
  background: #10151c;
  color: #e8edf3;
  border-bottom: 3px solid var(--accent);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(31,111,235,.25); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  font-size: 13px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------------- layout ---------------- */

.container { max-width: 1100px; margin: 24px auto 48px; padding: 0 20px; }
.dash-head { margin-bottom: 18px; }
.dash-head h1 { margin: 0 0 4px; font-size: 24px; }
.dash-hint, .dash-head p { margin: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 560px;
  margin: 60px auto;
}
.panel h1 { margin-top: 0; font-size: 22px; }
.panel p { margin: 10px 0; }
.panel form { margin-top: 18px; }
.panel code, .card code { background: #eef1f5; border-radius: 4px; padding: 1px 5px; font-size: 13px; }

/* ---------------- cards ---------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-title { margin: 0; font-size: 18px; text-transform: capitalize; }
.card-domain { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card-facts { margin: 0; font-size: 13px; }
.last-job { margin: 0; font-size: 13px; }
.last-job .ok { color: var(--ok); }
.last-job .bad { color: var(--danger); }
.linklike { color: var(--accent); text-decoration: underline; cursor: pointer; }

.card-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 4px; }

/* ---------------- badges ---------------- */

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-ok { color: var(--ok); background: #e8f5ec; border-color: #bfe3cd; }
.badge-warn { color: var(--warn); background: #fdf3df; border-color: #f0d9a6; }
.badge-off { color: var(--muted); background: #eef1f5; border-color: var(--line); }
.badge-running { color: #0b5cad; background: #e7f1ff; border-color: #bcd6f8; animation: pulse 2s ease-in-out infinite; }

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

/* ---------------- job strip (active job) ---------------- */

.job-strip {
  border: 1px solid #c9ddf7;
  background: #f4f9ff;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.job-strip-head { display: flex; align-items: center; gap: 8px; }
.job-phase { font-weight: 600; font-size: 13px; }
.job-elapsed { font-size: 12px; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(31,111,235,.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- buttons ---------------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:hover { background: #f2f5f8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #1a63d6; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b02525; }
.btn-ghost { background: transparent; }
.btn-small { padding: 5px 12px; font-size: 13px; }
.btn-large { padding: 12px 22px; font-size: 16px; }

/* ---------------- log boxes ---------------- */

.logbox {
  background: var(--log-bg);
  color: var(--log-ink);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.logbox-full { max-height: 420px; }

.error { color: var(--danger); margin: 0; font-size: 13px; }

/* ---------------- modals ---------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 21, 28, .55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  z-index: 50;
  overflow: auto;
}

.modal-box {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .3);
  width: 100%;
  max-width: 560px;
  padding: 22px 24px;
}
.modal-box h2 { margin: 0 0 6px; font-size: 20px; }
.modal-desc { margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.eta { font-size: 13px; }

.field { margin: 14px 0; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; }
.field input[type="text"] {
  width: 100%;
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.field input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.toggle { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.toggle input { margin-top: 3px; accent-color: var(--accent); }

/* destroy modal specifics */
.modal-danger .modal-box { border-top: 4px solid var(--danger); }

.outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 4px; }
.outcome {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  opacity: .55;
  transition: opacity .15s ease, border-color .15s ease, background .15s ease;
  font-size: 13px;
}
.outcome strong { display: block; margin-bottom: 2px; }
.outcome.active { opacity: 1; border-color: var(--accent); background: #f4f9ff; }
.modal-danger .outcome.active { border-color: var(--danger); background: #fdf0f0; }

/* ---------------- toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #10151c;
  color: #e8edf3;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16,24,40,.35);
  z-index: 100;
  max-width: 90vw;
  font-size: 14px;
}
.toast.ok { border-left: 4px solid #2ea043; }
.toast.error { border-left: 4px solid #e5534b; }

/* ---------------- footer ---------------- */

.footer { border-top: 1px solid var(--line); background: #fff; }
.footer .topbar-inner { padding: 14px 20px; font-size: 13px; justify-content: space-between; }

/* ---------------- responsive ---------------- */

@media (max-width: 560px) {
  .outcomes { grid-template-columns: 1fr; }
  .topbar-inner, .footer .topbar-inner { flex-direction: column; align-items: flex-start; gap: 6px; }
}
