:root { color-scheme: dark; font: 15px/1.5 Inter, system-ui, sans-serif; color: #f4eff8; background: #14101a; --muted: #bfb2cc; --panel: #201929; --line: #3c3048; --accent: #e0c4ff; --input: #17121e; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden] { display: none !important; }
.frame { max-width: 1160px; margin: auto; padding-inline: 28px; }
.top { border-bottom: 1px solid var(--line); background: #1a1422; }
.nav, .title-row, .table-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.nav { min-height: 66px; justify-content: flex-start; }
.brand { color: inherit; font-size: 1.4rem; font-weight: 750; text-decoration: none; }
.brand span { color: var(--accent); margin-right: 5px; }
#dashboard-nav { display: flex; gap: 4px; }
.nav-link { background: transparent; color: var(--muted); }
.nav-link:hover, .nav-link[aria-current] { background: #302338; color: var(--accent); }
#logout { margin-inline-start: auto; }
main { padding-block: 32px 48px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.045em; line-height: 1.12; }
h2 { font-size: 1.25rem; letter-spacing: -.02em; }
.eyebrow { color: var(--accent); font-size: .82rem; margin-bottom: 8px; font-weight: 650; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.auth { margin: min(9vh, 70px) auto 0; width: min(100%, 440px); padding: 32px; }
.auth h1 { font-size: 2.25rem; margin-bottom: 24px; }
label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .9rem; }
input, textarea, select, button { font: inherit; }
input, textarea, select { width: 100%; color: inherit; background: var(--input); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
textarea { resize: vertical; }
.auth input { margin-bottom: 14px; }
button { cursor: pointer; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent; color: inherit; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary { color: #261934; background: var(--accent); font-weight: 700; }
.primary:hover { background: #ecdbff; }
.auth .primary { width: 100%; margin-top: 6px; }
.quiet { border-color: var(--line); background: #251d2e; }
.quiet:hover { background: #32263d; }
.text { background: transparent; color: var(--accent); padding-inline: 0; margin-top: 8px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.metric { padding: 12px 16px; }
.metric span, .note { color: var(--muted); font-size: .9rem; }
.metric strong { display: block; font-size: 1.9rem; letter-spacing: -.04em; }
.note { margin-top: 10px; }
.tester-card { margin-top: 26px; overflow: hidden; }
.table-head { padding: 18px 20px; }
.table-head input { width: min(260px, 100%); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 650px; text-align: left; }
th, td { padding: 12px 20px; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: .84rem; font-weight: 600; }
td { font-size: .91rem; }
td:last-child { text-align: right; }
.status { display: inline-block; background: #233c34; color: #c1eed5; border-radius: 20px; padding: 3px 9px; font-size: .8rem; }
.status.disabled { background: #49313e; color: #ffcede; }
.empty { padding: 24px 20px; color: var(--muted); }
.notice { margin-top: 14px; color: var(--accent); }
.notice:empty { display: none; }
dialog { width: min(460px, calc(100% - 32px)); padding: 24px; color: inherit; }
dialog::backdrop { background: #0d0911aa; }
dialog label { margin-top: 16px; }
#subscription-remove input { width: auto; margin-inline-end: .4rem; }
.dialog-actions { justify-content: flex-end; margin-top: 16px; }
#conversation-bots { display: grid; gap: 12px; padding: 0; list-style: none; }
#conversation-bots li { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
#conversation-bots button { white-space: nowrap; }
#conversation-bots .conversation-bot {
  flex: 1 1 130px;
  background: transparent;
  color: var(--accent);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
#conversation-bots .conversation-bot:hover { background: #1a1320; }
#conversation-json-dialog, #checkins-dialog { width: min(960px, calc(100% - 32px)); padding: clamp(16px, 4vw, 24px); }
#checkins-list { display: grid; gap: 16px; padding-left: 24px; }
#checkins-list pre { max-height: 45vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.conversation-json-header, #conversation-json-search-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.conversation-json-header { justify-content: space-between; }
#conversation-json-status:empty { display: none; }
#conversation-json-search-form { margin-top: 16px; }
#conversation-json-search { flex: 1 1 180px; width: auto; min-width: 0; }
#conversation-json-matches { min-height: 1.5em; margin-top: 8px; color: var(--muted); font-size: .9rem; }
#conversation-json-code {
  max-height: 58dvh;
  overflow: auto;
  margin: 8px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1a1320;
  font-size: .875rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#conversation-json-code mark { background: #61465a; color: inherit; }
#conversation-json-code mark.current { background: var(--accent); color: #2d1a23; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 680px) { .frame { padding-inline: 16px; } main { padding-block: 26px; } .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .metric { padding: 12px; } .table-head { flex-wrap: wrap; } .auth { padding: 24px; } }

.toolbar { display: flex; align-items: center; gap: .65rem; }
.toolbar.wrap { flex-wrap: wrap; }
.section-pad { padding: 1rem; margin-bottom: 1rem; }
.catalog { margin-top: 22px; }
.catalog-tools, .bot-row { display: flex; gap: .85rem; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 13px 16px; }
.catalog-tools input { width: min(300px, 100%); }
.catalog-tools select { width: auto; }
.bot-row { border-top: 1px solid var(--line); }
.bot-identity { display: flex; align-items: center; gap: 12px; min-width: 0; overflow-wrap: anywhere; }
.bot-avatar { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; background: #39294a; color: var(--accent); border-radius: 11px; overflow: hidden; font-weight: 700; }
.bot-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bot-status.inactive { color: var(--muted); background: #302737; }
.bot-menu { position: relative; }
.bot-menu > summary { cursor: pointer; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.bot-menu-controls { position: absolute; z-index: 1; inset-inline-end: 0; top: calc(100% + 5px); min-width: 174px; padding: 9px; display: grid; gap: 6px; box-shadow: 0 12px 26px #0006; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: .75rem; }
.field-grid label { display: block; }
.field-grid input, .field-grid textarea { width: 100%; }
.back-link { color: var(--accent); background: transparent; padding: 0; }
.back-link:hover { text-decoration: underline; }
.editor-title { margin: 12px 0 22px; }
.editor-layout { display: grid; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(230px, 30%); gap: 20px; }
#bot-form { display: grid; gap: 12px; }
.editor-section > summary { padding: 13px 16px; cursor: pointer; font-weight: 650; }
.editor-section > summary::marker { color: var(--accent); }
.editor-section[open] > summary { border-bottom: 1px solid var(--line); }
.editor-fields { padding: 16px; }
.editor-fields.field-grid, .editor-fields .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.field-wide { grid-column: 1 / -1; }
.field-help { margin-top: 3px; color: var(--muted); font-size: .86rem; }
.field-help:empty, .preview-tags:empty, .bot-preview p:empty { display: none; }
.editor-actions { position: sticky; bottom: 0; background: #14101af5; border-top: 1px solid var(--line); padding-block: 10px; }
.editor-actions .notice { margin: 0 0 7px; }
.editor-actions .toolbar { justify-content: flex-end; }
.editor-rail { display: grid; gap: 12px; }
.editor-rail .section-pad { margin: 0; }
.bot-preview { display: grid; gap: 9px; margin-top: 12px; overflow-wrap: anywhere; }
.preview-header, .preview-tags { display: flex; gap: 8px; align-items: center; }
.preview-tags { flex-wrap: wrap; }
.preview-tags span { background: #332542; border-radius: 6px; padding: 3px 7px; font-size: .83rem; }
.bot-preview img { width: 58px; height: 70px; object-fit: cover; border-radius: 8px; }
#bot-test textarea { margin-bottom: 7px; }
#bot-test img { max-width: 100%; border-radius: 8px; }
.media-sections { display: grid; gap: 14px; }
.bot-media { min-width: 0; margin: 0; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; }
.bot-media legend { padding: 0 .4rem; font-weight: 650; }
.bot-media details { margin-top: .55rem; }
.bot-media summary { cursor: pointer; color: var(--muted); }
.bot-media details label { margin-top: .5rem; }
.bot-media input[type=file]::file-selector-button { margin-right: .55rem; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: 6px; color: inherit; background: var(--panel); cursor: pointer; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: .65rem; margin-top: .7rem; }
.media-grid:empty { display: none; }
.media-photo { display: grid; align-content: start; gap: .35rem; padding: .5rem; border: 1px solid var(--line); border-radius: 10px; }
.media-photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.media-photo label { margin: 0; }
.media-photo input { padding: .35rem .5rem; font-size: .85rem; }
.media-photo button { justify-self: start; }
#expert-video-selection video { display: block; width: min(100%, 260px); max-height: 300px; margin-block: 10px; border-radius: 8px; background: #100c15; }
input[type=range] { accent-color: var(--accent); padding-inline: 0; }
@media (max-width: 760px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .editor-actions { position: static; }
}
@media (max-width: 480px) {
  .nav { flex-wrap: wrap; gap: 6px; padding-block: 8px; }
  #dashboard-nav { order: 1; width: 100%; }
  .nav-link { padding: 5px 10px; }
  .editor-fields.field-grid, .editor-fields .field-grid { grid-template-columns: minmax(0, 1fr); }
  .catalog-tools input { flex: 1 1 140px; }
  .bot-row-actions { width: 100%; }
  .bot-row-actions .bot-status { margin-inline-end: auto; }
}
