:root {
    --appointment-ink: #143042;
    --appointment-muted: #617785;
    --appointment-primary: #0b6b74;
    --appointment-primary-dark: #07545d;
    --appointment-accent: #dff4f1;
    --appointment-border: #dce6eb;
    --appointment-bg: #f4f8fa;
    --appointment-white: #fff;
    --appointment-danger: #a43131;
    --appointment-danger-soft: #fff1f1;
    --appointment-success: #146c52;
    --appointment-shadow: 0 18px 45px rgba(18, 54, 72, .09);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body.appointment-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 8% 0, rgba(45, 170, 164, .11), transparent 25rem),
        var(--appointment-bg);
    color: var(--appointment-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}
button, input { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid #36b8b2; outline-offset: 3px; }

.appointment-skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--appointment-ink);
    color: #fff;
    transform: translateY(-150%);
}
.appointment-skip-link:focus { transform: translateY(0); }
.appointment-header {
    border-bottom: 1px solid rgba(220,230,235,.9);
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(12px);
}
.appointment-header-inner {
    display: flex;
    width: min(1120px, calc(100% - 40px));
    min-height: 82px;
    margin: 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.appointment-identity { display: flex; align-items: center; gap: 13px; text-decoration: none; }
.appointment-identity img { width: auto; height: 58px; object-fit: contain; }
.appointment-identity span { display: flex; flex-direction: column; line-height: 1.22; }
.appointment-identity strong { font-size: .98rem; }
.appointment-identity small { margin-top: 3px; color: var(--appointment-muted); font-size: .75rem; }
.appointment-header-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border-radius: 10px;
    color: var(--appointment-primary-dark);
    font-size: .83rem;
    font-weight: 800;
    text-decoration: none;
}
.appointment-header-link:hover { background: var(--appointment-accent); }

.appointment-main {
    width: min(1120px, calc(100% - 40px));
    min-height: calc(100vh - 170px);
    margin: 0 auto;
    padding: 48px 0 72px;
}
.appointment-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 28px;
}
.appointment-eyebrow {
    color: var(--appointment-primary);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.appointment-hero h1 {
    max-width: 720px;
    margin: 7px 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.03;
    letter-spacing: -.05em;
}
.appointment-hero p { max-width: 690px; margin: 0; color: var(--appointment-muted); }
.appointment-security-note {
    display: flex;
    min-width: 285px;
    align-items: center;
    gap: 11px;
    padding: 13px 15px;
    border: 1px solid #bee2dc;
    border-radius: 14px;
    background: rgba(255,255,255,.82);
}
.appointment-security-note > span {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border-radius: 50%;
    background: var(--appointment-accent);
    color: var(--appointment-success);
    font-weight: 900;
}
.appointment-security-note div { display: flex; flex-direction: column; }
.appointment-security-note strong { font-size: .8rem; }
.appointment-security-note small { color: var(--appointment-muted); font-size: .67rem; }

.appointment-progress {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 0 0 24px;
    padding: 0;
    border: 1px solid var(--appointment-border);
    border-radius: 16px;
    background: rgba(255,255,255,.76);
    list-style: none;
    overflow: hidden;
}
.appointment-progress li {
    position: relative;
    display: flex;
    min-height: 72px;
    align-items: center;
    gap: 11px;
    padding: 14px 22px;
    color: var(--appointment-muted);
}
.appointment-progress li:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 18px;
    right: 0;
    bottom: 18px;
    width: 1px;
    background: var(--appointment-border);
}
.appointment-progress li > span {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 1px solid #cbd9df;
    border-radius: 50%;
    background: #fff;
    font-size: .78rem;
    font-weight: 900;
}
.appointment-progress li div { display: flex; flex-direction: column; }
.appointment-progress strong { color: var(--appointment-ink); font-size: .82rem; }
.appointment-progress small { font-size: .68rem; }
.appointment-progress .is-active { background: #f0fbf9; }
.appointment-progress .is-active > span { border-color: var(--appointment-primary); color: var(--appointment-primary); }
.appointment-progress .is-complete > span { border-color: var(--appointment-primary); background: var(--appointment-primary); color: #fff; }

.appointment-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
    padding: 15px 17px;
    border: 1px solid #cbdde4;
    border-radius: 13px;
    background: #fff;
}
.appointment-alert > span {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border-radius: 50%;
    background: #e9f3f6;
    color: #276681;
    font-weight: 900;
}
.appointment-alert strong { font-size: .8rem; }
.appointment-alert p { margin: 2px 0 0; color: var(--appointment-muted); font-size: .75rem; }
.appointment-alert--error { border-color: #e8bbbb; background: #fff5f5; }
.appointment-alert--error > span { background: #f9dddd; color: var(--appointment-danger); }

.appointment-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(310px, .8fr); gap: 24px; }
.appointment-card, .appointment-result {
    border: 1px solid var(--appointment-border);
    border-radius: 20px;
    background: var(--appointment-white);
    box-shadow: var(--appointment-shadow);
}
.appointment-card { padding: clamp(24px, 4vw, 36px); }
.appointment-card-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 24px; }
.appointment-card-heading > span {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border-radius: 11px;
    background: var(--appointment-accent);
    color: var(--appointment-primary-dark);
    font-size: .7rem;
    font-weight: 900;
}
.appointment-card h2 { margin: 0 0 4px; font-size: 1.3rem; letter-spacing: -.03em; }
.appointment-card-heading p { margin: 0; color: var(--appointment-muted); font-size: .75rem; }
.appointment-search-card form { display: grid; gap: 8px; }
.appointment-search-card label { font-size: .78rem; font-weight: 850; }
.appointment-search-card form > small { color: var(--appointment-muted); font-size: .68rem; }
.appointment-rut-field, .appointment-email-field { position: relative; display: flex; align-items: center; }
.appointment-rut-field > span, .appointment-email-field > span {
    position: absolute;
    left: 13px;
    display: grid;
    min-width: 37px;
    height: 28px;
    place-items: center;
    border-radius: 7px;
    background: var(--appointment-accent);
    color: var(--appointment-primary-dark);
    font-size: .67rem;
    font-weight: 900;
}
.appointment-rut-field input, .appointment-email-field input {
    width: 100%;
    min-height: 54px;
    padding: 11px 14px 11px 62px;
    border: 1px solid #c5d5dc;
    border-radius: 12px;
    color: var(--appointment-ink);
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: .02em;
}
.appointment-rut-field input:focus, .appointment-email-field input:focus { border-color: var(--appointment-primary); box-shadow: 0 0 0 4px rgba(11,107,116,.11); outline: none; }
.appointment-rut-field input[aria-invalid="true"] { border-color: #c84c4c; }
.appointment-rut-status { display: flex; min-height: 28px; align-items: center; gap: 7px; color: var(--appointment-muted); }
.appointment-rut-status > span { font-weight: 900; }
.appointment-rut-status p { margin: 0; font-size: .69rem; }
.appointment-rut-status.is-valid { color: var(--appointment-success); }
.appointment-rut-status.is-invalid { color: var(--appointment-danger); }
.appointment-rut-status.is-pending { color: #8a5b0b; }
.appointment-search-card button {
    display: inline-flex;
    min-height: 51px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
    border: 0;
    border-radius: 12px;
    background: var(--appointment-primary);
    color: #fff;
    font-weight: 850;
    cursor: pointer;
}
.appointment-search-card button:hover:not(:disabled) { background: var(--appointment-primary-dark); }
.appointment-search-card button:disabled { cursor: not-allowed; opacity: .46; }
.appointment-help-card { background: linear-gradient(145deg, #0c5964, #0b4656); color: #fff; }
.appointment-help-card .appointment-eyebrow { color: #9fe4dc; }
.appointment-help-card h2 { margin: 8px 0 19px; }
.appointment-help-card ul { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; }
.appointment-help-card li { display: flex; gap: 11px; padding: 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; background: rgba(255,255,255,.06); }
.appointment-help-card li > span { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 9px; background: rgba(159,228,220,.14); color: #bcefe9; font-weight: 900; }
.appointment-help-card li div { display: flex; flex-direction: column; }
.appointment-help-card li strong { font-size: .78rem; }
.appointment-help-card li small { margin-top: 2px; color: #c7d9de; font-size: .67rem; }
.appointment-help-card > p { margin: 18px 0 0; color: #bdd0d6; font-size: .69rem; }

.appointment-result { padding: clamp(24px, 5vw, 42px); }
.appointment-result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.appointment-result-heading h2 { margin: 7px 0 4px; font-size: clamp(1.45rem, 3vw, 2rem); letter-spacing: -.04em; }
.appointment-result-heading p { max-width: 680px; margin: 0; color: var(--appointment-muted); font-size: .76rem; }
.appointment-status { padding: 6px 10px; border-radius: 999px; background: #e5f6ef; color: var(--appointment-success); font-size: .69rem; font-weight: 900; white-space: nowrap; }
.appointment-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 0 24px;
    border: 1px solid var(--appointment-border);
    border-radius: 15px;
    overflow: hidden;
}
.appointment-details div { padding: 15px 17px; border-bottom: 1px solid var(--appointment-border); }
.appointment-details div:nth-child(odd) { border-right: 1px solid var(--appointment-border); }
.appointment-details .appointment-detail-wide { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
.appointment-details dt { color: var(--appointment-muted); font-size: .68rem; font-weight: 800; }
.appointment-details dd { margin: 3px 0 0; font-size: .88rem; font-weight: 850; }
.appointment-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.appointment-action {
    display: flex;
    min-height: 84px;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 1px solid;
    border-radius: 14px;
    text-decoration: none;
    transition: transform .16s ease, box-shadow .16s ease;
}
.appointment-action:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(18,54,72,.09); }
.appointment-action > span { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border-radius: 11px; font-size: 1.1rem; font-weight: 900; }
.appointment-action div { display: flex; flex-direction: column; }
.appointment-action strong { font-size: .82rem; }
.appointment-action small { margin-top: 2px; color: var(--appointment-muted); font-size: .68rem; }
.appointment-action--primary { border-color: #b8ddd8; background: #f3fbfa; }
.appointment-action--primary > span { background: var(--appointment-accent); color: var(--appointment-primary-dark); }
.appointment-action--danger { border-color: #e9c6c6; background: #fff8f8; }
.appointment-action--danger > span { background: var(--appointment-danger-soft); color: var(--appointment-danger); }
.appointment-result-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--appointment-border); }
.appointment-result-footer p { margin: 0; color: var(--appointment-muted); font-size: .7rem; }
.appointment-result-footer a { color: var(--appointment-primary-dark); font-size: .73rem; font-weight: 850; }

.appointment-footer {
    display: flex;
    width: min(1120px, calc(100% - 40px));
    min-height: 86px;
    margin: 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-top: 1px solid var(--appointment-border);
    color: var(--appointment-muted);
    font-size: .68rem;
}

@media (max-width: 820px) {
    .appointment-hero { align-items: flex-start; flex-direction: column; }
    .appointment-security-note { width: 100%; min-width: 0; }
    .appointment-layout { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .appointment-header-inner, .appointment-main, .appointment-footer { width: min(100% - 28px, 1120px); }
    .appointment-header-inner { min-height: 72px; }
    .appointment-identity img { height: 48px; }
    .appointment-identity small { display: none; }
    .appointment-header-link { padding: 8px; font-size: .75rem; }
    .appointment-main { padding: 32px 0 52px; }
    .appointment-progress li { min-height: 64px; padding: 12px; }
    .appointment-progress li > div { display: none; }
    .appointment-progress li { justify-content: center; }
    .appointment-result-heading, .appointment-result-footer { align-items: flex-start; flex-direction: column; }
    .appointment-details, .appointment-actions { grid-template-columns: 1fr; }
    .appointment-details div:nth-child(odd) { border-right: 0; }
    .appointment-details .appointment-detail-wide { grid-column: auto; }
    .appointment-details div:last-child { border-bottom: 0; }
    .appointment-footer { align-items: flex-start; flex-direction: column; justify-content: center; padding: 20px 0; }
    .appointment-footer p { margin: 0; }
}
