:root {
  --bg: #0D0D0D;
  --sidebar-bg: #111;
  --card-bg: #181818;
  --card-bg2: #1E1E1E;
  --border: #2A2A2A;
  --border2: #333;
  --accent: #7C6FFF;
  --accent-hover: #9488FF;
  --accent-dim: rgba(124, 111, 255, 0.12);
  --text: #E4E4E4;
  --text2: #999;
  --success: #22C55E;
  --success-dim: rgba(34, 197, 94, 0.12);
  --code-bg: #151515;
  --input-bg: #161616;
  --danger: #EF4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
}

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

/* ---- Sidebar ---- */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 1;
}

.btn-new {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--card-bg2);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-new:hover { background: var(--accent); border-color: var(--accent); }

.sessions-list { flex: 1; overflow-y: auto; padding: 6px; }

.sessions-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text2);
  font-size: 13px;
}

.session-item {
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  position: relative;
  margin-bottom: 3px;
  border: 1px solid transparent;
  transition: all 0.12s;
}
.session-item:hover { background: #1C1C1C; }
.session-item.active {
  background: var(--accent-dim);
  border-color: rgba(124, 111, 255, 0.25);
}

.session-title {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 62px;
  margin-bottom: 5px;
}

.session-title-input {
  font-size: 12px;
  font-weight: 500;
  background: var(--input-bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--text);
  padding: 1px 5px;
  width: 100%;
  margin-bottom: 5px;
  font-family: inherit;
  outline: none;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.session-stage {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.session-date { font-size: 10px; color: var(--text2); }

.btn-del, .btn-rename, .btn-share {
  position: absolute;
  top: 6px;
  background: none; border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  padding: 3px 5px;
  border-radius: 3px;
  line-height: 1;
  transition: opacity 0.12s, color 0.12s;
  z-index: 2;
}
.btn-del    { right: 6px;  font-size: 14px; }
.btn-rename { right: 26px; }
.btn-share  { right: 46px; }
.btn-share.shared { opacity: 0.45; color: var(--accent); }
.session-item:hover .btn-del,
.session-item:hover .btn-rename,
.session-item:hover .btn-share { opacity: 1; }
.btn-del:hover    { color: var(--danger); }
.btn-rename:hover { color: var(--text); }
.btn-share:hover  { color: var(--accent); }

/* ---- Main ---- */
.main { flex: 1; overflow-y: auto; }
.hidden { display: none !important; }

/* ---- Welcome ---- */
.welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.welcome-content {
  text-align: center;
  max-width: 700px;
}

.welcome-icon { font-size: 48px; margin-bottom: 16px; }
.welcome-content h2 { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.welcome-content > p { color: var(--text2); margin-bottom: 32px; line-height: 1.6; }

.welcome-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.w-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 20px;
}
.w-step span {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.w-arrow { color: var(--border2); font-size: 14px; }

/* ---- Workspace ---- */
.workspace { padding: 24px 32px 48px; min-height: 100vh; }

/* ---- Stages bar ---- */
.stages-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  gap: 0;
}

.stage-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: default;
}

.stage-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text2);
  transition: all 0.2s;
}

.stage-lbl {
  font-size: 11px;
  color: var(--text2);
  transition: color 0.2s;
  white-space: nowrap;
}

.stage-dot.active .stage-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}
.stage-dot.active .stage-lbl { color: var(--accent); font-weight: 600; }

.stage-dot.done .stage-circle {
  border-color: var(--success);
  background: var(--success);
  color: white;
  font-size: 0;
}
.stage-dot.done .stage-circle::after { content: '✓'; font-size: 14px; }

.stage-line {
  flex: 1; min-width: 24px; max-width: 56px;
  height: 2px;
  background: var(--border);
  margin: 0 2px 20px;
  transition: background 0.2s;
}
.stage-line.done { background: var(--success); }

/* ---- Stage content ---- */
.stage-content { max-width: 820px; margin: 0 auto; }

.stage-header { margin-bottom: 20px; }
.stage-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 5px; }
.stage-header p { color: var(--text2); font-size: 14px; line-height: 1.5; }

/* ---- Sections ---- */
.section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  /* overflow: hidden убран — иначе обрезает тултипы */
}
.sec-head {
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  user-select: none;
  border-radius: 10px 10px 0 0;
}
/* Когда sec-body скрыт — sec-head занимает всю карточку */
.sec-head:last-child,
.section > .sec-head:only-child {
  border-radius: 10px;
  border-bottom: none;
}
.sec-head.collapsible { cursor: pointer; }
.sec-head.collapsible:hover { background: rgba(255,255,255,0.02); }

.toggle-arrow { font-size: 10px; color: var(--text2); transition: transform 0.2s; }
.toggle-arrow.open { transform: rotate(180deg); }

.sec-body { padding: 14px 16px; }
.sec-body.collapsed { display: none; }

/* ---- Textarea ---- */
textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 11px 13px;
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.15s;
  display: block;
}
textarea:focus { outline: none; border-color: var(--accent); }

textarea.code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12.5px;
  min-height: 150px;
  color: #C8D0FF;
}

textarea.idea { min-height: 180px; font-size: 15px; }
textarea.response { min-height: 140px; }
textarea.answers { min-height: 120px; }
textarea.final { min-height: 300px; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12.5px; color: #C8D0FF; }

/* ---- Hint ---- */
.hint {
  font-size: 12px;
  color: var(--text2);
  padding: 8px 10px;
  background: rgba(124, 111, 255, 0.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 5px 5px 0;
  margin-bottom: 10px;
  line-height: 1.5;
}
.hint code {
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 11px;
  color: #A89FFF;
}

/* ---- Composed prompt display ---- */
.composed-box {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px 14px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
  color: #B0C4FF;
  line-height: 1.55;
  margin-bottom: 12px;
}

/* ---- AI selector ---- */
.ai-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ai-btn {
  padding: 5px 12px;
  border-radius: 16px;
  border: 1.5px solid var(--border2);
  background: var(--card-bg2);
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ai-btn:hover { border-color: var(--ai-color); color: var(--text); }
.ai-btn.selected {
  border-color: var(--ai-color);
  background: color-mix(in srgb, var(--ai-color) 14%, transparent);
  color: var(--text);
}
.rec {
  font-size: 9px;
  background: var(--ai-color);
  color: white;
  padding: 1px 4px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.action-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---- Buttons ---- */
button, a.btn-secondary, a.btn-primary {
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary.btn-lg { padding: 11px 24px; font-size: 15px; font-weight: 600; }

.btn-secondary {
  background: #222;
  color: var(--text);
  border: 1px solid var(--border2);
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 14px;
}
.btn-secondary:hover { background: #2A2A2A; }

.btn-ghost {
  background: none;
  color: var(--text2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }

.btn-success { background: var(--success) !important; }
.btn-copy { padding: 8px 16px; border-radius: 7px; font-size: 14px; font-weight: 500; background: var(--accent); color: white; }
.btn-copy.copied { background: var(--success); }

/* ---- Meta-prompt actions ---- */
.meta-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ---- Nav ---- */
.stage-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 4px;
}

.nav-right { display: flex; gap: 8px; }

/* ---- Stage 1 actions ---- */
.intake-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* ---- Stage 5 complete ---- */
.complete-banner {
  background: var(--success-dim);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.complete-banner-icon { font-size: 24px; }
.complete-banner-text h3 { font-size: 15px; font-weight: 600; color: var(--success); }
.complete-banner-text p { font-size: 13px; color: var(--text2); margin-top: 2px; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #2A2A2A;
  color: var(--text);
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.2s;
  pointer-events: none;
  z-index: 9999;
  border: 1px solid var(--border2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Sidebar footer ---- */
.sidebar-header-right { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}
.user-label {
  font-size: 11px;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-logout {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 15px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}
.btn-logout:hover { color: var(--danger); background: rgba(239,68,68,0.08); }

.btn-settings {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-settings:hover { background: #1C1C1C; color: var(--text); border-color: var(--border2); }

.mode-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.mode-badge.manual { background: rgba(255,255,255,0.06); color: var(--text2); }
.mode-badge.auto   { background: rgba(124,111,255,0.2); color: var(--accent); }

/* ---- Settings panel ---- */
.settings-panel {
  width: 300px;
  background: #141414;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.settings-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
}

.btn-ghost-sm {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-ghost-sm:hover { color: var(--text); background: #222; }

.settings-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.setting-group { display: flex; flex-direction: column; gap: 6px; }
.setting-group label { font-size: 12px; font-weight: 600; color: var(--text2); }

.setting-hint { font-size: 11px; color: var(--text2); line-height: 1.4; }

.settings-input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s;
}
.settings-input:focus { outline: none; border-color: var(--accent); }

.mode-toggle { display: flex; gap: 6px; }
.mode-opt {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--card-bg2);
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.12s;
  text-align: center;
}
.mode-opt:hover { border-color: var(--accent); color: var(--text); }
.mode-opt.active { border-color: var(--accent); background: var(--accent-dim); color: var(--text); }

.key-set   { color: var(--success); font-weight: 600; }
.key-unset { color: #888; }

/* ---- Review banner ---- */
.review-banner {
  background: rgba(255, 200, 50, 0.07);
  border: 1px solid rgba(255, 200, 50, 0.2);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 12px;
  color: #C8A84A;
  margin-bottom: 14px;
}

/* ---- Auto mode badges ---- */
.auto-badge {
  font-size: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 600;
}

.loading-badge {
  font-size: 11px;
  color: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

/* ---- Docs recommendations ---- */
.docs-rec .sec-body { padding: 14px 16px; }

.docs-grid { display: flex; flex-direction: column; gap: 7px; }

.doc-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: var(--card-bg2);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.doc-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.doc-file { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; color: #A89FFF; margin-bottom: 2px; }
.doc-desc { font-size: 12px; color: var(--text2); }

/* ---- Models list in settings ---- */
.models-list {
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 11px;
}
.models-count { color: var(--text2); margin-bottom: 6px; font-weight: 600; }
.model-id {
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  font-family: monospace;
  color: #A89FFF;
  transition: background 0.1s;
}
.model-id:hover { background: var(--accent-dim); }

/* ---- Stage mode bar (per-step toggle) ---- */
.sec-head { flex-wrap: wrap; gap: 6px; }

.stage-mode-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}
.smb-label { font-size: 11px; color: var(--text2); font-weight: 400; }

.smode-btn {
  padding: 3px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border2);
  background: var(--card-bg2);
  color: var(--text2);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.12s;
}
.smode-btn:hover { border-color: var(--accent); color: var(--text); }
.smode-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
}

.model-mini-input {
  background: var(--input-bg);
  border: 1px solid var(--border2);
  border-radius: 5px;
  color: var(--text);
  padding: 3px 8px;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  width: 130px;
  transition: border-color 0.15s;
}
.model-mini-input:focus { outline: none; border-color: var(--accent); }

/* ---- Settings: per-stage models table ---- */
.stage-models-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 2px;
}
.stage-models-table tr + tr td { padding-top: 5px; }
.smt-label {
  font-size: 12px;
  color: var(--text2);
  padding-right: 8px;
  white-space: nowrap;
  width: 70px;
}
.smt-input { padding: 5px 8px; font-size: 12px; }

/* ---- Stage dot clickable ---- */
.stage-dot.clickable { cursor: pointer; }
.stage-dot.clickable:hover .stage-circle {
  filter: brightness(1.2);
  transform: scale(1.08);
}
.stage-dot.clickable:hover .stage-lbl { color: var(--text); }
.stage-circle { transition: all 0.15s; }

/* ---- Template selector (step 1) ---- */
.tpl-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.tpl-card {
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--card-bg2);
}
.tpl-card:hover { border-color: var(--accent); background: var(--accent-dim); }
.tpl-card.selected { border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 0 1px var(--accent)33; }

.tpl-card-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.tpl-card-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.tpl-card-desc { font-size: 11px; color: var(--text2); line-height: 1.4; }

/* ---- Meta-prompt template context ---- */
.meta-tpl-context {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}
.meta-tpl-context strong { color: var(--accent); margin-left: 4px; }

/* ---- Template Manager Modal ---- */
.tpl-manager {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.tpl-manager:not(.hidden) { pointer-events: all; }

.tpl-mgr-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.tpl-mgr-panel {
  position: relative;
  background: #181818;
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 640px;
  max-width: 96vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tpl-mgr-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.tpl-mgr-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.tpl-mgr-hint { font-size: 12px; color: var(--text2); margin-bottom: 12px; }

/* Template list */
.tpl-list { display: flex; flex-direction: column; gap: 8px; }

.tpl-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg2);
  gap: 12px;
}
.tpl-list-item.current { border-color: rgba(124,111,255,0.3); background: var(--accent-dim); }

.tpl-list-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.tpl-list-icon { font-size: 20px; flex-shrink: 0; }
.tpl-list-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.tpl-list-desc { font-size: 11px; color: var(--text2); }
.tpl-current-badge { font-size: 10px; background: var(--accent-dim); color: var(--accent); padding: 1px 5px; border-radius: 5px; font-weight: 600; margin-left: 5px; }
.tpl-list-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* Template editor */
.tpl-edit-form { display: flex; flex-direction: column; gap: 10px; }
.tpl-edit-row { display: flex; gap: 10px; }
.tpl-edit-field { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tpl-edit-field label { font-size: 11px; font-weight: 600; color: var(--text2); }
.tpl-meta-ta { min-height: 100px; }
.tpl-edit-actions { display: flex; gap: 8px; padding-top: 4px; }

/* ---- Tooltips ---- */
.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border2);
  color: var(--text2);
  font-size: 9px;
  font-weight: 700;
  cursor: help;
  margin-left: 5px;
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
  font-style: normal;
  line-height: 1;
  transition: background 0.12s;
}
.tip:hover { background: var(--accent); color: white; }

.tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: #252525;
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
  width: 230px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.tip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 201;
}
.tip:hover::after,
.tip:hover::before { opacity: 1; }

/* Tooltip pointing left (near right edge) */
.tip-left::after { left: auto; right: -4px; transform: none; }
.tip-left::before { left: auto; right: 4px; transform: none; }

/* ---- Share overlay ---- */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-dialog {
  background: #1C1C1C;
  border: 1px solid var(--border2);
  border-radius: 12px;
  width: 420px;
  max-width: 94vw;
  overflow: hidden;
}
.share-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}
.share-dialog-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.share-url-input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--accent);
  padding: 9px 12px;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  width: 100%;
  outline: none;
  cursor: text;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2E2E2E; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3A3A3A; }
