:root {
  --bg: #090a0d;
  --panel: #121419;
  --ink: #f3f4f6;
  --muted: #9da3af;
  --line: #252c37;
  --line-soft: #1c2330;
  --accent: #ffffff;
  --accent-ink: #0f1012;
  --accent-rgb: 255, 255, 255;
  --danger: #ff7676;
  --ok: #9ce3bc;
  --shadow: 0 24px 44px rgba(0, 0, 0, 0.45);
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  background: radial-gradient(circle at top left, #161921 0%, #090a0d 46%);
  font-family: "Manrope", sans-serif;
}

body {
  position: relative;
  overflow-x: hidden;
}

.bg-blur {
  position: fixed;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  filter: blur(90px);
  z-index: 0;
  pointer-events: none;
}

.bg-blur-a {
  top: -230px;
  left: -180px;
  background: rgba(255, 255, 255, 0.1);
}

.bg-blur-b {
  right: -220px;
  bottom: -280px;
  background: rgba(255, 255, 255, 0.07);
}

.app,
.login-shell {
  position: relative;
  z-index: 1;
}

.app {
  width: min(1400px, 94vw);
  height: 100dvh;
  margin: 0 auto;
  padding: 6px 0 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-wrap {
  width: clamp(82px, 8vw, 126px);
  min-width: clamp(82px, 8vw, 126px);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.08), transparent 56%),
    rgba(12, 16, 24, 0.72);
}

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

.brand-logo {
  width: 100%;
  max-height: clamp(78px, 8vw, 122px);
  height: auto;
  display: block;
  object-fit: contain;
}

.brand-subtitle {
  margin-top: 4px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  margin-top: 4px;
  font-size: clamp(1.3rem, 2vw, 2.05rem);
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  min-height: 0;
  height: 100%;
}

.panel {
  background: linear-gradient(160deg, rgba(19, 22, 28, 0.97), rgba(14, 17, 23, 0.97));
  border: 1px solid rgba(121, 134, 157, 0.16);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
}

.panel-head h2,
.panel-head h3 {
  font-size: 1.04rem;
}

.panel-head p {
  margin: 5px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  overflow: hidden;
}

.nav-menu {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  align-content: start;
  overflow: auto;
  padding-right: 2px;
}

.nav-item {
  width: 100%;
  border: 1px solid rgba(124, 138, 162, 0.24);
  border-radius: 12px;
  background: #131821;
  color: var(--ink);
  padding: 10px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: inherit;
}

.nav-item.is-active {
  border-color: var(--accent);
  background: linear-gradient(140deg, #1a202c, #151922);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.15);
}

.nav-icon {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(127, 141, 165, 0.38);
  border-radius: 8px;
  background: #171e2a;
  color: #dce4f3;
  display: grid;
  place-items: center;
  flex: 0 0 26px;
}

.nav-icon svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.is-active .nav-icon {
  border-color: rgba(var(--accent-rgb), 0.72);
  background: #202938;
  color: var(--accent);
}

.nav-title {
  display: block;
  font-size: 0.9rem;
  line-height: 1.2;
  font-weight: 700;
}

.nav-item.nav-stage {
  display: flex;
}

.nav-item.nav-config {
  margin-top: 8px;
  border-top-width: 2px;
}

.sidebar-footer {
  border-top: 1px solid #2b3240;
  padding-top: 12px;
  display: grid;
  gap: 10px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #161d29;
  border: 1px solid #394254;
  font-weight: 800;
  font-size: 0.88rem;
  color: #f4f6fb;
}

.sidebar-user-name {
  font-size: 0.9rem;
  line-height: 1.2;
}

.sidebar-version {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-refresh,
.sidebar-logout {
  width: 100%;
}

.work-area {
  min-width: 0;
  height: 100%;
  min-height: 0;
}

.mode-view {
  display: none;
}

.mode-view.is-active {
  display: block;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.config-panel {
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.prompt-preview {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f1319;
  padding: 12px;
  white-space: pre-wrap;
  font-size: 0.83rem;
  line-height: 1.45;
}

.chat-panel {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-header h2 {
  margin-top: 4px;
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-only-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
}

.icon-only-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#stage-description {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.prompt-btn {
  white-space: nowrap;
}

.artifact-live {
  border: 1px solid rgba(130, 144, 168, 0.28);
  border-radius: 14px;
  padding: 10px;
  background: linear-gradient(160deg, rgba(17, 24, 35, 0.95), rgba(13, 19, 29, 0.95));
}

.artifact-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.artifact-live-head strong {
  font-size: 0.88rem;
}

.artifact-live-meta {
  color: var(--muted);
  font-size: 0.76rem;
}

.artifact-live-body {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.chat-zone {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid rgba(118, 132, 157, 0.24);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(17, 23, 34, 0.96), rgba(10, 15, 24, 0.96)),
    radial-gradient(circle at 14% 0%, rgba(255, 255, 255, 0.08), transparent 45%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 -80px 120px rgba(4, 8, 16, 0.45);
  overflow: hidden;
}

.chat-zone-head {
  padding: 10px 12px;
  border-bottom: 1px solid #293141;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c4ccda;
  font-weight: 800;
}

.chat-log {
  padding: 12px;
  min-height: 0;
  max-height: none;
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-content: flex-start;
  gap: 10px;
}

.bubble {
  display: inline-block;
  width: fit-content;
  max-width: 92%;
  align-self: flex-start;
  height: auto;
  flex: 0 0 auto;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.86rem;
  line-height: 1.35;
}

.bubble.user {
  margin-left: auto;
  max-width: min(78%, 760px);
  border: 1px solid rgba(129, 143, 171, 0.44);
  background: #1b2331;
}

.bubble.assistant {
  margin-right: auto;
  width: fit-content;
  max-width: 92%;
  border: 1px solid rgba(102, 115, 138, 0.38);
  background: #141a24;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip {
  border: 1px solid #3f4757;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.77rem;
  background: #151b25;
}

.chat-composer {
  border: 1px solid rgba(118, 132, 157, 0.26);
  border-radius: 14px;
  background: #0f1319;
  padding: 8px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.clip-btn,
.ghost-btn,
.primary-btn {
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
}

.clip-btn {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(120, 134, 157, 0.34);
  background: #181d26;
  color: var(--ink);
  font-size: 1.15rem;
}

.composer-input {
  width: 100%;
  min-width: 0;
  resize: none;
  border: 1px solid rgba(118, 132, 157, 0.3);
  border-radius: 10px;
  background: #10141a;
  color: var(--ink);
  padding: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  min-height: 44px;
  max-height: 130px;
}

.composer-input:focus {
  border-color: var(--accent);
  outline: 1px solid rgba(var(--accent-rgb), 0.32);
}

.ghost-btn {
  background: #181d26;
  border: 1px solid rgba(120, 134, 157, 0.3);
  color: var(--ink);
  padding: 10px 12px;
}

.primary-btn {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 14px;
  box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.18);
}

.primary-btn:hover,
.primary-btn:focus-visible {
  filter: brightness(1.05);
}

.config-note {
  margin: 12px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.config-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.config-actions .ghost-btn,
.config-actions .primary-btn {
  padding: 9px 12px;
}

.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-choice {
  border: 1px solid rgba(124, 138, 162, 0.3);
  border-radius: 10px;
  background: #151b25;
  padding: 6px;
  cursor: pointer;
}

.icon-choice .nav-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.icon-choice.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.28);
}

.flow-overview {
  margin-top: 12px;
  border: 1px solid rgba(118, 132, 157, 0.24);
  border-radius: 14px;
  background:
    linear-gradient(160deg, rgba(17, 24, 36, 0.94), rgba(13, 18, 28, 0.94)),
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.12), transparent 48%);
  padding: 12px;
}

.flow-head h4 {
  margin: 0;
  font-size: 0.95rem;
  font-family: "Space Grotesk", sans-serif;
}

.flow-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.flow-track {
  margin-top: 10px;
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 4px 0 6px;
  scrollbar-width: thin;
}

.flow-segment {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex: 0 0 auto;
}

.flow-node {
  width: 236px;
  border: 1px solid rgba(118, 132, 157, 0.28);
  border-radius: 13px;
  background: linear-gradient(150deg, #141c2a, #0f1622);
  padding: 11px 11px 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.flow-node.is-decision {
  border-style: dashed;
  background: linear-gradient(140deg, #222233, #171c29);
}

.flow-node.is-active-stage {
  border-color: rgba(var(--accent-rgb), 0.92);
  box-shadow:
    0 0 0 1px rgba(var(--accent-rgb), 0.28),
    0 10px 24px rgba(var(--accent-rgb), 0.14);
}

.flow-node-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-node-icon.nav-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 7px;
  background: rgba(25, 35, 52, 0.9);
}

.flow-stage {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(142, 157, 183, 0.3);
  background: #1a2230;
  color: #d5deef;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 800;
}

.flow-stage-control {
  background: #262029;
  border-color: rgba(188, 161, 191, 0.35);
  color: #f1deff;
}

.flow-node strong {
  display: block;
  margin-top: 9px;
  font-size: 0.9rem;
}

.flow-node p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.flow-arrow {
  position: relative;
  width: 24px;
  flex: 0 0 24px;
  align-self: center;
}

.flow-arrow > span {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(137, 152, 178, 0.2), rgba(137, 152, 178, 0.9));
}

.flow-arrow > span::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  border-left: 5px solid rgba(137, 152, 178, 0.9);
}

.flow-empty {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.flow-strip {
  margin: 4px 0 10px;
  border: 1px solid rgba(118, 132, 157, 0.22);
  border-radius: 12px;
  background:
    linear-gradient(140deg, rgba(18, 25, 39, 0.92), rgba(13, 20, 32, 0.92)),
    radial-gradient(circle at left center, rgba(var(--accent-rgb), 0.18), transparent 55%);
  padding: 9px 10px;
}

.flow-strip-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.flow-strip-head strong {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flow-strip-head span {
  color: var(--muted);
  font-size: 0.74rem;
}

.flow-track-operacion {
  margin-top: 8px;
  padding-bottom: 2px;
}

.stage-flow-segment {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.stage-flow-card {
  border: 1px solid rgba(124, 138, 162, 0.32);
  border-radius: 11px;
  background: #141b28;
  color: var(--ink);
  padding: 7px 9px;
  min-width: 172px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.stage-flow-card:hover {
  border-color: rgba(var(--accent-rgb), 0.65);
}

.stage-flow-card.is-active {
  border-color: rgba(var(--accent-rgb), 0.9);
  background: linear-gradient(145deg, #1b2434, #161f2e);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.2);
}

.stage-flow-icon.nav-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.stage-flow-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stage-flow-copy strong {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: #bcc6d8;
  text-transform: uppercase;
}

.stage-flow-copy span {
  font-size: 0.78rem;
  line-height: 1.2;
  font-weight: 700;
}

.stage-flow-arrow {
  width: 20px;
  height: 1px;
  background: linear-gradient(90deg, rgba(132, 148, 176, 0.28), rgba(132, 148, 176, 0.9));
  position: relative;
}

.stage-flow-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -3px;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  border-left: 5px solid rgba(132, 148, 176, 0.9);
}

.config-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.config-item {
  border: 1px solid rgba(118, 132, 157, 0.24);
  border-radius: 12px;
  background: #0f1319;
  padding: 10px;
  overflow: hidden;
}

.config-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.config-item-meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.config-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.config-item-head strong {
  margin: 0;
}

.config-remove-btn {
  background: #20151a;
  border: 1px solid rgba(193, 128, 140, 0.4);
  color: #ffd9df;
  border-radius: 10px;
  padding: 6px 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
}

.config-grid {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.config-field {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.config-field input,
.config-field select,
.config-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(118, 132, 157, 0.3);
  border-radius: 10px;
  background: #10141a;
  color: var(--ink);
  padding: 9px 10px;
  font-family: inherit;
  font-size: 0.85rem;
}

.config-field textarea {
  min-height: 90px;
  resize: vertical;
}

#save-config-btn {
  margin-top: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 12, 0.68);
  backdrop-filter: blur(3px);
  padding: 20px;
}

.modal-card {
  width: min(760px, 94vw);
  max-height: 84vh;
  overflow: auto;
  border: 1px solid rgba(118, 132, 157, 0.26);
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(18, 21, 28, 0.99), rgba(13, 16, 22, 0.99));
  box-shadow: var(--shadow);
  padding: 16px;
}

.stage-modal-card {
  width: min(980px, 95vw);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stage-modal-body {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.stage-widget {
  border: 1px solid rgba(118, 132, 157, 0.24);
  border-radius: 12px;
  background: #0f1319;
  padding: 12px;
}

.stage-widget-artifact {
  border-color: rgba(168, 193, 228, 0.35);
  background: linear-gradient(150deg, #121a27, #101622);
}

.stage-widget h4 {
  margin: 0;
  font-size: 0.9rem;
}

.stage-text {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.86rem;
}

.stage-kpi-grid {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stage-kpi-item {
  border: 1px solid rgba(118, 132, 157, 0.24);
  border-radius: 10px;
  background: #111723;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.stage-kpi-label {
  font-size: 0.74rem;
  color: var(--muted);
}

.stage-list {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 5px;
  color: #d8dee8;
  font-size: 0.86rem;
}

.stage-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.stage-table-wrap {
  margin-top: 8px;
  overflow: auto;
}

.stage-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 460px;
}

.stage-table th,
.stage-table td {
  border: 1px solid rgba(118, 132, 157, 0.24);
  padding: 7px 8px;
  text-align: left;
  font-size: 0.82rem;
  vertical-align: top;
}

.stage-table th {
  background: #161f2d;
  font-weight: 800;
}

.stage-markdown {
  margin: 8px 0 0;
  border: 1px solid rgba(118, 132, 157, 0.24);
  border-radius: 10px;
  background: #0f1319;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Manrope", sans-serif;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #dde4f0;
}

body.modal-open {
  overflow: hidden;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 95vw);
  border-radius: 24px;
  border: 1px solid rgba(118, 132, 157, 0.25);
  background: rgba(18, 20, 25, 0.95);
  padding: 24px;
  box-shadow: var(--shadow);
}

.login-hero {
  width: 100%;
  min-height: 116px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  border: 1px solid #303748;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.16), transparent 58%),
    linear-gradient(160deg, rgba(21, 24, 31, 0.98), rgba(12, 14, 18, 0.98));
  padding: 14px;
  margin-bottom: 14px;
}

.login-hero-logo {
  width: min(340px, 100%);
  height: 68px;
  object-fit: contain;
}

.login-kicker {
  margin-top: 2px;
}

.login-client {
  margin-top: 4px;
}

.login-card h2 {
  margin: 6px 0 8px;
}

.login-copy {
  margin: 0 0 14px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
}

.login-forgot {
  justify-self: end;
  color: var(--accent);
  font-size: 0.78rem;
  text-decoration: none;
  border-bottom: 1px dashed rgba(var(--accent-rgb), 0.45);
  padding-bottom: 2px;
}

.login-forgot:hover,
.login-forgot:focus-visible {
  filter: brightness(1.08);
  border-bottom-color: rgba(var(--accent-rgb), 0.8);
}

.login-form input {
  width: 100%;
  border: 1px solid rgba(118, 132, 157, 0.3);
  border-radius: 10px;
  padding: 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  background: #10141a;
}

.login-form input:focus {
  border-color: var(--accent);
  outline: 1px solid rgba(var(--accent-rgb), 0.32);
}

.login-hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.login-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
}

html[data-profile="miacom"] .login-card {
  border-color: rgba(var(--accent-rgb), 0.3);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(var(--accent-rgb), 0.14);
}

html[data-profile="miacom"] .topbar {
  margin-bottom: 6px;
}

html[data-profile="miacom"] .brand-logo-wrap {
  width: clamp(78px, 7.4vw, 112px);
  min-width: clamp(78px, 7.4vw, 112px);
  padding: 3px;
  overflow: hidden;
}

html[data-profile="miacom"] .brand-logo {
  max-height: none;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transform: scale(1.06);
  transform-origin: center;
}

html[data-profile="miacom"] .login-hero {
  min-height: 92px;
  padding: 8px;
  border-color: rgba(var(--accent-rgb), 0.28);
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.22), transparent 62%),
    linear-gradient(160deg, rgba(21, 24, 31, 0.98), rgba(12, 14, 18, 0.98));
}

html[data-profile="miacom"] .login-hero-logo {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  border: 2px solid rgba(var(--accent-rgb), 0.82);
  background: #ffffff;
  padding: 3px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.2);
}

@media (max-width: 1220px) {
  .workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    grid-template-rows: auto;
  }

  .work-area {
    height: auto;
  }

  .mode-view.is-active,
  .chat-panel {
    height: auto;
  }
}

@media (max-width: 980px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-logo-wrap {
    width: min(138px, 52vw);
    min-width: 0;
  }

  html[data-profile="miacom"] .brand-logo-wrap {
    width: min(126px, 48vw);
  }

  .chat-composer {
    grid-template-columns: 44px 1fr;
  }

  .chat-composer .primary-btn {
    grid-column: 1 / -1;
  }

  .chat-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .flow-node {
    width: 196px;
  }

  .stage-flow-card {
    min-width: 150px;
  }

  .flow-strip-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}
