/* pacientes.css - Versión final con todas las secciones y estilos completos */

.patients-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Header */
.patients-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, #ffffff, #eef8f5);
    box-shadow: var(--shadow-sm);
}

.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--primary-dark);
    font-size: 0.85rem;
    font-weight: 800;
}

.patients-header h1 {
    margin: 0.35rem 0;
    color: var(--text-dark);
    font-size: clamp(1.8rem, 3vw, 2.35rem);
}

.patients-header p {
    max-width: 760px;
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.patients-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 1rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 94px;
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    flex: 0 0 50px;
    border-radius: 18px;
    color: var(--primary-dark);
    background: rgba(61, 155, 122, 0.12);
}

.stat-icon-success { color: var(--success); background: rgba(44, 122, 94, 0.12); }
.stat-icon-warning { color: var(--warning); background: rgba(237, 137, 54, 0.14); }
.stat-icon-danger { color: var(--danger); background: rgba(229, 62, 62, 0.12); }

.stat-card p {
    margin: 0 0 0.2rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.stat-card strong {
    color: var(--text-dark);
    font-size: 1.75rem;
}

/* Toolbar de búsqueda (estilos completos) */
.patients-toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(420px, 0.95fr);
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.search-box {
    position: relative;
    display: block;
}
.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.search-box input {
    width: 100%;
    min-height: 50px;
    padding: 0.8rem 1rem 0.8rem 2.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    transition: var(--transition);
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(61, 155, 122, 0.12);
}

.toolbar-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(130px, 1fr));
    gap: 0.75rem;
}
.toolbar-filters label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
}
.toolbar-filters select {
    width: 100%;
    min-height: 50px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
}
.toolbar-filters select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(61, 155, 122, 0.12);
}

/* Búsqueda desplegable */
.patient-search-area { position: relative; }
.patient-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(28, 46, 40, 0.12);
}
.patient-result {
    display: flex;
    gap: 0.75rem;
    padding: 0.7rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
}
.patient-result:hover { background: rgba(61, 155, 122, 0.08); }
.patient-result.active { background: rgba(61, 155, 122, 0.12); }
.empty-search-results { padding: 1rem; text-align: center; color: var(--text-muted); }

/* Patient hero - más pequeño */
.patient-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, #f6fbf9, #ffffff);
}
.patient-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.record-label {
    color: var(--primary-dark);
    font-size: 0.7rem;
    font-weight: 800;
}
.patient-hero h2 {
    margin: 0.1rem 0;
    font-size: 1.3rem;
    color: var(--text-dark);
}
.patient-hero p {
    margin: 0 0 0.2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.patient-badges, .patient-dates {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.patient-dates article {
    min-width: 120px;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: #ffffff;
}
.patient-dates span {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.65rem;
    color: var(--text-muted);
}
.patient-dates strong {
    font-size: 0.8rem;
    color: var(--text-dark);
}
.avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    font-size: 1.1rem;
}

/* Layout principal */
.patient-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: 540px;
}
.patient-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem;
    border-right: 1px solid var(--border-light);
    background: #fbfdfc;
}
.patient-tab {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
    transition: 0.2s ease;
    color: var(--text-muted);
}
.patient-tab:hover, .patient-tab.active {
    color: #ffffff;
    background: var(--primary);
}
.patient-content-area {
    min-width: 0;
    padding: 1.15rem;
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}
.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.panel-heading h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-dark);
}
.panel-heading p {
    margin: 0.3rem 0 0;
    color: var(--text-muted);
}

/* Summary */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
.summary-card {
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: #ffffff;
}
.summary-card span {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
}
.summary-card p {
    margin: 0;
    color: var(--text-dark);
    line-height: 1.55;
}

/* Historial con selector horizontal (select) */
.history-selector {
    margin-bottom: 1.5rem;
}
.history-select {
    width: 100%;
    max-width: 400px;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #ffffff;
    font-weight: 500;
    cursor: pointer;
}
.history-panels {
    min-height: 400px;
}
.history-section-panel {
    display: none;
    animation: fadeIn 0.2s;
}
.history-section-panel.active {
    display: block;
}
.history-section-panel .history-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.85rem;
}
.history-field {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: #fbfdfc;
    overflow-x: auto;
    word-break: break-word;
}
.history-field strong {
    color: var(--primary-dark);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}
.history-field span {
    color: var(--text-dark);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
}
.history-field-control {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.history-section-panel.is-editing .history-field span {
    outline: 2px dashed rgba(61, 155, 122, 0.5);
    outline-offset: 2px;
    background: #ffffff;
}

/* Archivos adjuntos */
.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.5rem 0.8rem;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}
.attachment-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
}
.attachment-info i { color: var(--primary); font-size: 1rem; }
.attachment-info span { font-size: 0.85rem; font-weight: 500; }
.attachment-info small { font-size: 0.7rem; }
.delete-attachment {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
}
.delete-attachment:hover { color: var(--danger); }
.add-attachment-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}
.add-attachment-form input, .add-attachment-form select {
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.add-attachment-form button { padding: 0.5rem 0.9rem; font-size: 0.85rem; }
.empty-attachments {
    padding: 0.8rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Tareas y notas */
.items-list {
    display: grid;
    gap: 0.9rem;
}
.item-card {
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: #ffffff;
}
.item-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.item-card h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-dark);
}
.item-card p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-body);
}
.item-card small { font-size: 0.75rem; color: var(--text-muted); }
.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
}
.meta-chip {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: var(--bg-main);
}
.item-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.7rem;
}
.icon-btn {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
}
.icon-btn:hover {
    color: var(--primary-dark);
    border-color: var(--primary);
}

/* Badges */
.status-badge, .risk-badge, .item-status {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
}
.status-active { color: var(--success); background: rgba(44, 122, 94, 0.12); }
.status-inactive { color: var(--danger); background: rgba(229, 62, 62, 0.1); }
.risk-bajo { color: var(--success); background: rgba(44, 122, 94, 0.12); }
.risk-medio { color: #b95d10; background: rgba(237, 137, 54, 0.14); }
.risk-alto { color: var(--danger); background: rgba(229, 62, 62, 0.12); }

/* Modales */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(10, 31, 51, 0.55);
    backdrop-filter: blur(4px);
}
.modal.is-open { display: flex; }
.modal-card {
    position: relative;
    width: min(820px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
    padding: 1.4rem;
    border-radius: var(--radius-xl);
    background: #ffffff;
    box-shadow: 0 24px 80px rgba(10, 31, 51, 0.24);
}
.modal-card-small { width: min(580px, 96vw); }
.modal-card h2 { margin: 0 2rem 1rem 0; font-size: 1.3rem; }
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: 0;
    background: transparent;
    font-size: 1.5rem;
    cursor: pointer;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem;
}
.form-full { grid-column: 1 / -1; }
.form-grid label {
    display: grid;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 800;
}
.form-grid input, .form-grid select, .form-grid textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .patients-toolbar, .patient-layout { grid-template-columns: 1fr; }
    .patient-tabs { flex-direction: row; overflow-x: auto; }
    .history-select { max-width: 100%; }
}
@media (max-width: 760px) {
    .patients-header, .patient-hero, .panel-heading, .item-card-header { flex-direction: column; align-items: stretch; }
    .summary-grid, .form-grid { grid-template-columns: 1fr; }
    .history-field { grid-template-columns: 1fr; }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Corrección barra de búsqueda de pacientes
   ========================================================= */
.patient-search-area {
  position: relative;
}

.patient-search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  z-index: 50;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 340px;
  overflow-y: auto;
}

.patient-result {
  width: 100%;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.85rem;
  align-items: center;
  padding: 1rem;
  border: none;
  border-bottom: 1px solid var(--border-light);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
}

.patient-result:last-child {
  border-bottom: none;
}

.patient-result:hover,
.patient-result.active {
  background: #f0faf6;
}

.result-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #ffffff;
  background: var(--primary);
}

.result-avatar.avatar-blue {
  background: #4f7cff;
}

.result-avatar.avatar-orange {
  background: #f59e0b;
}

.result-info {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.result-info strong {
  display: block;
  font-weight: 900;
  color: var(--text-dark);
}

.result-info span {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  word-break: break-word;
}

.result-info small {
  display: block;
  font-size: 0.8rem;
  color: var(--primary-dark);
  font-style: italic;
}

/* =========================================================
   Historial clínico con inputs HTML
   ========================================================= */
.clinical-history-form {
  display: grid;
  gap: 1.25rem;
}

.history-module {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: #ffffff;
}

.history-module legend {
  padding: 0 0.5rem;
  font-weight: 900;
  color: var(--primary-dark);
}

.history-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.85rem;
}

.history-field {
  display: grid;
  gap: 0.4rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #fbfdfc;
}

.history-field strong {
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.history-field input,
.history-field select,
.history-field textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text-dark);
  background: #ffffff;
}

.history-field textarea {
  resize: vertical;
  min-height: 82px;
}

.history-field input:focus,
.history-field select:focus,
.history-field textarea:focus {
  outline: 2px solid rgba(61, 155, 122, 0.25);
  border-color: var(--primary);
}

.form-full {
  grid-column: 1 / -1;
}

.patient-result.is-hidden,
.empty-search-results.is-hidden {
  display: none !important;
}

.history-tabs {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.9rem 0 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
  scrollbar-width: thin;
}

.history-tabs::-webkit-scrollbar {
  height: 7px;
}

.history-tabs::-webkit-scrollbar-track {
  background: #eef6f2;
  border-radius: 999px;
}

.history-tabs::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 999px;
}

.history-tab {
  flex: 0 0 auto;
  border: 1px solid var(--border-light);
  background: #ffffff;
  color: var(--text-muted);
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.history-tab:hover {
  color: var(--primary-dark);
  border-color: var(--primary);
  background: #f0faf6;
}

.history-tab.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(61, 155, 122, 0.22);
}

.clinical-history-form {
  min-height: 430px;
}

.history-module {
  display: none;
  animation: fadeHistorySection 0.2s ease;
}

.history-module.active {
  display: block;
}

@keyframes fadeHistorySection {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.session-history-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.session-history-list {
  display: grid;
  gap: 1rem;
}

.session-record-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: #ffffff;
  padding: 1rem;
}

.session-record-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.session-record-header h3 {
  margin: 0.2rem 0;
  color: var(--text-dark);
}

.session-record-header p {
  margin: 0;
  color: var(--text-muted);
}

.attachments-panel {
  display: grid;
  gap: 1.25rem;
}

.attachment-upload-card,
.attached-files-list {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: #ffffff;
  padding: 1rem;
}

.attached-files-list {
  display: grid;
  gap: 0.85rem;
}

.attached-files-list h3 {
  margin: 0 0 0.25rem;
  color: var(--primary-dark);
}

.attached-file-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.9rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #fbfdfc;
}

.attached-file-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f0faf6;
  color: var(--primary-dark);
  font-size: 1.25rem;
}

.attached-file-card strong {
  color: var(--text-dark);
}

.attached-file-card p,
.attached-file-card small {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
}

.attached-file-actions {
  display: flex;
  gap: 0.35rem;
}

@media (max-width: 760px) {
  .session-record-header,
  .attached-file-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .attached-file-actions {
    justify-content: flex-start;
  }
}

/* Historial de sesiones fuera del historial clínico */
.session-history-readonly {
  display: grid;
  gap: 1rem;
}

.session-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.session-summary-grid article {
  padding: 0.9rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #fbfdfc;
}

.session-summary-grid span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--primary-dark);
  text-transform: uppercase;
}

.session-summary-grid p {
  margin: 0;
  color: var(--text-dark);
  line-height: 1.5;
}

.session-notes-details {
  margin-top: 1rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #ffffff;
  overflow: hidden;
}

.session-notes-details summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  color: var(--primary-dark);
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.session-notes-details summary::-webkit-details-marker {
  display: none;
}

.session-notes-details summary:hover {
  background: #f0faf6;
}

.session-notes-content {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-top: 1px solid var(--border-light);
  background: #fbfdfc;
}

.session-notes-content p {
  margin: 0;
  color: var(--text-dark);
  line-height: 1.55;
}

/* Revisión real de tareas terapéuticas */
.review-shell {
    margin-top: 1.5rem;
}

.review-list,
.task-history-grid {
    display: grid;
    gap: 1rem;
}

.review-card {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
    gap: 1.25rem;
    border: 1px solid rgba(61, 155, 122, .18);
    border-radius: 22px;
    background: #fff;
    padding: 1.1rem;
}

.review-main h3,
.task-history-card h3 {
    margin: .45rem 0 .35rem;
    color: var(--text-dark, #0d2d2b);
}

.review-patient {
    color: var(--text-body, #4b5d57);
}

.review-answer {
    margin-top: .7rem;
    background: #f6faf8;
    border: 1px solid rgba(61, 155, 122, .12);
    border-radius: 14px;
    padding: .8rem;
    line-height: 1.55;
}

.review-form {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    background: #f8fbfa;
    border-radius: 18px;
    padding: 1rem;
}

.review-actions {
    display: flex;
    gap: .7rem;
    flex-wrap: wrap;
}

.btn-outline-danger {
    border: 1px solid rgba(220, 80, 80, .45);
    background: #fff;
    color: #c74f4f;
    border-radius: 14px;
    padding: .85rem 1rem;
    font-weight: 800;
    cursor: pointer;
}

.btn-outline-danger:hover {
    background: rgba(220, 80, 80, .08);
}

.task-history-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.task-history-card {
    border: 1px solid rgba(61, 155, 122, .12);
    border-radius: 18px;
    background: #fdfefe;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.file-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    width: fit-content;
    margin-top: .7rem;
    color: var(--primary-dark, #24765c);
    font-weight: 800;
    text-decoration: none;
}

.file-link::before {
    content: '📎';
}

@media (max-width: 900px) {
    .review-card {
        grid-template-columns: 1fr;
    }
}
