:root {
  --primary: #ef3737;
  --primary-dark: #e9161c;
  --text: #10243f;
  --muted: #5b6f91;
  --border: #d1d9e6;
  --soft-red: #fff0f0;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: #f3f6fb;
}

.app-shell {
  position: relative;
  width: min(1024px, 100vw);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background: var(--white);
  border-radius: 0 0 18px 18px;
}

.brand-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #edf0f5;
  overflow: hidden;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 34px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  margin-top: 10px;
}

.login-card h2 {
  margin: 0 0 14px;
  font-size: 38px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -1px;
}

.subtitle {
  margin: 0 0 14px;
  font-size: 20px;
  color: var(--muted);
}

label {
  display: block;
  margin: 12px 0 10px;
  font-weight: 700;
}

.input-wrapper {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  background: #fff;
}

.input-wrapper.active,
.input-wrapper:focus-within {
  border-color: var(--primary);
}

.input-icon {
  width: 20px;
  color: #6d7d96;
  font-size: 14px;
}

input {
  flex: 1;
  height: 100%;
  border: 0;
  outline: none;
  font-size: 16px;
  color: var(--text);
  background: transparent;
}

input::placeholder { color: #6c7890; }

.eye-button {
  border: 0;
  background: transparent;
  color: #0e2948;
  cursor: pointer;
  font-size: 15px;
}

.forgot-link {
  display: inline-block;
  margin: 14px 0 26px;
  color: var(--primary);
  font-size: 14px;
}

.primary-button,
.secondary-button {
  width: 89%;
  height: 39px;
  margin-left: 24px;
  border-radius: 9px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--primary);
  color: #fff;
  background: var(--primary);
}

.secondary-button {
  margin-top: 15px;
  border: 1px solid var(--primary);
  color: var(--primary);
  background: #fff;
}

.logo-card {
  position: relative;
  z-index: 2;
  width: 300px;
  height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.86);
  box-shadow: 0 18px 50px rgba(17, 24, 39, .06);
}

.medical-icon {
  position: relative;
  width: 190px;
  height: 190px;
  border: 7px solid var(--primary-dark);
  border-radius: 50%;
  margin-bottom: 18px;
}

.cross {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 4px solid var(--primary-dark);
  border-radius: 7px;
  background: #fff;
}

.cross.horizontal { width: 104px; height: 26px; }
.cross.vertical { width: 26px; height: 104px; }

.logo-text {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 9px;
  color: #33343a;
}

.logo-text span { color: var(--primary-dark); }

.bg-circle,
.bg-plus {
  position: absolute;
  color: rgba(239, 55, 55, .10);
  background: rgba(239, 55, 55, .07);
}

.bg-circle { border-radius: 50%; }
.bg-circle-one { width: 150px; height: 150px; left: 40px; top: 82px; }
.bg-circle-two { width: 74px; height: 74px; right: 45px; top: 97px; }
.bg-circle-three { width: 150px; height: 150px; right: 40px; bottom: 60px; }

.bg-plus {
  background: transparent;
  font-size: 78px;
  font-weight: 100;
}
.bg-plus-one { left: 92px; bottom: 96px; }
.bg-plus-two { right: 120px; top: 168px; font-size: 60px; }

footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  text-align: center;
  color: #7a8799;
  font-size: 13px;
}

.menu-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.menu-card {
  width: min(420px, 90vw);
  padding: 36px;
  border: 1px solid #edf0f5;
  border-radius: 18px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(17, 24, 39, .08);
}

.menu-card h1 { margin-top: 0; color: var(--primary); }
.menu-link { color: var(--primary); font-weight: 700; }

@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: 46vh; border-right: 0; border-bottom: 1px solid #edf0f5; }
  .login-panel { align-items: flex-start; padding-bottom: 70px; }
  .login-card h2 { font-size: 32px; }
  .logo-card { width: 260px; height: 260px; }
  .medical-icon { width: 165px; height: 165px; }
}


/* Dashboard / Menu */
.dashboard-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 258px 1fr;
  background: #f6f7fb;
  color: var(--text);
}

.sidebar {
  min-height: 100vh;
  padding: 28px 14px 74px;
  background: #fff;
  border-right: 1px solid #e8edf4;
  box-shadow: 8px 0 28px rgba(16, 36, 63, .05);
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  margin-bottom: 28px;
  color: var(--text);
}

.small-medical-icon {
  position: relative;
  width: 70px;
  height: 70px;
  border: 3px solid var(--primary-dark);
  border-radius: 50%;
}

.small-medical-icon::before,
.small-medical-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--primary-dark);
  border-radius: 4px;
  background: white;
}

.small-medical-icon::before { width: 40px; height: 12px; }
.small-medical-icon::after { width: 12px; height: 40px; }
.sidebar-logo p {
  margin: 9px 0 0;
  font-size: 9px;
  letter-spacing: 4px;
  font-weight: 700;
}
.sidebar-logo span { color: var(--primary-dark); }

.sidebar-nav { flex: 1; }
.nav-item {
  position: relative;
  height: 41px;
  padding: 0 18px 0 26px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  border-left: 4px solid transparent;
}
.nav-item:hover,
.nav-item.active {
  background: #fde8e8;
  border-left-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 700;
}
.nav-icon {
  width: 18px;
  display: inline-flex;
  justify-content: center;
  font-size: 17px;
}
.nav-section {
  margin: 18px 6px 8px;
  padding-top: 14px;
  border-top: 1px solid #dfe5ee;
  color: #50617e;
  font-size: 12px;
  font-weight: 800;
}
.logout-button {
  height: 42px;
  margin: 0 6px;
  padding: 0 25px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--primary-dark);
  background: #fde8e8;
  font-weight: 800;
  font-size: 14px;
}

.dashboard-main {
  padding: 32px 18px 70px 12px;
}
.topbar {
  min-height: 84px;
  padding: 0 30px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-radius: 12px;
}
.topbar h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.7px;
}
.user-menu {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  cursor: pointer;
}
.status-dot {
  width: 22px;
  height: 22px;
  border: 3px solid var(--primary);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px #fff;
  background: var(--primary);
}
.user-menu small { display: block; color: #7a8799; font-size: 14px; text-align: left; }
.user-menu strong { display: block; font-size: 18px; }
.chevron { font-size: 22px; margin-left: 34px; }

.welcome-card {
  min-height: 280px;
  padding: 84px 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-radius: 12px;
}
.welcome-left {
  display: flex;
  align-items: center;
  gap: 30px;
}
.plus-tile {
  width: 98px;
  height: 98px;
  display: grid;
  place-items: center;
  background: #fff2f2;
  color: var(--primary);
  font-size: 74px;
  font-weight: 300;
  line-height: 1;
}
.welcome-card h2 {
  margin: 0 0 9px;
  color: #06162a;
  font-size: 29px;
}
.welcome-card p {
  margin: 8px 0;
  font-size: 20px;
}
.welcome-card .lead { font-size: 24px; }
.medical-symbol {
  margin-right: 78px;
  color: var(--primary);
  font-size: 138px;
  line-height: 1;
}
.page-placeholder .plus-tile { font-size: 44px; font-weight: 700; }
.dashboard-footer {
  position: fixed;
  left: 258px;
  right: 0;
  bottom: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #dfe5ee;
  background: #fff;
}

@media (max-width: 900px) {
  .dashboard-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; padding-bottom: 14px; }
  .dashboard-main { padding: 16px 12px 70px; }
  .topbar { align-items: flex-start; gap: 16px; flex-direction: column; padding: 22px; }
  .welcome-card { flex-direction: column; align-items: flex-start; padding: 34px 22px; }
  .welcome-left { flex-direction: column; align-items: flex-start; }
  .medical-symbol { margin: 10px 0 0; font-size: 90px; }
  .dashboard-footer { left: 0; }
}

/* Profile Page */
.profile-layout {
  grid-template-columns: 200px 1fr;
  background: #f7f9fc;
}
.profile-sidebar { padding: 16px 14px 70px; }
.profile-sidebar .small-medical-icon { width: 78px; height: 78px; }
.profile-sidebar .sidebar-logo { margin-bottom: 18px; }
.profile-sidebar .nav-item { height: 36px; font-size: 12px; padding-left: 18px; gap: 12px; }
.profile-sidebar .nav-section { font-size: 11px; margin-top: 12px; padding-top: 12px; }
.profile-sidebar .logout-button { position: absolute; left: 20px; right: 20px; bottom: 22px; height: 38px; font-size: 12px; }

.profile-main { min-height: 100vh; padding: 14px 14px 66px; }
.profile-header { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; }
.back-button { width: 42px; height: 42px; border-radius: 8px; background: #fff; box-shadow: 0 4px 18px rgba(16,36,63,.08); color: var(--text); display: grid; place-items: center; font-size: 28px; text-decoration: none; }
.profile-title { flex: 1; }
.profile-title h1 { margin: 0 0 4px; font-size: 22px; }
.profile-title p { margin: 0; color: #72809a; font-size: 12px; }
.profile-user-chip { border: 0; background: transparent; display: flex; align-items: center; gap: 10px; color: var(--text); cursor: pointer; }
.profile-user-chip small { display: block; color: #687792; text-align: left; }
.profile-user-chip strong { display: block; }
.avatar-mini { width: 44px; height: 44px; border-radius: 50%; background: #ffe9e9; color: var(--primary-dark); display: grid; place-items: center; font-size: 28px; }

.profile-grid { display: grid; grid-template-columns: 188px 1fr; gap: 12px; }
.profile-card, .form-card { background: #fff; border: 1px solid #e9eef6; border-radius: 8px; box-shadow: 0 5px 18px rgba(16,36,63,.04); }
.identity-card { min-height: 557px; padding: 22px 14px; text-align: center; }
.avatar-large { position: relative; width: 90px; height: 90px; margin: 0 auto 10px; border-radius: 50%; background: #fde9e9; overflow: visible; }
.avatar-large .head { position: absolute; top: 20px; left: 33px; width: 25px; height: 25px; background: var(--primary-dark); border-radius: 50%; }
.avatar-large .body { position: absolute; top: 54px; left: 19px; width: 52px; height: 32px; background: var(--primary-dark); border-radius: 36px 36px 0 0; }
.camera-button { position: absolute; right: -5px; bottom: 2px; width: 27px; height: 22px; border: 1px solid #dfe5ee; border-radius: 7px; background: #fff; }
.identity-card h2 { margin: 0; font-size: 15px; }
.role-red { margin: 5px 0 22px; color: var(--primary-dark); font-weight: 700; font-size: 12px; }
.identity-list { text-align: left; }
.identity-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 8px; border-bottom: 1px solid #edf1f6; }
.identity-item.selected { background: #f1f3f7; }
.identity-item span { font-size: 17px; color: var(--text); }
.identity-item small { display: block; color: #7e8aa0; font-size: 10px; }
.identity-item strong { display: block; font-size: 11px; font-weight: 600; }
.badge-ok, .verified { display: inline-block; padding: 2px 7px; border-radius: 5px; background: #dff8e8; color: #1c9a4a; font-size: 10px; font-style: normal; }

.profile-form { display: grid; gap: 12px; }
.form-card { padding: 14px 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-header h3 { margin: 0; font-size: 12px; }
.card-header h3 span { color: var(--primary-dark); font-size: 18px; margin-right: 8px; }
.outline-red { height: 28px; padding: 0 14px; border: 1px solid var(--primary); border-radius: 5px; color: var(--primary-dark); background: #fff; font-weight: 700; }
.form-grid { display: grid; gap: 12px 16px; margin-bottom: 11px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.email-phone { grid-template-columns: 1.5fr 1fr 90px 36px; align-items: end; }
.address-row { grid-template-columns: 1.6fr 1fr; }
.profile-form label, .notes-label { margin: 0; font-size: 10px; font-weight: 800; color: #14233c; }
.profile-form input, .profile-form select, .profile-form textarea { width: 100%; height: 28px; margin-top: 7px; padding: 0 11px; border: 1px solid #d4dce9; border-radius: 5px; background: #fff; color: #233956; font-size: 11px; outline: none; }
.profile-form input.disabled { background: #f0f2f6; color: #7b8799; }
.phone-button { height: 28px; border: 1px solid #d4dce9; border-radius: 5px; background: #fff; }
.lower-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 12px; }
.card-header.compact { padding-bottom: 10px; border-bottom: 1px solid #e7edf5; }
.small-outline { height: 28px; padding: 0 12px; border: 1px solid #cfd8e6; border-radius: 4px; background: #fff; color: #394b65; font-size: 10px; }
.info-row, .detail-row { min-height: 29px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #edf1f6; font-size: 11px; }
.info-row span, .detail-row span { min-width: 145px; color: #55657d; }
.info-row strong, .detail-row strong { font-weight: 500; }
.info-row.split { justify-content: space-between; }
.info-row.split button { width: 70px; height: 28px; border: 1px solid #d4dce9; border-radius: 5px; background: #fff; color: #233956; }
.notes-label { display: grid; grid-template-columns: 110px 1fr; align-items: start; margin-top: 7px; color: #55657d; }
.profile-form textarea { height: 56px; resize: none; padding-top: 9px; margin-top: 0; background: #f4f6fa; }
.profile-actions { position: fixed; left: 200px; right: 0; bottom: 0; height: 54px; padding: 9px 14px; display: flex; justify-content: flex-end; gap: 28px; background: #fff; border-top: 1px solid #e1e6ef; }
.save-profile, .cancel-profile { width: 152px; height: 36px; border-radius: 5px; font-weight: 800; cursor: pointer; }
.save-profile { border: 1px solid var(--primary-dark); background: var(--primary-dark); color: #fff; }
.cancel-profile { border: 1px solid var(--primary); background: #fff; color: var(--primary-dark); }

@media (max-width: 1050px) {
  .profile-grid, .lower-grid { grid-template-columns: 1fr; }
  .identity-card { min-height: auto; }
  .form-grid.three, .email-phone, .address-row { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-actions { left: 0; }
  .profile-header { flex-wrap: wrap; }
}

/* Reporte de Estudios */
.report-layout { grid-template-columns: 200px 1fr; background: #f7f9fc; }
.report-main { padding: 16px 14px 64px; }
.report-header { margin-bottom: 18px; }
.report-card { background: #fff; border: 1px solid #e8eef7; border-radius: 8px; box-shadow: 0 5px 18px rgba(16,36,63,.04); }
.search-panel { padding: 18px 20px; margin-bottom: 18px; }
.report-card-title { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; color: #14233c; font-size: 12px; font-weight: 800; }
.report-card-title span { color: var(--primary-dark); font-size: 17px; }
.report-filters { display: grid; grid-template-columns: 125px 200px 95px 95px 150px 58px 66px; gap: 22px; align-items: end; }
.report-filters label { margin: 0; font-size: 10px; font-weight: 800; color: #14233c; }
.report-filters input, .report-filters select { width: 100%; height: 30px; margin-top: 9px; padding: 0 12px; border: 1px solid #d5dde9; border-radius: 4px; outline: none; color: #223756; background: #fff; font-size: 11px; }
.report-filters input::placeholder { color: #7b8799; font-size: 11px; }
.search-red, .clean-white { height: 51px; border-radius: 4px; font-weight: 800; font-size: 10px; cursor: pointer; }
.search-red { border: 1px solid var(--primary-dark); background: linear-gradient(180deg, #ef3737, #df1018); color: #fff; }
.clean-white { border: 1px solid #d5dde9; background: #fff; color: #14233c; }
.search-red span, .clean-white span { display: block; font-size: 24px; line-height: 20px; margin-bottom: 4px; }
.results-panel { padding: 16px 14px 10px; }
.results-top { display: flex; align-items: center; justify-content: space-between; }
.results-top p { margin: 0 5px 12px 0; font-size: 12px; color: #34455f; }
.results-top strong { color: var(--primary-dark); }
.table-wrapper { overflow-x: auto; border: 1px solid #dfe6f1; }
.reports-table { width: 100%; border-collapse: collapse; min-width: 900px; font-size: 10px; }
.reports-table th, .reports-table td { height: 35px; padding: 6px 8px; border-right: 1px solid #dfe6f1; border-bottom: 1px solid #dfe6f1; text-align: left; white-space: nowrap; }
.reports-table th { background: #fbfcfe; color: #14233c; font-weight: 800; text-align: center; }
.reports-table td:first-child, .reports-table th:first-child { text-align: center; width: 34px; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; height: 18px; border-radius: 4px; font-size: 9px; font-weight: 700; }
.status-pill.done { background: #dff8e8; color: #1c9a4a; }
.status-pill.pending { background: #fff0c8; color: #d78900; }
.actions-cell { display: flex; gap: 10px; align-items: center; justify-content: center; }
.actions-cell button { border: 0; background: transparent; font-weight: 800; cursor: pointer; font-size: 17px; line-height: .9; }
.actions-cell small { display: block; font-size: 8px; margin-top: 2px; }
.pdf-action { color: var(--primary-dark); }
.excel-action { color: #10a653; }
.table-footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding-top: 12px; }
.table-footer p { margin: 0; font-size: 11px; color: #273a57; }
.pagination { display: flex; gap: 7px; }
.pagination button { min-width: 27px; height: 25px; border: 1px solid #d9e1ed; border-radius: 5px; background: #fff; color: #14233c; font-weight: 700; cursor: pointer; }
.pagination button.active { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.records-select { justify-self: end; margin: 0; display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 500; color: #273a57; }
.records-select select { width: 50px; height: 28px; border: 1px solid #d9e1ed; border-radius: 5px; }
.report-info { margin-top: 12px; padding: 10px 15px; border-radius: 6px; background: #fde8e8; color: #2b3d58; font-size: 11px; }
.report-info span { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; margin-right: 10px; border-radius: 50%; background: var(--primary-dark); color: #fff; font-weight: 800; }
.profile-user-chip .avatar-mini::before { content: ""; width: 13px; height: 13px; border-radius: 50%; background: var(--primary-dark); display: block; margin: 8px auto 0; }
.profile-user-chip .avatar-mini::after { content: ""; width: 26px; height: 13px; border-radius: 18px 18px 0 0; background: var(--primary-dark); display: block; margin: 2px auto 0; }

@media (max-width: 1150px) {
  .report-filters { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .search-red, .clean-white { height: 42px; }
  .table-footer { grid-template-columns: 1fr; justify-items: center; }
  .records-select { justify-self: center; }
}
@media (max-width: 760px) {
  .report-layout { grid-template-columns: 1fr; }
  .report-filters { grid-template-columns: 1fr; gap: 12px; }
}

/* Sidebar consistency fix: same width, same items and same logout size on every page */
:root { --sidebar-width: 280px; }
.dashboard-shell,
.profile-layout,
.report-layout {
  grid-template-columns: var(--sidebar-width) 1fr !important;
}
.sidebar,
.profile-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  padding: 16px 14px 70px !important;
  position: relative;
}
.sidebar .small-medical-icon,
.profile-sidebar .small-medical-icon {
  width: 78px;
  height: 78px;
}
.sidebar-logo,
.profile-sidebar .sidebar-logo {
  margin-bottom: 18px;
}
.nav-item,
.profile-sidebar .nav-item {
  height: 36px !important;
  font-size: 12px !important;
  padding-left: 18px !important;
  gap: 12px !important;
}
.nav-section,
.profile-sidebar .nav-section {
  font-size: 11px !important;
  margin-top: 12px !important;
  padding-top: 12px !important;
}
.logout-button,
.profile-sidebar .logout-button {
  position: absolute !important;
  left: 20px !important;
  right: 20px !important;
  bottom: 22px !important;
  width: auto !important;
  height: 38px !important;
  margin: 0 !important;
  padding: 0 16px !important;
  font-size: 12px !important;
}
.dashboard-footer,
.profile-actions {
  left: var(--sidebar-width) !important;
}
@media (max-width: 760px) {
  .dashboard-shell,
  .profile-layout,
  .report-layout { grid-template-columns: 1fr !important; }
  .sidebar,
  .profile-sidebar { width: 100%; min-width: 0; min-height: auto; }
  .dashboard-footer,
  .profile-actions { left: 0 !important; }
}


/* Patient Search Page */
.patient-main { padding: 16px 18px 70px; }
.patient-header { margin-bottom: 18px; }
.patient-search-panel { padding: 18px 20px; margin-bottom: 18px; }
.patient-card-title { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; color: #14233c; font-size: 12px; font-weight: 800; }
.patient-card-title span { color: var(--primary-dark); font-size: 18px; }
.patient-filters { display: grid; grid-template-columns: 150px 230px 90px 90px 140px 145px 58px 66px; gap: 18px; align-items: end; }
.patient-filters label { margin: 0; font-size: 10px; font-weight: 800; color: #14233c; }
.patient-filters input, .patient-filters select { width: 100%; height: 31px; margin-top: 9px; padding: 0 12px; border: 1px solid #d5dde9; border-radius: 5px; outline: none; color: #223756; background: #fff; font-size: 11px; }
.patient-filters input::placeholder { color: #7b8799; font-size: 11px; }
.patient-results-panel { padding: 16px 14px 10px; }
.patients-table { width: 100%; border-collapse: collapse; min-width: 980px; font-size: 11px; }
.patients-table th, .patients-table td { height: 42px; padding: 8px 10px; border-right: 1px solid #dfe6f1; border-bottom: 1px solid #dfe6f1; text-align: left; white-space: nowrap; }
.patients-table th { background: #fbfcfe; color: #14233c; font-weight: 800; text-align: left; }
.patients-table td:first-child, .patients-table th:first-child { text-align: center; width: 54px; }
.gender-icon { display: inline-flex; width: 20px; justify-content: center; margin-right: 8px; font-size: 18px; font-weight: 800; }
.gender-icon.male { color: #1f7cff; }
.gender-icon.female { color: #ff2b69; }
.patient-actions { display: flex; gap: 12px; align-items: center; justify-content: center; }
.icon-button { width: 38px; height: 28px; border: 1px solid #d9e1ed; border-radius: 5px; background: #fff; color: #14233c; cursor: pointer; font-size: 16px; }
.patient-info { margin-top: 12px; padding: 12px 15px; border-radius: 6px; background: #fde8e8; color: #2b3d58; font-size: 11px; }
.patient-info span { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; margin-right: 10px; border-radius: 50%; border: 1px solid #7b8799; color: #14233c; font-weight: 800; }

/* Sidebar final consistency */
.sidebar-nav { overflow: hidden; }
.nav-item span:last-child { white-space: normal; line-height: 1.15; }
.report-layout .reports-table { min-width: 980px; }
.report-layout .report-filters { grid-template-columns: 135px 220px 100px 100px 155px 58px 66px; gap: 20px; }
@media (max-width: 1350px) {
  .patient-filters { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .report-layout .report-filters { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
}
@media (max-width: 900px) {
  .patient-filters { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}
@media (max-width: 760px) {
  .patient-filters { grid-template-columns: 1fr; }
}

/* Wider shared sidebar for all pages */
:root { --sidebar-width: 280px; }

/* Agregar Estudio */
.study-add-layout { background: #f7f9fc; }
.study-add-main { min-height: 100vh; padding: 16px 16px 74px; }
.study-add-header { margin-bottom: 14px; }
.study-card {
  background: #fff;
  border: 1px solid #e5ecf6;
  border-radius: 8px;
  box-shadow: 0 5px 18px rgba(16,36,63,.04);
}
.study-card h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  color: #14233c;
  font-size: 12px;
  font-weight: 800;
}
.study-card h2 span { color: var(--primary-dark); font-size: 18px; }
.study-search-card { padding: 16px 20px; margin-bottom: 12px; }
.study-search-form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(190px, 1fr) minmax(190px, 1fr) 76px;
  gap: 24px;
  align-items: end;
}
.study-search-form label,
.study-add-form label {
  margin: 0;
  color: #14233c;
  font-size: 10px;
  font-weight: 800;
}
.study-search-form input,
.study-add-form input,
.study-add-form select,
.study-add-form textarea {
  width: 100%;
  height: 31px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid #d4dce9;
  border-radius: 5px;
  background: #fff;
  color: #233956;
  font-size: 11px;
  outline: none;
}
.study-search-form input::placeholder,
.study-add-form input::placeholder,
.study-add-form textarea::placeholder { color: #7b8799; }
.study-search-button { height: 50px; }
.selected-patient-card { padding: 16px 20px; margin-bottom: 12px; }
.selected-patient-content {
  display: grid;
  grid-template-columns: 76px 1fr 1.35fr 1.6fr;
  gap: 18px;
  align-items: center;
}
.study-avatar {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fde9e9;
}
.study-avatar::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 23px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-dark);
}
.study-avatar::after {
  content: "";
  position: absolute;
  top: 39px;
  left: 13px;
  width: 38px;
  height: 22px;
  border-radius: 28px 28px 0 0;
  background: var(--primary-dark);
}
.selected-name-block h3 { margin: 0 0 7px; font-size: 16px; }
.selected-name-block p,
.selected-info-grid p { margin: 7px 0; color: #223756; font-size: 11px; }
.selected-name-block span,
.selected-info-grid span { display: inline-block; width: 22px; color: var(--text); font-weight: 800; }
.study-add-form {
  display: grid;
  grid-template-columns: 1.05fr .78fr .92fr;
  gap: 12px;
}
.study-info-card,
.study-type-card,
.study-notes-card,
.study-history-card { padding: 16px 20px; }
.study-form-grid { display: grid; gap: 12px 18px; }
.study-form-grid.two-cols { grid-template-columns: 1fr 1fr; }
.study-add-form b { color: var(--primary-dark); }
.study-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.study-type-option {
  height: 48px;
  border: 1px solid #d4dce9;
  border-radius: 5px;
  background: #fff;
  color: #14233c;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.study-type-option.active,
.study-type-option:hover { border-color: var(--primary); background: #fff6f6; color: var(--primary-dark); }
.study-type-option span { min-width: 24px; color: var(--primary-dark); font-size: 22px; }
.other-study-label { display: block; margin-top: 12px !important; }
.study-notes-card { display: grid; gap: 17px; }
.study-notes-card label { font-size: 12px; }
.study-notes-card label::first-letter { color: var(--primary-dark); }
.study-add-form textarea { height: 84px; resize: none; padding-top: 10px; }
.study-history-card { grid-column: 1 / -1; }
.study-history-table { width: 100%; border-collapse: collapse; min-width: 900px; font-size: 11px; }
.study-history-table th,
.study-history-table td { height: 34px; padding: 7px 10px; border-right: 1px solid #dfe6f1; border-bottom: 1px solid #dfe6f1; text-align: left; white-space: nowrap; }
.study-history-table th { background: #fbfcfe; color: #14233c; font-weight: 800; }
.study-history-table td:last-child { display: flex; justify-content: center; gap: 10px; align-items: center; }
.study-history-summary { margin: 10px 0 0; color: #273a57; font-size: 11px; }
.study-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  padding-top: 4px;
}
.clean-study {
  width: 152px;
  height: 38px;
  border: 1px solid #d4dce9;
  border-radius: 5px;
  background: #fff;
  color: #14233c;
  font-weight: 800;
  cursor: pointer;
}
.study-actions button span { margin-right: 8px; }
@media (max-width: 1300px) {
  .study-search-form { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
  .study-add-form { grid-template-columns: 1fr; }
  .selected-patient-content { grid-template-columns: 70px 1fr; }
}
@media (max-width: 760px) {
  .study-search-form,
  .study-form-grid.two-cols { grid-template-columns: 1fr; }
  .study-actions { flex-direction: column; }
  .save-profile,
  .cancel-profile,
  .clean-study { width: 100%; }
}

/* Sidebar SVG icons */
.nav-icon svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.logout-button .nav-icon svg { width: 16px; height: 16px; }


/* Final shared sidebar: identical on every page and works with wider report pages */
:root { --sidebar-width: 280px; }
.dashboard-shell,
.profile-layout,
.report-layout,
.study-add-layout {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) !important;
}
.sidebar,
.profile-sidebar {
  width: var(--sidebar-width) !important;
  min-width: var(--sidebar-width) !important;
  max-width: var(--sidebar-width) !important;
}
.dashboard-main,
.profile-main,
.report-main,
.patient-main,
.study-add-main {
  min-width: 0;
}
.dashboard-footer,
.profile-actions {
  left: var(--sidebar-width) !important;
}
.logout-button,
.profile-sidebar .logout-button {
  height: 46px !important;
  border-radius: 10px !important;
}
@media (max-width: 760px) {
  .dashboard-shell,
  .profile-layout,
  .report-layout,
  .study-add-layout { grid-template-columns: 1fr !important; }
  .sidebar,
  .profile-sidebar { width: 100% !important; min-width: 0 !important; max-width: none !important; }
  .dashboard-footer,
  .profile-actions { left: 0 !important; }
}

/* Agregar Reumatología */
.rheuma-main {
  min-height: 100vh;
  padding: 16px 16px 74px;
  background: #f7f9fc;
}
.rheuma-form {
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  gap: 12px;
}
.rheuma-card {
  background: #fff;
  border: 1px solid #e5ecf6;
  border-radius: 8px;
  box-shadow: 0 5px 18px rgba(16,36,63,.04);
  padding: 16px 18px;
}
.rheuma-card h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  color: #14233c;
  font-size: 12px;
  font-weight: 800;
}
.rheuma-card h2 span {
  color: var(--primary-dark);
  font-size: 19px;
}
.rheuma-grid {
  display: grid;
  gap: 12px 14px;
}
.rheuma-card label,
.rheuma-card legend {
  margin: 0;
  color: #14233c;
  font-size: 10px;
  font-weight: 800;
}
.rheuma-card input[type="text"],
.rheuma-card input[type="number"],
.rheuma-card input[type="date"],
.rheuma-card textarea {
  width: 100%;
  height: 31px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid #d4dce9;
  border-radius: 5px;
  background: #fff;
  color: #233956;
  font-size: 11px;
  outline: none;
}
.rheuma-card input::placeholder,
.rheuma-card textarea::placeholder { color: #7b8799; }
.general-grid { grid-template-columns: 1.4fr 1fr .7fr .8fr; align-items: start; }
.radio-field {
  display: grid;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
}
.radio-field label,
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 11px;
}
.rheuma-card input[type="checkbox"],
.rheuma-card input[type="radio"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary-dark);
}
.checkbox-grid {
  display: grid;
  gap: 12px 18px;
}
.dx-grid { grid-template-columns: repeat(6, minmax(56px, 1fr)); align-items: center; }
.dx-grid .wide-input { grid-column: span 5; margin-top: 0; }
.treatment-grid { grid-template-columns: repeat(4, 1fr); }
.treatment-grid .wide-label { grid-column: span 3; }
.labs-grid { grid-template-columns: repeat(6, 1fr); }
.urine-grid { grid-template-columns: repeat(3, 1fr); }
.urine-grid .wide-label { grid-column: 1 / -1; }
.immuno-grid { grid-template-columns: repeat(2, 1fr); }
.physical-grid { grid-template-columns: repeat(4, 1fr); }
.rheuma-physical,
.rheuma-comments { grid-column: span 1; }
.rheuma-studies { grid-column: span 1; }
.studies-checks { grid-template-columns: repeat(3, 1fr); align-items: center; }
.studies-checks input[type="text"] { grid-column: span 2; margin-top: 0; }
.rheuma-comments textarea {
  height: 86px;
  padding-top: 11px;
  resize: none;
}
.rheuma-actions { grid-column: 1 / -1; }
.clean-study { min-width: 152px; width: auto; padding: 0 24px; }
@media (max-width: 1280px) {
  .rheuma-form { grid-template-columns: 1fr; }
  .general-grid, .treatment-grid, .labs-grid, .physical-grid { grid-template-columns: repeat(2, 1fr); }
  .dx-grid { grid-template-columns: repeat(3, 1fr); }
  .dx-grid .wide-input { grid-column: span 2; }
}
@media (max-width: 760px) {
  .general-grid, .treatment-grid, .labs-grid, .urine-grid, .immuno-grid, .physical-grid, .dx-grid, .studies-checks { grid-template-columns: 1fr; }
  .dx-grid .wide-input, .studies-checks input[type="text"], .treatment-grid .wide-label { grid-column: auto; }
}

/* Dashboard page */
.dashboard-page-layout { background: #f7f9fc; }
.dashboard-stats-main {
  min-width: 0;
  padding: 24px 16px 70px;
  background: #f7f9fc;
}
.dashboard-stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.dashboard-stats-header h1 {
  margin: 0 0 5px;
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.4px;
}
.dashboard-stats-header p {
  margin: 0;
  color: #5d6b84;
  font-size: 13px;
}
.dashboard-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tool-button {
  height: 38px;
  padding: 0 14px;
  border: 1px solid #d7deea;
  border-radius: 7px;
  background: #fff;
  color: #172943;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.tool-button span { margin-right: 9px; color: var(--text); }
.tool-button b { margin-left: 10px; }
.stats-section-header {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 16px;
  margin-bottom: 10px;
}
.stats-section-header h2,
.charts-title h2,
.dashboard-table-card h2 {
  margin: 0;
  font-size: 14px;
  color: #172943;
  font-weight: 800;
}
.dashboard-summary-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 16px;
  margin-bottom: 18px;
}
.summary-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(115px, 1fr));
  gap: 10px;
}
.summary-card,
.quick-reports button,
.chart-card,
.dashboard-table-card {
  background: #fff;
  border: 1px solid #e1e8f2;
  border-radius: 10px;
  box-shadow: 0 5px 18px rgba(16,36,63,.035);
}
.summary-card {
  min-height: 132px;
  padding: 14px 12px 12px;
}
.summary-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 22px;
  font-weight: 800;
}
.summary-card.red .summary-icon { background:#ffe5e8; color:#ef3737; }
.summary-card.blue .summary-icon { background:#e8f1ff; color:#2d70ff; }
.summary-card.green .summary-icon { background:#e9f8ef; color:#22a65a; }
.summary-card.purple .summary-icon { background:#f1e8ff; color:#8b46ff; }
.summary-card.orange .summary-icon { background:#fff1dd; color:#ff9e21; }
.summary-card.cyan .summary-icon { background:#e5f8ff; color:#20a9d2; }
.summary-card strong { display:block; font-size: 24px; line-height: 1; }
.summary-card p { margin: 5px 0 12px; font-size: 12px; font-weight: 700; }
.summary-card small { display:block; font-size: 11px; font-weight: 800; }
.summary-card small.positive { color:#16a34a; }
.summary-card small.negative { color:#ef3737; }
.summary-card em { display:block; margin-top: 2px; font-style: normal; color:#6b7890; font-size: 10px; }
.quick-reports {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.quick-reports button {
  height: 53px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #152842;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}
.quick-reports button span { color:#2d5fae; font-size: 20px; }
.charts-title { margin-bottom: 10px; }
.charts-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.chart-card {
  min-height: 132px;
  padding: 12px 12px 8px;
  overflow: hidden;
}
.chart-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 11px;
  color: #172943;
}
.chart-card h3 span {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #172943;
  color: #fff;
  font-size: 10px;
}
.line-chart svg { width: 100%; height: 82px; }
.line-chart polyline { fill:none; stroke-width:4; stroke-linecap:round; stroke-linejoin:round; }
.red-line polyline { stroke:#ef3737; }
.orange-line polyline { stroke:#ff9e21; }
.dual-line .first { stroke:#2d70ff; }
.dual-line .second { stroke:#4abc6b; }
.axis-labels { display:flex; justify-content:space-around; color:#65738b; font-size:10px; }
.donut {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  margin: 4px 8px 0 10px;
  display: inline-grid;
  place-items: center;
  vertical-align: top;
  position: relative;
}
.donut::after {
  content:"";
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background:#fff;
  position:absolute;
}
.donut-multi { background: conic-gradient(#2d70ff 0 40%, #8b46ff 40% 65%, #22a65a 65% 80%, #ff9e21 80% 90%, #42b6ff 90% 95%, #b7c2d2 95%); }
.donut-status { background: conic-gradient(#4abc6b 0 80%, #ffb22e 80% 95%, #ef3737 95%); }
.donut-sex { background: conic-gradient(#2d70ff 0 52%, #ff4d9a 52%); }
.donut-pending { background: conic-gradient(#ef3737 0 60%, #ff6b6b 60% 85%, #ffb2b2 85%); }
.donut-pending strong { z-index: 1; text-align:center; font-size: 11px; color:#172943; }
.chart-legend { display:inline-block; margin: 0; padding: 0; list-style: none; font-size: 9px; line-height:1.65; color:#172943; }
.chart-legend li::before { content:"■"; color:#2d70ff; margin-right:5px; }
.bar-chart { height: 80px; display:flex; align-items:flex-end; gap:16px; justify-content:center; padding-top:10px; }
.bar-chart span { width:20px; background:#2d70ff; border-radius:3px 3px 0 0; }
.horizontal-bars { display:grid; gap:8px; padding-top:8px; }
.horizontal-bars p { display:grid; grid-template-columns: 1fr 36px; align-items:center; gap:8px; margin:0; }
.horizontal-bars span { display:block; height:10px; border-radius:2px; background:#8756dc; }
.horizontal-bars b { font-size:10px; }
.green-bars span { background:#4abc6b; }
.dashboard-table-card { padding: 12px 12px 10px; }
.dashboard-table-card h2 { margin-bottom: 10px; }
.dashboard-table { min-width: 1100px; font-size: 10px; }
.status-pill.cancelled { background:#ffdfe1; color:#e11d25; }

@media (max-width: 1400px) {
  .summary-cards { grid-template-columns: repeat(3, 1fr); }
  .charts-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1150px) {
  .dashboard-summary-grid,
  .stats-section-header { grid-template-columns: 1fr; }
  .quick-reports { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .dashboard-stats-header { align-items:flex-start; flex-direction:column; }
  .dashboard-tools { flex-wrap:wrap; }
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .summary-cards,
  .charts-grid,
  .quick-reports { grid-template-columns: 1fr; }
}
