/* Daggr Studio — custom frontend theme.
   Charcoal/grey base (the house UI language), one accent, generous spacing, and a
   layout that keeps the pipeline visible while you work on it. */

:root {
  --bg: #0b0c0e;
  --bg-1: #131417;
  --bg-2: #1a1c20;
  --bg-3: #23262c;
  --line: #2c3037;
  --line-soft: #22252b;
  --text: #e8eaed;
  --text-dim: #9aa0a6;
  --text-faint: #6b7076;
  --accent: #6366f1;
  --accent-soft: #4f46e5;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ── app shell ─────────────────────────────────────────────────────────── */

#app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; background: rgba(11,12,14,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .2px; }
.brand .brick { font-size: 18px; }
.brand small { color: var(--text-faint); font-weight: 500; letter-spacing: 0; }
.topbar .spacer { flex: 1; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  padding: 7px 13px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px;
}
.tab:hover { color: var(--text); background: var(--bg-2); }
.tab[aria-selected="true"] { background: var(--bg-3); color: var(--text); border-color: var(--line); }

main { flex: 1; padding: 20px 18px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }
.panel { display: none; }
.panel[data-active="true"] { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; } }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.sidebar { grid-template-columns: minmax(320px, 380px) minmax(0, 1fr); }
@media (max-width: 1000px) { .grid.two, .grid.sidebar { grid-template-columns: 1fr; } }

/* ── cards ─────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-1); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px 18px;
}
.card > h2 {
  margin: 0 0 4px; font-size: 15px; letter-spacing: .3px; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600;
}
.card > .hint { margin: 0 0 14px; color: var(--text-faint); font-size: 13px; }

/* ── controls ──────────────────────────────────────────────────────────── */

label { display: block; font-size: 13px; color: var(--text-dim); margin: 10px 0 5px; }

input[type="text"], input[type="password"], textarea, select {
  width: 100%; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 11px; font: inherit; font-size: 14px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
textarea { resize: vertical; min-height: 84px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 130px; }
.row.tight > * { min-width: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters > * { min-width: 120px; }

button.btn {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--line);
  padding: 9px 15px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px;
  display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto;
}
button.btn:hover { background: #2b2f36; }
button.btn.primary { background: var(--accent-soft); border-color: var(--accent-soft); color: #fff; font-weight: 600; }
button.btn.primary:hover { background: var(--accent); }
button.btn.ghost { background: transparent; }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }
.hidden { display: none !important; }

/* ── status + logs ─────────────────────────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-dim);
}
.pill.ok { color: var(--ok); border-color: rgba(52,211,153,.35); }
.pill.warn { color: var(--warn); border-color: rgba(251,191,36,.35); }
.pill.bad { color: var(--bad); border-color: rgba(248,113,113,.35); }

.log {
  background: #0f1013; border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 11px 13px; max-height: 260px; overflow: auto; font-family: var(--mono); font-size: 12.5px;
  white-space: pre-wrap; word-break: break-word;
}
.log .l-ok { color: var(--ok); } .log .l-bad { color: var(--bad); }
.log .l-warn { color: var(--warn); } .log .l-dim { color: var(--text-faint); }
.log .l-info { color: var(--info); }

/* ── pipeline view ─────────────────────────────────────────────────────── */

.pipeline { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; }
.node {
  min-width: 230px; max-width: 260px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; position: relative; flex: 0 0 auto;
}
.node.running { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.node.ok { border-color: rgba(52,211,153,.5); }
.node.failed { border-color: rgba(248,113,113,.55); }
.node.repaired { border-color: rgba(251,191,36,.55); }
.node h4 { margin: 0 0 3px; font-size: 14px; }
.node .src { color: var(--text-faint); font-size: 11.5px; font-family: var(--mono); word-break: break-all; }
.node .why { color: var(--text-dim); font-size: 12.5px; margin: 7px 0; }
.node .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.node .arrow { position: absolute; right: -14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.node .out { margin-top: 9px; }
.node .out img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.node .out audio, .node .out video { width: 100%; }
.node .repairs { margin-top: 8px; font-size: 12px; color: var(--warn); }

/* ── tables ────────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; color: var(--text-faint); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .4px; padding: 7px 9px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-1);
}
tbody td { padding: 8px 9px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover { background: var(--bg-2); }
.table-wrap { max-height: 460px; overflow: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.mono-sm { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

/* ── misc ──────────────────────────────────────────────────────────────── */

.artifacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.artifact { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; }
.artifact img, .artifact video { width: 100%; border-radius: 6px; display: block; }
.artifact audio { width: 100%; }
.artifact .name { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; font-family: var(--mono); word-break: break-all; }

pre.code {
  background: #0f1013; border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 13px; overflow: auto; max-height: 460px; margin: 0;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 11px; font-size: 12.5px; color: var(--text-dim); cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 60;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font-size: 13.5px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.ok { border-color: rgba(52,211,153,.5); }
.toast.bad { border-color: rgba(248,113,113,.5); }

.spinner {
  display: inline-block; width: 13px; height: 13px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer.legal {
  border-top: 1px solid var(--line-soft); color: var(--text-faint); font-size: 12.5px;
  padding: 14px 18px; max-width: 1400px; margin: 0 auto;
}
