/* Pestaña «Claude». Mismo lenguaje que el resto de Cabina: grafito, Inter, botones ≥72 px. */

:root { --claude: #d97757; --ok: #3fb950; --warn: #e9a23b; }
.c-claude { --c: var(--claude); }

.claude { height: 100%; display: flex; flex-direction: column; min-height: 0; background: var(--bg); position: relative; }
.claude:not([hidden]) { animation: viewIn 0.32s var(--ease); }

.cl-head { display: flex; align-items: center; gap: 16px; padding: 14px 20px; }
.cl-title { flex: 1; min-width: 0; }
.cl-title h2 { margin: 0; font-size: 1.3rem; font-weight: 500; }
.cl-mac { margin: 2px 0 0; font-size: 0.92rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.cl-mac::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.cl-mac.on::before { background: var(--ok); }
.cl-mac.off::before { background: var(--danger); }

.cl-lock {
  display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 0 20px;
  border: 0; border-radius: 16px; background: var(--panel-2); color: var(--muted); cursor: pointer;
}
.cl-lock .ico { width: 26px; height: 26px; }
.cl-lock b { color: var(--text); font-weight: 600; padding-left: 12px; border-left: 1px solid var(--line); }
.cl-lock.open { color: var(--text); box-shadow: inset 0 0 0 2px var(--claude); }
.cl-lock.open .ico { color: var(--claude); }

.cl-body { flex: 1; min-height: 0; display: flex; gap: 16px; padding: 0 20px 16px; }
.cl-col { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }

/* Permisos: lo más importante de la pestaña. */
.cl-perms { display: flex; flex-direction: column; gap: 12px; }
.cl-perm { background: var(--panel); border-radius: var(--radius); padding: 16px 18px; box-shadow: inset 4px 0 0 var(--claude); }
.cl-perm header { display: flex; align-items: center; gap: 12px; }
.cl-perm header b { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-perm header time { color: var(--faint); font-size: 0.85rem; }
.cl-perm-tag { background: var(--claude); color: #fff; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.cl-perm-tool { margin: 12px 0 4px; color: var(--muted); font-size: 0.9rem; }
.cl-perm-detail, .cl-confirm-body {
  margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--panel-2);
  font: 0.92rem/1.45 ui-monospace, 'SF Mono', Menlo, monospace; white-space: pre-wrap; word-break: break-word;
  max-height: 9.5em; overflow-y: auto; user-select: text;
}
.cl-perm-actions { display: flex; gap: 12px; margin-top: 14px; }
.cl-perm-actions .cl-btn { flex: 1; }
.cl-wait { margin: 0; color: var(--muted); }

.cl-btn {
  min-height: 72px; padding: 0 22px; border: 0; border-radius: 16px; font-weight: 600; font-size: 1.05rem; cursor: pointer;
  transition: transform 0.15s var(--ease), opacity 0.18s var(--ease);
}
.cl-btn:active { transform: scale(0.97); }
.cl-btn.allow { background: var(--accent); color: var(--accent-ink); }
.cl-btn.deny { background: var(--panel-2); color: var(--danger); box-shadow: inset 0 0 0 2px var(--danger); }
.cl-btn.ghost { background: var(--panel-2); color: var(--text); }

/* Sesiones */
.cl-list { display: flex; flex-direction: column; gap: 8px; }
.cl-sess {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 80px; padding: 12px 16px;
  border: 0; border-radius: var(--radius); background: var(--panel); text-align: left; cursor: pointer;
}
.cl-sess:active { background: var(--panel-2); }
.cl-sess.sel { background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--accent); }
.cl-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--faint); }
.cl-sess.work .cl-dot { background: var(--accent); animation: clPulse 1.6s ease-in-out infinite; }
.cl-sess.wait .cl-dot, .cl-sess.perm .cl-dot { background: var(--claude); }
.cl-sess.done .cl-dot { background: var(--ok); }
.cl-sess-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cl-sess-main b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-sess-main small { color: var(--muted); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cl-sess-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 0.82rem; }
.cl-sess-side em { font-style: normal; color: var(--muted); }
.cl-sess.wait em, .cl-sess.perm em { color: var(--claude); font-weight: 600; }
.cl-sess-side time { color: var(--faint); }
.cl-sess-side i { font-style: normal; color: var(--warn); }
.cl-empty { color: var(--muted); padding: 24px 4px; }
@keyframes clPulse { 50% { opacity: 0.35; } }

.cl-log { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.cl-log time { color: var(--faint); margin-right: 8px; }
.cl-log .ok { color: var(--ok); } .cl-log .err { color: var(--danger); } .cl-log .warn { color: var(--warn); }

/* Dictado */
.cl-dict { flex: none; width: min(42%, 460px); display: flex; flex-direction: column; gap: 14px; padding: 16px 18px; border-radius: var(--radius); background: var(--panel); overflow-y: auto; }
.cl-dict header { display: flex; align-items: flex-start; gap: 12px; }
.cl-dict header div { flex: 1; min-width: 0; }
.cl-dict-k { margin: 0; color: var(--faint); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.cl-dict h3 { margin: 2px 0; font-size: 1.15rem; font-weight: 500; }
.cl-dict header p:last-child { margin: 0; color: var(--muted); font-size: 0.88rem; }
.cl-mic {
  display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 96px;
  border: 0; border-radius: 20px; background: var(--panel-2); color: var(--text); font-size: 1.1rem; font-weight: 600; cursor: pointer;
}
.cl-mic .ico { width: 34px; height: 34px; }
.cl-mic.rec { background: var(--danger); color: #fff; }
.cl-mic.busy { opacity: 0.6; pointer-events: none; }
#cl-text {
  min-height: 120px; resize: none; padding: 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--panel-2); font-size: 1rem; line-height: 1.4; user-select: text;
}
#cl-text:focus { outline: none; border-color: var(--accent); }
.cl-note { margin: 0; color: var(--faint); font-size: 0.82rem; }

/* Hojas (PIN y confirmación) sobre la pestaña */
.cl-sheet { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgb(0 0 0 / 0.62); }
.cl-sheet[hidden] { display: none; }
.cl-sheet-card { width: min(520px, 100%); max-height: 100%; overflow-y: auto; padding: 24px; border-radius: 22px; background: var(--panel); animation: viewIn 0.25s var(--ease); }
.cl-sheet-card h3 { margin: 0 0 8px; font-size: 1.25rem; font-weight: 600; }
.cl-sheet-card .keypad button { height: 76px; }
.cl-sheet-cancel { width: 100%; min-height: 64px; margin-top: 12px; border-radius: 16px; }
.cl-confirm-body { margin: 8px 0 18px; max-height: 14em; }
.cl-confirm-actions { display: flex; gap: 12px; }
.cl-confirm-actions .cl-btn { flex: 1; }

/* Pantalla angosta: el dictado pasa abajo */
@media (max-width: 899px) {
  .cl-body { flex-direction: column; overflow-y: auto; }
  .cl-col { overflow: visible; }
  .cl-dict { width: auto; }
  .cl-lock span { display: none; }
  .cl-lock b { border: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { .cl-sess.work .cl-dot { animation: none; } }
