/* OpenSymphony Factory: operational console UI */

:root {
  color-scheme: dark;
  --bg: #10100e;
  --bg-ink: #161713;
  --surface: #1d1e19;
  --surface-2: #24251f;
  --surface-3: #2b2d25;
  --field: #12130f;
  --line: rgba(238 230 205 / 0.11);
  --line-strong: rgba(238 230 205 / 0.2);
  --line-hot: rgba(211 166 77 / 0.5);
  --text: #f0ead9;
  --muted: #b7ae97;
  --faint: #7d7563;
  --accent: #d3a64d;
  --accent-2: #78a870;
  --accent-3: #c96653;
  --accent-blue: #77a4aa;
  --accent-soft: rgba(211 166 77 / 0.13);
  --green-soft: rgba(120 168 112 / 0.15);
  --red-soft: rgba(201 102 83 / 0.14);
  --blue-soft: rgba(119 164 170 / 0.15);
  --amber-soft: rgba(211 166 77 / 0.14);
  --shadow: 0 24px 80px rgba(0 0 0 / 0.38);
  --shadow-low: 0 10px 32px rgba(0 0 0 / 0.24);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --max: 1680px;
  --fast: 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --smooth: 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  font-family: "Outfit", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(circle at 18% -18%, rgba(211 166 77 / 0.2), transparent 28rem),
    radial-gradient(circle at 96% 8%, rgba(120 168 112 / 0.12), transparent 26rem),
    linear-gradient(135deg, #10100e 0%, #141510 48%, #0d0e0b 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(238 230 205 / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(238 230 205 / 0.028) 1px, transparent 1px);
  background-size: 36px 36px, 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  color: inherit;
  background: none;
  border: 0;
}

::selection {
  color: #15130e;
  background: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(238 230 205 / 0.18);
  border-radius: 999px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 12px;
  color: #16130d;
  background: var(--accent);
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(var(--max), calc(100% - 40px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px 0 32px;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  margin-bottom: 18px;
  background: rgba(29 30 25 / 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-low);
  backdrop-filter: blur(22px);
}

.brand-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 220px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #14120c;
  letter-spacing: 0.02em;
  background:
    linear-gradient(135deg, #efd27d, #b98032),
    var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgba(255 255 255 / 0.34), 0 14px 32px rgba(211 166 77 / 0.22);
}

.brand-kicker,
.sidebar-label,
.eyebrow,
.section-label,
.metric-card span,
.stat-cell span,
.file-row .type {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand-lockup h1 {
  margin: 1px 0 0;
  font-size: 1.03rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.nav-menu {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  background: rgba(16 16 14 / 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 38px;
  padding: 0 13px;
  overflow: hidden;
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: color var(--fast), background var(--fast), border-color var(--fast), transform var(--fast);
}

.nav-item:hover {
  color: var(--text);
  background: rgba(238 230 205 / 0.06);
}

.nav-item:active,
.button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.nav-item.is-active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(211 166 77 / 0.16), rgba(211 166 77 / 0.07));
  border-color: var(--line-hot);
  box-shadow: inset 0 1px 0 rgba(255 255 255 / 0.08);
}

.sidebar-card {
  display: grid;
  gap: 6px;
  min-width: 170px;
  padding: 10px 12px;
  background: rgba(16 16 14 / 0.52);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.sidebar-card.compact {
  max-width: 250px;
}

.sidebar-muted,
.mono-value {
  margin: 0;
  overflow: hidden;
  font-size: 0.78rem;
  color: var(--faint);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono-value,
.stat-cell strong,
.file-row .path,
.log-row,
.code-editor {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.status-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  width: fit-content;
  min-height: 25px;
  padding: 0 9px;
  font-size: 0.79rem;
  font-weight: 700;
  border: 1px solid currentColor;
  border-radius: var(--radius-xs);
}

.status-dot {
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.42;
    transform: scale(0.72);
  }
}

.status-connected {
  color: var(--accent-2);
  background: var(--green-soft);
}

.status-disconnected {
  color: var(--accent-3);
  background: var(--red-soft);
}

.status-connecting {
  color: var(--accent);
  background: var(--amber-soft);
}

.main-stage {
  min-width: 0;
}

.topbar {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 18px 0 22px;
}

.topbar h2 {
  max-width: 15ch;
  margin: 4px 0 0;
  font-size: clamp(2rem, 4vw, 4.8rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0;
  text-wrap: balance;
}

.topbar-actions,
.filter-row,
.inline-tools,
.tag-row,
.action-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-actions {
  padding: 6px;
  background: rgba(29 30 25 / 0.74);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.view-panel {
  display: none;
}

.view-panel.is-active {
  display: block;
  animation: fadeUp 320ms var(--smooth) both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 36px;
  padding: 0 13px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  background: linear-gradient(180deg, rgba(238 230 205 / 0.08), rgba(238 230 205 / 0.035));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: color var(--fast), background var(--fast), border-color var(--fast), transform var(--fast), box-shadow var(--fast);
}

.button:hover:not(:disabled) {
  background: rgba(238 230 205 / 0.11);
  border-color: rgba(238 230 205 / 0.34);
  box-shadow: 0 10px 24px rgba(0 0 0 / 0.2);
}

.button.primary {
  color: #17140e;
  background: linear-gradient(180deg, #e7c66e, #c6923b);
  border-color: rgba(255 230 156 / 0.42);
  box-shadow: 0 12px 30px rgba(211 166 77 / 0.2);
}

.button.secondary {
  color: var(--muted);
}

.button.danger {
  color: #f0b4a9;
  background: var(--red-soft);
  border-color: rgba(201 102 83 / 0.34);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button.full {
  width: 100%;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(4, minmax(120px, 0.72fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric-card {
  position: relative;
  min-height: 132px;
  padding: 15px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(238 230 205 / 0.09), transparent 42%),
    rgba(29 30 25 / 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: transform var(--fast), border-color var(--fast), background var(--fast);
}

.metric-card::after {
  position: absolute;
  right: 14px;
  bottom: 9px;
  font-family: "JetBrains Mono", monospace;
  font-size: 2.8rem;
  font-weight: 700;
  color: rgba(238 230 205 / 0.06);
  content: attr(data-icon);
}

.metric-card:first-child {
  background:
    linear-gradient(135deg, rgba(211 166 77 / 0.24), transparent 48%),
    rgba(29 30 25 / 0.9);
  border-color: rgba(211 166 77 / 0.35);
}

.metric-card:hover {
  background-color: rgba(36 37 31 / 0.9);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.metric-body {
  position: relative;
  z-index: 1;
}

.metric-card strong {
  display: block;
  margin-top: 24px;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(2rem, 4vw, 3.8rem);
  font-weight: 700;
  line-height: 0.88;
  color: var(--text);
  letter-spacing: 0;
}

.metric-icon {
  display: none;
}

.split-grid,
.two-column,
.workspace-layout {
  display: grid;
  gap: 16px;
}

.split-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.two-column {
  grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
}

.lower-grid {
  margin-top: 16px;
}

.workspace-layout {
  grid-template-columns: minmax(300px, 0.35fr) minmax(0, 1fr);
}

.surface {
  position: relative;
  min-width: 0;
  padding: 18px;
  background: rgba(29 30 25 / 0.76);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-low);
}

.surface::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255 255 255 / 0.045);
}

.surface-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.surface-head.stacked {
  display: block;
}

.surface h3 {
  margin: 3px 0 0;
  font-size: clamp(1.16rem, 1.6vw, 1.62rem);
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: 0;
  text-wrap: balance;
}

.agent-grid,
.manager-list,
.workload-list,
.file-tree,
.logs-panel,
.skill-list,
.skill-options,
.custom-skill-list {
  display: grid;
  gap: 8px;
}

.agent-grid {
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
}

.agent-card,
.manager-item,
.work-item,
.skill-card,
.custom-skill-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(36 37 31 / 0.95), rgba(24 25 20 / 0.9));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: transform var(--fast), border-color var(--fast), background var(--fast);
}

.agent-card:hover,
.manager-item:hover,
.work-item:hover,
.skill-card:hover,
.custom-skill-item:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.card-top,
.item-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.card-identity {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: center;
}

.agent-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: #11120e;
  border: 1px solid rgba(255 255 255 / 0.2);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgba(255 255 255 / 0.28);
}

.agent-avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 0.7rem;
}

.agent-card h4,
.manager-item h4,
.work-item h4,
.skill-card h4,
.custom-skill-item h4 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.15;
}

.agent-id,
.meta-line {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
  color: var(--faint);
}

.meta-line {
  color: var(--muted);
}

.badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
}

.badge.IDLE,
.metric-card.blue {
  color: var(--accent-blue);
  background: var(--blue-soft);
}

.badge.WORKING,
.metric-card.green {
  color: var(--accent-2);
  background: var(--green-soft);
}

.badge.FAILED,
.metric-card.red {
  color: var(--accent-3);
  background: var(--red-soft);
}

.metric-card.amber {
  color: var(--accent);
  background: var(--amber-soft);
}

.agent-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.stat-cell {
  min-width: 0;
  padding: 9px;
  background: rgba(16 16 14 / 0.5);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.stat-cell strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 0.88rem;
  color: var(--text);
  text-overflow: ellipsis;
}

.tag {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(16 16 14 / 0.44);
}

.tag.accent {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(211 166 77 / 0.34);
}

.action-row .button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.empty-state {
  min-height: 118px;
  padding: 26px;
  margin: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(211 166 77 / 0.09), transparent 45%),
    rgba(16 16 14 / 0.48);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
}

.form-stack,
.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label,
.field-label {
  display: grid;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--muted);
}

.input,
.select,
.textarea,
.code-editor {
  width: 100%;
  color: var(--text);
  background: rgba(16 16 14 / 0.82);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}

.input,
.select {
  height: 38px;
  padding: 0 11px;
  font-size: 0.88rem;
}

.textarea,
.code-editor {
  padding: 11px 12px;
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder,
.code-editor::placeholder {
  color: var(--faint);
}

.input:focus,
.select:focus,
.textarea:focus,
.code-editor:focus {
  background: rgba(16 16 14 / 0.96);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(211 166 77 / 0.16);
}

.inline-tools {
  margin-top: 10px;
}

.inline-tools .input {
  flex: 1 1 190px;
}

.inline-tools.slim {
  width: min(430px, 100%);
}

.skill-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  cursor: pointer;
  background: rgba(16 16 14 / 0.42);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: background var(--fast), border-color var(--fast);
}

.skill-option:hover {
  background: var(--surface-2);
}

.skill-option:has(input:checked) {
  background: var(--accent-soft);
  border-color: rgba(211 166 77 / 0.42);
}

.skill-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.skill-option span {
  min-width: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.add-skill-panel {
  margin-top: 10px;
}

.add-skill-panel > summary {
  width: fit-content;
  list-style: none;
}

.add-skill-panel > summary::-webkit-details-marker {
  display: none;
}

.add-skill-panel[open] > summary {
  margin-bottom: 12px;
}

.add-skill-form {
  padding: 14px;
  background: rgba(16 16 14 / 0.46);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.files-panel,
.editor-panel,
.logs-surface {
  min-height: calc(100dvh - 11rem);
}

.file-tree,
.logs-panel {
  max-height: calc(100dvh - 19rem);
  overflow-y: auto;
  scrollbar-color: rgba(238 230 205 / 0.18) transparent;
  scrollbar-width: thin;
}

.code-editor {
  min-height: 63dvh;
  tab-size: 2;
  background:
    linear-gradient(rgba(238 230 205 / 0.028) 1px, transparent 1px),
    rgba(9 10 8 / 0.9);
  background-size: 100% 1.6em;
}

.file-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(16 16 14 / 0.4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}

.file-row:hover {
  background: var(--accent-soft);
  border-color: rgba(211 166 77 / 0.34);
  transform: translateX(2px);
}

.file-row button {
  min-width: 0;
  padding: 0;
  color: inherit;
  text-align: left;
}

.file-row .path {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.78rem;
  color: var(--muted);
}

.file-row .type {
  flex: 0 0 auto;
}

.log-row {
  display: grid;
  grid-template-columns: 9rem 8rem minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 11px 12px;
  overflow-wrap: anywhere;
  font-size: 0.78rem;
  color: var(--muted);
  background: rgba(16 16 14 / 0.48);
  border: 1px solid var(--line);
  border-left: 3px solid rgba(238 230 205 / 0.16);
  border-radius: var(--radius-sm);
}

.log-row.error {
  color: #f0b4a9;
  background: var(--red-soft);
  border-color: rgba(201 102 83 / 0.28);
  border-left-color: var(--accent-3);
}

.log-row.warn {
  border-left-color: var(--accent);
}

.log-time {
  color: var(--faint);
}

.log-agent {
  color: var(--accent);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 48px));
  padding: 13px 15px;
  font-size: 0.9rem;
  color: var(--text);
  pointer-events: none;
  background: rgba(29 30 25 / 0.95);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--smooth), transform var(--smooth);
}

.toast.is-visible {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .app-shell {
    width: min(100% - 24px, var(--max));
  }

  .sidebar {
    grid-template-columns: 1fr;
    position: relative;
  }

  .brand-lockup {
    min-width: 0;
  }

  .nav-menu {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .sidebar-card {
    display: none;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-grid,
  .two-column,
  .workspace-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, var(--max));
    padding-top: 10px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h2 {
    max-width: 11ch;
    font-size: clamp(2.2rem, 14vw, 3.6rem);
  }

  .topbar-actions,
  .surface-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions .button,
  .filter-row .input,
  .filter-row .select,
  .inline-tools .button {
    flex: 1 1 auto;
    width: 100%;
  }

  .summary-grid,
  .agent-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 108px;
  }

  .surface {
    padding: 14px;
  }

  .agent-stats,
  .log-row {
    grid-template-columns: 1fr;
  }

  .nav-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
