:root {
  color-scheme: dark;
  --bg: #0b0f17;
  --panel: #111827;
  --panel-2: #172033;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.24);
  --accent: #facc15;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --blue: #38bdf8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  --bg: #0b0f17;
  --panel: #111827;
  --panel-2: #172033;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.24);
  --accent: #facc15;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --blue: #38bdf8;
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 20% 10%, rgba(56, 189, 248, 0.12), transparent 30%),
    radial-gradient(circle at 82% 18%, rgba(250, 204, 21, 0.09), transparent 26%),
    var(--bg);
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

.app-header {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 20, 0.88);
  backdrop-filter: blur(14px);
}

.app-header strong {
  display: block;
  font-size: 15px;
  color: #f8fafc;
}

.app-header span,
.panel-head span,
.source-note {
  color: var(--muted);
  font-size: 12px;
}

.app-header nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header a,
.app-header button {
  min-height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.82);
  color: #f8fafc;
  text-decoration: none;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-header a:hover,
.app-header button:hover {
  background: rgba(30, 41, 59, 0.96);
  border-color: #7dd3fc;
  color: #ffffff;
}

.app-header button:nth-of-type(3) {
  border-color: rgba(250, 204, 21, 0.58);
  background: rgba(250, 204, 21, 0.16);
  color: #fde68a;
  font-weight: 800;
}

.app-header button:disabled {
  cursor: not-allowed;
  border-color: rgba(148, 163, 184, 0.34);
  background: rgba(15, 23, 42, 0.56);
  color: #cbd5e1;
  opacity: 1;
}

.workspace {
  height: calc(100vh - 58px);
  min-width: 1280px;
  display: grid;
  grid-template-columns: 410px minmax(660px, 1fr) 340px;
  gap: 12px;
  padding: 12px;
}

.source-column,
.preview-column,
.runtime-column {
  min-width: 0;
  min-height: 0;
}

.source-column,
.preview-column,
.runtime-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.82);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.tab {
  flex: 1;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  border-color: rgba(56, 189, 248, 0.62);
  background: rgba(56, 189, 248, 0.13);
  color: #e0f2fe;
  font-weight: 800;
}

.editor-stack {
  height: calc(100% - 106px);
  min-height: 0;
}

.editor-pane {
  height: 100%;
  display: none;
  grid-template-rows: auto 1fr;
}

.editor-pane.active {
  display: grid;
}

.editor-pane span {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  resize: none;
  border: 0;
  outline: 0;
  padding: 14px;
  background: #0b1220;
  color: #e5e7eb;
  font: 12px/1.55 Consolas, "Cascadia Mono", monospace;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.source-note {
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  line-height: 1.45;
}

.preview-column {
  display: grid;
  grid-template-rows: auto 1fr;
}

.panel-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head strong {
  display: block;
  font-size: 14px;
}

.status-pill {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill.running {
  border-color: rgba(250, 204, 21, 0.6);
  background: rgba(250, 204, 21, 0.14);
  color: #fde68a;
}

.status-pill.done {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
}

.status-pill.error {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
}

.preview-stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background-color: #151a22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 20px 20px;
}

.dashboard-mount {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.xcon-render-frame {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
}

.xcon-render-frame > .xa-al-form-root,
.xcon-render-frame > [data-xcon-type="form"] {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
}

.markdown-intro {
  width: min(1180px, 100%);
  flex: 0 0 auto;
  padding: 16px 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.78);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.2);
  color: #dbeafe;
}

.markdown-intro h2,
.markdown-intro h3,
.markdown-intro p {
  margin: 0;
}

.markdown-intro h2 {
  color: #ffffff;
  font-size: 20px;
  line-height: 1.25;
}

.markdown-intro h3 {
  color: #e2e8f0;
  font-size: 15px;
  line-height: 1.35;
}

.markdown-intro p {
  margin-top: 8px;
  max-width: 760px;
  color: #aebbd0;
  font-size: 13px;
  line-height: 1.55;
}

.markdown-intro code {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 5px;
  background: rgba(2, 6, 23, 0.58);
  color: #bae6fd;
  padding: 1px 5px;
}

.dashboard-mount:empty::before {
  content: "Render the SKETCH dashboard to start.";
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 40px;
  margin: 60px auto;
}

.runtime-column {
  display: grid;
  grid-template-rows: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 12px;
}

.runtime-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
}

.trace-panel {
  grid-template-rows: auto 1fr;
}

.progress-row {
  display: grid;
  grid-template-columns: 78px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: #cbd5e1;
  font-size: 12px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  transition: width 220ms ease;
}

.tick-strip {
  display: flex;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.tick-strip span {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.tick-strip span.running {
  background: #facc15;
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.65);
}

.tick-strip span.done {
  background: #22c55e;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.55);
}

.runtime-log {
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 14px;
  font: 11px/1.45 Consolas, "Cascadia Mono", monospace;
}

.event-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.event-row time {
  color: #64748b;
}

.event-row strong {
  display: block;
  color: #e2e8f0;
}

.event-row span {
  color: #94a3b8;
}

pre {
  margin: 0;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  background: #0b1220;
  color: #dbeafe;
  font: 11px/1.55 Consolas, "Cascadia Mono", monospace;
}

#dashboardMount [data-monitor-state="running"] {
  filter: drop-shadow(0 0 12px rgba(250, 204, 21, 0.55));
}

#dashboardMount [data-monitor-state="done"] {
  filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.48));
}

#dashboardMount [data-monitor-state="failed"] {
  filter: drop-shadow(0 0 14px rgba(239, 68, 68, 0.58));
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.55);
  background-clip: padding-box;
}
