/* Canal web ag2c170 — alineado a tono prototipo naranja */
:root {
  --orange-50: #fff7ed;
  --orange-500: #f97316;
  --orange-700: #c2410c;
  --orange-900: #7c2d12;
  --muted: #64748b;
  --bg: #fafaf9;
  --card: #fff;
  --border: #e7e5e4;
  --radius: 10px;
  --font: system-ui, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: #1c1917;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--orange-700), var(--orange-500));
  color: #fff;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar__link {
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
}

.topbar__link:hover {
  background: rgba(255, 255, 255, 0.15);
}

.topbar__brand {
  font-weight: 700;
  font-size: 1.1rem;
}

.topbar__brand small {
  display: block;
  font-weight: 400;
  opacity: 0.9;
  font-size: 0.75rem;
}

.topbar__tag {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
}

.main {
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  width: 100%;
}

.main--wide {
  max-width: 980px;
}

.progress {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress__fill {
  height: 100%;
  background: var(--orange-500);
  transition: width 0.25s ease;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  min-height: 200px;
}

.bubble {
  max-width: 95%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  line-height: 1.45;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

.bubble--assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.bubble--user {
  align-self: flex-end;
  background: var(--orange-50);
  border: 1px solid #fed7aa;
  color: var(--orange-900);
}

.bubble--loading {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.9rem;
}

.spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid #cbd5e1;
  border-top-color: var(--orange-500);
  border-radius: 50%;
  flex-shrink: 0;
  animation: spin 0.7s linear infinite;
}

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

.composer__hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

.composer__hint strong {
  color: #334155;
  font-weight: 600;
}

.composer__status {
  min-height: 1.25rem;
  font-size: 0.8rem;
  color: var(--orange-700);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.composer__status:empty {
  display: none;
}

.composer--loading .composer__row,
.composer--loading .composer__start {
  opacity: 0.72;
  pointer-events: none;
}

.composer__start {
  width: 100%;
  margin-bottom: 0.75rem;
}

.composer__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.text-input {
  flex: 1 1 160px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}

.file input {
  display: none;
}

.file span {
  display: inline-block;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--muted);
}

.file:hover span {
  border-color: var(--orange-500);
  color: var(--orange-700);
}

.btn {
  padding: 0.65rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--orange-500);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}

.btn:hover {
  background: var(--orange-700);
}

.btn--ghost {
  background: transparent;
  color: var(--orange-700);
  border: 1px solid #fed7aa;
}

.btn--ghost:hover {
  background: var(--orange-50);
}

.btn--block {
  width: 100%;
  margin-top: 0.75rem;
}

.closed-panel {
  text-align: center;
  padding: 1.5rem;
  background: var(--orange-50);
  border-radius: var(--radius);
  border: 1px solid #fed7aa;
  line-height: 1.55;
}

.closed-panel__title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--orange-900);
  margin: 0 0 0.5rem;
}

.closed-panel p {
  margin: 0;
  color: #44403c;
  font-size: 0.95rem;
}

.footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 1rem;
}

.hidden {
  display: none !important;
}

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel__title {
  margin: 0;
  font-size: 1.1rem;
}

.panel__meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.75rem 0;
}

.panel__error {
  margin: 0.75rem 0;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.file-table th,
.file-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.55rem 0.45rem;
  vertical-align: top;
}

.file-table th {
  color: #334155;
  background: #f8fafc;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.link-btn {
  border: none;
  background: none;
  color: #0f766e;
  text-decoration: underline;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

/* Aviso Habeas Data — visible antes del hilo de chat */
.invite-banner {
  margin: 0 0 0.85rem;
  padding: 0.75rem 1rem;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.4;
  color: #065f46;
}

.invite-banner.hidden {
  display: none;
}

.habeas-panel {
  background: var(--orange-50);
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #292524;
}

.habeas-panel__title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--orange-900);
}

.habeas-panel__lead {
  margin: 0 0 0.65rem;
}

.habeas-panel__consent {
  margin: 0;
  padding-top: 0.65rem;
  border-top: 1px dashed #fdba74;
  font-size: 0.85rem;
}

.habeas-panel__checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 0.85rem;
  padding: 0.65rem 0.55rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  font-size: 0.86rem;
  line-height: 1.4;
  cursor: pointer;
  color: var(--orange-900);
}

.habeas-panel__checkbox input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}
