[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.studio { padding-block: 3rem 5rem; }
.studio-heading, .workspace-bar, .editor-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.studio-heading { padding-bottom: 2rem; border-bottom: 1px solid #3c4535; margin-bottom: 2rem; }
.studio-heading h1 { font-size: clamp(2.8rem, 6vw, 5rem); margin: 0; letter-spacing: -.04em; }
.studio-heading h1 span { color: var(--lime); }
.studio-heading p, .hosting p, .hint { color: var(--muted); line-height: 1.6; }
.auth-layout { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 7vw, 8rem); align-items: center; max-width: 65rem; margin: 3rem auto; }
.auth-intro h2 { font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1.1; letter-spacing: -.035em; margin: 0 0 1.5rem; }
.auth-intro p { color: var(--muted); line-height: 1.75; max-width: 31rem; }
.sheet { border: 1px solid #3c4535; border-radius: .5rem; background: #1a2019; padding: clamp(1rem, 3vw, 1.75rem); }
.sheet h2, .sheet h3 { margin-top: 0; }
label { display: grid; gap: .5rem; margin-bottom: 1.25rem; font-size: .9375rem; }
input, textarea, select { width: 100%; min-width: 0; border: 1px solid #5b6651; border-radius: .25rem; background: #11170f; color: #f3f4ea; padding: .75rem; }
textarea { min-height: 7rem; resize: vertical; line-height: 1.6; }
.button { border: 0; justify-content: center; }
.secondary { border: 1px solid #768465; padding: .65rem .85rem; border-radius: .25rem; background: transparent; color: var(--text); min-height: 2.75rem; }
.secondary:hover { background: #2a3523; }
.text-button, #logout { color: var(--lime); background: none; border: 0; padding: .6rem .2rem; min-height: 2.75rem; text-decoration: underline; text-underline-offset: .2em; }
#auth-form .text-button { display: block; }
#notice { border: 1px solid #839d61; padding: 1rem; border-radius: .35rem; background: #28391c; color: #f4ffe8; line-height: 1.5; }
#notice[data-error="true"] { background: #492a24; border-color: #d6947c; }
.bot-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%, 19rem),1fr)); gap: 1rem; margin-block: 1.25rem 2rem; }
.bot-card { background: #1a2019; padding: 1.25rem; border: 1px solid #48523f; border-radius: .4rem; }
.bot-card h3 { margin: .75rem 0; overflow-wrap: anywhere; }
.bot-card p { line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.bot-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.insights-header { display: flex; gap: 1rem; justify-content: space-between; align-items: start; }
.insights-header :is(h2, p) { margin: 0; overflow-wrap: anywhere; }
.insights-header .hint { color: var(--lime); margin-bottom: .2rem; }
.dialog-heading, .insights-header-actions { display: flex; align-items: center; gap: .6rem; }
.dialog-heading { justify-content: space-between; margin-bottom: .65rem; }
.dialog-heading h2 { margin-bottom: 0; }
.insights-header-actions { flex-wrap: wrap; justify-content: end; }
html:has(#insights-dialog[open]) { overflow: hidden; }
#insights-dialog { color: var(--text); width: min(calc(100% - 1.5rem), 48rem); max-height: calc(100dvh - 1.5rem); }
#insights-dialog::backdrop { background: #10130edb; }
.insights-summary { margin-top: 1rem; padding: .85rem 1rem; border: 1px solid #48563f; background: #141b12; border-radius: .3rem; }
.insights-summary div { display: grid; grid-template-columns: auto 1fr; column-gap: .75rem; align-items: center; }
.insights-summary strong { text-align: right; font-family: var(--mono); color: var(--lime); }
.insights-summary progress { grid-column: 1 / -1; width: 100%; height: .55rem; margin: .4rem 0; accent-color: var(--lime); }
.insights-summary p { margin: .25rem 0 0; }
.insights-section { padding-top: 1rem; margin-top: .95rem; border-top: 1px solid #3c4535; min-width: 0; }
.insights-section :is(h3, .hint) { margin: 0 0 .25rem; }
.insights-empty { margin: .5rem 0 0; color: var(--muted); }
.activity-scroll { margin-top: .5rem; max-height: 13.5rem; overflow: auto; }
.activity-scroll:focus-visible { outline: 2px solid var(--lime); outline-offset: -2px; }
.activity-chart { border-collapse: separate; border-spacing: 0; width: 100%; text-align: left; font-size: .875rem; }
.activity-chart :is(th, td) { border-bottom: 1px solid #384535; padding: .35rem .4rem; }
.activity-chart thead th { position: sticky; top: 0; z-index: 1; background: #1a2019; color: var(--muted); }
.activity-chart tbody th { white-space: nowrap; font-weight: 400; }
.activity-chart td { width: 25%; font-variant-numeric: tabular-nums; }
.activity-chart meter { display: block; width: 100%; height: .45rem; }
.activity-chart meter::-webkit-meter-bar { background: #283426; border: 0; }
.activity-chart [data-metric="accepted"] { --bar: #9aac90; }
.activity-chart [data-metric="replies"] { --bar: var(--lime); }
.activity-chart [data-metric="errors"] { --bar: #ffb8a3; }
.activity-chart meter::-webkit-meter-optimum-value { background: var(--bar); }
.activity-chart meter::-moz-meter-bar { background: var(--bar); }
.insights-details { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1rem; }
.insights-ranking, .insights-events { list-style: none; margin: .5rem 0 0; padding: 0; }
.insights-ranking li, .insights-events li { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding-block: .35rem; border-bottom: 1px solid #384535; }
.insights-events time { font: .75rem var(--mono); color: var(--muted); flex: none; }
.insights-ranking code { color: var(--lime); overflow-wrap: anywhere; }
.insights-events { max-height: 14rem; overflow: auto; }
@media (max-width: 38rem) {
  .insights-details { grid-template-columns: minmax(0,1fr); gap: 0; }
  .insights-header { align-items: center; }
  .insights-header-actions { flex: 0 0 auto; }
}
@media (max-width: 28rem) {
  .insights-header-actions { flex-direction: column-reverse; align-items: end; }
}
.status { font-size: .875rem; color: var(--lime); }
.status[data-status="pending"] { color: #ffe5a4; }
.status[data-status="rejected"], .status[data-status="suspended"] { color: #ffb8a3; }
.editor { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr); gap: 1.5rem; align-items: start; }
.command { margin-block: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #3c4535; }
.command .workspace-bar h3 { margin: 0; }
.command .workspace-bar { margin-bottom: 1rem; }
.button-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: .5rem; margin-bottom: .5rem; align-items: start; }
.button-row label { margin: 0; font-size: .875rem; }
.button-row button { margin-top: 1.65rem; }
.editor-actions { justify-content: start; margin-block: 1.5rem; }
.hint { font-size: .875rem; }
.import-label { color: var(--muted); }
.phone { border: 1px solid #627252; border-radius: 1rem; overflow: hidden; background: #e5eadc; color: #25311e; margin-bottom: 1.5rem; }
.phone-heading { display: grid; gap: .35rem; padding: 1.15rem; border-bottom: 1px solid #c0cbb3; }
.phone-heading span { font-size: .875rem; color: #4f5d44; }
#chat { padding: 1rem; min-height: 13rem; max-height: 28rem; overflow-y: auto; }
.bubble { background: #fff; border-radius: .7rem .7rem .7rem .1rem; padding: .8rem; margin-bottom: .8rem; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.bubble.user { background: #cee89f; margin-left: 25%; }
.chat-buttons { display: grid; gap: .4rem; margin-bottom: 1rem; }
.chat-buttons button, .chat-buttons a { padding: .7rem; color: #2d4a1a; border: 1px solid #a4b98e; border-radius: .3rem; background: #f7faef; text-align: center; font: inherit; }
.preview-control { padding: 1rem; border-top: 1px solid #c0cbb3; }
.preview-control label { color: #314127; }
.preview-control select { background: white; color: #26371c; }
.preview-control .secondary { color: #26371c; }
.empty { color: var(--muted); padding-block: 1rem; }
.hosting .button { width: 100%; }
.review { border-top: 1px solid #4f5d44; margin-top: 1rem; padding-top: 1rem; }
.review pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.6; }
@media (max-width: 50rem) {
  .editor, .auth-layout { grid-template-columns: minmax(0,1fr); }
  .auth-layout { margin-block: 1rem; gap: 2rem; }
  .studio { padding-top: 2rem; }
}
@media (max-width: 28rem) {
  .button-row { grid-template-columns: minmax(0,1fr); }
  .button-row button { margin: 0; justify-self: start; }
}

#python-source { min-height: 30rem; tab-size: 4; font-family: Consolas, monospace; font-size: .9375rem; white-space: pre; overflow: auto; }
#token-status { color: var(--lime); font-size: .875rem; }

#preview-text-form { margin-top: 1rem; }
.command-triggers { min-height: 4rem; }
.bot-card > .repo-link { margin-bottom: 1rem; }

.editor { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.editor-toolbar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.editor-toolbar h2, .editor-toolbar .editor-actions { margin: 0; }
.editor-main { display: grid; gap: 1rem; min-width: 0; }
.project-settings summary, .step-advanced summary { cursor: pointer; color: var(--lime); }
.project-settings[open] summary, .step-advanced[open] summary { margin-bottom: 1rem; }
#ai-provider-help { margin: -1rem 0 1rem; }
.ai-knowledge { border-top: 1px solid #3c4535; padding-top: 1rem; }
.ai-knowledge label { margin-bottom: .5rem; }
.ai-knowledge p { margin: .35rem 0 .85rem; }
.flow-panel { padding: 0; overflow: hidden; }
.flow-toolbar { padding: 1rem 1.25rem; }
.flow-toolbar h3, .flow-toolbar p { margin: 0; }
.flow-scroll { overflow: auto; max-height: 30rem; min-height: 10rem; background: radial-gradient(circle, #42503b 1px, transparent 1px) 0 0 / 16px 16px, #131912; border-top: 1px solid #3c4535; }
.flow-scroll:focus-visible { outline: 2px solid var(--lime); outline-offset: -3px; }
#flow { position: relative; width: max-content; min-width: 100%; }
#flow-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#flow-nodes { position: relative; display: flex; align-items: flex-start; gap: 2.75rem; padding: 1.25rem 2rem 1.25rem 1.25rem; }
.flow-column { display: grid; gap: 1rem; width: 12rem; flex: none; }
.flow-node { display: grid; background: #1b2419; border: 1px solid #637658; border-radius: .55rem; overflow: hidden; }
.flow-node:has([aria-pressed="true"]) { border-color: var(--lime); }
.flow-node-title { border: 0; border-bottom: 1px solid #536747; padding: .65rem .8rem; text-align: left; color: var(--lime); background: #283525; font-family: var(--mono); overflow-wrap: anywhere; }
.flow-node-title:hover, .flow-node-title[aria-pressed="true"] { color: #14210d; background: var(--lime); }
.flow-node button:focus-visible { outline-offset: -3px; }
.flow-node p { margin: .65rem .8rem; font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.flow-route { display: block; width: 100%; padding: .4rem .8rem; text-align: left; border: 0; border-top: 1px solid #384735; background: transparent; color: #c6dcb7; font-size: .8rem; overflow-wrap: anywhere; }
button.flow-route:hover { background: #31412a; }
.flow-route-missing { color: #ffb8a3; }
.step-editor .command { margin-top: 0; padding-top: 0; border-top: none; }
.step-advanced, #fallback-field { border-top: 1px solid #3c4535; padding-top: 1rem; }
.step-editor #fallback-field { margin-bottom: 0; }
.phone-heading { position: relative; padding-right: 8rem; }
.phone-heading strong { overflow-wrap: anywhere; }
.preview-reset { position: absolute; top: .95rem; right: .75rem; color: #344e24; background: transparent; border: 0; text-decoration: underline; padding: .5rem; font-size: .8rem; }
.preview-reset:focus-visible { outline-color: #344e24; }
@media (max-width: 54rem) {
  .editor { grid-template-columns: minmax(0, 1fr); }
}

.secondary:is(a) { display: inline-flex; align-items: center; }
.user-search, .user-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.user-search label { flex: 1 1 14rem; max-width: 24rem; margin-bottom: 0; }
.user-list { display: grid; gap: .75rem; margin-block: 1rem; }
.user-row { justify-content: space-between; align-items: center; }
.user-row h3, .user-row p { margin: 0 0 .35rem; }
.bot-limits { border-top: 1px solid #48523f; padding-top: .85rem; margin: 1rem 0; }
.bot-limits h4 { margin: 0; }
.bot-limits label { margin-bottom: .7rem; }

.flow-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.flow-actions [aria-pressed="true"] { color: #17241a; background: var(--lime); }
.board-help { margin: 0; padding: 0 1.25rem .75rem; }
.visual-board #flow-lines { pointer-events: auto; }
#flow-nodes.is-board { display: block; padding: 0; pointer-events: none; }
.is-board .flow-node { position: absolute; width: 13rem; pointer-events: auto; }
.is-board .flow-node-title { cursor: grab; touch-action: none; }
.is-board .dragging { z-index: 2; }
.is-board .dragging .flow-node-title { cursor: grabbing; }
.is-board.is-linking .flow-node-title { cursor: crosshair; }
.flow-connect { border: 0; border-top: 1px solid #536747; background: #22301e; color: #cee7b4; padding: .42rem .65rem; text-align: left; font-size: .83rem; }
.flow-connect:hover { background: #34482b; }
.flow-connect[aria-pressed="true"] { background: #35462a; color: var(--lime); }
.step-branches:not(:empty) { margin-top: .65rem; }
#connection-dialog { width: min(29rem, calc(100% - 2rem)); color: var(--text); }
#connection-dialog::backdrop { background: #0b100bd9; }
#connection-error { color: #facba7; }

.template-picker { padding: 1rem; }
.template-picker h3 { margin-bottom: .6rem; }
.template-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .65rem; }
.template-options button { display: grid; gap: .25rem; text-align: left; background: #222d1f; }
.template-options button:hover { background: #34482b; }
.template-options span { font-size: .8rem; color: #d0dbc6; }
html:has(.board-open), body.board-open { overflow: hidden; }
#board-inspector { display: none; }
#editor.visual-board {
  position: fixed; inset: 0; z-index: 20; margin: 0;
  --board-columns: minmax(0, 1fr) clamp(17rem, 27vw, 24rem);
  display: grid; grid-template: auto minmax(0, 1fr) / var(--board-columns);
  gap: 0; align-items: stretch; background: #131a13;
}
.visual-board .editor-toolbar {
  display: grid; grid-template: "exit title actions language" / auto minmax(0, 1fr) auto auto;
  gap: .5rem 1rem; padding: .55rem clamp(.55rem, 2vw, 1.1rem);
  border-width: 0 0 1px; border-radius: 0; background: #202a1c; z-index: 2;
}
.visual-board .editor-heading { grid-area: title; min-width: 0; }
.visual-board .editor-toolbar h2 { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#board-label { display: block; font: .72rem var(--mono); color: #c2d7ae; margin-bottom: .2rem; }
.visual-board #save-status { display: block; font-size: .75rem; line-height: 1.3; }
#board-exit {
  grid-area: exit; justify-self: start; display: inline-flex; align-items: center; gap: .45rem;
  border-color: #9eac68; color: var(--lime); background: #283525; font-weight: 700; white-space: nowrap;
}
#board-exit:hover { background: #3a4b2a; border-color: var(--lime); }
#board-exit [aria-hidden] { font: 1.1em var(--mono); }
#board-language { grid-area: language; justify-self: end; }
.visual-board .editor-toolbar .editor-actions { grid-area: actions; gap: .4rem; }
.visual-board .editor-toolbar button { min-height: 2.75rem; }
.visual-board .editor-actions [aria-pressed="true"] { background: #35462a; border-color: var(--lime); }
.visual-board #close-editor, .visual-board #templates, .visual-board #board-toggle { display: none; }
.visual-board .editor-main {
  display: grid; grid-column: 1 / -1; grid-row: 2;
  grid-template: auto minmax(0, 1fr) / var(--board-columns); gap: 0; min-height: 0; align-items: stretch;
}
.visual-board .project-settings {
  grid-area: 1 / 2; padding: .8rem 1rem; max-height: min(38dvh, 24rem); overflow: auto;
  border-radius: 0; border-top: 0;
}
.visual-board .flow-panel { grid-area: 1 / 1 / 3 / 2; display: flex; flex-direction: column; border: 0; border-radius: 0; }
.visual-board .flow-toolbar { padding: .65rem .85rem; }
.visual-board .flow-toolbar .hint { display: none; }
.visual-board .board-help { padding: 0 .85rem .5rem; color: #c2d7ae; }
.visual-board .flow-scroll {
  flex: 1; max-height: none; min-height: 0; cursor: grab; touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.visual-board .flow-scroll.is-panning, .visual-board .flow-scroll.is-panning * { cursor: grabbing; }
.visual-board .step-editor { grid-area: 2 / 2; overflow: auto; border-radius: 0; padding: .95rem; }
.visual-board .preview-column {
  display: none; grid-area: 2 / 2; background: #171e17; overflow: auto; z-index: 1; min-width: 0;
  padding: .8rem; border-left: 1px solid #3c4535;
}
.visual-board[data-board-panel="preview"] .preview-column { display: block; }
.visual-board[data-board-panel="preview"] :is(.project-settings, .step-editor, .hosting) { display: none; }
#notice.board-notice { position: fixed; z-index: 21; bottom: .5rem; left: 1rem; max-width: min(38rem, calc(100% - 2rem)); }
@media (max-width: 720px) {
  #editor.visual-board { --board-columns: minmax(0, 1fr); }
  .visual-board .editor-toolbar {
    grid-template: "exit title language" "actions actions actions" / auto minmax(0, 1fr) auto;
    gap: .4rem;
  }
  .visual-board .editor-toolbar #board-exit { padding-inline: .4rem; font-size: .8rem; }
  #board-inspector { display: block; }
  .visual-board .editor-toolbar .editor-actions {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .visual-board .editor-toolbar .editor-actions button { padding: .35rem .25rem; font-size: .8rem; }
  .visual-board .flow-panel { grid-area: 1 / 1 / 3 / 2; }
  .visual-board .project-settings { grid-area: 1 / 1; max-height: 35dvh; }
  .visual-board .step-editor { grid-area: 2 / 1; }
  .visual-board .preview-column { grid-area: 2 / 1; border-left: 0; }
  .visual-board:not([data-board-panel="settings"]) :is(.project-settings, .step-editor),
  .visual-board:not([data-board-panel="canvas"]) .flow-panel { display: none; }
  .visual-board .flow-toolbar { gap: .45rem; }
  .visual-board .flow-toolbar h3 { font-size: .9rem; }
  .visual-board .flow-toolbar .flow-actions { gap: .3rem; }
  .visual-board .flow-toolbar .flow-actions button { padding: .4rem .45rem; font-size: .8rem; }
  .visual-board .board-help { font-size: .75rem; }
}

.check-row { display: flex; gap: .65rem; align-items: center; }
.check-row input { width: auto; }
.visual-board .step-editor, .visual-board .preview-column { overscroll-behavior: contain; }
