:root {
  --bg: #eefbff;
  --surface: #ffffff;
  --ink: #17323d;
  --muted: #647b84;
  --line: #c8eaf2;
  --green: #12b886;
  --green-soft: #d9fbe8;
  --aqua: #00a6d6;
  --aqua-soft: #dff7ff;
  --coral: #ff6b6b;
  --amber: #ffd166;
  --blue: #1479ff;
  --violet: #5b7cfa;
  --cyan: #04c8de;
  --mint: #23d3a2;
  --shadow: 0 18px 42px rgba(0, 129, 167, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(20, 121, 255, 0.12), transparent 24%),
    radial-gradient(circle at 72% 8%, rgba(35, 211, 162, 0.16), transparent 20%),
    radial-gradient(circle at top left, rgba(4, 200, 222, 0.22), transparent 32%),
    var(--bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  overflow-x: hidden;
}

body.locked {
  grid-template-columns: 1fr;
}

body.locked .sidebar,
body.locked .app {
  display: none;
}

body:not(.locked) .login-screen {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, rgba(28, 167, 201, 0.16), transparent 34%), var(--bg);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

button,
input,
select,
textarea {
  font: inherit;
}

.sidebar {
  min-height: 100vh;
  padding: 20px 16px;
  background: linear-gradient(180deg, #c9f4ff 0%, #e6fff8 46%, #ffffff 100%);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  border-right: 1px solid var(--line);
}

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

.login-brand {
  flex-direction: column;
  gap: 14px;
  padding-bottom: 6px;
  text-align: center;
}

.brand-mark {
  width: 78px;
  height: 34px;
  flex: 0 0 auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(0, 166, 214, 0.16));
}

.login-card .brand-mark {
  width: 190px;
  height: 70px;
}

.remember-session {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
}

.remember-session input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: #073044;
  font-size: 1rem;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  margin-top: 3px;
  font-size: 13px;
}

.brand-settings {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(280px, 1.2fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.logo-preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 166, 214, 0.08), rgba(18, 184, 134, 0.1));
}

.logo-preview-card img {
  width: 104px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.logo-preview-card strong,
.logo-preview-card span {
  display: block;
}

.logo-preview-card strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.logo-preview-card span {
  margin-top: 4px;
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item,
.ghost,
.primary,
.link,
.icon {
  border: 0;
  cursor: pointer;
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  color: #265160;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item[data-view="pacientes"]::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 8px 5px 0 -4px currentColor;
  opacity: 0.8;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(135deg, #d7f8ff, #dcfff1);
  color: #006b88;
  box-shadow: inset 5px 0 0 var(--blue), 0 8px 18px rgba(0, 166, 214, 0.1);
}

.nav-item[hidden],
[data-role-action][hidden],
#patientTopActions[hidden],
#userAdminPanel[hidden] {
  display: none !important;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.session-box {
  padding: 10px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, #dff7ff, #e2fbe8);
  color: #006b88;
}

.session-box strong,
.session-box small {
  display: block;
}

.session-box small {
  margin-top: 4px;
  color: var(--muted);
}

.notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff8e7;
  color: #8a5f13;
  font-weight: 700;
}

.notice.subtle {
  background: #e9fbff;
  color: #006b88;
}

.app {
  min-width: 0;
  padding: 24px 28px 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
  margin-bottom: 0;
}

.top-actions,
.toolbar,
.summary-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.cash-date-control {
  display: grid;
  gap: 6px;
  max-width: 220px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.agenda-toolbar {
  display: grid;
  grid-template-columns: 150px minmax(160px, 1fr) minmax(160px, 1fr) auto auto auto;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 8px;
}

.agenda-toolbar input,
.agenda-toolbar select,
.agenda-toolbar button {
  min-height: 38px;
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 14px;
}

.search,
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.search {
  width: min(360px, 45vw);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5fcfd;
  color: var(--ink);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check-grid .check-row {
  min-height: 54px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.primary,
.ghost,
.link {
  border-radius: 8px;
  padding: 10px 14px;
  white-space: nowrap;
  font-size: 14px;
}

.primary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--cyan) 42%, var(--green) 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(0, 166, 214, 0.24), 0 5px 14px rgba(18, 184, 134, 0.18);
}

.ghost {
  background: linear-gradient(135deg, #e2f8ff, #edfdf5);
  color: #006b88;
  font-weight: 700;
}

.ghost.full,
.file-label {
  width: 100%;
  text-align: center;
  display: block;
}

.file-label input {
  display: none;
}

.link {
  background: transparent;
  color: var(--green);
  font-weight: 800;
  padding-inline: 4px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi,
.panel,
.appointment-card,
.campaign-card,
.treatment-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi {
  background: linear-gradient(135deg, #ffffff 0%, #e9fbff 65%, #e5fff3 100%);
  border-top: 3px solid rgba(20, 121, 255, 0.42);
}

.kpi {
  padding: 18px 20px;
  border-radius: 12px;
}

.kpi-detail-card {
  position: relative;
}

.kpi-detail-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}

.kpi-detail-btn::before,
.kpi-detail-btn::after {
  content: "";
  position: absolute;
  border-color: var(--blue);
}

.kpi-detail-btn::before {
  width: 10px;
  height: 10px;
  top: 7px;
  right: 7px;
  border-top: 2px solid var(--blue);
  border-right: 2px solid var(--blue);
}

.kpi-detail-btn::after {
  width: 12px;
  height: 2px;
  top: 15px;
  left: 7px;
  background: var(--blue);
  transform: rotate(-45deg);
  transform-origin: center;
}

.kpi-detail-btn:hover {
  background: #eefbff;
  box-shadow: 0 8px 18px rgba(0, 166, 214, 0.14);
}

.kpi span {
  color: var(--muted);
  font-weight: 700;
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
}

.kpi strong {
  font-size: 28px;
  line-height: 1.08;
}

.kpi-breakdown {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.kpi-breakdown small {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.kpi-breakdown b {
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.content-grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.content-grid > * {
  min-width: 0;
}

.content-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-grid.form-and-list {
  grid-template-columns: 360px minmax(0, 1fr);
}

.content-grid.general-layout {
  grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.55fr);
}

.content-grid.general-layout.lower {
  margin-top: 18px;
}

.receivable-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.75fr) minmax(130px, 0.65fr) minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.receivable-form label:first-child {
  position: relative;
}

.patient-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 5;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(0, 105, 130, 0.16);
}

.patient-suggestions:empty {
  display: none;
}

.patient-suggestions button {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid #e0f2f6;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.patient-suggestions button:hover,
.patient-suggestions button:focus {
  background: #eefbff;
  outline: none;
}

.patient-suggestions span {
  color: var(--muted);
  font-size: 12px;
}

#receivablesTable .muted {
  font-size: 13px;
}

.inline-edit-btn {
  margin-left: 7px;
  border: 1px solid var(--line);
  background: #f7fdff;
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  vertical-align: middle;
}

.inline-edit-btn:hover {
  color: #006b88;
  border-color: #9ddceb;
}

.user-admin-grid {
  margin-top: 18px;
}

.panel {
  padding: 18px 20px;
  min-width: 0;
  border-radius: 12px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.form {
  display: grid;
  gap: 12px;
  align-content: start;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.inline-fields label {
  min-width: 0;
  font-size: clamp(11px, 0.8vw, 13px);
}

.inline-fields input {
  min-width: 0;
}

.mixed-payment-fields {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(223, 247, 255, 0.9), rgba(217, 251, 232, 0.75));
}

.mixed-payment-fields[hidden] {
  display: none;
}

.mixed-payment-fields .muted {
  margin: 0;
}

.mixed-payment-fields .ghost {
  width: 100%;
}

.mixed-payment-summary {
  margin: 0;
  font-weight: 800;
  color: var(--green);
}

.mixed-payment-summary.invalid {
  color: var(--coral);
}

.patient-contact-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  align-items: start;
}

.patient-contact-row .compact-label {
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stack {
  display: grid;
  gap: 12px;
}

.appointment-card,
.treatment-card,
.campaign-card {
  padding: 12px 14px;
  border-radius: 12px;
}

.card-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--aqua-soft);
  color: #08718a;
}

.status.warn {
  background: #fff1c7;
  color: var(--amber);
}

.status.danger {
  background: #ffe0df;
  color: var(--coral);
}

.agenda-board {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  max-height: calc(100vh - 164px);
  overflow: auto;
  padding-right: 4px;
}

.agenda-row {
  display: grid;
  grid-template-columns: 50px repeat(2, minmax(0, 1fr));
  gap: 2px;
  align-items: stretch;
}

.agenda-notice,
.nonwork-day {
  border: 1px solid #7edce8;
  background: linear-gradient(135deg, #e2fbff, #e6fff4);
  color: #006b88;
}

.agenda-notice {
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 800;
}

.time-cell,
.slot {
  min-height: 26px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  padding: 2px 6px;
}

.time-cell {
  color: var(--muted);
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.slot.busy {
  border-color: #65d3ea;
  background: linear-gradient(135deg, #d9f7ff, #effdff);
}

.slot.status-atendida {
  border-color: #39d98a;
  background: linear-gradient(135deg, #c9f9df, #effff5);
}

.slot.status-reprogramada {
  border-color: #ffb020;
  background: linear-gradient(135deg, #ffe7ad, #fff8df);
}

.slot.status-no_asistio,
.slot.status-cancelada {
  border-color: #ff7b72;
  background: linear-gradient(135deg, #ffd3d0, #fff0ed);
}

tr.followup-rescheduled td {
  background: #fff8db;
}

tr.followup-pending td {
  background: #ffe8e8;
}

tr.followup-rescheduled td:first-child {
  border-left: 4px solid #f4b942;
}

tr.followup-pending td:first-child {
  border-left: 4px solid #ff6b6b;
}

#appointmentFollowUpsTable {
  font-size: 12px;
}

#appointmentFollowUpsTable th,
#appointmentFollowUpsTable td {
  padding: 6px 8px;
  line-height: 1.2;
  vertical-align: top;
}

#appointmentFollowUpsTable td strong {
  font-size: 12px;
  line-height: 1.2;
}

#appointmentFollowUpsTable .muted {
  font-size: 11px;
}

#appointmentFollowUpsTable .status {
  font-size: 9px;
  padding: 3px 7px;
}

#appointmentFollowUpsTable .row-actions {
  gap: 6px;
}

#appointmentFollowUpsTable .small-btn {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.slot.lunch {
  background: linear-gradient(135deg, #fff7df, #fffaf0);
}

.slot {
  display: grid;
  gap: 1px;
  align-content: center;
  font-size: 10px;
  line-height: 1;
}

.slot strong {
  font-size: 10.5px;
  line-height: 1;
}

.slot-main {
  min-width: 0;
}

.slot-main strong,
.slot-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-meta {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 8.5px;
}

.slot-meta span {
  padding-right: 3px;
  border-right: 1px solid var(--line);
}

.slot-meta span:last-child {
  border-right: 0;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
}

.patients-scroll {
  max-height: calc(100vh - 245px);
  overflow: auto;
  padding-right: 4px;
}

.patients-scroll table {
  font-size: 13px;
}

.patients-scroll th,
.patients-scroll td {
  padding: 8px 8px;
}

.patients-scroll td strong {
  font-size: 13px;
  line-height: 1.15;
}

.patients-scroll .muted {
  font-size: 12px;
}

.patients-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.daily-audit-panel table {
  font-size: 13px;
  line-height: 1.28;
}

.daily-audit-panel th {
  font-size: 11px;
  padding: 9px 12px;
}

.daily-audit-panel td {
  padding: 10px 12px;
  vertical-align: top;
}

.daily-audit-panel td:first-child {
  width: 72px;
  white-space: nowrap;
}

.income-breakdown-panel table {
  min-width: 780px;
  font-size: 12px;
  line-height: 1.22;
}

#dailyIncomeBreakdownReport {
  max-height: 310px;
  overflow: auto;
  padding-right: 4px;
}

.income-breakdown-panel th {
  font-size: 10px;
  padding: 8px 8px;
}

.income-breakdown-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.income-breakdown-panel td {
  padding: 9px 8px;
  vertical-align: top;
}

.income-breakdown-panel td strong {
  font-size: 12px;
}

.patient-appointment {
  display: grid;
  gap: 3px;
  min-width: 145px;
  max-width: 210px;
}

.patient-appointment strong {
  font-size: 12px;
  line-height: 1.15;
}

.patient-appointment span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.patient-appointment-scheduled strong {
  color: #007f91;
}

.patient-appointment-rescheduled strong {
  color: var(--amber);
}

.patient-appointment-cancelled strong,
.patient-appointment-missed strong {
  color: var(--coral);
}

.patient-appointment-none strong {
  color: var(--muted);
}

.patient-detail-row td {
  background: linear-gradient(90deg, rgba(224, 255, 249, 0.9), rgba(238, 250, 255, 0.9));
  padding: 12px 14px;
}

.patient-appointment-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.patient-appointment-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.patient-appointment-status strong {
  color: #007f91;
  font-size: 14px;
}

.patient-appointment-status span {
  color: var(--muted);
  font-size: 13px;
}

.patient-appointment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.patient-appointment-grid span,
.patient-appointment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.patient-appointment-grid strong,
.patient-appointment-item strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
}

.patient-appointment-list {
  display: grid;
  gap: 8px;
}

.patient-appointment-item span {
  display: block;
  line-height: 1.25;
}

.patient-appointment-rescheduled .patient-appointment-status strong {
  color: var(--amber);
}

.patient-appointment-cancelled .patient-appointment-status strong,
.patient-appointment-missed .patient-appointment-status strong {
  color: var(--coral);
}

.patient-appointment-none .patient-appointment-status strong {
  color: var(--muted);
}

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

  .patient-appointment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

tr.row-highlight td {
  background: #eafff3;
  box-shadow: inset 4px 0 0 var(--green);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.small-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 6px 9px;
  cursor: pointer;
  color: #006b88;
  text-decoration: none;
  font-weight: 700;
}

.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

#recordatorios .campaign-grid {
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 10px;
}

#recordatorios .campaign-card {
  padding: 11px 12px;
}

#recordatorios .card-title {
  margin-bottom: 6px;
}

#recordatorios .card-title strong {
  font-size: 14px;
}

#recordatorios .campaign-card p {
  margin: 7px 0;
  font-size: 14px;
}

#recordatorios .campaign-card .muted {
  font-size: 13px;
}

#recordatorios .campaign-card .primary {
  padding: 9px 12px;
  font-size: 13px;
}

.summary-row {
  justify-content: space-between;
  padding: 10px 12px;
  background: #f5fcfd;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 12px;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(520px, calc(100vw - 28px));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(16, 37, 29, 0.45);
}

#receptionPatientsDialog {
  width: min(1120px, calc(100vw - 40px));
}

#generalBalanceDetailDialog {
  width: min(1180px, calc(100vw - 24px));
  max-height: min(84vh, 760px);
}

.balance-detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
  padding-right: 8px;
}

.balance-detail-summary strong {
  color: var(--ink);
}

.balance-detail-modal table {
  font-size: 13px;
  min-width: 780px;
}

.balance-detail-modal th,
.balance-detail-modal td {
  padding: 11px 14px;
  white-space: nowrap;
}

.compact-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}

.compact-filters label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  max-width: 180px;
}

.compact-filters input {
  margin-top: 5px;
  padding: 9px 10px;
  min-height: 40px;
  font-size: 14px;
}

.alert-dialog {
  width: min(460px, calc(100vw - 32px));
}

#receiptIssueDialog {
  width: min(920px, calc(100vw - 24px));
}

.receipt-issue-modal {
  width: 100%;
  max-width: none;
  font-size: 14px;
}

.receipt-fields-grid {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(150px, 190px) minmax(280px, 1fr);
  gap: 12px;
  align-items: end;
}

.receipt-issue-modal input,
.receipt-issue-modal select,
.receipt-issue-modal textarea {
  min-width: 0;
  font-size: 14px;
  min-height: 42px;
  padding: 10px 12px;
}

.receipt-issue-modal menu,
.alert-dialog menu {
  margin-top: 14px;
}

#electronicReceiptsTable {
  font-size: 14px;
}

#electronicReceiptsTable td,
#electronicReceiptsTable th {
  padding-top: 10px;
  padding-bottom: 10px;
}

.modal-form {
  padding: 18px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0;
  margin: 4px 0 0;
}

.icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eef9fb;
}

.kpi-grid.compact {
  margin-bottom: 18px;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  position: relative;
  padding: 14px 14px 14px 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfeff;
}

.timeline-item summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.timeline-item summary::marker {
  color: var(--aqua);
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--aqua);
  box-shadow: 0 0 0 5px var(--aqua-soft);
}

.odontogram-panel {
  overflow: hidden;
}

.odontogram-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  margin-bottom: 14px;
}

.odontogram-type {
  display: grid;
  gap: 6px;
}

.type-pill {
  min-width: 84px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #f4faf8;
  color: var(--teal-dark);
  font-weight: 900;
  cursor: pointer;
}

.type-pill.active {
  background: #bdeee6;
  border-color: #6bcfc4;
}

.type-pill:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.72;
}

.odontogram-symbol-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  border: 1px solid var(--line);
  background: #fff;
}

.condition-chip {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #f9fcfd;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  padding: 6px 8px;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
}

.condition-chip.active {
  background: #dff7f4;
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 2px var(--teal);
}

.chip-swatch {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: #fff;
}

.condition-chip.cariado .chip-swatch { background: #f05b5b; }
.condition-chip.obturado .chip-swatch,
.condition-chip.sellante .chip-swatch { background: #27b17e; }
.condition-chip.perdido .chip-swatch,
.condition-chip.ausente .chip-swatch,
.condition-chip.extraido .chip-swatch,
.condition-chip.por-extraer .chip-swatch { background: #3b82f6; }
.condition-chip.corona .chip-swatch { background: #f2c94c; }
.condition-chip.endodoncia .chip-swatch { background: #9b6bd3; }
.condition-chip.implante .chip-swatch { background: #6c7a89; }
.condition-chip.ortodoncia .chip-swatch { background: #1f9bd1; }
.condition-chip.protesis .chip-swatch { background: #f39c6b; }
.condition-chip.observacion .chip-swatch { background: #f7a8c9; }

.odontogram-grid {
  display: grid;
  gap: 12px;
}

.odontogram-board {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  padding: 12px;
  overflow-x: auto;
}

.odontogram-sheet-title {
  min-width: 1180px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  background: #edf8f6;
  color: var(--text);
  padding: 7px 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.odontogram-sheet-title span {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

.odontogram-section {
  min-width: 1180px;
  border: 1px solid var(--line);
  border-top: 0;
  padding: 0;
}

.odontogram-section:first-of-type {
  border-top: 1px solid var(--line);
}

.odontogram-section h3 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #f7fbfc;
  padding: 5px 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.tooth-number-strip {
  display: grid;
  grid-template-columns: repeat(16, minmax(58px, 1fr));
  border-bottom: 1px solid var(--line);
}

.tooth-number-strip.bottom {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.tooth-number-strip span {
  min-height: 24px;
  border-right: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tooth-number-strip span:last-child {
  border-right: 0;
}

.odontogram-row {
  display: grid;
  grid-template-columns: repeat(16, minmax(58px, 1fr));
  gap: 0;
  background: #fff;
}

.tooth {
  position: relative;
  min-height: 150px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  display: grid;
  grid-template-rows: auto 86px auto;
  align-items: center;
  justify-items: center;
  gap: 3px;
  padding: 6px 4px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tooth:last-child {
  border-right: 0;
}

.tooth:hover {
  transform: none;
  background: #f7fdff;
  box-shadow: inset 0 0 0 2px var(--teal);
}

.tooth.selected {
  background: #eefbfb;
  box-shadow: inset 0 0 0 3px var(--teal);
}

.tooth-art {
  position: relative;
  width: 64px;
  height: 84px;
  display: grid;
  place-items: center;
}

.tooth-svg {
  width: 64px;
  height: 84px;
  overflow: visible;
}

.tooth-root,
.tooth-crown {
  fill: #fff7e9;
  stroke: #1f2a2e;
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.tooth-shade {
  fill: rgba(93, 78, 161, 0.15);
  stroke: none;
}

.tooth-condition {
  min-width: 34px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #f7fcfd;
  color: var(--muted);
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.tooth.cariado .tooth-crown,
.tooth.cariado .tooth-shade { fill: #ffd7d2; }
.tooth.obturado .tooth-crown,
.tooth.sellante .tooth-crown { fill: #d8f3e2; }
.tooth.perdido .tooth-crown,
.tooth.ausente .tooth-crown,
.tooth.extraido .tooth-crown,
.tooth.por-extraer .tooth-crown { fill: #e8edf2; }
.tooth.corona .tooth-crown { fill: #fff0b8; }
.tooth.endodoncia .tooth-shade { fill: rgba(125, 80, 190, 0.35); }
.tooth.implante .tooth-root { fill: #dce5eb; }
.tooth.ortodoncia .tooth-crown { fill: #d8eef7; }
.tooth.protesis .tooth-crown { fill: #ffe1c7; }
.tooth.observacion .tooth-crown { fill: #ffe0ef; }

.tooth-mark {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.surface-cross {
  position: relative;
  width: 36px;
  height: 31px;
  display: block;
}

.surface {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #7a858c;
  background: #fff;
}

.surface.top {
  left: 12px;
  top: 0;
}

.surface.left {
  left: 0;
  top: 10px;
}

.surface.center {
  left: 12px;
  top: 10px;
}

.surface.right {
  right: 0;
  top: 10px;
}

.surface.bottom {
  left: 12px;
  bottom: 0;
}

.surface-cross.cariado.active .center { background: #e23131; border-color: #c92222; }
.surface-cross.obturado.active .center,
.surface-cross.sellante.active .center { background: #25a96c; border-color: #188457; }
.surface-cross.endodoncia.active .center { background: #7a50bc; border-color: #5b3696; }

.mark-x::before,
.mark-x::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 40px;
  height: 4px;
  border-radius: 999px;
  background: #1f74db;
}

.mark-x::before { transform: rotate(45deg); }
.mark-x::after { transform: rotate(-45deg); }

.mark-dot::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e23131;
  left: 25px;
  top: 45px;
  box-shadow: 0 0 0 3px rgba(226, 49, 49, 0.18);
}

.mark-square::before,
.mark-bracket::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 3px solid #176fba;
  background: rgba(255, 255, 255, 0.65);
  left: 22px;
  top: 46px;
}

.mark-bracket::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 56px;
  height: 3px;
  background: #176fba;
}

.mark-line::before,
.mark-cap::before,
.mark-bridge::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 30px;
  height: 4px;
  border-radius: 999px;
  background: #6f42c1;
}

.mark-cap::before {
  background: #d59b0b;
}

.mark-bridge::before {
  top: 26px;
  height: 18px;
  background: transparent;
  border-top: 4px solid #f0803c;
  border-radius: 50% 50% 0 0;
}

.mark-pin::before {
  content: "";
  position: absolute;
  left: 34px;
  top: 54px;
  width: 6px;
  height: 28px;
  border-radius: 999px;
  background: #51606d;
}

.mark-note::before {
  content: "!";
  position: absolute;
  right: 13px;
  top: 26px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f08ab4;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
}

.odontogram-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.odontogram-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfeff;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
}

.cash-box {
  border: 1px solid var(--line);
  background: #fbfeff;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.cash-breakdown {
  flex: 1;
  min-width: 460px;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
}

.cash-breakdown span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5fcfd;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 800;
}

.cash-breakdown strong {
  display: block;
  color: var(--ink);
  margin-top: 4px;
}

.danger-btn {
  color: var(--coral);
}

.day-detail {
  margin-top: 8px;
}

.day-detail summary {
  cursor: pointer;
  color: var(--aqua);
  font-weight: 800;
}

.day-detail table {
  margin-top: 8px;
  font-size: 13px;
}

#pagos .payments-layout {
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  align-items: start;
}

#pagos .payment-entry-panel {
  position: sticky;
  top: 18px;
  gap: 10px;
  padding: 18px;
  border-radius: 14px;
}

#pagos .payment-entry-panel .panel-head {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(200, 234, 242, 0.9);
}

#pagos .payment-entry-panel label {
  gap: 5px;
  font-size: 12px;
}

#pagos .payment-entry-panel input,
#pagos .payment-entry-panel select,
#pagos .payment-entry-panel textarea {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 13px;
}

#pagos .payment-entry-panel .primary {
  min-height: 44px;
  margin-top: 4px;
}

#pagos .payments-workspace {
  padding: 18px 22px;
  border-radius: 14px;
}

#pagos .payments-cash-box {
  padding: 10px 12px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(235, 252, 255, 0.9)),
    #fbfeff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

#pagos .payments-cash-box .panel-head {
  margin-bottom: 10px;
}

#pagos .payments-cash-box .panel-head h2 {
  font-size: 18px;
}

#pagos .payments-cash-box .settings-grid {
  grid-template-columns: repeat(3, minmax(150px, 220px));
  justify-content: start;
  gap: 7px;
}

#pagos .payments-cash-box label {
  font-size: 11px;
  gap: 4px;
}

#pagos .payments-cash-box input {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

#pagos .payments-cash-box .summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

#pagos .payments-cash-box .summary-row span {
  flex: 0 1 150px;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f5fcfd;
  color: var(--muted);
  font-size: 11px;
}

#pagos .payments-cash-box .summary-row strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
}

#pagos .payments-cash-box .top-actions {
  align-items: stretch;
  gap: 7px;
}

#pagos .payments-cash-box .top-actions > button {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 13px;
}

#pagos .cash-breakdown {
  flex: 0 1 390px;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 6px;
}

#pagos .cash-breakdown span {
  min-height: 40px;
  padding: 6px 8px;
  font-size: 11px;
}

#pagos .cash-breakdown strong {
  font-size: 14px;
  margin-top: 2px;
}

#pagos .compact-section-head {
  margin: 16px 0 6px;
  padding-top: 4px;
}

#pagos .compact-section-head h2 {
  font-size: 17px;
}

#pagos .table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

#pagos .table-wrap table {
  font-size: 13px;
}

#pagos .table-wrap th {
  font-size: 10px;
  padding: 9px 11px;
  background: rgba(245, 252, 253, 0.86);
}

#pagos .table-wrap td {
  padding: 9px 11px;
  line-height: 1.25;
}

#pagos .table-wrap .small-btn {
  min-height: 32px;
  font-size: 12px;
  padding: 5px 8px;
}

#pagos .payments-table-wrap {
  max-height: 420px;
  overflow: auto;
}

#utilityForm {
  gap: 10px;
  padding: 18px 20px;
}

#utilityForm label {
  gap: 5px;
  font-size: 12px;
}

#utilityForm input,
#utilityForm select,
#utilityForm textarea {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 13px;
}

#utilityForm textarea {
  min-height: 76px;
}

#utilityForm .top-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.82fr);
  gap: 8px;
  align-items: stretch;
}

#utilityForm .top-actions .ghost,
#utilityForm .top-actions .primary {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 13px;
}

.tooth-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.tooth-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tooth-legend i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid var(--line);
}

.tooth-legend .healthy {
  background: #fff;
}

.tooth-legend .cavity {
  background: #fff0ed;
}

.tooth-legend .treated {
  background: #e9f7ee;
}

.tooth-legend .missing {
  background: #f1f3f5;
}

.doctor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.doctor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfeff;
  padding: 14px;
}

.metric-bar {
  height: 9px;
  background: #e8f3f6;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.metric-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--aqua), var(--green));
}

.mini-chart {
  min-height: 330px;
  display: grid;
  gap: 34px;
  align-content: start;
}

.report-line-chart {
  width: 100%;
  max-width: 520px;
  height: 178px;
  display: block;
}

.chart-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--muted);
}

.chart-summary strong {
  color: var(--ink);
  font-size: 28px;
}

.chart-summary small {
  color: var(--green);
  font-weight: 800;
}

.report-line-chart .chart-grid {
  stroke: rgba(88, 111, 124, 0.16);
  stroke-width: 1;
}

.report-line-chart .chart-area {
  fill: url(#careAreaGradient);
}

.report-line-chart .chart-line {
  stroke: #1479f6;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 5px 8px rgba(20, 121, 246, 0.16));
}

.report-line-chart circle {
  fill: #18b89f;
  stroke: #fff;
  stroke-width: 3;
}

.report-line-chart text {
  fill: var(--muted);
  font-size: 12px;
}

.report-line-chart .chart-value {
  fill: var(--ink);
  font-weight: 800;
}

.reception-new-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #f3fbfd);
  padding: 22px 24px;
  min-height: 145px;
  box-shadow: 0 16px 34px rgba(13, 80, 102, 0.08);
}

.reception-new-card span,
.reception-new-card small {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.reception-new-card strong {
  color: var(--ink);
  display: block;
  font-size: 42px;
  line-height: 1;
  margin: 10px 0 4px;
}

.open-mini-modal {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-size: 0;
  cursor: pointer;
}

.open-mini-modal::before,
.open-mini-modal::after {
  content: "";
  position: absolute;
  display: block;
}

.open-mini-modal::before {
  width: 22px;
  height: 22px;
  left: 14px;
  top: 17px;
  border: 3px solid currentColor;
  border-radius: 5px;
  border-top: 0;
}

.open-mini-modal::after {
  width: 17px;
  height: 17px;
  right: 13px;
  top: 12px;
  border-top: 4px solid currentColor;
  border-right: 4px solid currentColor;
  transform: rotate(0deg);
}

.open-mini-modal:hover {
  border-color: var(--blue);
  box-shadow: 0 8px 18px rgba(20, 121, 246, 0.14);
}

.wide-modal {
  width: min(1120px, calc(100vw - 40px));
  max-height: min(78vh, 760px);
}

.wide-modal table {
  font-size: 13px;
}

.wide-modal th,
.wide-modal td {
  padding: 9px 10px;
}

.wide-modal td strong {
  font-size: 13px;
}

.wide-modal .muted {
  font-size: 12px;
}

/* Escala visual compacta global: mantiene colores y funciones, solo reduce zoom visual. */
.top-actions,
.toolbar,
.summary-row {
  gap: 10px;
}

.stack {
  gap: 10px;
}

.appointment-card strong,
.campaign-card strong,
.treatment-card strong {
  font-size: 14px;
  line-height: 1.2;
}

.appointment-card p,
.campaign-card p,
.treatment-card p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.35;
}

.panel .muted,
.table-wrap .muted {
  font-size: 13px;
}

.table-wrap table {
  font-size: 14px;
}

.small-btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.status {
  padding: 3px 8px;
  font-size: 11px;
}

.cash-breakdown span,
.doctor-card,
.timeline-item {
  padding: 12px 14px;
}

.reception-new-card {
  padding: 18px 20px;
  min-height: 128px;
}

.reception-new-card strong {
  font-size: 34px;
}

.open-mini-modal {
  width: 44px;
  height: 44px;
}

.open-mini-modal::before {
  width: 18px;
  height: 18px;
  left: 12px;
  top: 15px;
}

.open-mini-modal::after {
  width: 14px;
  height: 14px;
  right: 11px;
  top: 10px;
}

@media (max-width: 980px) {
  .receivable-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: auto;
    padding: 12px;
    gap: 12px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
  }

  .sidebar-footer {
    display: none;
  }

  .kpi-grid,
  .content-grid.two,
  .content-grid.form-and-list,
  .content-grid.general-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .agenda-toolbar {
    grid-template-columns: 1fr;
  }

  .odontogram-toolbar {
    grid-template-columns: 1fr;
  }

  .odontogram-symbol-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .agenda-board {
    max-height: none;
    overflow: visible;
  }

  .search {
    width: 100%;
  }

  .agenda-row {
    grid-template-columns: 1fr;
  }

  .cash-breakdown {
    min-width: 100%;
    grid-template-columns: 1fr;
  }

  #pagos .payments-layout,
  #pagos .payments-cash-box .settings-grid,
  #pagos .payments-cash-box .summary-row {
    grid-template-columns: 1fr;
  }

  #pagos .payment-entry-panel {
    position: static;
  }

  #utilityForm .top-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .receivable-form {
    grid-template-columns: 1fr;
  }

  .receipt-fields-grid {
    grid-template-columns: 1fr;
  }

  body {
    display: block;
    background:
      radial-gradient(circle at top right, rgba(20, 121, 255, 0.14), transparent 28%),
      var(--bg);
    width: 100%;
  }

  .login-screen {
    padding: 14px;
  }

  .login-card {
    padding: 22px;
  }

  .sidebar {
    max-height: 42vh;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 58px;
    height: 26px;
  }

  .brand strong {
    font-size: 0.98rem;
  }

  .nav-item {
    min-height: 42px;
    padding: 10px 14px;
    font-size: 14px;
  }

  .app {
    padding: 14px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .view,
  .content-grid,
  .panel,
  .table-wrap {
    max-width: 100%;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 17px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }

  .top-actions .search {
    grid-column: 1 / -1;
    width: 100%;
  }

  .top-actions button,
  .agenda-toolbar button,
  .primary,
  .ghost {
    min-height: 44px;
  }

  .panel {
    padding: 14px;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head .top-actions {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    gap: 10px;
  }

  .kpi {
    padding: 14px;
  }

  .kpi strong {
    font-size: 24px;
  }

  .content-grid,
  .campaign-grid,
  .doctor-grid {
    gap: 12px;
  }

  .form {
    gap: 12px;
  }

  .patient-contact-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 8px;
  }

  .patient-contact-row .compact-label {
    font-size: 11px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  textarea {
    min-height: 88px;
  }

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

  .summary-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .table-wrap {
    margin-inline: -4px;
    padding-bottom: 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .patients-scroll {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
  }

  table {
    min-width: 560px;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .agenda-board {
    gap: 4px;
  }

  .agenda-row {
    gap: 4px;
  }

  .time-cell {
    min-height: 30px;
    justify-content: start;
    padding-left: 8px;
  }

  .slot {
    min-height: 42px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .slot strong {
    font-size: 12px;
  }

  .cash-breakdown,
  .odontogram-symbol-grid {
    grid-template-columns: 1fr;
  }

  dialog {
    width: min(100vw - 16px, 560px);
    max-height: calc(100dvh - 18px);
    overflow: auto;
  }

  .modal-form {
    padding: 16px;
  }

  menu {
    display: grid;
    grid-template-columns: 1fr;
  }
}
