/* ============================================================================
   Portal Reuniones NEWTEX — sistema de diseño
   ============================================================================ */

:root {
  /* Fondo */
  --bg-base: #0a0a0a;
  --bg-surface: #111111;
  --bg-elevated: #1a1a1a;
  --bg-hover: #222222;

  /* Acento NEWTEX */
  --accent: #00E87B;
  --accent-dim: rgba(0, 232, 123, 0.12);
  --accent-border: rgba(0, 232, 123, 0.3);
  --accent-strong: rgba(0, 232, 123, 0.6);

  /* Texto */
  --text-primary: #f0f0f0;
  --text-secondary: #888888;
  --text-muted: #444444;

  /* Bordes */
  --border: #2a2a2a;
  --border-focus: #00E87B;

  /* Estados */
  --warning: #F5A623;
  --warning-dim: rgba(245, 166, 35, 0.12);
  --danger: #E84040;
  --danger-dim: rgba(232, 64, 64, 0.12);

  /* Tipografía */
  --font-ui: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;

  /* Espaciado y radios */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.02), 0 4px 12px rgba(0,0,0,0.4);
}

/* ============================================================================
   Reset
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================================
   Utilidades
   ============================================================================ */

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* ============================================================================
   Header global
   ============================================================================ */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-header__logo {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: var(--bg-base);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}

.app-header__title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.app-header__title .sep { color: var(--text-muted); margin: 0 6px; }

.app-header__date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: capitalize;
}

/* ============================================================================
   Layout principal
   ============================================================================ */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
}

.page-title {
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 8px 0;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}

/* ============================================================================
   Vista 1 — Selector
   ============================================================================ */

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  align-items: center;
}

.search-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.15s, background 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--bg-elevated);
}
.search-input::placeholder { color: var(--text-muted); }

.btn {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.btn--primary {
  background: var(--accent);
  color: var(--bg-base);
  border-color: var(--accent);
}
.btn--primary:hover { background: #00ff88; border-color: #00ff88; }
.btn--ghost {
  background: transparent;
  border-color: var(--border);
}
.btn--danger {
  color: var(--danger);
  border-color: var(--border);
}
.btn--danger:hover { background: var(--danger-dim); border-color: var(--danger); }
.btn--sm { padding: 8px 12px; font-size: 13px; }

.continue-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  gap: 16px;
}
.continue-pill__text {
  font-size: 14px;
  color: var(--text-primary);
}
.continue-pill__label {
  color: var(--accent);
  font-weight: 500;
  margin-right: 8px;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.card:hover {
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}
.badge--neutral {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border);
}
.badge--warning {
  background: var(--warning-dim);
  color: var(--warning);
  border-color: rgba(245, 166, 35, 0.4);
}

.card__menu-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}
.card__menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.card__menu {
  position: absolute;
  top: 56px;
  right: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 180px;
  z-index: 10;
  box-shadow: var(--shadow-card);
}
.card__menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.card__menu button:hover { background: var(--bg-hover); }
.card__menu button.danger { color: var(--danger); }

.card__negocio {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
}
.card__cliente {
  font-size: 14px;
  color: var(--text-secondary);
}
.card__meta {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.card__meta .row { display: flex; gap: 10px; }
.card__time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-bar__fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.card__cta {
  margin-top: 4px;
  text-align: right;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}
.empty-state__icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state__text { font-size: 15px; }

/* ============================================================================
   Modal
   ============================================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
}

.modal__title {
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 4px 0;
}
.modal__subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
}

.field { margin-bottom: 18px; }
.field__label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.field__label .req { color: var(--accent); margin-left: 2px; }
.field__input,
.field__select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.15s;
}
.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--border-focus);
}
.field__hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.radio-group, .check-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.radio-pill, .check-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  user-select: none;
}
.radio-pill:hover, .check-pill:hover { border-color: var(--text-muted); }
.radio-pill input, .check-pill input {
  accent-color: var(--accent);
}
.radio-pill:has(input:checked),
.check-pill:has(input:checked) {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.modal__error {
  background: var(--danger-dim);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ============================================================================
   Vista 2 — Reunión activa
   ============================================================================ */

.meeting-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.meeting-header__row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-hover); }

.meeting-header__info {
  flex: 1;
  min-width: 0;
}

.meeting-title {
  font-size: 17px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.meeting-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.meeting-meta .sep { color: var(--text-muted); margin: 0 6px; }

.meeting-header__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.status-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.status-pill--saved {
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
}
.status-pill--saving {
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.status-pill--error {
  color: var(--warning);
  background: var(--warning-dim);
  border: 1px solid rgba(245, 166, 35, 0.4);
}

.meeting-progress {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.meeting-progress .progress-bar { flex: 1; }
.meeting-progress__label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Secciones del formulario */

.section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.section__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  color: inherit;
}
.section__header:hover { background: var(--bg-hover); }

.section__number {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}
.section__title {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
}
.section__counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 4px 10px;
  border-radius: 999px;
}
.section__toggle {
  color: var(--text-secondary);
  font-size: 14px;
  transition: transform 0.2s;
}
.section--collapsed .section__toggle { transform: rotate(-90deg); }
.section--collapsed .section__body { display: none; }

.section__body {
  padding: 0 22px 18px;
  border-top: 1px solid var(--border);
}

.question {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.question:last-child { border-bottom: none; }

.question__check {
  margin-top: 2px;
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

.question__content { min-width: 0; }
.question__label {
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 8px;
  cursor: pointer;
}
.question--marked .question__label { color: var(--accent); }

.question__textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.question__textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.notas-internas {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 18px;
}
.notas-internas__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 500;
}
.notas-internas__textarea {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text-primary);
  resize: vertical;
  min-height: 120px;
  font-family: var(--font-ui);
  line-height: 1.5;
}
.notas-internas__textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Panel planes */

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 16px;
}
.panel__title {
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin: 0 0 16px 0;
}

.planes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.plan-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.15s;
}
.plan-card--selected {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.plan-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.plan-card__label {
  font-weight: 500;
  font-size: 14px;
}
.plan-card__prices {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.plan-card__prices .price { color: var(--accent); }
.plan-card__desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.plan-card__btn {
  margin-top: auto;
  align-self: flex-start;
}

/* Demos panel */

.demos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.demo-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.demo-card:hover {
  border-color: var(--accent-border);
  background: var(--bg-hover);
}
.demo-card__icon { font-size: 26px; }
.demo-card__title {
  font-size: 14px;
  font-weight: 500;
}
.demo-card__desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.demo-card__open {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}
.demo-card .badge--recommended {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* Export button */

.meeting-footer {
  margin-top: 32px;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

/* ============================================================================
   Modal bloqueante de error de guardado
   ============================================================================ */

.blocking-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 20px;
}
.blocking-modal__inner {
  background: var(--bg-surface);
  border: 1px solid var(--warning);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  box-shadow: 0 0 40px rgba(245, 166, 35, 0.2);
}
.blocking-modal__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 500;
  color: var(--warning);
  margin-bottom: 12px;
}
.blocking-modal__body {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 20px;
}
.blocking-modal__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================================
   Error genérico
   ============================================================================ */

.error-screen {
  text-align: center;
  padding: 80px 20px;
}
.error-screen__title {
  font-size: 22px;
  margin-bottom: 12px;
}
.error-screen__msg {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 768px) {
  .app-header { padding: 14px 18px; }
  .app-header__date { display: none; }
  .container { padding: 20px 16px; }
  .page-title { font-size: 22px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .grid-cards { grid-template-columns: 1fr; }
  .meeting-header { padding: 14px 18px; }
  .meeting-header__row { flex-wrap: wrap; }
  .meeting-header__actions { width: 100%; justify-content: flex-end; }
  .meeting-footer { flex-direction: column; align-items: stretch; }
  .section__header { padding: 14px 16px; }
  .section__body { padding: 0 16px 14px; }
}

/* ============================================================================
   Impresión — formato exportable
   ============================================================================ */

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: 'DM Sans', Arial, sans-serif !important;
  }
  .app-header,
  .meeting-header__actions,
  .icon-btn,
  .panel,
  .meeting-footer,
  .card__menu-btn,
  .section__toggle,
  .modal-overlay,
  .blocking-modal,
  .demo-card,
  .question__textarea:placeholder-shown,
  .status-pill {
    display: none !important;
  }
  .meeting-header {
    position: static;
    border-bottom: 2px solid #000;
    padding: 0 0 16px;
    background: transparent;
  }
  .meeting-title, .meeting-meta { color: #000 !important; }
  .meeting-progress { display: none; }
  .container { padding: 24px; max-width: none; }
  .section {
    background: transparent !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    margin-bottom: 14px;
  }
  .section__header { padding: 12px 16px; }
  .section__number, .section__title { color: #000 !important; }
  .section__counter { display: none; }
  .section__body { display: block !important; padding: 0 16px 12px; }
  .question {
    grid-template-columns: 1fr;
    border-color: #eee !important;
    page-break-inside: avoid;
  }
  .question__check { display: none; }
  /* Solo mostrar preguntas marcadas en impresión */
  .question:not(.question--marked) { display: none; }
  .question__label { color: #000 !important; font-weight: 500; }
  .question__textarea {
    background: transparent !important;
    border: none !important;
    padding: 4px 0 !important;
    color: #000 !important;
    min-height: 0 !important;
    resize: none !important;
  }
  .notas-internas {
    background: #f6f6f6 !important;
    border: 1px solid #999 !important;
    color: #000 !important;
    page-break-inside: avoid;
  }
  .notas-internas__label { color: #000 !important; }
  .notas-internas__textarea {
    background: transparent !important;
    border: none !important;
    color: #000 !important;
  }
  .badge {
    background: transparent !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }
  @page { margin: 18mm; }
}
