@import url("/assets/cenevet-ui-v0933.css?v=0.9.33");
/* CENEVET Agenda v0.4.4 · filas completas con color profesional */
:root {
  --bg: #f3f7f6;
  --surface: #ffffff;
  --surface-soft: #edf4f2;
  --text: #173033;
  --muted: #647679;
  --primary: #126c70;
  --primary-dark: #0b5357;
  --primary-soft: #dcefed;
  --sidebar: #123a3f;
  --sidebar-hover: #1d5055;
  --sidebar-text: #eff8f6;
  --border: #d7e3e1;
  --danger: #bd3440;
  --warning: #a15c08;
  --success: #247346;
  --shadow: 0 12px 34px rgba(18, 58, 63, 0.09);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }

.login-body {
  background:
    radial-gradient(circle at 12% 10%, rgba(94, 174, 160, 0.2), transparent 34rem),
    linear-gradient(145deg, #eef6f3 0%, #f8faf9 52%, #eaf3f1 100%);
}

.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, 520px);
  align-items: center;
  gap: clamp(2rem, 7vw, 7rem);
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 6rem);
}

.login-intro h1 { max-width: 760px; margin: 2rem 0 1.1rem; font-size: clamp(2.4rem, 5vw, 4.7rem); line-height: 1.02; letter-spacing: -0.05em; }
.login-intro p { max-width: 650px; font-size: 1.15rem; line-height: 1.7; color: var(--muted); }
.login-brand { display: inline-flex; align-items: center; gap: 0.8rem; font-weight: 800; letter-spacing: 0.04em; }
.login-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 0.7rem; color: #345356; }
.login-points li::before { content: "✓"; color: var(--success); font-weight: 800; margin-right: 0.65rem; }
.login-card { background: rgba(255,255,255,0.94); border: 1px solid rgba(205,222,218,0.9); border-radius: 24px; padding: clamp(1.7rem, 4vw, 3.2rem); box-shadow: 0 30px 80px rgba(18,58,63,0.14); }
.login-card h2 { margin: 0.5rem 0 0.3rem; font-size: 2rem; letter-spacing: -0.03em; }
.login-help { margin: 1.35rem 0 0; font-size: 0.82rem; line-height: 1.5; color: var(--muted); }
.eyebrow { color: var(--primary); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; font-weight: 800; }

.stack-form { display: grid; gap: 1rem; margin-top: 1.7rem; }
label { display: grid; gap: 0.45rem; font-size: 0.88rem; font-weight: 650; color: #28464a; }
input, select, textarea {
  width: 100%;
  border: 1px solid #bfd0cd;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 0.7rem 0.8rem;
  min-height: 42px;
}
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(18,108,112,0.15); border-color: var(--primary); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  min-height: 40px;
  padding: 0.62rem 0.95rem;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}
.button:hover { border-color: #a8bfbb; background: #f9fbfa; }
.button.primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.button.ghost { background: transparent; }
.button.small { min-height: 34px; padding: 0.42rem 0.68rem; font-size: 0.82rem; }
.button.full { width: 100%; }
.link-button { border: 0; background: none; color: rgba(239,248,246,0.72); cursor: pointer; padding: 0.3rem; }
.link-button:hover { color: #fff; }
.icon-button { border: 1px solid var(--border); background: #fff; border-radius: 8px; min-width: 38px; min-height: 38px; cursor: pointer; }

.erp-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.erp-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); color: var(--sidebar-text); border-right: 1px solid #27565b; z-index: 50; }
.erp-brand { display: flex; align-items: center; gap: 0.8rem; padding: 1.15rem; min-height: 76px; text-decoration: none; border-bottom: 1px solid #29575c; }
.erp-brand strong { display: block; font-size: 0.9rem; letter-spacing: 0.04em; }
.erp-brand small { display: block; margin-top: 0.15rem; color: rgba(239,248,246,0.6); font-size: 0.72rem; }
.erp-brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; border-radius: 13px; background: #9bd0b3; color: #123a3f; font-weight: 900; }
.erp-navigation { padding: 1rem 0.7rem; display: flex; flex-direction: column; gap: 0.18rem; overflow-y: auto; }
.erp-nav-heading { padding: 1rem 0.7rem 0.45rem; color: rgba(239,248,246,0.5); text-transform: uppercase; letter-spacing: 0.11em; font-size: 0.63rem; font-weight: 800; }
.erp-nav-link { display: flex; align-items: center; gap: 0.75rem; border-radius: 9px; padding: 0.68rem 0.75rem; color: rgba(239,248,246,0.78); text-decoration: none; font-size: 0.9rem; }
.erp-nav-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.erp-nav-link.is-active { background: var(--sidebar-hover); color: #fff; font-weight: 700; }
.erp-nav-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: 0.72; }
.erp-user { margin-top: auto; min-height: 74px; padding: 0.9rem; border-top: 1px solid #29575c; display: flex; align-items: center; gap: 0.65rem; }
.erp-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #28595e; font-weight: 800; font-size: 0.75rem; }
.erp-user-copy { min-width: 0; flex: 1; }
.erp-user-copy strong, .erp-user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erp-user-copy strong { font-size: 0.8rem; }
.erp-user-copy small { margin-top: 0.1rem; color: rgba(239,248,246,0.55); font-size: 0.7rem; }
.erp-main { min-width: 0; }
.erp-content { padding: clamp(1rem, 2.5vw, 2.25rem); max-width: 1700px; margin: 0 auto; }
.erp-mobile-header { display: none; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; }
.page-header h1 { margin: 0; font-size: clamp(1.75rem, 3vw, 2.4rem); letter-spacing: -0.035em; }
.page-header p { margin: 0.4rem 0 0; color: var(--muted); line-height: 1.5; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.55rem; }
.muted { color: var(--muted); }
.small-text { font-size: 0.8rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--border); }
.card-header h2 { margin: 0; font-size: 1rem; }
.card-body { padding: 1.15rem; }
.form-card { margin-bottom: 1.2rem; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.9rem; align-items: end; }
.span-2 { grid-column: span 2; }.span-3 { grid-column: span 3; }.span-4 { grid-column: span 4; }.span-6 { grid-column: span 6; }.span-12 { grid-column: span 12; }
.checkbox-label { display: flex; align-items: center; gap: 0.55rem; min-height: 42px; }
.checkbox-label input { width: 18px; min-height: 18px; }

.alert { border: 1px solid #bfd5d1; background: #eef8f6; color: #245c56; padding: 0.8rem 1rem; border-radius: 9px; margin-bottom: 1rem; }
.alert.error { border-color: #f2bfc4; background: #fff0f1; color: #8f2630; }
.alert.warning { border-color: #eed1a5; background: #fff7e7; color: #7d4a09; }
.alert.success { border-color: #b9ddc7; background: #effaf3; color: #22653d; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.data-table th { text-align: left; padding: 0.72rem 0.8rem; color: var(--muted); background: #f7faf9; border-bottom: 1px solid var(--border); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.data-table td { padding: 0.72rem 0.8rem; border-bottom: 1px solid #e8efed; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfdfc; }
.status-pill, .code-badge { display: inline-flex; align-items: center; border: 1px solid; border-radius: 999px; padding: 0.18rem 0.48rem; font-size: 0.7rem; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.code-badge { color: #fff; background: #243b53; border-color: #172b3a; }
.status-pill.active { color: #17623a; background: #e5f7ec; border-color: #a9d9bb; }
.status-pill.inactive { color: #667276; background: #f0f3f3; border-color: #d3dddd; }
.status-pill.pending { color: #8a5007; background: #fff4db; border-color: #ebc77e; }
.row-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }

.agenda-view-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 0.9rem; background: #f7faf9; border-bottom: 1px solid var(--border); }
.agenda-view-bar p { margin: 0; color: var(--muted); font-size: 0.72rem; line-height: 1.4; }
.agenda-view-switcher { display: inline-flex; flex: 0 0 auto; padding: 3px; border: 1px solid #cbdad7; border-radius: 10px; background: #e8f0ee; }
.agenda-view-button { min-height: 32px; padding: 0.35rem 0.8rem; border: 0; border-radius: 7px; background: transparent; color: #476063; font-size: 0.72rem; font-weight: 750; cursor: pointer; }
.agenda-view-button:hover { color: var(--primary-dark); }
.agenda-view-button.is-active { background: #fff; color: var(--primary-dark); box-shadow: 0 1px 5px rgba(18,58,63,0.14); }
.agenda-view-button:focus-visible { outline: 3px solid rgba(18,108,112,0.18); }

.agenda-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.85rem; padding: 0.9rem; }
.toolbar-group { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.toolbar-group select, .toolbar-group input { width: auto; min-width: 150px; }
.period-title { min-width: 195px; text-align: center; font-weight: 800; }
.calendar-status { padding: 1.2rem; color: var(--muted); text-align: center; }
.calendar-scroll { overflow: auto; max-height: calc(100vh - 245px); min-height: 560px; border-top: 1px solid var(--border); }
.calendar-grid { min-width: 1020px; position: relative; }
.calendar-head { position: sticky; top: 0; z-index: 20; display: grid; background: rgba(255,255,255,0.97); border-bottom: 1px solid var(--border); }
.calendar-time-head { position: sticky; left: 0; z-index: 22; background: #fff; border-right: 1px solid var(--border); }
.calendar-day-head { min-height: 58px; padding: 0.72rem; border-right: 1px solid var(--border); }
.calendar-day-head strong, .calendar-day-head span { display: block; }
.calendar-day-head span { margin-top: 0.15rem; color: var(--muted); font-size: 0.72rem; }
.calendar-body { display: grid; position: relative; background: #fff; }
.time-axis { position: sticky; left: 0; z-index: 12; background: #fff; border-right: 1px solid var(--border); }
.time-label { position: absolute; right: 0.7rem; transform: translateY(-50%); color: var(--muted); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.calendar-day { position: relative; border-right: 1px solid var(--border); background: linear-gradient(to bottom, rgba(236,244,242,0.38), transparent 90px); }
.hour-line { position: absolute; left: 0; right: 0; border-top: 1px solid #e3ebe9; pointer-events: none; }
.appointment-card { position: absolute; z-index: 5; overflow: hidden; border: 1px solid rgba(23,48,51,0.12); border-left: 4px solid; border-radius: 8px; padding: 5px 7px; color: var(--text); text-align: left; cursor: pointer; box-shadow: 0 2px 7px rgba(25,60,60,0.11); transition: transform .12s, box-shadow .12s; }
.appointment-card:hover { z-index: 10; transform: translateY(-1px); box-shadow: 0 7px 18px rgba(25,60,60,0.18); }
.appointment-card.is-cancelled { opacity: 0.48; text-decoration: line-through; }
.appointment-card.is-absence { background: #fff0f1 !important; }
.appointment-title { display: flex; align-items: center; gap: 0.3rem; min-width: 0; font-size: 0.75rem; font-weight: 800; }
.appointment-title .patient-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appointment-meta { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.68rem; color: #4e6365; }
.appointment-card .code-badge { flex: 0 0 auto; border-radius: 5px; padding: 1px 4px; font-size: 0.61rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.65rem; padding: 0.7rem 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.72rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.legend-color { width: 10px; height: 10px; border-radius: 3px; }

/* Vista Huecos y vista Día: franjas de 15 minutos con alta directa. */
.agenda-slots-grid { min-width: 914px; background: #fff; }
.agenda-day-grid { min-width: 940px; }
.schedule-head { min-height: 60px; }
.calendar-time-head { display: grid; place-items: center; min-height: 60px; color: var(--muted); font-size: 0.65rem; font-weight: 750; }
.schedule-column-head { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.schedule-column-title { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.schedule-column-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-column-color { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 3px; }
.schedule-body { background: #fff; }
.schedule-column { overflow: hidden; background: #fff; border-bottom: 1px solid var(--border); }
.schedule-slot { position: absolute; z-index: 1; left: 0; width: 100%; padding: 0; border: 0; border-top: 1px dashed #e5edeb; background: transparent; color: var(--primary-dark); text-align: right; cursor: cell; }
.schedule-slot.is-hour { border-top-style: solid; border-top-color: #cad9d6; }
.schedule-slot:not(:disabled):hover, .schedule-slot:not(:disabled):focus-visible { z-index: 3; background: rgba(18,108,112,0.08); outline: 1px solid rgba(18,108,112,0.35); outline-offset: -1px; }
.schedule-slot span { position: absolute; top: 50%; right: 5px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; opacity: 0; transform: translateY(-50%); background: var(--primary); color: #fff; font-size: 0.75rem; font-weight: 800; }
.schedule-slot:hover span, .schedule-slot:focus-visible span { opacity: 1; }
.schedule-slot:disabled { cursor: default; }
.slot-appointment-group { position: absolute; z-index: 6; overflow: hidden; border: 1px solid #bccfcb; border-radius: 7px; background: rgba(255,255,255,0.97); box-shadow: 0 2px 7px rgba(25,60,60,0.13); }
.slot-appointment-group:hover { z-index: 10; border-color: #7baaa3; box-shadow: 0 7px 18px rgba(25,60,60,0.2); }
.slot-appointment-group.has-simultaneous { border-color: #75a9a1; box-shadow: inset 3px 0 0 #75a9a1, 0 2px 7px rgba(25,60,60,0.13); }
.slot-group-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.3rem; min-height: 20px; padding: 1px 3px 1px 6px; background: #e8f1ef; border-bottom: 1px solid #d2dfdc; }
.slot-group-header strong { font-size: 0.61rem; font-variant-numeric: tabular-nums; }
.slot-group-header span { overflow: hidden; color: var(--muted); font-size: 0.52rem; text-overflow: ellipsis; white-space: nowrap; }
.slot-group-add { display: grid; place-items: center; width: 17px; height: 17px; padding: 0; border: 1px solid #abc5c0; border-radius: 5px; background: #fff; color: var(--primary-dark); font-size: 0.7rem; font-weight: 800; cursor: pointer; }
.slot-group-add:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot-group-list { display: grid; align-content: start; }
.slot-appointment-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 3px; min-width: 0; min-height: 15px; padding: 1px 4px 1px 3px; border: 0; border-bottom: 1px solid rgba(255,255,255,0.52); border-left: 3px solid; color: var(--text); text-align: left; cursor: pointer; transition: filter 120ms ease, box-shadow 120ms ease; }
.slot-appointment-row:last-child { border-bottom: 0; }
.slot-appointment-row:hover { filter: brightness(0.92); }
.slot-appointment-row.is-cancelled { opacity: 0.48; text-decoration: line-through; }
.slot-appointment-row.is-absence { box-shadow: inset 0 0 0 2px #b42335; }
.slot-code { min-width: 17px; padding: 1px 2px; border-radius: 3px; background: #243b53; color: #fff; font-size: 0.49rem; font-weight: 800; line-height: 1.05; text-align: center; }
.slot-patient { display: block; overflow: hidden; min-width: 0; font-size: 0.57rem; font-weight: 800; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.slot-professional { overflow: hidden; max-width: 46px; color: inherit; font-size: 0.46rem; font-weight: 700; opacity: 0.82; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.slot-appointment-group.is-dense .slot-group-header { min-height: 18px; }
.slot-appointment-group.is-dense .slot-appointment-row { min-height: 14px; }
.schedule-empty { margin: 1rem; padding: 1rem; color: var(--muted); text-align: center; }

/* Agenda B-Lista: cinco días, horas ordenadas y citas simultáneas apiladas. */
.agenda-list-grid { min-width: 1160px; background: #fff; }
.agenda-list-week { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); align-items: stretch; }
.agenda-list-day { min-width: 0; border-right: 1px solid var(--border); background: #fff; }
.agenda-list-day:last-child { border-right: 0; }
.agenda-list-day-header { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; min-height: 62px; padding: 0.72rem 0.8rem; background: rgba(255,255,255,0.97); border-bottom: 1px solid var(--border); }
.agenda-list-day-header strong, .agenda-list-day-header span { display: block; }
.agenda-list-day-header strong { font-size: 0.92rem; }
.agenda-list-day-header div > span { margin-top: 0.16rem; color: var(--muted); font-size: 0.69rem; }
.agenda-list-day-count { display: grid !important; place-items: center; min-width: 27px; height: 27px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-size: 0.7rem; font-weight: 800; }
.agenda-list-groups { display: grid; align-content: start; gap: 0.62rem; padding: 0.65rem; }
.agenda-time-group { overflow: hidden; border: 1px solid #dce7e5; border-radius: 10px; background: #fbfdfc; }
.agenda-time-group.has-simultaneous { border-color: #a9c8c3; box-shadow: inset 3px 0 0 #75a9a1; }
.agenda-time-group-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.45rem; min-height: 30px; padding: 0.3rem 0.4rem 0.3rem 0.55rem; background: #edf4f2; border-bottom: 1px solid #dce7e5; }
.agenda-time-group-header strong { font-size: 0.73rem; font-variant-numeric: tabular-nums; }
.agenda-time-group-header > span { color: var(--muted); font-size: 0.62rem; }
.agenda-list-add-time { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 1px solid #b8cbc7; border-radius: 7px; background: #fff; color: var(--primary-dark); font-size: 0.9rem; font-weight: 800; cursor: pointer; }
.agenda-list-add-time:hover { color: #fff; background: var(--primary); border-color: var(--primary); }
.appointment-list-card { display: block; width: calc(100% - 0.7rem); margin: 0.35rem; padding: 0.45rem 0.5rem; border: 1px solid rgba(23,48,51,0.12); border-left: 4px solid; border-radius: 8px; color: var(--text); text-align: left; cursor: pointer; box-shadow: 0 2px 6px rgba(25,60,60,0.08); }
.appointment-list-card + .appointment-list-card { margin-top: 0; }
.appointment-list-card:hover { border-color: rgba(18,108,112,0.4); box-shadow: 0 5px 13px rgba(25,60,60,0.14); }
.appointment-list-card.is-cancelled { opacity: 0.5; text-decoration: line-through; }
.appointment-list-card.is-absence { background: #fff0f1 !important; }
.appointment-list-title { display: flex; align-items: flex-start; gap: 0.32rem; min-width: 0; font-size: 0.74rem; font-weight: 800; line-height: 1.28; }
.appointment-list-title .patient-name { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.appointment-list-title .code-badge { flex: 0 0 auto; border-radius: 5px; padding: 1px 4px; font-size: 0.59rem; }
.appointment-list-status { flex: 0 0 auto; padding: 0.12rem 0.3rem; border-radius: 999px; background: rgba(255,255,255,0.7); color: #5b6c6e; font-size: 0.54rem; text-transform: uppercase; letter-spacing: 0.03em; }
.appointment-list-meta, .appointment-list-service { display: block; margin-top: 0.2rem; color: #4e6365; font-size: 0.63rem; line-height: 1.25; }
.appointment-list-meta { font-weight: 700; font-variant-numeric: tabular-nums; }
.appointment-list-service { overflow-wrap: anywhere; }
.agenda-list-empty { margin: 0; padding: 1.2rem 0.5rem; color: var(--muted); text-align: center; font-size: 0.74rem; }
.agenda-list-add-day { width: 100%; min-height: 34px; border: 1px dashed #b6cbc7; border-radius: 8px; background: #fff; color: var(--primary-dark); font-size: 0.68rem; font-weight: 750; cursor: pointer; }
.agenda-list-add-day:hover { background: var(--primary-soft); border-color: var(--primary); }

.print-agenda { display: none; }

dialog { width: min(94vw, 860px); border: 0; border-radius: 18px; padding: 0; color: var(--text); box-shadow: 0 30px 90px rgba(16,44,47,0.3); }
dialog::backdrop { background: rgba(8,31,34,0.54); backdrop-filter: blur(3px); }
.dialog-header { display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.dialog-header h2 { margin: 0; font-size: 1.2rem; }
.dialog-body { padding: 1.2rem; }
.dialog-footer { display: flex; justify-content: space-between; gap: 0.7rem; padding: 1rem 1.2rem; border-top: 1px solid var(--border); background: #f8faf9; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.55rem; }
.close-dialog { border: 0; background: transparent; font-size: 1.35rem; cursor: pointer; color: var(--muted); }
.warning-list { margin: 0.7rem 0 0; padding-left: 1.2rem; }
.field-help { display: block; color: var(--muted); font-size: 0.73rem; font-weight: 400; line-height: 1.45; }
.availability-panel { margin-top: 1.15rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.availability-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.availability-toolbar h3 { margin: 0.3rem 0 0; font-size: 1.05rem; }
.availability-panel .calendar-status { padding: 0.55rem 0; text-align: left; }
.availability-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 0.65rem; max-height: 330px; overflow: auto; padding: 0.15rem 0.15rem 0.55rem; }
.availability-day { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 0.35rem; padding: 0.55rem; background: var(--surface-soft); border-radius: 10px; }
.availability-day h4 { grid-column: 1 / -1; margin: 0 0 0.25rem; font-size: 0.78rem; text-transform: capitalize; }
.availability-slot { min-height: 32px; padding: 0.3rem 0.2rem; border: 1px solid #c7d6d3; border-radius: 7px; background: #fff; color: var(--text); font-size: 0.72rem; font-weight: 700; cursor: pointer; }
.availability-slot:hover { border-color: var(--primary); }
.availability-slot.is-recommended { background: #dff3e7; border-color: #9bcbae; color: #1d603c; }
.availability-slot.is-selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.availability-empty { grid-column: 1 / -1; color: var(--muted); font-size: 0.75rem; }
.recovery-comments { min-width: 210px; min-height: 58px; }
.data-table td > .small-text { display: block; margin-top: 0.35rem; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; max-width: 620px; gap: 2.2rem; }
  .login-intro h1 { font-size: 2.65rem; }
  .erp-shell { display: block; }
  .erp-sidebar { position: fixed; left: -250px; width: 238px; transition: left .18s ease; }
  .erp-sidebar.is-open { left: 0; box-shadow: 20px 0 50px rgba(8,31,34,0.3); }
  .erp-mobile-header { position: sticky; top: 0; z-index: 35; display: flex; align-items: center; gap: 0.75rem; min-height: 58px; padding: 0 1rem; background: rgba(243,247,246,0.94); border-bottom: 1px solid var(--border); backdrop-filter: blur(12px); }
  .erp-content { padding: 1rem; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .span-2, .span-3, .span-4, .span-6 { grid-column: span 1; }
  .span-12 { grid-column: 1 / -1; }
  .page-header { flex-direction: column; }
  .agenda-view-bar { align-items: flex-start; flex-direction: column; }
  .calendar-scroll { max-height: calc(100vh - 300px); }
  .availability-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .login-layout { padding: 1.2rem; }
  .login-intro { padding: 1rem 0.4rem 0; }
  .login-intro h1 { margin-top: 1.4rem; font-size: 2.15rem; }
  .login-intro p, .login-points { font-size: 0.95rem; }
  .form-grid { grid-template-columns: 1fr; }
  .span-12 { grid-column: span 1; }
  .agenda-toolbar { align-items: stretch; }
  .agenda-view-switcher { width: 100%; }
  .agenda-view-button { flex: 1; }
  .toolbar-group { width: 100%; }
  .toolbar-group select, .toolbar-group input { flex: 1; min-width: 120px; }
  .period-title { order: -1; width: 100%; }
  .availability-toolbar { flex-direction: column; }
  .availability-grid { grid-template-columns: 1fr; max-height: 420px; }
  .availability-day { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@page { size: A4 landscape; margin: 6mm; }

@media print {
  html, body { width: 100%; min-height: 0; background: #fff !important; }
  body { color: #111; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .erp-sidebar, .erp-mobile-header, .erp-content > :not(.print-agenda) { display: none !important; }
  .erp-shell, .erp-main, .erp-content { display: block !important; width: 100% !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; }
  .print-agenda { --print-row-font: 7.4pt; --print-row-padding: 0.8mm; display: block !important; width: 100%; max-height: 196mm; overflow: hidden; color: #111; font-family: Arial, sans-serif; }
  .print-agenda-header { display: grid; grid-template-columns: 1fr auto; align-items: end; column-gap: 5mm; margin-bottom: 2.4mm; padding-bottom: 1.8mm; border-bottom: 0.35mm solid #173033; }
  .print-agenda-brand { grid-column: 1 / -1; margin-bottom: 0.7mm; color: #30575a; font-size: 6.7pt; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
  .print-agenda-header h1 { margin: 0; font-size: 13pt; line-height: 1; }
  .print-agenda-header p { margin: 0; color: #4d5f61; font-size: 7pt; }
  .print-agenda-week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; border: 0.25mm solid #aab8b6; border-radius: 1.5mm; }
  .print-agenda-day { min-width: 0; border-right: 0.25mm solid #bac6c4; }
  .print-agenda-day:last-child { border-right: 0; }
  .print-agenda-day > header { display: flex; align-items: baseline; justify-content: space-between; gap: 1mm; padding: 1.2mm 1.4mm; background: #e8f0ee; border-bottom: 0.25mm solid #bac6c4; }
  .print-agenda-day > header strong { font-size: 8pt; text-transform: capitalize; }
  .print-agenda-day > header span { color: #4d5f61; font-size: 6.3pt; }
  .print-appointment { break-inside: avoid; padding: var(--print-row-padding) 1.1mm; border-bottom: 0.2mm solid #dce3e2; border-left: 1.2mm solid; font-size: var(--print-row-font); line-height: 1.12; }
  .print-appointment:last-child { border-bottom: 0; }
  .print-appointment.is-cancelled { opacity: 0.5; text-decoration: line-through; }
  .print-appointment.is-absence { background: #fff0f1; }
  .print-appointment-main { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; gap: 0.7mm; min-width: 0; }
  .print-appointment-time { font-variant-numeric: tabular-nums; }
  .print-code { display: inline-block; min-width: 4.8mm; padding: 0.25mm 0.6mm; border-radius: 0.7mm; background: #243b53; color: #fff; text-align: center; font-size: 0.82em; font-weight: 800; }
  .print-patient { min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
  .print-appointment-meta { margin-top: 0.35mm; padding-left: 0.2mm; color: #4d5f61; font-size: 0.88em; }
  .print-agenda-empty { margin: 0; padding: 4mm 1mm; color: #687779; text-align: center; font-size: 7pt; }
  .print-agenda-legend { display: flex; flex-wrap: wrap; gap: 2.4mm; margin-top: 1.7mm; color: #405456; font-size: 6.2pt; }
  .print-agenda-legend span { display: inline-flex; align-items: center; gap: 0.7mm; }
  .print-agenda-legend i { width: 2.3mm; height: 2.3mm; border-radius: 0.5mm; }
  .print-slots-head { display: grid; min-height: 7mm; border: 0.25mm solid #aab8b6; border-bottom: 0; background: #e8f0ee; }
  .print-slots-head > div { display: flex; align-items: center; justify-content: center; gap: 0.8mm; min-width: 0; padding: 0.8mm; border-right: 0.2mm solid #bac6c4; color: #405456; font-size: 5.6pt; }
  .print-slots-head > div:last-child { border-right: 0; }
  .print-slot-column-head i { flex: 0 0 auto; width: 2.2mm; height: 2.2mm; border-radius: 0.5mm; }
  .print-slot-column-head strong { overflow: hidden; min-width: 0; font-size: 6.5pt; text-overflow: ellipsis; white-space: nowrap; }
  .print-slot-column-head span { color: #536668; font-size: 5pt; white-space: nowrap; }
  .print-slots-body { display: grid; height: 171mm; overflow: hidden; border: 0.25mm solid #aab8b6; background: #fff; }
  .print-slots-axis, .print-slot-column { position: relative; min-width: 0; height: 100%; border-right: 0.2mm solid #bac6c4; }
  .print-slot-column:last-child { border-right: 0; }
  .print-slots-axis span { position: absolute; right: 1mm; transform: translateY(-50%); color: #405456; font-size: 4.9pt; font-variant-numeric: tabular-nums; }
  .print-slot-line { position: absolute; left: 0; right: 0; display: block; border-top: 0.15mm dotted #dfe7e5; }
  .print-slot-line.is-hour { border-top: 0.2mm solid #b7c7c4; }
  .print-slot-group { position: absolute; z-index: 2; overflow: hidden; padding: 0; border: 0.2mm solid #8fa8a4; border-radius: 0.6mm; background: rgba(255,255,255,0.98); }
  .print-slot-group.has-simultaneous { border-color: #477d76; }
  .print-slot-group > header { display: flex; align-items: center; justify-content: space-between; min-height: 2.5mm; padding: 0.2mm 0.5mm; background: #dfeae8; border-bottom: 0.15mm solid #b8cac7; font-size: 4.4pt; line-height: 1; }
  .print-slot-appointment { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.4mm; min-height: 1.75mm; padding: 0.1mm 0.35mm; border-bottom: 0.12mm solid rgba(255,255,255,0.55); border-left: 0.65mm solid; font-size: 4.25pt; line-height: 1.05; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-slot-appointment:last-child { border-bottom: 0; }
  .print-slot-appointment.is-cancelled { opacity: 0.5; text-decoration: line-through; }
  .print-slot-appointment.is-absence { box-shadow: inset 0 0 0 0.35mm #b42335; }
  .print-slot-appointment b { min-width: 2.7mm; padding: 0.15mm 0.25mm; border-radius: 0.3mm; background: #243b53; color: #fff; font-size: 0.85em; text-align: center; }
  .print-slot-appointment span { overflow: hidden; min-width: 0; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
  .print-slot-appointment .print-slot-patient { display: block; font-weight: 800; }
  .print-slot-appointment small { overflow: hidden; max-width: 11mm; color: inherit; font-size: 0.82em; opacity: 0.82; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
}
