:root {
  --sidebar: #0f172a;
  --sidebar-soft: #1e293b;
  --sidebar-text: #94a3b8;
  --canvas: #f6f7f9;
  --surface: #ffffff;
  --line: #e4e7ec;
  --text: #101828;
  --muted: #667085;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font: 14px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { display: flex; min-height: 100%; }

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: var(--sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 20px 18px 18px;
  color: #fff;
  text-decoration: none;
}

.brand:hover { text-decoration: none; }
.brand strong { display: block; font-size: 14.5px; letter-spacing: -0.1px; }
.brand small { display: block; color: var(--sidebar-text); font-size: 11.5px; }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
}

.sidebar nav { padding: 4px 10px 20px; flex: 1; }

.nav-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 8px 6px;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.nav-label a {
  color: #64748b;
  font-size: 15px;
  line-height: 1;
  padding: 0 4px;
  border-radius: 4px;
}

.nav-label a:hover { color: #fff; background: var(--sidebar-soft); text-decoration: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: 7px;
  color: #cbd5e1;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover { background: var(--sidebar-soft); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-item.muted { color: #64748b; font-size: 12.5px; }
.nav-item.muted:hover { color: #cbd5e1; }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #475569;
  flex: 0 0 6px;
}

.nav-item.active .dot { background: #fff; }

.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid #1e293b;
  color: #475569;
  font-size: 11.5px;
}

/* ------------------------------------------------------------------- main */

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

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 30px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 { margin: 2px 0 0; font-size: 20px; letter-spacing: -0.2px; }
.crumbs { color: var(--muted); font-size: 12px; }
.crumbs a { color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-actions form { margin: 0; }

.content { padding: 24px 30px 60px; max-width: 1180px; }

section { margin-top: 30px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.section-head h2 { margin: 0; font-size: 15px; letter-spacing: -0.1px; }
.section-head a { font-size: 13px; }

/* ------------------------------------------------------------------ parts */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: #f9fafb; border-color: #d0d5dd; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { color: #b42318; }
.btn.danger:hover { background: #fef3f2; border-color: #fda29b; }
.btn.block { display: flex; justify-content: center; width: 100%; margin-top: 12px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.panel.narrow { max-width: 620px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat-value { display: block; font-size: 24px; font-weight: 600; letter-spacing: -0.5px; }
.stat-label { color: var(--muted); font-size: 12.5px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--text);
  display: block;
}

a.card:hover { border-color: #b2c6f5; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.07); text-decoration: none; }
.card h3 { margin: 0 0 4px; font-size: 14.5px; }
.card p { margin: 0 0 4px; }
.tool-card { display: flex; flex-direction: column; }
.tool-card .meta { margin-top: auto; padding-top: 8px; }

.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: 12.5px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; }
.right { text-align: right; white-space: nowrap; }
.link { margin-left: 8px; font-size: 12.5px; }

.empty {
  background: var(--surface);
  border: 1px dashed #d0d5dd;
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.empty .btn { margin-top: 6px; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #f2f4f7;
  color: var(--muted);
  text-transform: capitalize;
}

.pill.success { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.pill.running { background: var(--accent-soft); border-color: #b2c6f5; color: #1749b3; }
.pill.error { background: #fef3f2; border-color: #fecdc9; color: #b42318; }

/* ------------------------------------------------------------------ forms */

label { display: block; font-weight: 600; font-size: 13px; margin: 16px 0 6px; }
label:first-of-type { margin-top: 0; }

input[type=text], textarea, select {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

input[type=text]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; line-height: 1.6; resize: vertical; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }

/* ----------------------------------------------------------------- tables */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
thead th { background: #fafbfc; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }

/* ------------------------------------------------------------- two column */

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }

.side-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  position: sticky;
  top: 96px;
}

.side-panel h3 { margin: 0 0 8px; font-size: 13.5px; }
.side-panel p { font-size: 12.5px; }

@media (max-width: 1000px) {
  .two-col { grid-template-columns: 1fr; }
  .side-panel { position: static; }
}

.kv { display: flex; flex-wrap: wrap; gap: 26px; }
.kv.stacked { flex-direction: column; gap: 10px; margin: 14px 0; }
.kv-label { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.notes { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); white-space: pre-wrap; }

.flash {
  background: var(--accent-soft);
  border: 1px solid #b2c6f5;
  color: #1749b3;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
}

/* -------------------------------------------------------------- run pages */

.run-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }
.toggles { display: flex; gap: 18px; margin-bottom: 14px; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details[open] summary { margin-bottom: 8px; }

pre {
  background: #f8f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 460px;
}

.working { display: flex; gap: 16px; align-items: center; }
.working p { margin: 4px 0 0; }
.error-panel pre { background: #fef3f2; border-color: #fecdc9; }

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex: 0 0 26px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------- rendered markdown body */

.md { padding: 30px 38px; line-height: 1.68; font-size: 14.5px; }
.md > *:first-child { margin-top: 0; }
.md h1 { font-size: 25px; margin: 30px 0 12px; letter-spacing: -0.3px; }
.md h2 { font-size: 19px; margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.md h3 { font-size: 16px; margin: 22px 0 8px; }
.md h4 { font-size: 14.5px; margin: 18px 0 6px; }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0; padding-left: 24px; }
.md li { margin: 4px 0; }
.md code { background: #f2f4f7; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-family: Consolas, "Courier New", monospace; font-size: 12.5px; }
.md pre { max-height: none; }
.md pre code { background: none; border: 0; padding: 0; }
.md table { margin: 16px 0; border: 1px solid var(--line); border-radius: 8px; }
.md th, .md td { border-bottom: 1px solid var(--line); vertical-align: top; }
.md blockquote { margin: 14px 0; padding: 4px 16px; border-left: 3px solid #d0d5dd; color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.md img { max-width: 100%; }

/* ------------------------------------------------- projects, prompts, runs */

.pill.paused { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.pill.stopped { background: #f2f4f7; border-color: #d0d5dd; color: #475467; }
.pill + .pill { margin-left: 6px; }
td .pill { margin-left: 6px; }

.dot.success { background: #12b76a; }
.dot.running { background: #2563eb; }
.dot.paused { background: #f79009; }
.dot.error { background: #f04438; }
.dot.stopped { background: #667085; }

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  padding: 0;
  cursor: pointer;
}

.link-btn:hover { text-decoration: underline; }
.right form { display: inline; margin-left: 8px; }

.static-value { margin: 0 0 4px; font-size: 13.5px; }
.pre-line { white-space: pre-line; }
.kv.tight { gap: 12px; }
.kv.stacked > div { min-width: 0; word-break: break-word; }
.spaced { margin-top: 16px; }
pre.tall { max-height: 640px; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13px;
  margin: 16px 0 0;
}

.check input { width: auto; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0 16px;
}

.field-grid label { margin-top: 14px; }

.exec-note {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12.5px;
}

.exec-note strong { display: block; color: var(--text); font-size: 12px; margin-bottom: 2px; }

.spinner.held { animation: none; border-top-color: #f79009; border-color: #fedf89; border-top-color: #b54708; }

/* ------------------------------------------------------------------ modal */

.modal {
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: min(760px, calc(100vw - 40px));
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.22);
  color: var(--text);
}

.modal::backdrop { background: rgba(16, 24, 40, 0.45); }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 { margin: 0; font-size: 16px; }

.modal-body { padding: 18px 22px; max-height: min(62vh, 560px); overflow-y: auto; }

.modal-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-radius: 0 0 12px 12px;
}

.modal-foot .check { margin: 0; }
.modal-foot .form-actions { margin: 0; }

@media (max-width: 640px) {
  .modal-foot { flex-direction: column; align-items: stretch; }
}

/* ------------------------------------- sidebar projects nested under tools */

.nav-sub { margin: 0 0 6px 10px; padding-left: 8px; border-left: 1px solid #1e293b; }

.nav-item.sub {
  font-size: 12.5px;
  padding: 5px 8px;
  color: #94a3b8;
}

.nav-item.sub:hover { color: #fff; }
.nav-item.sub.active { background: var(--accent); color: #fff; }
.nav-item.sub.muted { color: #64748b; }

/* -------------------------------------------------------- run control bar */

.control-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
}

.control-state { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.control-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.control-buttons form { margin: 0; }

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f2f4f7;
  border-color: var(--line);
  color: var(--muted);
}

.btn.primary[disabled] { background: #cdd7ea; border-color: #cdd7ea; color: #f8fafc; }
.btn.danger[disabled] { color: var(--muted); }

.icon-btn {
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}

.icon-btn:hover { color: var(--text); }

/* ------------------------------------------- workspace: rail + detail pane */

.content.full { max-width: none; padding: 0; }

.workspace { display: grid; grid-template-columns: 330px minmax(0, 1fr); }

.rail {
  border-right: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 76px;
  height: calc(100vh - 76px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rail-filters { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.rail-filters .search { position: relative; margin-bottom: 8px; }
.rail-filters input, .rail-filters select { font-size: 13px; padding: 8px 10px; }
.rail-list { flex: 1; overflow-y: auto; padding: 10px; }

.rail-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 13px;
  margin-bottom: 8px;
  color: var(--text);
  text-decoration: none;
}

.rail-card:hover { border-color: #b2c6f5; text-decoration: none; background: #fbfcfe; }
.rail-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.rail-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.rail-card-head strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-url { color: var(--accent); font-size: 12px; margin: 3px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-meta { color: var(--muted); font-size: 11.5px; display: flex; gap: 12px; flex-wrap: wrap; }
.rail-empty { color: var(--muted); font-size: 13px; padding: 22px 12px; text-align: center; }
.rail-add { margin: 10px; width: calc(100% - 20px); }

.workspace-main { padding: 22px 26px 60px; min-width: 0; }

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

.detail-head h2 { margin: 0 0 4px; font-size: 19px; display: flex; align-items: center; gap: 10px; }
.detail-url { font-size: 13px; }
.detail-line { margin: 4px 0 0; font-size: 12.5px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.detail-actions form { margin: 0; }

.meta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: 13px;
}

.output-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.output-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}

.output-head strong { display: block; font-size: 13.5px; }
.output-head .muted { font-size: 12px; }
.output-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.output-block .flash { margin: 12px 16px 0; }

.terminal { background: #0b1220; padding: 16px 18px; max-height: 560px; overflow: auto; }

.terminal pre {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: #dbe4f3;
  font-size: 12.5px;
  line-height: 1.6;
  max-height: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.md.padded { padding: 24px 28px; }
.tall-empty { margin: 40px auto; max-width: 520px; }
.tall-empty h3 { margin: 0 0 6px; font-size: 17px; color: var(--text); }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-list { max-height: 320px; }
}

.js-ago.stalled { color: #b54708; font-weight: 600; }

details.output-block > summary.output-head { cursor: pointer; }
details.output-block > summary.output-head::-webkit-details-marker { display: none; }
details.output-block > summary.output-head strong { display: inline; margin-right: 8px; }
.error-panel details { margin-top: 10px; }

/* ------------------------------------------------- tool-driven form fields */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid > .full { grid-column: 1 / -1; }
.form-grid label { margin-top: 14px; }
.form-grid .hint { margin-top: 6px; }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.checkbox-grid .check { margin: 0; font-weight: 400; font-size: 13px; }
input[type=file] { width: 100%; font-size: 13px; padding: 8px 0; }

/* --------------------------------------------------------- accounts area */

.sidebar-user {
  border-top: 1px solid #1e293b;
  padding: 12px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-user .who strong { display: block; font-size: 13px; color: #e2e8f0; }
.sidebar-user .who small { color: #64748b; font-size: 11.5px; }
.sidebar-user .who-links { display: flex; gap: 12px; align-items: center; }
.sidebar-user a, .sidebar-user .link-btn { color: #94a3b8; font-size: 12px; }
.sidebar-user a:hover, .sidebar-user .link-btn:hover { color: #fff; }
.sidebar-user form { margin: 0; }

.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f79009;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--canvas);
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 30px 32px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.08);
}

.auth-brand { display: flex; gap: 11px; align-items: center; margin-bottom: 22px; }
.auth-brand strong { display: block; font-size: 15px; }
.auth-brand small { display: block; color: var(--muted); font-size: 11.5px; }
.auth-card h1 { font-size: 19px; margin: 0 0 14px; }
.auth-card .form-actions { margin-top: 20px; }
.auth-card .btn { width: 100%; justify-content: center; }

.tool-ai-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 170px;
  gap: 16px;
  align-items: end;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.tool-ai-row:last-of-type { border-bottom: 0; }
.tool-ai-row label { margin-top: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { max-width: 320px; }
.link-btn.danger-text { color: #b42318; }
td .link-btn + .link-btn, td form + form, td .link-btn + form { margin-left: 8px; }
h2.spaced { margin-top: 26px; }

/* -------------------------------------------------- server tool toggles */

.tool-toggles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.tool-toggle {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  background: #fbfcfe;
}

.tool-toggle.on { border-color: #b2c6f5; background: var(--accent-soft); }
.tool-toggle .check { margin: 0; }
.tool-toggle .hint { margin: 6px 0 0; }
.tool-toggle label:not(.check) { margin-top: 10px; font-size: 12px; }
.tiny { font-size: 11px; color: var(--muted); margin: 4px 0 0; }

.secret-field { display: flex; gap: 8px; align-items: center; }
.secret-field input { flex: 1; }
.small-modal { width: min(460px, calc(100vw - 40px)); }
.error-text { color: #b42318; }
.nowrap { white-space: nowrap; }
.inline-filters { display: flex; gap: 8px; border: 0; padding: 0 0 12px; }
.inline-filters select { max-width: 260px; }

/* ------------------------------------------------- settings and profile */

.narrow-form { max-width: 720px; }
.secret-field { display: flex; gap: 8px; align-items: stretch; }
.secret-field input { flex: 1 1 auto; min-width: 0; font-family: Consolas, "Courier New", monospace; }
.secret-field .btn { flex: 0 0 auto; }
.good-text { color: #067647; }
.warn-text { color: #b54708; }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  align-items: start;
  max-width: 960px;
}

.identity { grid-column: 1 / -1; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.identity h2 { margin: 0 0 6px; font-size: 18px; }
.identity p { margin: 8px 0 0; font-size: 13px; }

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 600;
}

.identity-meta {
  margin-left: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px 24px;
  font-size: 13px;
}

select optgroup { font-weight: 600; color: var(--muted); }
select option { font-weight: 400; color: var(--text); }
