:root {
    color-scheme: light;
    --ink: #20332e;
    --muted: #74837e;
    --green: #2f7562;
    --green-dark: #205747;
    --mint: #e8f2ed;
    --line: #e5ebe7;
    --paper: #ffffff;
    --background: #f5f8f6;
    --shadow: 0 20px 60px rgb(34 62 52 / 8%);
    --topbar-height: 88px;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    margin: 0;
    background: var(--background);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

select,
textarea {
    font: inherit;
}

.page-shell {
    width: min(1120px, calc(100% - 48px));
    min-height: 100vh;
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    isolation: isolate;
    display: flex;
    height: 88px;
    align-items: center;
    justify-content: space-between;
}

.topbar::before {
    position: absolute;
    z-index: -1;
    inset: 0 auto 0 50%;
    width: 100vw;
    transform: translateX(-50%);
    border-bottom: 1px solid var(--line);
    background: var(--background);
    box-shadow: 0 8px 18px rgb(34 62 52 / 6%);
    content: "";
    pointer-events: none;
}

.brand,
.user-menu,
.welcome-meta {
    display: flex;
    align-items: center;
}

.topbar-date {
    position: absolute;
    left: 50%;
    display: grid;
    gap: 5px;
    justify-items: center;
    transform: translateX(-50%);
    color: var(--ink);
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.clock-date {
    color: #71817a;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.clock-digits {
    display: flex;
    align-items: center;
    gap: 4px;
}

.clock-unit {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 48px;
    height: 48px;
    padding: 0 7px;
    border-radius: 10px;
    background: linear-gradient(#2c3330, #171c1a);
    color: #f2f6f3;
    font-size: 26px;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    letter-spacing: 0.6px;
    perspective: 260px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4),
        0 2px 6px rgba(16, 32, 24, 0.22);
    overflow: hidden;
}

.clock-unit::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.55);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07);
}

.clock-face {
    display: block;
    backface-visibility: hidden;
    transform-origin: center bottom;
}

.clock-face--next {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    transform: rotateX(90deg);
    opacity: 0;
}

.clock-unit.is-flipping .clock-face:not(.clock-face--next) {
    animation: clock-face-out 0.42s ease-in both;
}

.clock-unit.is-flipping .clock-face--next {
    animation: clock-face-in 0.42s ease-out both;
}

.clock-separator {
    color: #4b5c55;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    animation: clock-separator-blink 1s steps(1, end) infinite;
}

@keyframes clock-face-out {
    from {
        transform: rotateX(0deg);
        opacity: 1;
    }

    to {
        transform: rotateX(-90deg);
        opacity: 0;
    }
}

@keyframes clock-face-in {
    from {
        transform: rotateX(90deg);
        opacity: 0;
    }

    to {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

@keyframes clock-separator-blink {
    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0.35;
    }
}

.brand {
    gap: 11px;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 17px;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.brand strong {
    font-weight: 800;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    background: var(--green);
    color: white;
    font-size: 27px;
    font-weight: 500;
    line-height: 1;
}

.user-menu {
    position: relative;
    gap: 18px;
}

.user-greeting {
    color: var(--muted);
    font-size: 14px;
}

.user-menu form {
    margin: 0;
}

.account-hover {
    position: relative;
}

.account-hover-toggle {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--green-dark);
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease;
}

.account-hover-toggle:hover,
.account-hover:focus-within .account-hover-toggle {
    border-color: rgb(47 117 98 / 28%);
    background: var(--mint);
}

.account-hover-toggle:focus-visible {
    outline: 3px solid rgb(47 117 98 / 28%);
    outline-offset: 2px;
}

.account-hover-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.account-hover-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    display: none;
    min-width: 200px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.account-hover-panel::before {
    position: absolute;
    inset: -8px 0 auto;
    height: 8px;
    content: "";
}

.account-hover:hover .account-hover-panel,
.account-hover:focus-within .account-hover-panel {
    display: grid;
}

.account-hover-action {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.account-hover-action:hover,
.account-hover-action:focus-visible {
    background: var(--mint);
    color: var(--green-dark);
}

.account-hover-action svg {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.account-menu {
    display: none;
    position: relative;
}

.account-menu-toggle {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--green-dark);
    cursor: pointer;
    list-style: none;
}

.account-menu-toggle::-webkit-details-marker {
    display: none;
}

.account-menu-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
}

.account-menu-toggle:focus-visible {
    outline: 3px solid rgb(47 117 98 / 28%);
    outline-offset: 2px;
}

.account-menu-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 30;
    display: grid;
    min-width: 210px;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    box-shadow: var(--shadow);
    max-height: calc(100vh - var(--topbar-height) - 32px);
    max-height: calc(100dvh - var(--topbar-height) - 32px);
    overflow-y: auto;
}

.account-menu-popover .user-greeting {
    display: block;
}

.account-menu-popover .button {
    width: 100%;
}

.account-menu-nav {
    display: grid;
    gap: 2px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.account-menu-link {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.account-menu-link:hover,
.account-menu-link:focus-visible {
    background: var(--mint);
    color: var(--green-dark);
}

.account-menu-link.is-coming {
    color: var(--muted);
    cursor: default;
}

.account-menu-link.is-coming:hover,
.account-menu-link.is-coming:focus-visible {
    background: transparent;
    color: var(--muted);
}

.account-menu-badge {
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--mint);
    color: var(--green-dark);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.topbar-quicknav {
    display: none;
}

.topbar-quicknav-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--green-dark);
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease;
}

.topbar-quicknav-button:hover {
    border-color: var(--line);
    background: var(--mint);
}

.topbar-quicknav-button:focus-visible {
    outline: 3px solid rgb(47 117 98 / 28%);
    outline-offset: 2px;
}

.topbar-quicknav-button.is-coming {
    color: #9aa8a2;
    cursor: default;
}

.topbar-quicknav-button.is-coming:hover {
    border-color: transparent;
    background: transparent;
}

.topbar-quicknav-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: background 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:disabled,
.button[disabled] {
    opacity: 0.42;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
}

.button:focus-visible,
input:focus-visible {
    outline: 3px solid rgb(47 117 98 / 28%);
    outline-offset: 2px;
}

.button-quiet {
    padding: 0 14px;
    background: transparent;
    color: var(--green-dark);
}

.button-quiet:hover {
    background: var(--mint);
}

.button-primary {
    background: var(--green);
    color: #fff;
}

.button-primary:hover {
    background: var(--green-dark);
}

.button-secondary {
    border: 1px solid #cfe0d7;
    background: #f4faf6;
    color: var(--green-dark);
}

.button-secondary:hover {
    border-color: #b9d4c6;
    background: var(--mint);
}

.button-full {
    width: 100%;
    margin-top: 8px;
}

.notice {
    margin-top: 24px;
    padding: 14px 18px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.55;
}

.notice-info {
    border-color: #c8dcd3;
    background: #edf5f1;
    color: #275b4b;
}

.notice-error {
    border-color: #f0c6bd;
    background: #fff3f0;
    color: #9e3f31;
}

.notice code {
    font-size: 0.94em;
    font-weight: 700;
}

.notice-toast {
    position: fixed;
    top: max(16px, env(safe-area-inset-top, 0px));
    right: max(16px, calc((100vw - 1120px) / 2));
    z-index: 50;
    width: min(440px, calc(100vw - 32px));
    margin: 0;
    padding-right: 48px;
    box-shadow: var(--shadow);
    animation: toast-appear 180ms ease-out;
    transition: opacity 180ms ease, transform 180ms ease;
}

.notice-toast-dismissed {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
}

.notice-dismiss {
    position: absolute;
    top: 7px;
    right: 8px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: currentColor;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.notice-dismiss:hover,
.notice-dismiss:focus-visible {
    background: rgb(32 51 46 / 8%);
}

@keyframes toast-appear {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-layout {
    display: grid;
    min-height: 620px;
    grid-template-columns: 1.12fr 0.88fr;
    align-items: center;
    gap: 80px;
    padding: 56px 0;
}

.welcome-panel {
    position: relative;
    overflow: hidden;
    padding: 54px 48px;
    border-radius: 28px;
    background: linear-gradient(145deg, #255f4e, #397d68);
    box-shadow: var(--shadow);
    color: #fff;
}

.welcome-panel::after {
    position: absolute;
    right: -82px;
    bottom: -132px;
    width: 340px;
    height: 340px;
    border: 1px solid rgb(255 255 255 / 13%);
    border-radius: 50%;
    box-shadow: 0 0 0 38px rgb(255 255 255 / 5%), 0 0 0 82px rgb(255 255 255 / 4%);
    content: "";
}

.eyebrow {
    display: block;
    color: var(--green);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.25px;
    margin: 0 0 7px 0;
    text-transform: uppercase;
}

.welcome-panel .eyebrow {
    color: #b6dfcf;
}

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

h1,
h2,
h3 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: -0.8px;
}

.welcome-panel h1 {
    position: relative;
    z-index: 1;
    margin: 24px 0 17px;
    font-size: clamp(32px, 4vw, 46px);
    line-height: 1.17;
}

.welcome-panel > p {
    position: relative;
    z-index: 1;
    max-width: 390px;
    margin-bottom: 45px;
    color: #d6e8e1;
    font-size: 15px;
    line-height: 1.8;
}

.welcome-meta {
    position: relative;
    z-index: 1;
    gap: 10px;
    color: #e4f0eb;
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9fe3bf;
    box-shadow: 0 0 0 4px rgb(159 227 191 / 15%);
}

.login-card {
    width: 100%;
    max-width: 390px;
    justify-self: center;
}

.login-card h2 {
    margin: 12px 0 8px;
    font-size: 30px;
}

.muted,
.login-help {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.login-card > .muted {
    margin-bottom: 28px;
}

.login-form {
    display: grid;
    gap: 11px;
}

.login-form label {
    margin-top: 4px;
    color: #42534d;
    font-size: 13px;
    font-weight: 700;
}

.login-form input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #dfe7e2;
    border-radius: 11px;
    background: var(--paper);
    color: var(--ink);
}

.login-form input:focus {
    border-color: #78a895;
}

.login-help {
    margin-top: 19px;
    font-size: 12px;
}

.dashboard-heading,
.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
}

.dashboard-heading {
    margin: 54px 0 28px;
}

.dashboard-heading h1 {
    margin: 9px 0 4px;
    font-size: 34px;
}

.dashboard-heading .muted {
    margin-bottom: 0;
}

.date-chip {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: #53645e;
    font-size: 12px;
    font-weight: 700;
}

.dashboard-upcoming {
    margin: 20px 0 38px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--paper);
    box-shadow: 0 6px 20px rgb(34 62 52 / 3%);
}

/* La barra superior y el monitor llenan una pantalla; el pie queda fuera de
   ese bloque y se alcanza con el scroll de la página. */
.dashboard-page {
    min-height: 100vh;
    min-height: 100dvh;
}

/* El monitor ocupa una pantalla y no tiene scroll propio: muestra solo lo que
   sigue y lo que no cabe queda fuera, no oculto tras una barra de desplazamiento. */
.dashboard-page .dashboard-viewport {
    display: flex;
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
}

/* En el login no hay monitor: el bloque no debe empujar el pie de página. */
.dashboard-page .dashboard-viewport:not(:has(.dashboard-upcoming)) {
    height: auto;
    min-height: 0;
}

.dashboard-page .dashboard-upcoming {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 20px;
}

.dashboard-page .upcoming-table-frame {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.dashboard-page .upcoming-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.upcoming-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
}

.upcoming-heading h2 {
    margin: 5px 0 0;
    font-size: 22px;
}

.upcoming-note {
    margin: 8px 0 15px;
    color: #64736d;
    font-size: 12px;
    line-height: 1.45;
}

.upcoming-note-warning {
    color: #8c4a16;
}

.upcoming-heading .button {
    flex: 0 0 auto;
    padding: 0 14px;
    font-size: 13px;
}

.start-dialog-text {
    margin: 14px 0 0;
}

.start-dialog-note {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.start-dialog-fields {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.upcoming-row-activity .upcoming-medication strong {
    overflow-wrap: normal;
}

.upcoming-note code {
    font-size: 0.94em;
    font-weight: 700;
}

.upcoming-table-frame {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.upcoming-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    text-align: left;
}

.upcoming-table th,
.upcoming-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #edf1ee;
    vertical-align: middle;
}

.upcoming-table tr:last-child td {
    border-bottom: 0;
}

.upcoming-table th,
.medication-table th {
    background: #f8faf8;
    color: #74837e;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.25px;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.upcoming-table th:first-child {
    width: 38%;
}

.upcoming-table th:nth-child(2) {
    width: 18%;
}

.upcoming-table th:nth-child(3),
.upcoming-table th:nth-child(4) {
    width: 22%;
    text-align: center;
}

.upcoming-medication {
    min-width: 0;
}

.upcoming-medication strong,
.upcoming-patient,
.upcoming-time span {
    display: block;
}

.upcoming-medication strong,
.medication-table td strong {
    color: var(--ink);
    font-size: 16px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.upcoming-patient {
    margin-bottom: 3px;
    color: #71817a;
    font-size: 10px;
    line-height: 1.25;
}

.upcoming-time time {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 999px;
    background: #e8f4ec;
    color: #24633b;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.upcoming-time .upcoming-time-status--late-warning {
    background: #fff3cc;
    color: #805c00;
}

.upcoming-time .upcoming-time-status--late-critical {
    background: #fde7e4;
    color: #a12e24;
}

.upcoming-time .upcoming-time-status--idle {
    background: #eef1f0;
    color: #4b5c55;
}

.upcoming-time span {
    margin-top: 2px;
    color: #71817a;
    font-size: 10px;
}

.upcoming-action-cell {
    text-align: center;
}

.icon-action {
    display: inline-grid;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    border: 1px solid #d5e5dc;
    border-radius: 50%;
    background: #f2f8f4;
    color: var(--green-dark);
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.icon-action:hover,
.icon-action:focus-visible {
    border-color: #9dc2ad;
    background: #e4f1e9;
}

.icon-action:focus-visible {
    outline: 3px solid rgb(47 117 98 / 28%);
    outline-offset: 2px;
}

.icon-action:active {
    transform: scale(0.96);
}

.icon-action:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.icon-action svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.icon-action-camera {
    border-color: #c9ded1;
    background: #eaf4ed;
}

.evidence-form {
    position: relative;
    display: inline-grid;
    margin: 0;
}

.upcoming-empty {
    padding: 19px 12px !important;
    color: #71817a;
    font-size: 12px;
    text-align: center;
}

.instructions-dialog-text {
    color: #43544d;
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-line;
}

.instructions-dialog-subtitle {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.vital-group {
    display: block;
}

.vital-group[hidden],
.instructions-vitals[hidden],
.instructions-vitals-row[hidden],
.instructions-vitals-grid[hidden],
[data-vital-group][hidden] {
    display: none !important;
}

.instructions-vitals {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.instructions-vitals-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.instructions-vitals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit input {
    width: 100%;
    padding-right: 52px;
}

.input-unit-badge {
    position: absolute;
    right: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
}

@media (max-width: 600px) {
    .instructions-vitals-grid,
    .instructions-vitals-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.camera-dialog {
    width: min(560px, calc(100% - 32px));
}

.camera-preview {
    display: block;
    width: 100%;
    max-height: min(58vh, 560px);
    border-radius: 12px;
    background: #17231e;
    object-fit: contain;
}

.camera-preview[hidden] {
    display: none;
}

.camera-status {
    min-height: 42px;
    margin: 12px 0 0;
    color: #53645e;
    font-size: 13px;
    line-height: 1.5;
}

.camera-canvas {
    display: none;
}

.patient-avatar {
    display: grid;
    width: 56px;
    height: 56px;
    place-items: center;
    border-radius: 17px;
    background: var(--mint);
    color: var(--green-dark);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 22px;
    font-weight: 800;
}

.card-arrow {
    align-self: start;
    color: #94a49d;
    font-size: 18px;
}

.section-heading {
    margin: 46px 0 17px;
}

.section-heading h2 {
    margin: 6px 0 0;
    font-size: 22px;
}

.breadcrumbs {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    color: #97a49e;
    font-size: 12px;
}

.breadcrumbs a {
    color: var(--green);
    text-decoration: none;
}

.medication-heading {
    margin-top: 34px;
}

.form-field label {
    color: #42534d;
    font-size: 12px;
    font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
    min-width: 0;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #dfe7e2;
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
}

.form-field textarea {
    min-height: 88px;
    padding-top: 11px;
    resize: vertical;
}

.form-field input:focus-visible,
.form-field select:focus-visible {
    border-color: #78a895;
}

.medication-panel {
    margin-top: 24px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--paper);
    box-shadow: 0 6px 20px rgb(34 62 52 / 3%);
}

.medication-workflow {
    display: flex;
    flex-direction: column;
}

.medication-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: -6px 0 20px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #edf2ef;
}

.medication-action {
    min-height: 48px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--paper);
    color: var(--green-dark);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    box-shadow: 0 2px 8px rgb(34 62 52 / 9%);
}

.medication-action:hover {
    border-color: #c9d8d1;
    background: #ffffff;
}

.medication-action:focus-visible {
    outline: 3px solid rgb(47 117 98 / 35%);
    outline-offset: 2px;
}

.medication-dialog {
    width: min(720px, calc(100% - 32px));
    height: min(78vh, 720px);
    max-height: min(78vh, 720px);
    overflow-y: auto;
}

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

.photo-source-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 56px;
    padding: 12px 16px;
    border: 1.5px dashed #b8ccc3;
    border-radius: 12px;
    background: #f7faf8;
    color: var(--green-dark);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.photo-source-option svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.photo-source-option:hover {
    border-color: #78a895;
    background: #f0f6f2;
}

.photo-source-option:focus-visible {
    outline: 3px solid rgb(47 117 98 / 35%);
    outline-offset: 2px;
}

.photo-selected {
    margin: 10px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: #e9f2ec;
    color: var(--green-dark);
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.photo-selected[hidden] {
    display: none;
}

.medication-dialog .dialog-header--compact {
    align-items: center;
    margin-bottom: 12px;
}

.medication-dialog .dialog-header--compact h2 {
    margin: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

.panel-heading {
    margin: 0 0 22px;
}

.panel-heading h2 {
    margin: 6px 0 0;
    font-size: 21px;
}

.medication-form,
.inventory-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.wizard-progress {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0 0 8px;
    list-style: none;
}

.wizard-progress li {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
    padding: 10px;
    border-bottom: 2px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.wizard-progress li[aria-current="step"] {
    border-color: var(--green);
    color: var(--ink);
}

.wizard-progress li.is-complete {
    border-color: #9dc2b2;
    color: var(--green-dark);
}

.wizard-progress li span {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    place-items: center;
    border-radius: 50%;
    background: #edf1ee;
    font-weight: 700;
}

.wizard-progress li[aria-current="step"] span,
.wizard-progress li.is-complete span {
    background: var(--green);
    color: #fff;
}

.wizard-step {
    display: grid;
    grid-column: 1 / -1;
    gap: 18px;
}

.wizard-step[hidden] {
    display: none;
}

.wizard-step-heading h3 {
    margin: 5px 0 0;
    font-size: 18px;
}

.wizard-step-heading p {
    margin: 7px 0 0;
}

.wizard-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 4px;
}

.wizard-file-note {
    grid-column: 1 / -1;
    margin: -4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

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

.form-field small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.form-field input[readonly] {
    background: #f4f7f5;
    color: #65756e;
}

.form-field[hidden],
.form-field [hidden] {
    display: none;
}

.schedule-weekdays {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.schedule-weekdays legend {
    margin-bottom: 8px;
    color: #42534d;
    font-size: 12px;
    font-weight: 700;
}

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

.weekday-options label {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    border: 1px solid #dfe7e2;
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
    font-size: 12px;
}

.weekday-options input[type="checkbox"] {
    width: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: transparent;
    accent-color: var(--green);
}

.weekday-options label:has(input:checked) {
    border-color: #78a895;
    background: #edf5f1;
}

.form-span-2 {
    grid-column: span 2;
}

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

.required-mark {
    color: #bd5a4b;
}

.optional-mark {
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
    text-transform: none;
}

.prescription-link {
    color: var(--green);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.prescription-link:hover {
    color: var(--green-dark);
    text-decoration: underline;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 3px;
}

.form-actions .button {
    padding: 0 20px;
}

.inventory-panel {
    padding-bottom: 26px;
}

.inventory-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.as-needed-registry {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.as-needed-registry > h3 {
    margin: 0 0 14px;
    font-size: 15px;
}

.as-needed-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.as-needed-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfcfb;
}

.as-needed-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.as-needed-trigger {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    color: var(--green-dark);
    font-size: 12px;
    font-weight: 600;
}

.as-needed-trigger strong {
    font-weight: 800;
}

.as-needed-card h4 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 15px;
}

.as-needed-card h4 small {
    margin-left: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.as-needed-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin: 0 0 10px;
}

.as-needed-meta dt {
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.35px;
    text-transform: uppercase;
}

.as-needed-meta dd {
    margin: 3px 0 0;
    color: #43544d;
    font-size: 12px;
}

.as-needed-instructions {
    margin: 0 0 12px;
    color: #43544d;
    font-size: 12px;
    line-height: 1.55;
}

.as-needed-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.as-needed-actions form {
    margin: 0;
}

.table-panel {
    margin-top: 24px;
    padding: 24px 0 0;
    overflow: hidden;
}

.table-panel > .panel-heading {
    padding: 0 24px;
}

.table-scroll {
    overflow-x: auto;
}

.medication-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    text-align: left;
}

.medication-board .medication-actions {
    margin-top: 12px;
}

.medication-table th {
    white-space: nowrap;
    overflow-wrap: normal;
}

.medication-table th:first-child {
    width: 38%;
}

.medication-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #edf1ee;
    color: #43544d;
    font-size: 16px;
    line-height: 1.55;
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: anywhere;
}

.medication-table th:nth-child(2),
.medication-table th:nth-child(4) {
    width: 22%;
}

.medication-table th:nth-child(3) {
    width: 18%;
}

.medication-table th:not(:first-child),
.medication-table td:not(:first-child) {
    padding-right: 4px;
    padding-left: 4px;
    text-align: center;
}

.medication-table .icon-action {
    min-width: 44px;
    min-height: 44px;
}

.medication-table td strong {
    display: block;
}

.medication-table td small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.medication-table .table-badge {
    font-size: 14px;
}

.medication-table .stock-low {
    color: #a76e24;
}

.medication-table .stock-empty {
    color: #b94f42;
}

.table-badge {
    display: inline-block;
    margin-top: 5px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #eff2f0;
    color: #78857f;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-low {
    background: #fbf1df;
    color: #95651e;
}

.badge-empty {
    background: #fbecea;
    color: #a74d40;
}

.table-footnote {
    margin: 0;
    padding: 14px 24px 18px;
    color: var(--muted);
    font-size: 11px;
}

.table-action {
    min-height: 34px;
    padding: 0 9px;
    border: 1px solid var(--line);
    white-space: nowrap;
}

.table-action span {
    margin-right: 5px;
    font-size: 15px;
}

.delete-medication-form {
    display: flex;
    justify-content: center;
}

.icon-button {
    display: inline-grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--paper);
    color: #64736d;
    cursor: pointer;
    font: inherit;
}

.icon-button:hover {
    background: var(--mint);
    color: var(--green-dark);
}

.icon-button:focus-visible,
.table-action:focus-visible {
    outline: 3px solid rgb(47 117 98 / 28%);
    outline-offset: 2px;
}

.icon-button svg {
    width: 19px;
    height: 19px;
}

.delete-button {
    border-color: #f0d7d2;
    color: #a64e43;
}

.delete-button:hover {
    border-color: #e7bdb5;
    background: #fff3f0;
    color: #923d33;
}

.detail-dialog,
.confirm-dialog {
    width: min(620px, calc(100% - 32px));
    max-height: min(82vh, 760px);
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--paper);
    box-shadow: 0 24px 80px rgb(23 44 36 / 24%);
    color: var(--ink);
}

.detail-dialog::backdrop,
.confirm-dialog::backdrop {
    background: rgb(25 42 35 / 48%);
    backdrop-filter: blur(2px);
}

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

.dialog-header h2 {
    margin: 7px 0 0;
    font-size: 24px;
}

.dialog-close {
    font-size: 24px;
    line-height: 1;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
    margin: 0;
}

.detail-list > div {
    padding: 13px 0;
    border-bottom: 1px solid #edf1ee;
}

.detail-list dt {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.end-medication-form {
    margin-top: 20px;
}

.end-medication-form .button {
    padding: 0 16px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.dialog-actions .button {
    padding: 0 17px;
}

.dialog-actions--centered {
    justify-content: center;
    gap: 12px;
}

.dialog-actions--centered .button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 12px;
}

.dialog-status {
    margin: 16px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff4f0;
    color: #923d33;
    font-size: 13px;
    line-height: 1.5;
}

.dialog-status[hidden] {
    display: none;
}

.confirm-dialog > p {
    color: #53645e;
    font-size: 14px;
    line-height: 1.7;
}

.confirm-dialog > p strong {
    color: var(--ink);
}

.patient-picker-dialog {
    width: min(480px, calc(100% - 32px));
}

.patient-choice-list {
    display: grid;
    gap: 10px;
}

.patient-choice {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 64px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    text-decoration: none;
}

.patient-choice:hover,
.patient-choice:focus-visible {
    border-color: var(--green);
    background: #f5f8f6;
}

.patient-choice .patient-avatar {
    flex: 0 0 38px;
    margin: 0;
}

.patient-choice > span:nth-child(2) {
    flex: 1;
    color: var(--muted);
    font-size: 13px;
}

.patient-choice strong {
    color: var(--ink);
}

.button-danger {
    background: #a94c40;
    color: #fff;
}

.button-danger:hover {
    background: #893b32;
}

.empty-state {
    padding: 16px 24px 32px;
    text-align: center;
}

.empty-icon {
    display: inline-grid;
    width: 48px;
    height: 48px;
    place-items: center;
    margin-bottom: 10px;
    border-radius: 15px;
    background: var(--mint);
    color: var(--green);
    font-size: 24px;
}

.empty-state h3 {
    margin-bottom: 7px;
    font-size: 16px;
}

.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 12px;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 50px;
    padding: 20px 0 26px;
    border-top: 1px solid var(--line);
    color: #87958f;
    font-size: 11px;
}

@media (min-width: 1025px) {
    .topbar-quicknav {
        display: flex;
        gap: 6px;
        margin-left: auto;
        margin-right: 18px;
    }
}

@media (max-width: 1024px) {
    .topbar-date {
        position: static;
        margin-left: auto;
        margin-right: 12px;
        transform: none;
        text-align: right;
    }

    .user-menu {
        gap: 10px;
    }

    .account-hover {
        display: none;
    }

    .account-menu {
        display: block;
    }

    .notice-toast {
        top: calc(var(--topbar-height) + env(safe-area-inset-top, 0px) + 10px);
        right: 16px;
    }
}

@media (max-width: 780px) {
    .login-layout {
        min-height: auto;
        grid-template-columns: 1fr;
        gap: 34px;
        padding: 36px 0;
    }

    .welcome-panel {
        padding: 38px 30px;
    }

    .welcome-panel > p {
        margin-bottom: 30px;
    }

    .login-card {
        max-width: 460px;
        padding: 0 8px;
    }

    .medication-form,
    .inventory-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .medication-panel {
        padding: 20px;
    }

    .table-panel {
        padding: 20px 0 0;
    }
}

@media (max-width: 560px) {
    :root {
        --topbar-height: 72px;
    }

    .page-shell {
        width: min(100% - 32px, 480px);
    }

    .topbar {
        height: 72px;
    }

    .brand {
        gap: 0;
    }

    .brand > span:not(.brand-mark) {
        display: none;
    }

    .topbar-date {
        gap: 3px;
        justify-items: start;
        margin-left: 10px;
        margin-right: auto;
        text-align: left;
    }

    .clock-date {
        font-size: 8px;
        letter-spacing: 0.4px;
    }

    .clock-digits {
        gap: 3px;
    }

    .clock-unit {
        min-width: 34px;
        height: 34px;
        padding: 0 4px;
        border-radius: 7px;
        font-size: 18px;
    }

    .clock-separator {
        font-size: 15px;
    }

    .user-menu {
        margin-left: auto;
        gap: 5px;
    }

    .user-greeting {
        display: none;
    }

    .account-menu-popover .user-greeting {
        display: block;
    }

    .button-quiet {
        padding: 0 8px;
        font-size: 12px;
    }

    .welcome-panel {
        padding: 32px 25px;
        border-radius: 21px;
    }

    .welcome-panel h1 {
        font-size: 32px;
    }

    .dashboard-heading {
        align-items: start;
        gap: 10px;
        margin: 18px 0 12px;
    }

    .medication-heading {
        flex-direction: column;
    }

    .dashboard-heading h1 {
        font-size: 23px;
    }

    .date-chip {
        padding: 7px 8px;
        font-size: 10px;
    }

    .dashboard-upcoming {
        margin-bottom: 24px;
        padding: 12px;
        border-radius: 15px;
    }

    .upcoming-heading h2 {
        font-size: 18px;
    }

    .upcoming-heading {
        flex-wrap: wrap;
    }

    .upcoming-heading .button {
        width: 100%;
    }

    .upcoming-note {
        margin: 6px 0 10px;
        font-size: 10px;
    }

    .upcoming-table th,
    .upcoming-table td,
    .medication-table th,
    .medication-table td {
        padding: 7px 4px;
    }

    .upcoming-table th,
    .medication-table th {
        font-size: 9px;
        letter-spacing: 0;
    }

    .upcoming-medication strong,
    .medication-table td strong {
        font-size: 14px;
    }

    .upcoming-patient,
    .upcoming-time span {
        font-size: 9px;
    }

    .upcoming-time time {
        font-size: 12px;
    }

    .icon-action {
        width: 42px;
        height: 42px;
    }

    .medication-form,
    .inventory-form {
        grid-template-columns: 1fr;
        gap: 13px;
    }

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

    .wizard-progress {
        gap: 4px;
    }

    .wizard-progress li {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding: 8px 4px;
        font-size: 10px;
    }

    .wizard-progress li span {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
    }

    .form-span-2 {
        grid-column: auto;
    }

    .medication-panel {
        padding: 17px;
    }

    .table-panel {
        padding: 17px 0 0;
    }

    .table-panel > .panel-heading,
    .table-footnote {
        padding-right: 17px;
        padding-left: 17px;
    }

    .form-actions .button {
        width: 100%;
    }

    .detail-dialog,
    .confirm-dialog {
        padding: 20px;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }

    .dialog-actions .button {
        flex: 1;
        padding: 0 10px;
    }

    .footer {
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 560px) {
    .medication-action {
        padding: 8px 6px;
        font-size: 11px;
    }

    .as-needed-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .notice-toast {
        animation: none;
        transition: none;
    }

    .clock-separator {
        animation: none;
        opacity: 1;
    }
}

/* Archivo de documentos */

.doc-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.doc-topbar .doc-patient,
.doc-topbar .doc-actions {
    margin-top: 0;
}

.doc-patient {
    display: inline-flex;
    gap: 4px;
    margin-top: 18px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--background);
}

.doc-patient-link {
    padding: 7px 16px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.doc-patient-link.is-active {
    background: var(--paper);
    color: var(--green-dark);
    box-shadow: 0 2px 8px rgb(34 62 52 / 10%);
}

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

.doc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 22px;
    margin-top: 18px;
    padding-bottom: 40px;
}

.doc-main,
.doc-side-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--paper);
}

.doc-main {
    min-width: 0;
    padding: 18px;
}

.doc-side {
    display: grid;
    gap: 16px;
}

.doc-side-card {
    padding: 18px;
}

.doc-side-card h2 {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.doc-side-card ol,
.doc-side-card ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.doc-side-card .doc-meta {
    margin: 0;
}

.doc-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.doc-stat {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--background);
    color: inherit;
    text-decoration: none;
}

.doc-stat:hover,
.doc-stat:focus-visible,
.doc-stat.is-active {
    border-color: #cfe0d8;
    background: var(--mint);
}

.doc-stat strong {
    display: block;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
}

.doc-stat span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.doc-toolbar {
    display: grid;
    gap: 10px;
    margin: 0 0 6px;
}

.doc-toolbar input[type="search"] {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
    font-size: 14px;
}

.doc-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.doc-chip {
    flex: none;
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
}

.doc-chip:hover,
.doc-chip:focus-visible {
    border-color: #cfe0d8;
}

.doc-chip.is-active {
    border-color: transparent;
    background: var(--green);
    color: #fff;
}

.doc-summary {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.doc-summary a {
    color: var(--green);
    font-weight: 700;
}

.doc-year {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.doc-year::after {
    height: 1px;
    flex: 1;
    background: var(--line);
    content: "";
}

.doc-list {
    display: grid;
    gap: 10px;
}

.doc-card {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.doc-card:hover {
    border-color: #cfe0d8;
    box-shadow: 0 10px 24px rgb(34 62 52 / 7%);
}

.doc-thumb {
    display: grid;
    height: 72px;
    place-items: center;
    border-radius: 10px;
    background: var(--mint);
    color: var(--green-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: center;
    line-height: 1.35;
}

.doc-thumb.is-pdf {
    background: #fdeeea;
    color: #a3412c;
}

.doc-thumb-img {
    width: 56px;
    height: 72px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--background);
}

.doc-body {
    min-width: 0;
}

.doc-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.doc-meta {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.doc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}

.doc-tag {
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--background);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.doc-tag.is-study {
    background: #e8f2ed;
    color: var(--green-dark);
}

.doc-tag.is-consultation {
    background: #eef1fb;
    color: #3b4a8f;
}

.doc-tag.is-prescription {
    background: #fdeeea;
    color: #a3412c;
}

.doc-tag.is-linked {
    background: #f4efe2;
    color: #7a6231;
}

.doc-actions-inline {
    display: grid;
    justify-items: end;
    gap: 6px;
}

.doc-open {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    color: var(--green-dark);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.doc-open:hover,
.doc-open:focus-visible {
    background: var(--mint);
}

.doc-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 11px;
}

.doc-pages a {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--background);
    color: var(--muted);
    text-decoration: none;
}

.doc-pages a:hover,
.doc-pages a:focus-visible {
    background: var(--mint);
    color: var(--green-dark);
}

.doc-empty {
    margin-top: 18px;
    border: 1px dashed var(--line);
    border-radius: 16px;
    background: var(--paper);
}

.document-dialog {
    width: min(680px, calc(100% - 32px));
}

.document-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.document-form .form-field {
    display: grid;
    gap: 6px;
    align-content: start;
}

.document-form .dialog-actions {
    margin-top: 4px;
}

.doc-field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.doc-field-hint.is-error {
    color: #a3412c;
    font-weight: 700;
}

@media (min-width: 900px) {
    .doc-layout {
        grid-template-columns: minmax(0, 1fr) 288px;
    }
}

@media (max-width: 560px) {
    .doc-card {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .doc-thumb {
        height: 56px;
    }

    .doc-thumb-img {
        width: 44px;
        height: 56px;
    }

    .doc-actions-inline {
        grid-column: 1 / -1;
        justify-items: stretch;
    }

    .doc-open {
        justify-content: center;
    }

    .document-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .document-form .form-span-2 {
        grid-column: auto;
    }
}

.account-menu-link[aria-current="page"] {
    background: var(--mint);
    color: var(--green-dark);
}

.topbar-quicknav-button[aria-current="page"] {
    border-color: var(--line);
    background: var(--mint);
}

.doc-choices {
    margin-top: 14px;
}

/* ══════════════════════════════════════════
   Signos vitales – tabla e historial
   ══════════════════════════════════════════ */

/* La tabla de signos vitales reutiliza .dashboard-upcoming y .upcoming-table
   del dashboard; aquí sólo se ajustan los anchos de sus 5 columnas. */
.vitals-board .upcoming-table th:first-child {
    width: 14%;
}

.vitals-board .upcoming-table th:nth-child(2) {
    width: 14%;
}

.vitals-board .upcoming-table th:nth-child(3),
.vitals-board .upcoming-table th:nth-child(4),
.vitals-board .upcoming-table th:nth-child(5) {
    width: 24%;
    text-align: center;
}

.vitals-board .upcoming-table td.vitals-td-value {
    text-align: center;
}

.vitals-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.vitals-board .upcoming-table {
    min-width: 640px;
}

/* ── Paginación ── */
.vitals-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.vitals-pagination a,
.vitals-pagination span {
    display: inline-flex;
    min-width: 36px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--ink);
    background: var(--paper);
    padding: 0 8px;
}

.vitals-pagination a:hover {
    background: var(--mint);
    border-color: var(--green);
}

.vitals-pagination .is-current {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}

.vitals-pagination .is-disabled {
    opacity: .4;
    pointer-events: none;
}

.vitals-pagination-summary {
    text-align: center;
    font-size: 12px;
    margin-top: 8px;
}

/* ── Modal foto ── */
.vitals-photo-dialog {
    width: min(680px, calc(100% - 32px));
    border: none;
    border-radius: 20px;
    padding: 0;
    box-shadow: var(--shadow);
    background: var(--paper);
}

.vitals-photo-dialog::backdrop {
    background: rgb(0 0 0 / 55%);
}

.vitals-photo-dialog-inner {
    display: flex;
    flex-direction: column;
}

.vitals-photo-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 0;
}

.vitals-photo-dialog-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
}

.vitals-photo-dialog-body {
    padding: 16px 20px 20px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vitals-photo-img {
    display: block;
    width: 100%;
    border-radius: 10px;
    max-height: 70vh;
    object-fit: contain;
}

.vitals-photo-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}

.vitals-photo-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--line);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: vitals-spin .7s linear infinite;
    display: block;
}

@keyframes vitals-spin {
    to { transform: rotate(360deg); }
}

.vitals-photo-error {
    text-align: center;
    font-size: 14px;
}

/* ── Tabla por fecha y turno ── */
.vitals-td-day {
    white-space: nowrap;
    font-weight: 600;
    vertical-align: top;
    padding-top: 16px;
    border-right: 1px solid var(--line);
    background: var(--paper);
}

.vitals-td-shift {
    white-space: nowrap;
    font-size: 13px;
    color: var(--muted);
}

.vitals-td-value {
    min-width: 110px;
}

.vitals-cell-btn {
    display: inline-block;
    border: none;
    background: none;
    padding: 2px 4px;
    margin: -2px -4px;
    font: inherit;
    font-weight: 600;
    color: var(--green-dark);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    cursor: pointer;
    border-radius: 6px;
    white-space: nowrap;
}

.vitals-cell-btn:hover {
    color: var(--green);
    background: var(--mint);
    text-decoration-style: solid;
}

.vitals-cell-btn:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 1px;
}

.vitals-cell-plain {
    white-space: nowrap;
}

.vitals-cell-photo {
    text-decoration: none;
    padding: 4px;
    margin: -4px;
}

.vitals-cell-photo svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

/* ── Metadatos del modal de evidencia ── */
.vitals-photo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
    margin: 0;
    padding: 12px 20px 0;
}

.vitals-photo-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vitals-photo-meta-item dt {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.vitals-photo-meta-item dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}
