* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: #1a1d21; color: #e7e9ea; }
.app { display: flex; height: 100vh; height: 100dvh; }

.sidebar { width: 320px; padding: 16px; background: #202327; border-right: 1px solid #33373b; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.sidebar h1 { font-size: 16px; margin: 0 0 8px; }
.sidebar label { font-size: 12px; color: #9aa0a6; }
.sidebar input { padding: 8px; border-radius: 6px; border: 1px solid #444; background: #14161a; color: #e7e9ea; }
.sidebar button { padding: 8px; border-radius: 6px; border: none; background: #4d8dff; color: white; cursor: pointer; font-weight: 600; }
.sidebar button:hover { background: #3b7ae0; }
.hint { font-size: 11px; color: #767a80; line-height: 1.4; }
.debug summary { font-size: 13px; color: #9aa0a6; cursor: pointer; margin-top: 8px; }
#profileView { font-size: 11px; background: #14161a; padding: 8px; border-radius: 6px; white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow-y: auto; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid #33373b; }
.tab { padding: 10px 16px; border: none; background: none; color: #9aa0a6; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: #e7e9ea; border-bottom-color: #4d8dff; }
.panel { flex: 1; min-height: 0; }
.hidden { display: none !important; }

.chat { display: flex; flex-direction: column; }
.messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 640px; padding: 10px 14px; border-radius: 10px; line-height: 1.4; white-space: pre-wrap; }
.msg.coach { background: #2b2f34; align-self: flex-start; }
.msg.climber { background: #4d8dff; align-self: flex-end; }
.msg.system { align-self: center; color: #767a80; font-size: 12px; font-style: italic; }
.composer { display: flex; gap: 8px; padding: 16px; border-top: 1px solid #33373b; }
.composer input { flex: 1; min-width: 0; padding: 12px; border-radius: 8px; border: 1px solid #444; background: #14161a; color: #e7e9ea; }
.composer button { padding: 12px 16px; border-radius: 8px; border: none; background: #4d8dff; color: white; font-weight: 600; cursor: pointer; }
.composer button.secondary { background: #2b2f34; border: 1px solid #4d8dff; color: #8fb6ff; }
.composer button.listening { background: #c0392b; border-color: #c0392b; color: #fff; }
.voice-lang { margin-left: auto; align-self: center; padding: 4px 6px; border-radius: 6px; border: 1px solid #444; background: #14161a; color: #e7e9ea; font-size: 12px; }
.toggle { margin-left: 8px; align-self: center; font-size: 12px; color: #9aa0a6; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.composer button:disabled { background: #444; border-color: #444; color: #999; cursor: not-allowed; }

.msg.summary { align-self: stretch; max-width: 720px; background: #1f2a3a; border: 1px solid #3b5a85; white-space: normal; padding: 16px 18px; }
.summary h2 { font-size: 15px; margin: 0 0 12px; color: #8fb6ff; }
.section { margin-bottom: 14px; }
.section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #9aa0a6; margin: 0 0 6px; display: flex; gap: 8px; align-items: center; }
.section p { margin: 0 0 4px; line-height: 1.45; }
.highlight { font-weight: 600; color: #fff; }
.note { font-size: 12px; color: #9aa0a6; font-style: italic; }
.why { font-size: 13px; color: #9aa0a6; }

.plan { margin: 0; padding-left: 20px; }
.plan li { margin-bottom: 10px; }
.plan strong { display: block; margin-bottom: 2px; }

.progress { overflow-y: auto; padding: 24px; max-width: 640px; display: flex; flex-direction: column; gap: 12px; }
.goal { margin: 0; color: #9aa0a6; font-size: 14px; }
.card { background: #202327; border: 1px solid #33373b; border-radius: 10px; padding: 14px 16px; }
.card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #9aa0a6; margin: 0 0 10px; }
.card h4 { font-size: 12px; color: #9aa0a6; margin: 14px 0 4px; font-weight: 600; }
.card.now { background: #1f2a3a; border-color: #3b5a85; }
.theory { margin: 0; font-size: 17px; line-height: 1.4; color: #fff; }
.theory .badge { margin-right: 8px; vertical-align: middle; }
.next { margin: 0; font-weight: 600; line-height: 1.45; }
.fold { border-top: 1px solid #2b2f34; padding: 8px 0; }
.fold:first-of-type { border-top: none; }
.fold summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "›"; margin-left: auto; color: #767a80; transition: transform 0.15s; }
.fold[open] summary::after { transform: rotate(90deg); }
.fold p { margin: 8px 0 0; line-height: 1.45; }
details.card { padding: 14px 16px; border-top: 1px solid #33373b; }
details.card > summary { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #9aa0a6; }
.history-row { display: flex; gap: 10px; }
.empty { color: #767a80; font-style: italic; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.items li { line-height: 1.45; }
.items li .badge { margin-right: 8px; }
.items li strong { margin-right: 6px; }
.timeline .date { color: #9aa0a6; font-size: 12px; margin-right: 8px; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.badge.good { background: #1e3d2b; color: #6fd394; }
.badge.ok { background: #263241; color: #9cc3f5; }
.badge.warn { background: #3d3420; color: #f0c76a; }
.badge.bad { background: #452326; color: #f08a8f; }
.badge.muted { background: #2b2f34; color: #9aa0a6; }

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid #33373b; padding: 12px; flex: none; }
  .sidebar .hint, .sidebar .debug { display: none; }
  .messages, .progress { padding: 12px; }
  .msg { max-width: 92%; }
  .composer { padding: 10px; }
  .composer button { padding: 12px 10px; }
}
