/* ============================================================
   One Click · AI Bot — интерфейс панели
   Фирменные токены One Click Studio
   ============================================================ */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-var-cyrillic.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F;
}
@font-face {
  font-family: "Unbounded";
  src: url("/assets/fonts/Unbounded-var-cyrillic.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Unbounded";
  src: url("/assets/fonts/Unbounded-var-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F;
}

:root {
  --paper: #f4f3ee;
  --paper-2: #ecebe3;
  --card: #ffffff;
  --ink: #17211d;
  --ink-soft: #46554d;
  --ink-faint: #6d7a72;
  --dark: #121816;
  --dark-2: #1a231f;
  --light: #f6f7f2;
  --lime: #c8f36a;
  --lime-soft: #eafac6;
  --lime-ink: #1b2a12;
  --signal: #b83a26;
  --signal-soft: #f7e3de;
  --amber: #a86a12;
  --amber-soft: #fbf0dc;
  --teal: #1f6b5c;
  --teal-soft: #e4f2ee;
  --line: rgba(23, 33, 29, 0.10);
  --line-2: rgba(23, 33, 29, 0.18);
  --line-dark: rgba(246, 247, 242, 0.12);
  --r: 14px;
  --r-sm: 10px;
  --r-xs: 7px;
  --shadow: 0 20px 44px -32px rgba(18, 24, 22, 0.42);
  --font: "Inter", -apple-system, "Segoe UI", sans-serif;
  --display: "Unbounded", "Inter", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--lime); color: var(--lime-ink); }
[hidden] { display: none !important; }

/* ---------- common ---------- */
.muted { color: var(--ink-faint); }
.small { font-size: 12.5px; line-height: 1.5; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }

/* ---------- login ---------- */
.login {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: var(--dark); color: var(--light);
  background-image:
    radial-gradient(900px 500px at 15% 0%, rgba(200, 243, 106, 0.14), transparent 60%),
    linear-gradient(to right, rgba(246, 247, 242, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(246, 247, 242, 0.035) 1px, transparent 1px);
  background-size: auto, 72px 72px, 72px 72px;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: rgba(246, 247, 242, 0.04);
  border: 1px solid var(--line-dark);
  border-radius: 18px;
  padding: 30px 28px 22px;
  display: flex; flex-direction: column; gap: 8px;
  backdrop-filter: blur(8px);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.login h1 { font-family: var(--display); font-size: 21px; font-weight: 600; margin: 6px 0 0; letter-spacing: -0.02em; }
.login p { margin: 0 0 10px; color: rgba(246, 247, 242, 0.62); font-size: 13px; }
.login .field span { color: rgba(246, 247, 242, 0.7); }
.login .field input {
  background: rgba(246, 247, 242, 0.07);
  border: 1px solid var(--line-dark);
  color: var(--light);
}
.login .btn-lg { margin-top: 6px; }
.login-error { color: #ffb4a4; font-size: 12.5px; }
.login-foot { margin-top: 16px; font-size: 11px; color: rgba(246, 247, 242, 0.38); text-align: center; letter-spacing: 0.04em; }

/* ---------- brand ---------- */
.mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--lime); color: var(--lime-ink);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 14px;
  letter-spacing: -0.04em; flex: 0 0 auto;
}
.brand-name { font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: 0.06em; }
.brand-sub { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.55; }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; }

.rail {
  width: 244px; flex: 0 0 244px;
  background: var(--dark); color: var(--light);
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(0, 0, 0, 0.4);
}
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 22px; }
.rail-brand .brand-name { color: var(--light); }
.rail-brand .brand-sub { color: var(--light); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  font-size: 13.5px; color: rgba(246, 247, 242, 0.62);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  position: relative;
}
.nav a svg { width: 17px; height: 17px; opacity: 0.75; }
.nav a:hover { background: rgba(246, 247, 242, 0.06); color: var(--light); }
.nav a.active { background: rgba(200, 243, 106, 0.12); color: var(--lime); }
.nav a.active svg { opacity: 1; }
.nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--lime);
}
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--lime); color: var(--lime-ink);
  font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
}

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sandbox-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 9px;
  border: 1px dashed rgba(200, 243, 106, 0.34);
  color: var(--lime); font-size: 13px;
}
.sandbox-link:hover { background: rgba(200, 243, 106, 0.08); }
.tenant { padding: 10px 10px 0; border-top: 1px solid var(--line-dark); }
.tenant-name { font-size: 12.5px; color: var(--light); }
.tenant-sub { font-size: 10.5px; color: rgba(246, 247, 242, 0.42); margin-top: 1px; }
.ghost-link {
  background: none; border: 0; color: rgba(246, 247, 242, 0.42);
  font-size: 11.5px; text-align: left; padding: 0 10px; cursor: pointer;
}
.ghost-link:hover { color: var(--light); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px; flex: 0 0 62px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(244, 243, 238, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.crumb-muted { color: var(--ink-faint); font-weight: 500; }
.slash { color: var(--line-2); }
.top-actions { display: flex; align-items: center; gap: 8px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-soft);
}
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.status-pill.on i { background: #3d9a5c; box-shadow: 0 0 0 3px rgba(61, 154, 92, 0.16); }
.status-pill.demo i { background: #d19a2a; box-shadow: 0 0 0 3px rgba(209, 154, 42, 0.16); }
.status-pill.off i { background: #c2503a; }

.view { padding: 26px 28px 48px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 {
  font-family: var(--display); font-size: 24px; font-weight: 600;
  letter-spacing: -0.025em; margin: 0; line-height: 1.2;
}
.page-head p { margin: 5px 0 0; color: var(--ink-faint); font-size: 13px; max-width: 720px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid transparent; background: #fff;
  font-size: 13px; font-weight: 500; color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-dark { background: var(--dark); color: var(--light); }
.btn-dark:hover { background: #1f2b26; }
.btn-lime { background: var(--lime); color: var(--lime-ink); }
.btn-lime:hover { background: #d4f884; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: #fff; }
.btn-soft { background: var(--paper-2); }
.btn-soft:hover { background: #e5e3d9; }
.btn-danger { background: var(--signal-soft); color: var(--signal); }
.btn-danger:hover { background: #f2d2ca; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--ink-soft);
}
.icon-btn:hover { background: var(--paper); }
.icon-btn svg { width: 15px; height: 15px; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px 12px;
}
.card-head h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.card-head .muted { font-size: 11.5px; }
.card-body { padding: 0 20px 18px; }

.grid { display: grid; gap: 14px; align-items: start; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-8-4 { grid-template-columns: minmax(0, 2.15fr) minmax(0, 1fr); }
.g-3-2 { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.g-4-4-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt { margin-top: 14px; }
.mt-lg { margin-top: 22px; }

/* ---------- kpi ---------- */
.kpi { padding: 16px 18px 14px; position: relative; overflow: hidden; }
.kpi-label { font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-faint); }
.kpi-value {
  font-family: var(--display); font-size: 30px; font-weight: 600;
  letter-spacing: -0.03em; line-height: 1.1; margin-top: 8px;
}
.kpi-value small { font-size: 15px; font-weight: 500; color: var(--ink-faint); letter-spacing: 0; }
.kpi-note { font-size: 11.5px; color: var(--ink-faint); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.kpi-spark { position: absolute; right: 12px; bottom: 12px; opacity: 0.9; }
.trend { font-weight: 600; }
.trend.up { color: #2f8a51; }
.trend.down { color: var(--signal); }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 10px; fill: var(--ink-faint); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-soft); }
.dot { width: 8px; height: 8px; border-radius: 3px; background: var(--lime); }
.dot.dark { background: var(--ink); }
.dot.grey { background: var(--line-2); }

.donut-wrap { display: flex; align-items: center; gap: 16px; padding: 4px 0 6px; }
.donut-svg { width: 132px; height: 132px; flex: 0 0 auto; }
.donut-center { font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: -0.03em; }
.donut-sub { font-size: 8px; fill: var(--ink-faint); letter-spacing: 0.02em; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.donut-legend .li { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.donut-legend .li b { margin-left: auto; font-weight: 600; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 26px; align-items: center; gap: 9px; font-size: 12px; }
.bar-track { display: block; height: 7px; border-radius: 4px; background: var(--paper-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--ink); }
.bar-row b { font-weight: 600; text-align: right; font-size: 11.5px; }

/* ---------- table ---------- */
.table-wrap { overflow: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; padding: 0 12px 9px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(244, 243, 238, 0.6); }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; opacity: 0.7; transition: opacity 0.15s; }
tr:hover .row-actions { opacity: 1; }

/* ---------- chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
  background: var(--paper-2); color: var(--ink-soft);
}
.chip.lime { background: var(--lime-soft); color: #4a6412; }
.chip.green { background: var(--teal-soft); color: var(--teal); }
.chip.red { background: var(--signal-soft); color: var(--signal); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.dark { background: var(--dark); color: var(--light); }
.chip.outline { background: transparent; border: 1px solid var(--line-2); }
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.badge-demo {
  font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--amber); background: var(--amber-soft);
  padding: 1px 6px; border-radius: 4px; font-weight: 600;
}

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11.5px; color: var(--ink-faint); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 9px;
  background: #fff; padding: 9px 11px; font-size: 13px; color: var(--ink);
  font-family: inherit; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input[type="range"] { padding: 0; border: 0; background: transparent; accent-color: var(--ink); height: 22px; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 33, 29, 0.08);
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236d7a72' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-faint); }
.search .input { padding-left: 32px; min-width: 220px; }

.segmented { display: inline-flex; background: var(--paper-2); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 7px;
  font-size: 12px; color: var(--ink-soft); cursor: pointer; font-weight: 500;
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07); }

.switch { position: relative; width: 34px; height: 20px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 10px; background: var(--paper-2);
  transition: background 0.15s; cursor: pointer;
}
.switch span::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform 0.15s var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(14px); }

/* ---------- dialogs list ---------- */
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; min-height: 620px; }
.dialog-list { display: flex; flex-direction: column; overflow: hidden; }
.dialog-list .list-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.dialog-list .list-scroll { overflow: auto; flex: 1; }
.dialog-item {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background 0.12s; display: flex; flex-direction: column; gap: 4px;
}
.dialog-item:hover { background: rgba(244, 243, 238, 0.7); }
.dialog-item.active { background: var(--lime-soft); border-left: 3px solid var(--ink); padding-left: 13px; }
.di-top { display: flex; align-items: center; gap: 8px; }
.di-name { font-weight: 600; font-size: 13px; }
.di-time { margin-left: auto; font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; }
.di-preview {
  font-size: 12px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}
.di-tags { display: flex; gap: 5px; margin-top: 3px; flex-wrap: wrap; }
.di-tags .chip { height: 19px; font-size: 10px; }

.thread { display: flex; flex-direction: column; overflow: hidden; }
.thread-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.thread-title { font-weight: 600; font-size: 14px; }
.thread-scroll { flex: 1; overflow: auto; padding: 18px; background:
  radial-gradient(circle at 1px 1px, rgba(23, 33, 29, 0.045) 1px, transparent 0) 0 0/16px 16px; }
.msg-row { display: flex; margin-bottom: 12px; }
.msg-row.user { justify-content: flex-start; }
.msg-row.assistant { justify-content: flex-end; }
.msg-row > div { max-width: 76%; min-width: 0; }
.msg {
  max-width: 100%; border-radius: 13px; padding: 10px 13px;
  font-size: 13px; line-height: 1.5; white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(18, 24, 22, 0.05);
}
.msg.user { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.assistant { background: var(--dark); color: var(--light); border-bottom-right-radius: 4px; }
.msg.operator { background: var(--lime); color: var(--lime-ink); border-bottom-right-radius: 4px; }
.msg-meta { font-size: 10.5px; color: var(--ink-faint); margin-top: 4px; }
.msg-row.user .msg-meta { text-align: left; }
.msg-row.assistant .msg-meta { text-align: right; }
.thread-empty { flex: 1; display: grid; place-items: center; color: var(--ink-faint); font-size: 13px; }
.thread-actions { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- bubbles for sandbox ---------- */
.bubble-buttons { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.bubble-btn {
  display: block; text-align: center; padding: 8px 12px; border-radius: 8px;
  background: #fff; border: 1px solid var(--line-2);
  color: var(--ink); font-size: 12.5px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(18, 24, 22, 0.04);
}
.bubble-btn:hover { background: var(--lime-soft); border-color: #a9d45a; }

/* ---------- readiness ---------- */
.rd-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rd-item:last-child { border-bottom: 0; }
.rd-check {
  width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto; margin-top: 1px;
  display: grid; place-items: center; border: 1px solid var(--line-2); color: transparent;
}
.rd-check.done { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.rd-check svg { width: 11px; height: 11px; stroke-width: 3; }
.rd-text { font-size: 12.5px; }
.rd-text small { display: block; color: var(--ink-faint); font-size: 11px; }
.rd-item a { font-size: 11px; color: var(--ink-faint); margin-left: auto; white-space: nowrap; }
.rd-item a:hover { color: var(--ink); text-decoration: underline; }
.rd-bar { height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; margin: 12px 0 4px; }
.rd-bar div { height: 100%; background: var(--lime); border-radius: 3px; }

/* ---------- versions ---------- */
.version { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.version:last-child { border-bottom: 0; }
.v-num {
  font-family: var(--display); font-size: 11px; font-weight: 600;
  background: var(--paper-2); color: var(--ink); border-radius: 6px;
  padding: 3px 6px; flex: 0 0 auto;
}
.v-num.active { background: var(--lime); color: var(--lime-ink); }
.v-body { flex: 1; min-width: 0; }
.v-title { font-size: 12.5px; line-height: 1.4; }
.v-sub { font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- editor ---------- */
.code {
  width: 100%; min-height: 420px; resize: vertical;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: #fbfbf8; border: 1px solid var(--line-2); border-radius: 11px;
  padding: 14px 16px; color: var(--ink); outline: none;
}
.code:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 33, 29, 0.07); }

/* ---------- dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--line-2); border-radius: 12px;
  padding: 22px; text-align: center; cursor: pointer;
  transition: background 0.15s, border-color 0.15s; background: #fbfbf8;
}
.dropzone:hover, .dropzone.drag { background: var(--lime-soft); border-color: var(--ink); }
.dropzone svg { width: 22px; height: 22px; color: var(--ink-soft); margin-bottom: 6px; }
.dropzone .dz-title { font-size: 13px; font-weight: 500; }
.dropzone .dz-sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(18, 24, 22, 0.34); z-index: 60; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw);
  background: var(--paper); z-index: 61; display: flex; flex-direction: column;
  box-shadow: -30px 0 60px -40px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.24s var(--ease);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  padding: 18px 20px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--line); background: var(--paper);
}
.drawer-title { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.drawer-body { padding: 20px; overflow: auto; flex: 1; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; }
.modal::before { content: ""; position: fixed; inset: 0; background: rgba(18, 24, 22, 0.42); }
.modal-card {
  position: relative; background: var(--paper); border-radius: 16px;
  width: min(560px, 100%); max-height: 88vh; overflow: auto;
  padding: 22px; box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.6);
  animation: pop 0.2s var(--ease);
}
@keyframes pop { from { transform: scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { font-family: var(--display); font-size: 17px; margin: 0 0 4px; letter-spacing: -0.02em; }
.modal .modal-sub { color: var(--ink-faint); font-size: 12.5px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--dark); color: var(--light); border-radius: 10px;
  padding: 10px 14px; font-size: 12.5px; box-shadow: 0 12px 30px -16px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.2s var(--ease); max-width: 360px;
}
.toast.err { background: var(--signal); }
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } }

/* ---------- misc ---------- */
.empty {
  padding: 44px 20px; text-align: center; color: var(--ink-faint); font-size: 13px;
}
.empty b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; font-weight: 500; }
.doc-preview {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 76px;
}
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; }
.hint {
  background: var(--lime-soft); border-radius: 10px; padding: 10px 12px;
  font-size: 12px; color: #3f5410; display: flex; gap: 8px; align-items: flex-start;
}
.hint svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 2px; }
.callout { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--lime); border-radius: 10px; padding: 12px 14px; font-size: 12.5px; }

.debug { background: var(--dark); color: var(--light); border-radius: 11px; padding: 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.6; }
.debug-row { display: flex; gap: 8px; }
.debug-key { color: rgba(246, 247, 242, 0.45); min-width: 92px; }
.debug-val { color: var(--lime); word-break: break-word; }

.preview-card { background: var(--dark); border-radius: 14px; padding: 18px; color: var(--light); }
.preview-card .bot-name { font-size: 11px; color: rgba(246, 247, 242, 0.5); margin-bottom: 8px; }
.preview-card .bubble {
  background: var(--dark-2); border: 1px solid var(--line-dark); border-radius: 12px 12px 12px 4px;
  padding: 10px 13px; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap;
}

@media (max-width: 1240px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-8-4, .g-3-2 { grid-template-columns: 1fr; }
  .g3, .g-4-4-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .rail { width: 66px; flex-basis: 66px; padding: 18px 8px; }
  .rail-brand > div:last-child, .nav span:not(.nav-badge), .rail-foot .tenant, .rail-foot .ghost-link, .sandbox-link span { display: none; }
  .nav a { justify-content: center; }
  .rail-brand { justify-content: center; padding-bottom: 18px; }
  .sandbox-link { justify-content: center; }
  .view { padding: 20px 18px 40px; }
  .split { grid-template-columns: 1fr; }
  .g4, .g3, .g2, .g-4-4-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
}
