﻿@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,650;9..144,700&family=Nunito+Sans:wght@400;600;700;800&display=swap");

:root {
  --bg: #f8f3f6;
  --panel: #ffffff;
  --accent: #5aaed0;
  --accent-dark: #d85d97;
  --text: #46505a;
  --muted: #7c858e;
  --danger: #c0392b;
  --border: #e9dde5;
  --sky-50: #f3fbff;
  --sky-200: #cfeefe;
  --sky-500: #4db6e6;
  --rose-300: #f7b9cf;
  --rose-500: #ea7fa7;
  --brand-blue: #7b9fb2;
  --ink-900: #1d1d22;
  --ink-700: #35323b;
  --ink-500: #6a6773;
  --line: #e5e2ee;
  --surface: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Nunito Sans", "Segoe UI", Arial, sans-serif;
  background: #0b0f16;
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

body.is-login .sidebar {
  display: none;
}

body.is-login .app {
  grid-template-columns: 1fr;
  background:
    radial-gradient(circle at top left, var(--sky-200), transparent 55%),
    radial-gradient(circle at 78% 24%, rgba(207, 238, 254, 0.78), transparent 48%),
    radial-gradient(circle at 20% 85%, var(--rose-300), transparent 60%),
    var(--sky-50);
}

body.is-login .main {
  padding: 0;
  background:
    radial-gradient(circle at top left, var(--sky-200), transparent 55%),
    radial-gradient(circle at 78% 24%, rgba(207, 238, 254, 0.78), transparent 48%),
    radial-gradient(circle at 20% 85%, var(--rose-300), transparent 60%),
    var(--sky-50);
}

.sidebar {
  background: #ffffff;
  color: #46505a;
  border-right: 1px solid #eadde5;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.logo {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 150px;
  overflow: hidden;
}

.sidebar-logo {
  width: 420px;
  height: 210px;
  max-width: none;
  display: block;
  object-fit: contain;
  object-position: center;
  transform: scale(2.05);
  transform-origin: center;
  filter:
    brightness(0.86)
    contrast(1.45)
    saturate(1.14)
    drop-shadow(0.25px 0 0 rgba(93, 126, 148, 0.35));
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  background: transparent;
  color: #46505a;
  border: 1px solid #eadde5;
  padding: 12px 14px;
  text-align: left;
  border-radius: 10px;
  cursor: pointer;
}

.nav-item.active {
  background: #f7edf3;
  border-color: #dfc4d3;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}

.sidebar-footer a {
  color: #5aaed0;
  text-decoration: none;
}

.main {
  padding: 24px;
  background:
    radial-gradient(circle at 35% 60%, rgba(222, 102, 158, 0.13) 0%, rgba(222, 102, 158, 0.05) 28%, transparent 54%),
    linear-gradient(118deg, #fbf8fa 0%, #ffffff 46%, #f5fafb 100%);
  min-height: 100vh;
}

.view {
  display: block;
}

.hidden {
  display: none !important;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  max-width: 460px;
}

.login-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px 16px;
}

.login-card {
  width: 390px;
  max-width: 92vw;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  padding: 28px 28px 22px;
  box-shadow: 0 18px 40px rgba(29, 29, 34, 0.12);
  backdrop-filter: blur(10px);
}

.login-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 116px;
  margin-bottom: 20px;
  overflow: hidden;
}

.login-logo img {
  width: 520px;
  height: 260px;
  display: block;
  object-fit: contain;
  object-position: center;
  transform: translateX(-14px) scale(2.24);
  transform-origin: center;
  filter:
    brightness(0.82)
    contrast(1.55)
    saturate(1.18)
    drop-shadow(0.35px 0 0 rgba(93, 126, 148, 0.42))
    drop-shadow(-0.35px 0 0 rgba(93, 126, 148, 0.28));
}

.login-card h1 {
  margin: 0 0 24px;
  color: var(--ink-900);
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: 29px;
  line-height: 1.1;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login-copy {
  margin: 0 0 20px;
  color: #2f3036;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}

.role-toggle {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

label {
  display: block;
  margin-top: 10px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #33343a;
  font-weight: 500;
}

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink-700);
  padding-right: 34px;
  min-height: 34px;
}

.password-wrap {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.password-wrap input[type="text"],
.password-wrap input[type="password"] {
  margin-top: 0;
}

.show-pass-btn {
  width: 46px;
  flex: 0 0 46px;
  align-self: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-700);
  cursor: pointer;
  font-weight: 600;
}

.primary {
  background: linear-gradient(90deg, var(--sky-500) 0%, var(--rose-500) 100%);
  color: white;
  border: none;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  width: 100%;
  margin-top: 12px;
}

.primary:hover {
  filter: brightness(0.98);
}

.secondary {
  background: #f3f4f6;
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
}

.register-open-btn {
  width: 100%;
  margin-top: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sky-500) 0%, var(--rose-500) 100%);
  color: white;
  border: none;
  font-weight: 700;
}

.forgot-password-link {
  display: block;
  width: 100%;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-500);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  text-align: center;
}

.forgot-password-link:hover {
  color: var(--rose-500);
  text-decoration: underline;
}

.error {
  margin-top: 10px;
  color: #ff6b6b;
  font-size: 12px;
}

.success {
  margin-top: 10px;
  color: #15803d;
  font-size: 12px;
}

.login-help {
  margin-top: 10px;
  color: var(--ink-500);
  font-size: 11px;
}

.login-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.instructivo-btn {
  border: 1px solid var(--line);
  color: var(--sky-500);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.login-footer {
  text-align: center;
  color: var(--ink-500);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-footer a {
  color: var(--sky-500);
  text-decoration: none;
}

.footer-place {
  color: #7c858e;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar h2 {
  color: #56616a;
  letter-spacing: 0.5px;
}

.metrics {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.metric {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e6d4de;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 12px;
  color: #5b646d;
  min-width: 220px;
}

.metric-card {
  min-width: 260px;
  text-align: center;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: #4d545b;
}

.metric-label {
  font-size: 12px;
  letter-spacing: 1px;
  color: #8b6d7e;
  margin-top: 4px;
}

.search-row {
  margin: 16px 0;
}

.search-row input {
  width: 520px;
  max-width: 100%;
  border-radius: 24px;
  border: 1px solid #dcbfd0;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.92);
  color: #46505a;
  outline: none;
  box-shadow: 0 0 0 1px rgba(216, 93, 151, 0.12);
}

.topbar .primary {
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  width: auto;
  min-width: 220px;
  margin-top: 0;
}

.table-wrap {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d7bccb;
  border-radius: 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1060px;
}

th, td {
  padding: 9px 10px;
  border-bottom: 1px solid #dcc2d1;
  font-size: 12px;
  text-align: left;
  color: #46505a;
  vertical-align: top;
}

#staff-table tbody tr:not(.new-visit-row),
#patient-table tbody tr,
#admin-staff-table tbody tr,
#admin-patient-table tbody tr {
  border-top: 1px solid #d7bccb;
}

#staff-table th:nth-child(6),
#staff-table td:nth-child(6) {
  min-width: 116px;
  width: 116px;
}

.study-pending-name {
  color: var(--danger);
  font-weight: 800;
}

.study-pending-name small {
  display: block;
  margin-top: 3px;
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.author-cell {
  min-width: 88px;
}

th {
  background: #f4e9f0;
  font-weight: 600;
  color: #685b64;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  margin-right: 6px;
}

.table-wrap .action-btn {
  border: none;
  background: #f3eaf0;
  color: #46505a;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 11px;
}

.admin-table-wrap {
  margin-top: 18px;
}

#admin-staff-table th,
#admin-staff-table td,
#admin-patient-table th,
#admin-patient-table td {
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  color: var(--ink-700);
}

.admin-staff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.admin-status.active {
  background: #dcfce7;
  color: #166534;
}

.admin-status.inactive {
  background: #fee2e2;
  color: #991b1b;
}

.admin-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.admin-role-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 10px;
  background: #f3eaf0;
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 800;
}

.admin-staff-card {
  width: min(620px, 92vw);
}

.admin-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--ink-700);
}

.admin-checkbox-row input {
  width: auto;
  margin: 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--panel);
  border-radius: 10px;
  padding: 20px;
  width: 100%;
  max-width: 520px;
}

.new-study-card {
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #d85d97 #f7eef4;
}

.new-study-card::-webkit-scrollbar {
  width: 8px;
}

.new-study-card::-webkit-scrollbar-track {
  background: #f7eef4;
  border-radius: 999px;
}

.new-study-card::-webkit-scrollbar-thumb {
  background: #d85d97;
  border-radius: 999px;
}

.modal-scroll-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-left: 12px;
}

.modal-scroll-controls button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(216, 93, 151, 0.32);
  background: linear-gradient(180deg, #df6aa2, #c44b87);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(196, 75, 135, 0.22);
}

.modal-scroll-controls button:hover {
  transform: translateY(-1px);
}

.register-modal-card {
  position: relative;
  overflow: hidden;
}

.password-change-card {
  width: min(560px, 92vw);
}

#modal-password-change {
  z-index: 1000;
}

.register-success-panel {
  position: absolute;
  inset: 18px;
  z-index: 4;
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(134, 239, 172, 0.32), transparent 40%),
    linear-gradient(145deg, rgba(240, 253, 244, 0.98), rgba(220, 252, 231, 0.96));
  border: 1px solid rgba(34, 197, 94, 0.28);
  box-shadow: 0 20px 45px rgba(21, 128, 61, 0.16);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 10px;
  padding: 28px 24px;
}

.register-success-check {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #22c55e, #16a34a);
  color: #fff;
  font-size: 40px;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(34, 197, 94, 0.28);
}

.register-success-title {
  color: #166534;
  font-size: 24px;
  font-weight: 800;
}

.register-success-copy {
  color: #2f5d3b;
  font-size: 15px;
  line-height: 1.4;
  max-width: 320px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.upload-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.progress {
  margin-top: 16px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.progress-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .nav {
    flex-direction: row;
  }

  .sidebar-footer {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  table {
    min-width: 720px;
  }
}


.modal-card-wide {
  width: min(860px, 92vw);
}

.modal-note {
  color: var(--muted);
  margin: 0 0 18px;
}

.report-textarea {
  min-height: 320px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.2;
}


/* Modal amplio para informe escrito */
.modal-card.modal-card-wide {
  width: min(980px, 92vw);
  max-width: 980px;
  padding: 26px;
}

.modal-card-wide .report-textarea {
  width: 100%;
  min-height: 430px;
  max-height: 62vh;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-sizing: border-box;
  resize: vertical;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.2;
}

.modal-card-wide .modal-actions {
  justify-content: space-between;
  align-items: center;
}

.modal-card-wide .modal-actions .primary {
  flex: 1;
}

.modal-card-wide .modal-actions .secondary {
  min-width: 150px;
}


/* Informe escrito: ajustado a pantalla */
#modal-report .modal-card-wide {
  width: min(1100px, 94vw) !important;
  max-width: 1100px !important;
  max-height: 88vh !important;
  min-height: auto !important;
  overflow-y: auto !important;
  padding: 24px !important;
}

#modal-report .report-textarea {
  display: block !important;
  width: 100% !important;
  min-width: 100% !important;
  height: min(380px, 42vh) !important;
  min-height: 260px !important;
  box-sizing: border-box !important;
  resize: vertical !important;
  padding: 14px !important;
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  font-family: inherit !important;
  font-size: 16px !important;
  line-height: 1.2 !important;
}

#modal-report .modal-actions {
  display: flex !important;
  gap: 16px !important;
}

#modal-report .modal-actions .primary {
  flex: 1 1 auto !important;
}

#modal-report .modal-actions .secondary {
  width: 150px !important;
}


/* Editor de informe tipo Word basico */
#modal-report .report-toolbar {
  display: flex;
  gap: 8px;
  margin: 8px 0 10px;
}

#modal-report .report-tool {
  width: 42px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
}

#modal-report .report-tool:hover {
  filter: brightness(0.97);
}

#modal-report .report-editor {
  overflow: auto;
  white-space: pre-wrap;
  outline: none;
}

#modal-report .report-editor div,
#modal-report .report-editor p {
  margin: 0;
  line-height: 1.2;
}

#modal-report .report-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}


/* Trazabilidad */
.audit-author-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.audit-author-btn:hover {
  text-decoration: underline;
}

.audit-modal-card {
  min-height: auto !important;
}

.audit-list {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow: auto;
  margin-top: 14px;
}

.audit-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
}

.audit-action {
  font-weight: 800;
  margin-bottom: 4px;
}

.audit-meta {
  color: var(--muted);
  font-size: 13px;
}

.audit-detail {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.4;
}


/* Carga de archivos: una sola opcion visible */
.hidden-file-input {
  display: none !important;
}

.upload-row-clean {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.upload-row-clean .secondary {
  min-width: 150px;
  font-weight: 800;
}

.upload-row-clean #dicom-selected {
  flex: 1 1 100%;
  color: var(--muted);
  line-height: 1.35;
}


.file-loaded {
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  padding: 9px 12px;
  margin-right: 6px;
  font-weight: 800;
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

body.is-authenticated .sidebar-footer {
  display: none;
}

body.is-staff #nav-studies {
  display: none;
}

.practices-list {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.practice-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.practice-row input {
  margin: 0;
}

.practice-remove {
  min-width: 44px;
  padding: 10px 12px;
}

.add-practice-btn {
  margin-bottom: 12px;
}

.practice-pill-list {
  display: grid;
  gap: 6px;
}

.practice-pill {
  display: inline-block;
  font-size: 13px;
  line-height: 1.25;
}

#report-practice {
  width: 100%;
  margin-bottom: 10px;
}

.access-actions-stack {
  display: inline-grid;
  gap: 6px;
}

.pdf-actions-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  width: 152px;
}

.report-practice-list {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  width: 128px;
}

.report-practice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 31px;
  margin-right: 0;
  text-align: center;
  white-space: nowrap;
  line-height: 1;
}

.pdf-actions-stack .action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 31px;
  margin-right: 0;
  text-align: center;
  white-space: nowrap;
  line-height: 1;
}

.pdf-download-link {
  font-weight: 700;
}

.pdf-practice-row {
  display: grid;
  grid-template-columns: 1fr 30px;
  gap: 5px;
  align-items: center;
}

.pdf-delete-mini {
  min-width: 30px;
  width: 30px;
  padding: 6px 0 !important;
}

.pdf-upload-practice {
  justify-content: center;
}

.existing-patient-alert {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid #e25c9a;
  border-radius: 12px;
  background: #fff1f8;
  color: #46505a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.existing-patient-alert strong {
  color: #c54f89;
  display: block;
  margin-bottom: 4px;
}

.existing-patient-alert span {
  font-size: 14px;
}

.existing-patient-alert button {
  white-space: nowrap;
}

.practice-table-editor {
  display: grid;
  gap: 6px;
  min-width: 168px;
}

.practice-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: center;
}

.practice-table-select {
  width: 100%;
  border: 1px solid #e6d4de;
  border-radius: 10px;
  background: #fff;
  color: #24364a;
  padding: 6px 8px;
  font-size: 11px;
}

.practice-delete-btn {
  min-width: 34px;
  width: 34px;
  height: 32px;
  padding: 0;
  margin-right: 0;
  font-weight: 700;
}

.practice-add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.practice-add-row .action-btn {
  margin-right: 0;
  white-space: nowrap;
}

.new-visit-row td {
  padding: 0 16px 18px !important;
  background: transparent !important;
  border-top: none !important;
}

.new-visit-wide-btn {
  width: 100%;
  border: 1px dashed #d85b99;
  border-radius: 16px;
  background: #fff7fb;
  color: #c54f89;
  padding: 12px 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.new-visit-wide-btn:hover {
  background: #fdebf5;
}

body.staff-hide-files #staff-table th:nth-child(8),
body.staff-hide-files #staff-table td:nth-child(8) {
  display: none;
}

body.staff-hide-report #staff-table th:nth-child(7),
body.staff-hide-report #staff-table td:nth-child(7) {
  display: none;
}

.modal-card-colpo {
  width: min(1180px, 96vw);
  max-width: 1180px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
}

.colpo-group-grid {
  display: contents;
}

.colpo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.colpo-section {
  border: 1px solid #dec8d3;
  border-radius: 16px;
  background: #fcfafc;
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.colpo-section-wide {
  grid-column: span 3;
}

.colpo-section h4 {
  margin: 0;
  text-align: center;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #46505a;
}

.colpo-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.colpo-chip {
  border-radius: 999px;
  padding: 7px 11px;
  border: 1px solid #dfd0d8;
  background: #ffffff;
  color: #46505a;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.25;
}

.colpo-chip.active {
  background: #efe4eb;
  border-color: #d27aa6;
  color: #24364a;
  font-weight: 700;
}

.colpo-section textarea,
.colpo-text-grid input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #dcc9d4;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: #24364a;
  background: #fff;
}

.colpo-text-grid {
  display: grid;
  gap: 10px;
}

.colpo-text-grid label {
  display: grid;
  gap: 6px;
  color: #46505a;
  font-size: 13px;
}

.colpo-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

#colpo-images-status {
  color: #5c6470;
}

@media (max-width: 1120px) {
  .colpo-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .colpo-section-wide {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .modal {
    align-items: center;
    padding: 10px;
  }

  .new-study-card {
    max-height: calc(100vh - 94px);
  }

  .modal-scroll-controls {
    position: fixed;
    right: 14px;
    bottom: 14px;
    flex-direction: row;
    margin-left: 0;
    z-index: 5;
  }

  .modal-scroll-controls button {
    width: 42px;
    height: 42px;
  }

  .modal-card-colpo {
    width: min(96vw, 96vw);
    padding: 18px;
  }

  .colpo-grid {
    grid-template-columns: 1fr;
  }

  .colpo-section-wide {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  body.is-login .main {
    min-height: 100dvh;
  }

  .login-view {
    min-height: 100dvh;
    justify-content: flex-start;
    padding: 18px 12px 22px;
  }

  .login-card {
    width: min(100%, 430px);
    max-width: 100%;
    padding: 20px 18px 18px;
    border-radius: 14px;
  }

  .login-logo {
    height: 92px;
    margin-bottom: 12px;
  }

  .login-logo img {
    transform: translateX(-10px) scale(1.92);
  }

  .login-card h1 {
    font-size: 25px;
    margin-bottom: 14px;
  }

  .login-copy {
    margin-bottom: 14px;
  }

  input[type="text"],
  input[type="password"] {
    font-size: 16px;
    min-height: 42px;
  }

  .password-wrap {
    gap: 8px;
  }

  .show-pass-btn {
    width: 56px;
    flex-basis: 56px;
  }

  body:not(.is-login) .app {
    grid-template-columns: 1fr;
  }

  body:not(.is-login) .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 8px 12px;
    gap: 8px;
    border-right: 0;
    border-bottom: 1px solid #eadde5;
  }

  body:not(.is-login) .logo {
    display: none;
  }

  body:not(.is-login) .nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 6px;
  }

  body:not(.is-login) .nav-item {
    min-height: 40px;
    padding: 9px 10px;
    text-align: center;
    font-size: 13px;
  }

  .main {
    padding: 14px 10px 18px;
  }

  .topbar h2 {
    font-size: 22px;
    line-height: 1.12;
    margin: 0;
  }

  #view-patient .table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  #patient-table {
    min-width: 0;
    display: block;
  }

  #patient-table thead {
    display: none;
  }

  #patient-table tbody {
    display: grid;
    gap: 12px;
  }

  #patient-table tr {
    display: block;
    padding: 14px;
    border: 1px solid #d7bccb;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 28px rgba(70, 80, 90, 0.08);
  }

  #patient-table td {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 10px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid #f0e2ea;
    font-size: 14px;
  }

  #patient-table td:last-child {
    border-bottom: 0;
  }

  #patient-table td::before {
    color: #8b7280;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
  }

  #patient-table td:nth-child(1)::before { content: "PACIENTE"; }
  #patient-table td:nth-child(2)::before { content: "DNI"; }
  #patient-table td:nth-child(3)::before { content: "FECHA"; }
  #patient-table td:nth-child(4)::before { content: "ESTUDIO"; }
  #patient-table td:nth-child(5)::before { content: "PDF"; }
  #patient-table td:nth-child(6)::before { content: "ACCESO"; }
  #patient-table td:nth-child(7)::before { content: "ACCIONES"; }

  #patient-table .action-btn,
  #patient-table button,
  #patient-table a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 6px 6px 0;
  }

  .modal {
    align-items: stretch;
    padding: 8px;
  }

  .modal-card,
  .modal-card.modal-card-wide,
  #modal-report .modal-card-wide,
  .register-modal-card,
  .new-study-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 16px) !important;
    overflow-y: auto !important;
    padding: 18px !important;
    border-radius: 14px !important;
  }

  .modal-actions,
  #modal-report .modal-actions {
    flex-direction: column;
    gap: 10px !important;
  }

  .modal-actions .primary,
  .modal-actions .secondary,
  #modal-report .modal-actions .primary,
  #modal-report .modal-actions .secondary {
    width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 420px) {
  .main {
    padding-inline: 8px;
  }

  #patient-table td {
    grid-template-columns: 88px 1fr;
    gap: 8px;
    font-size: 13px;
  }

  .login-card {
    padding-inline: 16px;
  }
}





