:root {
  --bg: #141413;
  --bg-2: #1b1a17;
  --sidebar: #0f0f0e;
  --line: #272622;
  --line-2: #3a3832;
  --text: #ededeb;
  --muted: #96948d;
  --faint: #5e5c56;
  --card: #1e1d1a;
  --hover: #262520;
  --accent: #d8c7a6;
  --accent-ink: #181714;
  --danger: #d96552;
  --ok: #8eb37c;
  --user-bg: #24231e;
  --user-border: #38362d;
  --shadow: 0 16px 48px rgba(0, 0, 0, .45);
  --r: 14px;
  --font: Urbanist, ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { color-scheme: dark; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: #3d372c; color: #fff; }

.app { display: flex; height: 100%; overflow: hidden; position: relative; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: margin-left .22s cubic-bezier(.2,0,0,1), transform .22s ease;
  z-index: 35;
}
.app.nav-off .sidebar { margin-left: -260px; }

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  min-height: 48px;
}
.brand-left {
  min-width: 0;
  flex: 1;
}
.brand-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.02em;
}
.brand-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.side-pad { padding: 6px 12px; }

/* Akce vedle sebe jako ikonky (Nový chat / Učení / Code) */
.side-actions { display: flex; gap: 6px; }
.side-actions .side-act { flex: 1; justify-content: center; padding: 9px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--card);
  color: var(--text);
  transition: background .12s, border-color .12s, color .12s, transform .08s;
  font-size: 13px;
  font-weight: 500;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text); border-color: var(--line-2); }
.btn-danger { color: var(--danger); background: transparent; border: 1px solid #5a2f28; }
.btn-danger:hover { background: #2a1614; }
.btn-block { width: 100%; }

.icon-btn {
  width: 32px; height: 32px;
  border: 0; background: transparent;
  border-radius: 8px;
  color: var(--muted);
  display: inline-grid; place-items: center;
  transition: background .12s, color .12s;
  padding: 0;
  flex-shrink: 0;
}
.icon-btn svg { display: block; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { color: var(--accent); background: #26241d; }
.icon-btn.rec { color: var(--danger); animation: pulseRec 1.2s infinite; }
@keyframes pulseRec { 0%,100%{opacity:1} 50%{opacity:.4} }

.search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  outline: none;
  font-size: 13px;
}
.search:focus { border-color: var(--line-2); }
.search::placeholder { color: var(--faint); }

.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; min-height: 0; }
.conv-empty { color: var(--faint); font-size: 12px; text-align: center; padding: 28px 8px; }
.conv {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  color: var(--text);
  cursor: pointer;
  transition: background .12s;
  position: relative;
}
.conv:hover { background: var(--hover); }
.conv.on { background: #24221c; }
.conv-main { min-width: 0; flex: 1; }
.conv-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { font-size: 11px; color: var(--faint); margin-top: 2px; }

/* Kebab 3-dots menu for desktop and touch/mobile */
.conv-menu-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.7;
  transition: all .12s;
}
.conv:hover .conv-menu-btn, .conv.on .conv-menu-btn, .conv-menu-btn:focus { opacity: 1; color: var(--text); }
.conv-menu-btn:hover { background: var(--card); color: #fff; }

.conv-pop {
  position: absolute;
  right: 8px;
  top: calc(100% + 2px);
  background: rgba(26, 25, 22, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 5px;
  display: flex;
  flex-direction: column;
  min-width: 140px;
  z-index: 70;
  animation: fadeInStatus .15s ease;
}
.conv-pop[hidden] { display: none; }
.conv-pop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  transition: background .1s;
}
.conv-pop-item:hover { background: var(--hover); }
.conv-pop-item.del-item { color: var(--danger); }
.conv-pop-item.del-item:hover { background: rgba(217, 101, 82, 0.14); }

.side-foot {
  border-top: 1px solid var(--line);
  padding: 8px 10px 10px;
}
.side-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.side-link:hover { background: var(--hover); text-decoration: none; }
.legal-mini { font-size: 11px; color: var(--faint); text-align: center; padding: 6px 8px 2px; }
.legal-mini a { color: var(--muted); }

/* Sidebar Close Button inside Sidebar Header */
.sidebar-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  border: 0;
  cursor: pointer;
  transition: all .12s;
}
.sidebar-close-btn:hover { background: var(--hover); color: #fff; }

/* ---------- Main & Floating Topbar Islands (Kimi / ChatGPT style) ---------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  height: 100%;
  overflow: hidden;
}
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: transparent;
  border: 0;
  z-index: 25;
  pointer-events: none;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

#btnSidebar { display: none; }
.app.nav-off #btnSidebar { display: inline-flex; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  margin-left: auto;
}

.topbar-btn,
.topbar-circle-btn,
.circle-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 11px;
  background: #181714;
  border: 1px solid #2d2b24;
  color: #c9c6bc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  outline: none;
}
.topbar-btn:hover,
.topbar-circle-btn:hover,
.circle-btn:hover {
  background: #25241f;
  border-color: #423f35;
  color: #ffffff;
  transform: translateY(-1px);
}
.topbar-btn:active,
.topbar-circle-btn:active,
.circle-btn:active {
  transform: scale(0.96);
}

.top-conv-wrap {
  position: relative;
}
.top-conv-wrap[hidden] {
  display: none !important;
}
.topbar-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: #1c1b17;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: auto;
}
.topbar-pop[hidden] {
  display: none;
}
.topbar-pop .conv-pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.topbar-pop .conv-pop-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.topbar-pop .conv-pop-item.del-item {
  color: #ef4444;
}
.topbar-pop .conv-pop-item.del-item:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ---------- Messages Thread ---------- */
.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 68px 20px 140px; /* Space so messages glide behind floating islands and above composer */
  scroll-behavior: smooth;
}
.thread { max-width: 760px; margin: 0 auto; width: 100%; }
.empty {
  max-width: 540px;
  margin: 14vh auto 0;
  text-align: center;
}
.empty h1 { font-size: 26px; font-weight: 600; letter-spacing: -.03em; margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 11px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all .12s;
}
.chip:hover { border-color: var(--line-2); background: var(--card); transform: translateY(-1px); }

.row { display: flex; margin: 0 0 24px; width: 100%; }
.row.user { justify-content: flex-end; }
.row.assistant { justify-content: flex-start; }

.bubble {
  max-width: min(85%, 660px);
  padding: 10px 16px;
  border-radius: 13px;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.row.user .bubble {
  background: var(--user-bg);
  border: 1px solid var(--user-border);
  border-bottom-right-radius: 4px;
}
.chip:hover { border-color: var(--line-2); background: var(--card); transform: translateY(-1px); }

.row { display: flex; margin: 0 0 24px; width: 100%; }
.row.user { justify-content: flex-end; }
.row.assistant { justify-content: flex-start; }

.bubble {
  max-width: min(85%, 660px);
  padding: 10px 16px;
  border-radius: 18px;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.row.user .bubble {
  background: var(--user-bg);
  border: 1px solid var(--user-border);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.row.assistant .bubble {
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  max-width: 100%;
}

/* Markdown typography */
.prose { font-size: 15px; color: #dedcd5; line-height: 1.65; }
.prose p { margin: 0 0 12px; }
.prose p:last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  color: #fff;
  font-weight: 700;
  line-height: 1.35;
  margin: 22px 0 10px;
}
.prose h1:first-child, .prose h2:first-child, .prose h3:first-child,
.prose h4:first-child, .prose h5:first-child, .prose h6:first-child { margin-top: 0; }
.prose h1 {
  font-size: 22px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-2);
}
.prose h2 {
  font-size: 18px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.prose h3 { font-size: 16px; }
.prose h4, .prose h5, .prose h6 { font-size: 15px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin-bottom: 4px; }
.prose code:not(pre code) {
  font-family: var(--mono);
  font-size: 13px;
  background: #23221d;
  border: 1px solid #333129;
  padding: 2px 5px;
  border-radius: 6px;
  color: #f0ede6;
}

/* ---------- Agentic Live Status & Steps Accordion ---------- */
.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  margin-bottom: 10px;
  animation: fadeInStatus .2s ease;
  user-select: none;
}
.agent-spinner {
  width: 10px;
  height: 10px;
  border: 2px solid var(--muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes fadeInStatus {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.agent-steps-accordion {
  margin-bottom: 12px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 10px;
  overflow: hidden;
  font-size: 12px;
  user-select: none;
}
.agent-steps-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.agent-steps-summary::-webkit-details-marker { display: none; }
.agent-steps-summary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.steps-chevron {
  transition: transform 0.2s ease;
}
.agent-steps-accordion[open] .steps-chevron {
  transform: rotate(90deg);
}
.agent-steps-content {
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11.5px;
}
.step-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- Scroll to bottom floating button ---------- */
.box {
  position: relative;
}
.scroll-bottom-btn {
  position: absolute;
  right: 12px;
  bottom: calc(100% + 12px);
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #1e1d19;
  border: 1px solid #333129;
  color: #e6e4dc;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: 35;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.scroll-bottom-btn:hover {
  background: #2b2923;
  border-color: #48453b;
  color: #fff;
  transform: translateY(-2px);
}
.scroll-bottom-btn[hidden] {
  display: none !important;
}

/* Embedded Media in Message Bubble */
.bubble-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.bubble-img {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #141310;
}
.bubble-img img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  display: block;
}
.bubble-img-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .15s ease;
}
.bubble-img:hover .bubble-img-actions,
.bubble-img:focus-within .bubble-img-actions {
  opacity: 1;
}
@media (hover: none) {
  .bubble-img-actions { opacity: 1; }
}
.bubble-img-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: rgba(20, 19, 16, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ededeb;
  cursor: pointer;
  padding: 0;
  transition: background .12s ease, transform .08s ease, color .12s ease;
}
.bubble-img-btn:hover { background: rgba(20, 19, 16, .92); }
.bubble-img-btn:active { transform: scale(.94); }
.bubble-img-btn.ok { color: var(--ok); }

.bubble-videos {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.bubble-video-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #141310;
  text-decoration: none;
  color: var(--text);
  transition: background .12s ease, border-color .12s ease;
}
.bubble-video-card:hover {
  background: #191815;
  border-color: var(--accent);
}
.bubble-video-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, .06);
  color: var(--accent);
}
.bubble-video-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.bubble-video-name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bubble-video-size {
  font-size: 12px;
  color: var(--muted);
}
.prose pre {
  margin: 14px 0;
  background: #171613;
  border: 1px solid #2d2c25;
  border-radius: 12px;
  overflow: hidden;
  font-family: var(--mono);
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: #1f1e1a;
  border-bottom: 1px solid #2d2c25;
  font-size: 11px;
  color: var(--muted);
}
.code-lang {
  font-weight: 700;
  letter-spacing: 0.5px;
}
.code-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.code-header-actions button,
.code-header button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.code-header-actions button:hover,
.code-header button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.code-canvas-btn {
  color: #f59e0b !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  background: rgba(245, 158, 11, 0.08) !important;
}
.code-canvas-btn:hover {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fbbf24 !important;
}

/* Downloadable File Cards [FILE: ...] */
.hertz-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #181714;
  border: 1px solid #2e2c24;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 12px 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  flex-wrap: wrap;
}
.hertz-file-l {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.hertz-file-icon {
  width: 36px;
  height: 40px;
  border-radius: 8px;
  background: #25231c;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.5px;
}
.hertz-file-icon.ext-html,
.hertz-file-icon.ext-htm {
  background: linear-gradient(135deg, #ea580c, #c2410c);
}
.hertz-file-icon.ext-py {
  background: linear-gradient(135deg, #0284c7, #0369a1);
}
.hertz-file-icon.ext-js,
.hertz-file-icon.ext-ts {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #1c1917;
}
.hertz-file-icon.ext-css {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}
.hertz-file-icon.ext-json,
.hertz-file-icon.ext-csv {
  background: linear-gradient(135deg, #10b981, #047857);
}
.hertz-file-icon.ext-pdf {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}
.hertz-file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
}
.hertz-file-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hertz-file-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.hertz-file-r {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hertz-file-r button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s ease;
}
.btn-canvas-launch {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: #f59e0b;
}
.btn-canvas-launch:hover {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
}
.btn-file-dl {
  background: #24221c;
  border-color: #38352b !important;
  color: var(--text);
}
.btn-file-dl:hover {
  background: #312e24;
  color: #fff;
  border-color: #4a4639 !important;
}

/* ---------- Hertz Learn: spouštěcí karta pro kvíz / kartičky v bublině ---------- */
.hertz-quiz-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #181714;
  border: 1px solid #2e2c24;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.hertz-quiz-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
}
.hertz-quiz-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 2px;
}
.hertz-quiz-info strong { color: #fff; font-size: 14px; }
.hertz-quiz-info span { color: var(--muted); font-size: 12.5px; }
.btn-quiz-launch,
.btn-flash-launch {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  transition: filter 0.12s ease;
}
.btn-quiz-launch:hover,
.btn-flash-launch:hover { filter: brightness(1.08); }
.hertz-quiz-card.hertz-quiz-error { background: rgba(217, 101, 82, 0.08); border-color: rgba(217, 101, 82, 0.3); }
.hertz-quiz-card.hertz-quiz-error .hertz-quiz-icon { background: rgba(217, 101, 82, 0.18); }

/* ---------- Hertz Learn: modál na hraní kvízu ---------- */
.learn-modal {
  position: fixed;
  inset: 0;
  z-index: 96;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInStatus 0.15s ease;
}
.learn-modal[hidden] { display: none !important; }
.learn-panel {
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  background: #141310;
  border: 1px solid #2e2c24;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}
.learn-head {
  padding: 16px 20px;
  border-bottom: 1px solid #2a2821;
  background: #191815;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.learn-head-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.learn-head-title strong { color: #fff; font-size: 15px; }
.learn-head-title span { color: var(--muted); font-size: 12.5px; }
.learn-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}
.learn-close-btn:hover { background: var(--hover); color: #fff; }
.learn-progress {
  height: 4px;
  background: #221f19;
  flex-shrink: 0;
}
.learn-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
  width: 0%;
}
.learn-body {
  padding: 24px 22px;
  overflow-y: auto;
  flex: 1;
}

/* Kvíz: otázka + možnosti */
.quiz-question { font-size: 17px; font-weight: 600; color: #fff; margin: 0 0 18px; line-height: 1.45; }
.quiz-options { display: flex; flex-direction: column; gap: 9px; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.quiz-option:hover:not(:disabled) { background: var(--hover); border-color: var(--accent); }
.quiz-option:disabled { cursor: default; }
.quiz-option .qo-letter {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.quiz-option.correct { background: rgba(142, 179, 124, 0.14); border-color: var(--ok); }
.quiz-option.correct .qo-letter { background: var(--ok); color: #123; }
.quiz-option.wrong { background: rgba(217, 101, 82, 0.12); border-color: var(--danger); }
.quiz-option.wrong .qo-letter { background: var(--danger); color: #fff; }
.quiz-explain {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line-2);
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
}
.quiz-explain strong { color: var(--text); }
.learn-foot {
  padding: 14px 20px;
  border-top: 1px solid #2a2821;
  background: #191815;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}
.learn-next-btn {
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
}
.learn-next-btn:disabled { opacity: 0.4; cursor: default; }
.learn-next-btn:not(:disabled):hover { filter: brightness(1.08); }

/* Výsledková obrazovka (kvíz) */
.quiz-result { text-align: center; padding: 12px 0; }
.quiz-result-score { font-size: 40px; font-weight: 800; color: #fff; margin: 0 0 6px; }
.quiz-result-label { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.quiz-result-actions { display: flex; gap: 10px; justify-content: center; width: 100%; }
.quiz-restart-btn,
.quiz-close-btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--text);
}
.quiz-restart-btn { background: var(--accent); color: var(--accent-ink); border: none; }
.quiz-restart-btn:hover { filter: brightness(1.08); }
.quiz-close-btn:hover { background: var(--hover); }

/* Kartičky */
.flash-card-wrap { display: flex; justify-content: center; padding: 8px 0 20px; }
.flash-card {
  width: 100%;
  max-width: 440px;
  min-height: 220px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 24px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  line-height: 1.5;
  transition: opacity 0.12s ease;
  user-select: none;
}
.flash-card.flipped { background: #201b2c; border-color: #6d28d9; font-weight: 500; font-size: 15.5px; color: var(--text); }
.flash-card-hint { text-align: center; color: var(--faint); font-size: 12px; margin-top: 10px; }
.flash-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.flash-nav-btn {
  padding: 9px 16px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--text);
}
.flash-nav-btn:disabled { opacity: 0.35; cursor: default; }
.flash-nav-btn:not(:disabled):hover { background: var(--hover); }
.flash-progress-label { color: var(--muted); font-size: 13px; }
.flash-done { text-align: center; padding: 20px 0; }
.flash-done strong { display: block; font-size: 18px; color: #fff; margin-bottom: 18px; }

@media (max-width: 640px) {
  .learn-modal { padding: 0; }
  .learn-panel { max-height: 100vh; border-radius: 0; border: 0; }
}

.prose pre code {
  display: block;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  color: #e6e4dc;
}
.prose .table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0;
}
.prose table {
  width: 100%; border-collapse: collapse; margin: 0; font-size: 13px;
}
.prose th, .prose td {
  padding: 8px 12px; border: 1px solid #2d2c25; text-align: left;
}
.prose th { background: #1f1e1a; font-weight: 600; color: #fff; }
.prose blockquote {
  border-left: 3px solid var(--accent); margin: 12px 0; padding: 4px 14px; color: var(--muted);
}
.prose hr {
  border: 0; border-top: 1px solid var(--line-2); margin: 16px 0;
}
.prose img {
  max-width: min(520px, 100%);
  border-radius: 12px;
  margin: 10px 0;
  display: block;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
  border: 1px solid var(--line);
}
.prose audio { margin-top: 8px; width: min(320px, 100%); }

/* Message Actions under AI bubble */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--faint);
}
.act-btn {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.act-btn:hover { background: var(--hover); color: var(--text); }
.act-btn svg { width: 14px; height: 14px; }
.act-btn.copied { color: var(--ok); }
.act-btn.reading { color: var(--accent); }
.act-btn.loading { color: var(--accent); }
.act-btn.retry-btn { color: var(--accent); font-weight: 600; border: 1px solid var(--line); }
.act-btn.retry-btn:hover { background: var(--hover); color: var(--accent); border-color: var(--accent); }
.act-btn.loading svg, .act-spin {
  animation: spin 0.8s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* ---------- Toggle switch (nastavení) ---------- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.toggle-row-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.toggle-row-desc { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.toggle-row-warn { font-size: 12px; color: var(--danger); margin-top: 6px; line-height: 1.45; }
.toggle-row-warn[hidden] { display: none !important; }
.toggle-row-warn code { font: 11.5px var(--mono); background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 4px; }
.switch-toggle {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 25px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  padding: 0;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.switch-toggle .switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s ease, background .15s ease;
}
.switch-toggle[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}
.switch-toggle[aria-checked="true"] .switch-knob {
  transform: translateX(19px);
  background: var(--accent-ink);
}

/* ---------- STT mikrofon: diktafon overlay v composeru ---------- */
.mic-overlay {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin: 0 0 10px;
}
/* [hidden] musí přebít display:flex/block níže i u #input */
.mic-overlay[hidden], .mic-wave[hidden], .mic-spinner[hidden], #input[hidden] { display: none !important; }
.mic-wave {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  width: 100%;
  height: 34px;
}
.mic-wave-bar {
  flex: 1 1 0;
  min-width: 0;
  height: 12%;
  border-radius: 3px;
  background: var(--accent);
  transition: height .08s ease;
}
.mic-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.mic-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid var(--muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.meta-tokens { margin-left: auto; font: 11px var(--mono); color: var(--faint); }

.caret {
  display: inline-block;
  width: 6px; height: 14px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: -2px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Floating Composer Bar ---------- */
.composer-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 16px 14px;
  background: linear-gradient(180deg, rgba(20, 20, 19, 0) 0%, rgba(20, 20, 19, 0.85) 45%, rgba(20, 20, 19, 0.98) 100%);
  pointer-events: none;
  z-index: 20;
}
.box {
  pointer-events: auto;
  max-width: 760px;
  margin: 0 auto;
  border: 1px solid var(--line-2);
  background: rgba(28, 27, 24, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 12px;
  padding: 12px 14px 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  transition: border-color .15s ease;
}
.box:focus-within { border-color: var(--accent); }
#input {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 200px;
  line-height: 1.5;
  font-size: 15px;
  padding: 0;
  margin: 0 0 10px;
}
#input::placeholder { color: var(--faint); }
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  row-gap: 8px;
  padding-top: 2px;
}
.bar-l, .bar-r {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  flex-shrink: 0;
}
.bar-l .icon-btn, .bar-r .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  flex-shrink: 0;
}
.bar-r .go {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  flex-shrink: 0;
}

.attach-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.attach-strip[hidden] { display: none; }

.thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #1c1b17;
  display: flex;
  align-items: center;
}

.thumb.thumb-img {
  width: 60px;
  height: 60px;
}
.thumb.thumb-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 8px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 1px 4px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.thumb.thumb-file {
  height: 52px;
  padding: 4px 28px 4px 6px;
  gap: 8px;
  min-width: 140px;
  max-width: 220px;
}
.thumb-file-icon {
  width: 36px;
  height: 40px;
  border-radius: 6px;
  background: #272520;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.thumb-file-icon.pdf {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
}
.thumb-file-icon.code {
  background: linear-gradient(135deg, #10b981, #047857);
  color: #fff;
}
.thumb-file-icon.doc {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
}
.thumb-file-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.2;
}
.thumb-file-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thumb-file-size {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.thumb button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.thumb button:hover {
  background: #ef4444;
}

/* Drag and Drop visual indicator */
.box.drag-over {
  border-color: var(--accent) !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
  background: #21201b;
}

/* User Message Attachments */
.bubble-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.bubble-att-img {
  max-width: 220px;
  max-height: 160px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #111;
}
.bubble-att-img img {
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: cover;
  display: block;
}
.bubble-att-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 12px;
}
.att-ext {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 4px;
  border-radius: 4px;
  background: #333;
  color: #fff;
  letter-spacing: 0.5px;
}
.att-ext.ext-pdf {
  background: #ef4444;
}
.att-ext.ext-doc {
  background: #3b82f6;
}
.att-name {
  font-weight: 600;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.att-size {
  color: var(--muted);
  font-size: 11px;
}
.user-text {
  word-break: break-word;
}

/* ---------- Mode Cluster: 3-way Fast / Smart / Super switch ---------- */
.mode-cluster {
  --mode-seg: 66px;
  display: inline-flex;
  align-items: center;
  position: relative;
  height: 32px;
  padding: 2px;
  border: 1px solid #3a3832;
  border-radius: 999px;
  background: #1a1916;
  box-sizing: border-box;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .22s ease;
}

.mode-cluster[data-mode="smart"] { border-color: #6b21a8; }
.mode-cluster[data-mode="super"] { border-color: #a21caf; }

.mode-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: var(--mode-seg);
  height: 26px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, #92400e 0%, #b45309 35%, #d97706 70%, #f59e0b 100%);
  transition: transform .3s cubic-bezier(.2,.9,.2,1);
  z-index: 1;
  pointer-events: none;
}

.mode-cluster[data-mode="smart"] .mode-thumb {
  transform: translateX(100%);
  background: linear-gradient(90deg, #581c87 0%, #6b21a8 35%, #7e22ce 70%, #9333ea 100%);
}

.mode-cluster[data-mode="super"] .mode-thumb {
  transform: translateX(200%);
  background: linear-gradient(90deg, #831843 0%, #a21caf 35%, #c026d3 70%, #e879f9 100%);
}

.mode-btn {
  position: relative;
  z-index: 2;
  width: var(--mode-seg);
  flex: 0 0 var(--mode-seg);
  height: 26px;
  border: 0;
  background: transparent;
  color: #a9a89f;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  text-align: center;
  white-space: nowrap;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s ease, text-shadow .2s ease;
}

.mode-btn.on {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}

.mode-btn:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
}

/* ---------- Modern Profile Card & Glassmorphic Pop-up Menu ---------- */
.acct { position: relative; }
.acct-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--text);
  cursor: pointer;
  transition: all .15s ease;
  text-align: left;
}
.acct-btn:hover {
  background: var(--hover);
  border-color: var(--line-2);
}
.acct-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #d8c7a6, #968565);
  color: #181714;
  font-weight: 750;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.acct-info {
  min-width: 0;
  flex: 1;
}
.acct-info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acct-info small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acct-chevron {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform .15s ease;
}
.acct-pop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  background: rgba(25, 24, 21, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  padding: 8px;
  z-index: 60;
  animation: fadeInStatus .18s cubic-bezier(.2,.9,.2,1);
}
.acct-pop[hidden] { display: none; }
.acct-pop-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 8px;
}
.acct-pop-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #968565);
  color: var(--accent-ink);
  font-weight: 750;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.acct-pop-user {
  min-width: 0;
  flex: 1;
}
.acct-pop-user strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acct-credit-pill {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}
.acct-pop-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}
.acct-pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  border: 0;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.acct-pop-item:hover {
  background: var(--hover);
  color: #fff;
  text-decoration: none;
}
.acct-pop-item.acct-logout {
  color: var(--muted);
}
.acct-pop-item.acct-logout:hover {
  background: rgba(217, 101, 82, 0.14);
  color: var(--danger);
}

.voice-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.voice-row .field { margin: 0; flex: 1; min-width: 140px; }
.row.assistant .bubble { background: #1b1a16; border: 1px solid #2c2a24; border-radius: 13px; padding: 12px 16px; }

/* Memory List and deletion in Settings */
.mem-list { display: flex; flex-direction: column; gap: 8px; }
.mem-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #151411;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
}
.mem-item-body {
  min-width: 0;
  flex: 1;
  font-size: 13.5px;
  line-height: 1.5;
}
.mem-item-date {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}
.mem-del-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
}
.mem-del-btn:hover {
  background: rgba(217, 101, 82, 0.15);
  color: var(--danger);
}

.sheet {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.5);
  display: grid; place-items: center;
  padding: 20px;
}
.sheet[hidden] { display: none; }
.sheet-box {
  width: min(520px, 100%);
  max-height: min(80vh, 640px);
  background: #161513;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.hist-list { overflow-y: auto; min-height: 120px; padding: 2px 2px 50px; }
.pin { color: var(--accent); }
.conv-divider {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--faint);
  padding: 12px 10px 4px;
}
.conv-divider:first-child { padding-top: 2px; }

/* ---------- Projekty ---------- */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.proj-card {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color .12s, transform .12s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.proj-card:hover { border-color: var(--accent); }
.proj-card-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: rgba(216, 199, 166, .14);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.proj-card-name { font-size: 14.5px; font-weight: 700; }
.proj-card-desc {
  font-size: 12.5px; color: var(--muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.proj-card-meta { font-size: 11px; color: var(--faint); margin-top: auto; padding-top: 8px; }
.proj-card-badge {
  font-size: 11px;
  font-weight: 700;
  color: #c4b5fd;
  background: rgba(124, 58, 237, .16);
  border: 1px solid rgba(124, 58, 237, .3);
  border-radius: 999px;
  padding: 3px 9px;
  display: inline-block;
  width: fit-content;
}
.proj-empty { color: var(--faint); font-size: 13px; padding: 24px 4px; text-align: center; grid-column: 1 / -1; }

/* Learn Mode: progress bar + milníky */
.learn-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
  margin-bottom: 6px;
}
.learn-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  border-radius: 999px;
  transition: width .3s ease;
}
.learn-progress-label { font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.learn-milestone-list { display: flex; flex-direction: column; gap: 6px; }
.learn-milestone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #141310;
  cursor: pointer;
  transition: border-color .12s ease;
}
.learn-milestone:hover { border-color: var(--accent); }
.learn-milestone-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.learn-milestone.done .learn-milestone-check {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}
.learn-milestone.in_progress .learn-milestone-check { border-color: #d8a94a; }
.learn-milestone-body { flex: 1; min-width: 0; }
.learn-milestone-title { font-size: 13.5px; font-weight: 600; }
.learn-milestone.done .learn-milestone-title { color: var(--muted); text-decoration: line-through; }
.learn-milestone-meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.proj-conv-list { display: flex; flex-direction: column; gap: 2px; }
.proj-file-empty, .proj-conv-empty { color: var(--muted); font-size: 13px; padding: 12px 0; }

/* ---------- Rozbalovací "Projekty" v postranním panelu ---------- */
.proj-nav { margin-bottom: 4px; }
.proj-nav-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.proj-nav-header:hover { background: var(--hover); color: var(--text); }
.proj-nav-header .proj-nav-chevron { transition: transform .15s ease; flex-shrink: 0; }
.proj-nav.open > .proj-nav-header .proj-nav-chevron { transform: rotate(90deg); }
.proj-nav-body { padding: 2px 0 6px 4px; }
.proj-nav-empty { color: var(--faint); font-size: 12px; padding: 6px 10px; }

.proj-nav-item-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.proj-nav-item-header:hover { background: var(--hover); }
.proj-nav-item-header .proj-nav-chevron { transition: transform .15s ease; flex-shrink: 0; color: var(--muted); }
.proj-nav-item-header[aria-expanded="true"] .proj-nav-chevron { transform: rotate(90deg); }
.proj-nav-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-nav-item-body { padding-left: 15px; border-left: 1px solid var(--line); margin-left: 15px; }
.proj-nav-item-body .conv { padding: 6px 10px; }
.proj-nav-item-body .conv .conv-title { font-size: 12.5px; font-weight: 400; }
.proj-nav-newchat {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.proj-nav-newchat:hover { background: var(--hover); color: var(--text); }

.proj-nav-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.proj-nav-action {
  display: block;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}
.proj-nav-action:hover { background: var(--hover); color: var(--text); }

.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.share-row:last-child { border-bottom: 0; }
.share-row-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row-meta { color: var(--faint); font-size: 11px; }
.share-row-revoke {
  border: 0; background: transparent; color: var(--faint);
  cursor: pointer; padding: 4px 8px; border-radius: 6px; font-size: 12px; flex-shrink: 0;
}
.share-row-revoke:hover { color: #f87171; background: rgba(248,113,113,.1); }
.share-empty { color: var(--faint); font-size: 13px; padding: 10px 4px; }

.shared-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 16px;
  color: var(--muted);
  font-size: 12.5px;
}
.shared-banner[hidden] { display: none; }
#sharedBannerText { flex: 1; }
button.shared-banner { border: none; font: inherit; }
#learnBannerText { flex: 1; }

.learn-chat-panel {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px 16px;
  border-bottom: 1px solid var(--line);
}
.learn-chat-panel[hidden] { display: none; }
.learn-chat-panel .learn-milestone-list { max-height: 260px; overflow-y: auto; }
.learn-panel-manage {
  display: block;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
}
.learn-panel-manage:hover { text-decoration: underline; }
.shared-copy-btn {
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease, border-color .15s ease;
}
.shared-copy-btn:hover { background: var(--card); border-color: var(--accent); }

/* Send & Stop Button */
.go {
  width: 32px; height: 32px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: transform .12s, background .12s, color .12s;
}
.go:hover { filter: brightness(1.06); }
.go.btn-stop {
  background: #c94a38;
  color: #fff;
  box-shadow: none !important;
  animation: none !important;
}
.go.btn-stop:hover {
  background: #b33e2d;
  filter: none;
}
.go.call-live {
  background: #c94a38;
  color: #fff;
  animation: pulseRec 1.4s ease-in-out infinite;
}
.go.call-live:hover { background: #b33e2d; filter: none; }

.fine { text-align: center; font-size: 11px; color: var(--faint); margin: 6px 0 0; }
.fine a { color: var(--muted); }

/* ---------- Pages (Settings, Legal) ---------- */
.page { min-height: 100%; display: flex; flex-direction: column; }
.page-head {
  position: sticky; top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}
.page-head-in, .page-body, .page-foot {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
}
.page-head-in { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-back:hover { background: var(--hover); text-decoration: none; border-color: var(--line-2); }

.page-body { padding: 32px 0 64px; }
.page-body h1 { font-size: 26px; letter-spacing: -.03em; margin: 0 0 6px; font-weight: 700; }
.lead { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 15px; font-weight: 600; color: #fff; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid #292823; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.field, .card input, .card select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  margin: 0 0 8px;
  font-size: 13px;
}
.field:focus, .card input:focus, .card select:focus { border-color: var(--line-2); }

/* Model Table in Settings */
.models-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  background: #161513;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.models-table th, .models-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.models-table th {
  background: #1c1b18;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.models-table tr:last-child td { border-bottom: 0; }
.models-table tr:hover td { background: #1b1a17; }
.badge-tech {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: #26241e;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #363428;
}

/* Pricing Grid */
.topup-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.topup-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(180deg, #1f1e1a 0%, #171613 100%);
  min-height: 150px; text-align: center; align-items: center;
}
.soon-tag {
  align-self: flex-start;
  font-size: 10px; letter-spacing: .08em;
  color: var(--accent-ink); background: var(--accent);
  border-radius: 999px; padding: 3px 7px; font-weight: 700; margin-bottom: 10px;
}
.gdpr-box { display: grid; gap: 12px; }
.gdpr-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; padding: 0 8px 8px 0; }
.table td { border-top: 1px solid var(--line); padding: 8px 8px 8px 0; }
.table .r { text-align: right; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hint { color: var(--faint); font-size: 12px; margin: 10px 0 0; }
.page-foot { border-top: 0; padding: 0 0 28px; color: var(--faint); font-size: 12px; }
.page-body h2 { font-size: 18px; margin: 28px 0 8px; }
.page-body p, .page-body li { color: #c8c8c2; }
.page-body ul { padding-left: 18px; }
.legal-table { width: 100%; border: 1px solid var(--line); border-radius: 12px; border-collapse: collapse; overflow: hidden; font-size: 13px; }
.legal-table th, .legal-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.legal-table th { background: var(--card); color: var(--muted); font-weight: 500; }

/* ---------- Auth (Login, Register) ---------- */
.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.auth-box { width: min(390px, 100%); }
.auth-box h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.03em; font-weight: 700; }
.auth-box .sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.auth-box form { display: grid; gap: 6px; }
.terms-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 10px;
  line-height: 1.4;
  cursor: pointer;
}
.terms-label input { margin-top: 2px; accent-color: var(--accent); }
.msg { min-height: 18px; font-size: 13px; margin-top: 4px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }
.switch { color: var(--muted); font-size: 13px; margin-top: 16px; }

/* ---------- Cookie banner & Overlays ---------- */
.cookie {
  position: fixed; left: 16px; right: 16px; bottom: 16px;
  z-index: 80;
  display: none;
  max-width: 720px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  align-items: center;
  gap: 12px;
}
.cookie.on { display: flex; }
.cookie p { margin: 0; font-size: 12px; color: var(--muted); flex: 1; }

.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  z-index: 30;
}
.overlay.on { display: block; }
.hidden { display: none !important; }
.mb { margin-bottom: 16px; }

@media (max-width: 860px) {
  .grid-2, .topup-grid { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    transform: translateX(-105%);
    margin-left: 0 !important;
  }
  .app:not(.nav-off) .sidebar { transform: none; }
  .topbar #btnSidebar { display: inline-flex; }
  .app:not(.nav-off) .topbar #btnSidebar { display: none; }
}

@media (max-width: 480px) {
  .mode-cluster { --mode-seg: 54px; }
  .mode-btn { font-size: 11px; }
}

/* ---------- Message nav: postranní posuvník s body zpráv (jen desktop) ---------- */
.msg-nav {
  position: absolute;
  top: 70px;
  bottom: 124px;
  right: 20px; /* u kraje panelu, ale o kousek dovnitř od nativního scrollbaru */
  width: 14px;
  z-index: 22;
  pointer-events: none;
}
.msg-nav-track {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  transition: transform .15s ease;
  transform-origin: right center;
}
.msg-nav-track:hover {
  /* Najetí kamkoliv do oblasti bodů zvětší celou lištu, ať se do jednotlivých bodů snáz trefí. */
  transform: scale(1.8);
}
.msg-nav[hidden] { display: none; }
.msg-nav-tick {
  position: absolute;
  left: 50%;
  width: 10px;
  height: 4px;
  border-radius: 999px;
  background: var(--faint);
  opacity: .65;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: opacity .15s ease, width .15s ease, height .15s ease, background .15s ease;
}
.msg-nav-tick.who-user { background: var(--accent); }
.msg-nav-tick:hover,
.msg-nav-tick.active {
  opacity: 1;
  width: 15px;
  height: 5px;
}
.msg-nav-tooltip {
  position: absolute;
  right: 20px;
  width: max-content;
  max-width: 220px;
  padding: 7px 11px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) translateX(4px);
  transition: opacity .12s ease, transform .12s ease;
  z-index: 23;
  white-space: normal;
}
.msg-nav-tooltip.show {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.msg-nav-tooltip::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--card);
  border-right: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  transform: translateY(-50%) rotate(-45deg);
}
@media (max-width: 860px) {
  /* Jen pro PC — na užších (tabletových/mobilních) šířkách se lišta vůbec nezobrazuje. */
  .msg-nav { display: none; }
}

/* ---------- Lightbox: zvětšené zobrazení obrázků z chatu ---------- */
.bubble-img img,
.bubble-att-img img,
.prose > img {
  cursor: zoom-in;
}
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 98;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: fadeInStatus 0.15s ease;
  cursor: zoom-out;
}
.img-lightbox[hidden] {
  display: none !important;
}
.img-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  cursor: default;
}
.img-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  cursor: pointer;
}
.img-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.15);
}
@media (max-width: 640px) {
  .img-lightbox { padding: 12px; }
  .img-lightbox-close { top: 10px; right: 10px; }
}

/* ---------- Hertz Canvas Live Web Preview (Gemini / Claude Artifacts) ---------- */
.canvas-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInStatus 0.15s ease;
}
.canvas-modal[hidden] {
  display: none !important;
}
.canvas-panel {
  width: 100%;
  height: 100%;
  max-width: 1320px;
  max-height: 94vh;
  background: #141310;
  border: 1px solid #2e2c24;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}
.canvas-head {
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid #2a2821;
  background: #191815;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.canvas-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.canvas-title-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.canvas-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 2px 7px;
  border-radius: 6px;
}
.term-panel {
  max-width: 760px;
  max-height: 76vh;
}
.term-badge {
  background: var(--ok);
  color: #0f1a0c;
}
.term-body {
  flex: 1;
  min-height: 0;
  background: #0a0a08;
  padding: 10px 4px 10px 12px;
  overflow: hidden;
}
.term-body .xterm { height: 100%; }
.term-body .xterm-viewport { overflow-y: auto; }
.canvas-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.canvas-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.canvas-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}
.canvas-tab:hover {
  background: #23221c;
  color: var(--text);
}
.canvas-tab.active {
  background: #27251f;
  border-color: #3d3a2f;
  color: #fff;
}
.canvas-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}
.canvas-tab-dot.html, .canvas-tab-dot.htm { background: #f97316; }
.canvas-tab-dot.css { background: #3b82f6; }
.canvas-tab-dot.js, .canvas-tab-dot.ts { background: #eab308; }
.canvas-tab-dot.py { background: #06b6d4; }

.canvas-head-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.canvas-viewports,
.canvas-mode-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #100f0d;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #28261f;
}
.cv-btn,
.cm-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}
.cv-btn {
  width: 28px;
  height: 26px;
  padding: 0;
}
.cv-btn:hover,
.cm-btn:hover {
  color: var(--text);
}
.cv-btn.active,
.cm-btn.active {
  background: #26241d;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.canvas-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.canvas-head-right .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #211f19;
  border: 1px solid #302d24;
  color: var(--muted);
}
.canvas-head-right .icon-btn:hover {
  background: #2c2921;
  color: #fff;
  border-color: #423f33;
}
.canvas-close-btn:hover {
  background: #3b1d1a !important;
  color: #ef4444 !important;
  border-color: #5c2420 !important;
}

.canvas-body {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #0c0c0a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.canvas-viewport-frame {
  width: 100%;
  height: 100%;
  transition: all 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.canvas-viewport-frame.vp-desktop {
  width: 100%;
  height: 100%;
}
.canvas-viewport-frame.vp-tablet {
  width: 768px;
  max-width: calc(100% - 24px);
  height: calc(100% - 24px);
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #2d2b23;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}
.canvas-viewport-frame.vp-mobile {
  width: 375px;
  max-width: calc(100% - 24px);
  height: calc(100% - 24px);
  border-radius: 20px;
  overflow: hidden;
  border: 3px solid #2d2b23;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}
.canvas-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
  display: block;
}

.canvas-code-pane {
  position: absolute;
  inset: 0;
  background: #141310;
  overflow-y: auto;
  padding: 16px;
  z-index: 10;
}
.canvas-code-pane[hidden] {
  display: none;
}
.canvas-code-pane pre {
  margin: 0;
  border-radius: 10px;
  background: #191815;
  border: 1px solid #2b2921;
}

@media (max-width: 768px) {
  .canvas-modal { padding: 0; }
  .canvas-panel { max-height: 100vh; border-radius: 0; border: 0; }
  .canvas-viewports { display: none; }
  .canvas-title { max-width: 110px; }
}


/* ---------- Sidebar Toggle Button ---------- */
#btnSidebar svg rect { opacity: .9; }
#btnSidebar svg path { opacity: .55; }

/* ---------- Collapsible Projects in Sidebar ---------- */
.proj-sidebar-wrap {
  margin: 6px 0 2px;
}
.proj-sidebar-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: background .15s, color .15s;
}
.proj-sidebar-header:hover {
  background: var(--hover);
  color: var(--text);
}
.proj-sidebar-header .proj-chevron {
  transition: transform .2s;
  flex-shrink: 0;
}
.proj-sidebar-header.open .proj-chevron {
  transform: rotate(90deg);
}
.proj-sidebar-body {
  padding: 2px 0 4px;
}
.proj-sidebar-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 20px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s;
}
.proj-sidebar-item-header:hover {
  background: var(--hover);
}
.proj-sidebar-item-header .proj-chevron {
  transition: transform .2s;
  flex-shrink: 0;
  color: var(--muted);
}
.proj-sidebar-item-header.open .proj-chevron {
  transform: rotate(90deg);
}
.proj-sidebar-children {
  padding: 0 0 2px 20px;
}
.proj-sidebar-children .conv {
  padding-left: 20px;
}
.proj-sidebar-loading,
.proj-sidebar-empty {
  padding: 6px 12px 6px 36px;
  font-size: 12px;
  color: var(--faint);
}
.proj-sidebar-new-chat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 36px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: background .15s;
  width: 100%;
  text-align: left;
}
.proj-sidebar-new-chat:hover {
  background: var(--hover);
}
.proj-sidebar-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: background .15s;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.proj-sidebar-action:hover {
  background: var(--hover);
  text-decoration: none;
}

/* ===================== Hertz Learn Workspace ===================== */
.learn-ws-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.learn-ws-title { flex: 1; min-width: 200px; }
.learn-ws-title h1 { font-size: 24px; line-height: 1.2; }
.learn-ws-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.learn-ws-actions { display: flex; gap: 8px; }

.learn-ws {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 20px;
  align-items: start;
}
.learn-ws-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.learn-ws-main { min-width: 0; position: sticky; top: 16px; }

/* Progress ring */
.progress-ring { position: relative; width: 74px; height: 74px; flex: none; }
.progress-ring-svg { transform: rotate(-90deg); }
.progress-ring-track { fill: none; stroke: var(--line-2); stroke-width: 6; }
.progress-ring-fill {
  fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round;
  transition: stroke-dashoffset .4s ease;
}
.progress-ring-center {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: var(--text);
}

/* Focus card */
.learn-focus {
  background: linear-gradient(180deg, #201f1b, #1b1a17);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 16px;
}
.learn-focus-top { display: flex; align-items: center; gap: 16px; }
.learn-focus-summary { min-width: 0; }
.learn-focus-pct { font-weight: 700; font-size: 15px; }
.learn-focus-desc { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 4px 0 0; }
.learn-focus-today {
  border-top: 1px solid var(--line); padding-top: 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.learn-focus-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.learn-focus-title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.learn-focus-meta { font-size: 12px; color: var(--muted); }
.learn-focus-today .btn { margin-top: 6px; }

/* Roadmap (expandable + checkable milestones) */
.learn-milestone-list { display: flex; flex-direction: column; gap: 6px; }
.learn-milestone {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 11px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.learn-milestone:hover { border-color: var(--line-2); }
.learn-milestone.expanded { border-color: var(--accent); background: #201f1b; }
.learn-milestone-check {
  width: 20px; height: 20px; border-radius: 6px; flex: none;
  border: 1.5px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 12px; cursor: pointer;
}
.learn-milestone.done .learn-milestone-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.learn-milestone.in_progress .learn-milestone-check { border-color: #d8a94a; }
.learn-milestone-body { flex: 1; min-width: 0; }
.learn-milestone-title { font-size: 13.5px; font-weight: 600; }
.learn-milestone.done .learn-milestone-title { color: var(--muted); text-decoration: line-through; }
.learn-milestone-meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.learn-milestone-detail {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
}
.learn-milestone-pos { font-size: 11.5px; color: var(--faint); }
.learn-milestone-chev { color: var(--faint); transition: transform .15s; }
.learn-milestone.expanded .learn-milestone-chev { transform: rotate(180deg); }

/* Quick actions */
.learn-quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.learn-quick-btn { display: flex; align-items: center; justify-content: center; gap: 8px; flex-direction: column; padding: 14px 8px; }
.learn-quick-btn span { font-size: 13px; }

/* Settings accordion */
.learn-settings > summary {
  list-style: none; cursor: pointer; padding: 4px 0;
  font-weight: 600; font-size: 15px; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.learn-settings > summary::-webkit-details-marker { display: none; }
.learn-settings > summary::after { content: '▾'; color: var(--muted); transition: transform .15s; }
.learn-settings[open] > summary::after { transform: rotate(180deg); }
.learn-settings form { margin-top: 12px; }

/* Embedded tutor chat */
.learn-chat {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  height: calc(100vh - 210px); min-height: 480px; overflow: hidden;
}
.learn-chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.learn-chat-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.learn-chat-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #7c3aed, #5b21b6); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.learn-chat-head-title { display: flex; flex-direction: column; min-width: 0; }
.learn-chat-head-title strong { font-size: 14px; }
.learn-chat-head-title span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.learn-chat-msg { flex: 1; overflow-y: auto; padding: 18px 18px 8px; min-height: 0; }
.learn-chat-msg .thread { max-width: 100%; }
.learn-chat-msg .bubble { max-width: 100%; }
.learn-chat-msg .row, .learn-chat-msg .lc-row { margin: 0 0 16px; }
.learn-chat-msg .lc-row { display: flex; width: 100%; }
.learn-chat-msg .lc-row.user { justify-content: flex-end; }
.learn-chat-msg .lc-row.assistant { justify-content: flex-start; }
.learn-chat-msg .row.user .bubble,
.learn-chat-msg .lc-row.user .bubble {
  background: var(--user-bg); border: 1px solid var(--user-border);
  border-bottom-right-radius: 4px; white-space: pre-wrap; max-width: 85%;
}
.learn-chat-msg .row.assistant .bubble,
.learn-chat-msg .lc-row.assistant .bubble {
  background: transparent; padding-left: 0; padding-right: 0; max-width: 100%;
}

/* Empty state + suggestion chips */
.learn-chat-empty {
  height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 24px; gap: 6px;
}
.learn-chat-empty-icon {
  width: 56px; height: 56px; border-radius: 16px; margin-bottom: 6px;
  background: rgba(124, 58, 237, .14); color: #a78bfa;
  display: flex; align-items: center; justify-content: center;
}
.learn-chat-empty-title { font-size: 16px; font-weight: 700; }
.learn-chat-empty-sub { color: var(--muted); font-size: 13px; max-width: 340px; line-height: 1.5; }
.learn-chat-empty-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.learn-chip {
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text);
  border-radius: 999px; padding: 7px 13px; font-size: 12.5px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.learn-chip:hover { border-color: var(--accent); background: #24221c; }

/* Composer */
.learn-chat-composer {
  display: flex; align-items: flex-end; gap: 8px;
  border-top: 1px solid var(--line); padding: 12px;
  background: var(--bg-2);
}
.learn-chat-composer textarea {
  flex: 1; resize: none; background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 12px; color: var(--text); padding: 10px 12px; font-size: 14px;
  font-family: inherit; line-height: 1.5; max-height: 160px; outline: none;
}
.learn-chat-composer textarea:focus { border-color: var(--accent); }
.learn-chat-composer button {
  width: 38px; height: 38px; border-radius: 11px; flex: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 0;
  display: flex; align-items: center; justify-content: center;
}
.learn-chat-composer button:hover { filter: brightness(1.06); }
.learn-chat-composer button.lc-busy { background: var(--danger); }

/* History conv as button */
.learn-conv-btn {
  width: 100%; text-align: left; background: transparent; border: 0; color: var(--text);
  cursor: pointer; border-radius: 8px; padding: 8px 10px;
}
.learn-conv-btn:hover { background: var(--hover); }

@media (max-width: 900px) {
  .learn-ws { grid-template-columns: 1fr; }
  .learn-ws-main { position: static; order: -1; }
  .learn-chat { height: 72vh; min-height: 420px; }
}
