:root {
    --ms-body-bg: #f4f8fb;
    --ms-surface: #ffffff;
    --ms-surface-soft: #f8fbfd;
    --ms-border: #dbe6ee;
    --ms-text: #173042;
    --ms-text-muted: #698090;
    --ms-primary: #2e6f95;
    --ms-primary-deep: #1f5878;
    --ms-accent: #84b6b1;
    --ms-success: #3e8b78;
    --ms-warning: #b98a3d;
    --ms-danger: #b35757;
    --ms-shadow: 0 22px 60px rgba(26, 58, 79, 0.08);
    --ms-radius-lg: 28px;
    --ms-radius-md: 20px;
    --ms-radius-sm: 14px;
}

html { scroll-behavior: smooth; }
html,
body {
    overflow-x: hidden;
}

body {
    background:
        radial-gradient(circle at top left, rgba(132, 182, 177, 0.18), transparent 32%),
        linear-gradient(180deg, #f8fbfd 0%, #f3f7fa 100%);
    color: var(--ms-text);
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
    letter-spacing: 0.01em;
}

a { color: var(--ms-primary); text-decoration: none; }
a:hover { color: var(--ms-primary-deep); }

.page-shell { min-height: 100vh; }

.navbar-premium {
    backdrop-filter: blur(14px);
    background: rgba(248, 251, 253, 0.9);
    border-bottom: 1px solid rgba(219, 230, 238, 0.8);
    z-index: 1080;
}

.navbar-premium .container {
    position: relative;
}

.brand-mark {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--ms-primary), var(--ms-accent));
    box-shadow: 0 16px 32px rgba(46, 111, 149, 0.22);
}

.brand-mark-image {
    width: auto;
    height: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.brand-mark-image img {
    display: block;
    width: auto;
    height: 3.9rem;
    object-fit: contain;
}

.footer-premium .brand-mark-image img {
    height: 4.6rem;
}

.brand-text { font-weight: 700; line-height: 1.1; }

.nav-link-premium {
    color: var(--ms-text-muted);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 999px;
}

.nav-link-nowrap {
    white-space: nowrap;
}

.nav-link-premium:hover,
.nav-link-premium.active {
    color: var(--ms-primary-deep);
    background: rgba(46, 111, 149, 0.08);
}

.btn-premium,
.btn-outline-premium,
.btn-soft-premium {
    border-radius: 999px;
    padding: 0.85rem 1.35rem;
    font-weight: 600;
}

.btn-premium {
    color: #fff;
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--ms-primary), var(--ms-primary-deep));
}

.btn-premium:hover { color: #fff; background: linear-gradient(135deg, var(--ms-primary-deep), #15445d); }

.btn-outline-premium {
    color: var(--ms-primary-deep);
    border: 1px solid rgba(46, 111, 149, 0.18);
    background: #fff;
}

.btn-outline-premium:hover {
    color: var(--ms-primary-deep);
    border-color: rgba(46, 111, 149, 0.32);
    background: rgba(255, 255, 255, 0.92);
}

.btn-soft-premium {
    color: var(--ms-primary-deep);
    border: 1px solid transparent;
    background: rgba(132, 182, 177, 0.18);
}

.hero-section { padding: 8rem 0 5rem; }

.hero-card,
.surface-card,
.portal-panel,
.auth-card,
.contact-card,
.service-card,
.feature-card,
.stats-card,
.step-card,
.appointment-card,
.table-shell {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(219, 230, 238, 0.9);
    border-radius: var(--ms-radius-lg);
    box-shadow: var(--ms-shadow);
}

.hero-card { padding: 3rem; position: relative; overflow: hidden; }
.hero-card::after {
    content: "";
    position: absolute;
    inset: auto -4rem -4rem auto;
    width: 16rem;
    height: 16rem;
    background: radial-gradient(circle, rgba(132, 182, 177, 0.32), transparent 68%);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(46, 111, 149, 0.08);
    color: var(--ms-primary-deep);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-title,
.section-title {
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-title { font-size: clamp(2.6rem, 6vw, 4.5rem); }
.section-title { font-size: clamp(1.8rem, 3vw, 2.7rem); }

.section-copy,
.muted-copy {
    color: var(--ms-text-muted);
    font-size: 1.02rem;
    line-height: 1.8;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.hero-stat-item {
    padding: 1.1rem 1.2rem;
    border-radius: var(--ms-radius-md);
    background: rgba(248, 251, 253, 0.95);
    border: 1px solid rgba(219, 230, 238, 0.7);
}

.hero-stat-item strong {
    display: block;
    font-size: 1.45rem;
    color: var(--ms-primary-deep);
}

.preview-board {
    padding: 2rem;
    border-radius: var(--ms-radius-lg);
    background: linear-gradient(180deg, rgba(46, 111, 149, 0.08), rgba(255, 255, 255, 0.92));
    border: 1px solid rgba(219, 230, 238, 0.85);
}

.preview-calendar,
.preview-note,
.preview-alert {
    border-radius: var(--ms-radius-md);
    background: #fff;
    border: 1px solid rgba(219, 230, 238, 0.85);
    padding: 1.2rem;
    box-shadow: 0 20px 40px rgba(26, 58, 79, 0.08);
}

.icon-circle {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: rgba(46, 111, 149, 0.1);
    color: var(--ms-primary-deep);
    font-size: 1.15rem;
}

.section-block { padding: 5rem 0; }

.service-card,
.feature-card,
.step-card,
.stats-card,
.appointment-card,
.contact-card,
.location-card,
.location-spotlight,
.location-schedule-card { padding: 1.6rem; height: 100%; }

.location-card,
.location-spotlight,
.location-schedule-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(219, 230, 238, 0.9);
    border-radius: var(--ms-radius-lg);
    box-shadow: var(--ms-shadow);
}

.location-spotlight {
    padding: 2rem;
    background:
        radial-gradient(circle at top right, rgba(132, 182, 177, 0.2), transparent 28%),
        rgba(255, 255, 255, 0.96);
}

.location-schedule-card { padding: 2rem; }

.location-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: rgba(46, 111, 149, 0.08);
    color: var(--ms-primary-deep);
    font-weight: 700;
}

.location-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.location-meta-item {
    padding: 1rem 1.1rem;
    border-radius: var(--ms-radius-md);
    background: rgba(248, 251, 253, 0.95);
    border: 1px solid rgba(219, 230, 238, 0.75);
}

.location-meta-item small {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--ms-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.location-meta-item strong {
    display: block;
    color: var(--ms-text);
    line-height: 1.5;
}

.service-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.58rem 0.95rem;
    border-radius: 999px;
    background: rgba(46, 111, 149, 0.08);
    color: var(--ms-primary-deep);
    font-weight: 600;
    font-size: 0.95rem;
}

.schedule-stack {
    display: grid;
    gap: 0.85rem;
}

.schedule-row-public {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: var(--ms-radius-md);
    background: rgba(248, 251, 253, 0.95);
    border: 1px solid rgba(219, 230, 238, 0.75);
}

.schedule-row-public.compact {
    padding: 0.85rem 1rem;
}

.step-number {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(46, 111, 149, 0.12);
    color: var(--ms-primary-deep);
    font-weight: 700;
}

.cta-banner {
    padding: 2.4rem;
    border-radius: var(--ms-radius-lg);
    background: linear-gradient(135deg, #f8fbfd 0%, #edf5f9 100%);
    border: 1px solid rgba(219, 230, 238, 0.85);
    box-shadow: var(--ms-shadow);
}

.footer-premium {
    padding: 3rem 0 2rem;
    border-top: 1px solid rgba(219, 230, 238, 0.9);
    background: rgba(248, 251, 253, 0.94);
}

.footer-link { color: var(--ms-text-muted); }

.privacy-banner {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    z-index: 1090;
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.1rem;
    border: 1px solid rgba(219, 230, 238, 0.9);
    border-radius: 1.4rem;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 60px rgba(26, 58, 79, 0.16);
    backdrop-filter: blur(18px);
}

.privacy-banner[hidden],
.privacy-modal[hidden] {
    display: none !important;
}

.privacy-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.privacy-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 37, 51, 0.52);
    backdrop-filter: blur(10px);
}

.privacy-modal-card {
    position: relative;
    width: min(100%, 46rem);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 1.5rem;
    border-radius: 1.7rem;
    border: 1px solid rgba(219, 230, 238, 0.9);
    background: rgba(255, 255, 255, 0.99);
    box-shadow: 0 32px 90px rgba(26, 58, 79, 0.18);
}

.privacy-modal-section {
    padding: 1rem 0;
    border-top: 1px solid rgba(219, 230, 238, 0.72);
}

.privacy-modal-section:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.auth-wrap { min-height: 100vh; padding: 5rem 0; }
.auth-card { overflow: hidden; }

.auth-side {
    background: linear-gradient(160deg, rgba(46, 111, 149, 0.92), rgba(132, 182, 177, 0.72));
    color: #fff;
    padding: 2.75rem;
}

.auth-main { padding: 2.75rem; }

.form-control,
.form-select,
.input-group-text,
.form-check-input {
    border-radius: 1rem;
    border-color: var(--ms-border);
    min-height: 3.15rem;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: rgba(46, 111, 149, 0.4);
    box-shadow: 0 0 0 0.25rem rgba(46, 111, 149, 0.12);
}

.form-section {
    padding: 1.6rem;
    border-radius: var(--ms-radius-md);
    background: var(--ms-surface-soft);
    border: 1px solid rgba(219, 230, 238, 0.75);
}

.alert-premium {
    padding: 1rem 1.15rem;
    border-radius: 1rem;
    border: 1px solid transparent;
}

.alert-premium-success { color: #1c5b4d; background: rgba(62, 139, 120, 0.12); border-color: rgba(62, 139, 120, 0.22); }
.alert-premium-danger { color: #8d4747; background: rgba(179, 87, 87, 0.12); border-color: rgba(179, 87, 87, 0.22); }

.portal-body { background: linear-gradient(180deg, #f5f9fb 0%, #eff5f8 100%); }
.portal-body {
    min-height: 100vh;
    overflow-y: auto;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: auto;
}

.portal-shell { padding-top: 0.35rem; }

.portal-mobile-header {
    position: sticky;
    top: 0;
    z-index: 1040;
    padding: max(0.85rem, env(safe-area-inset-top)) 1rem 0.85rem;
    background: rgba(245, 249, 251, 0.94);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(219, 230, 238, 0.85);
}

.portal-mobile-header > .d-flex {
    align-items: center;
}

.portal-mobile-brand {
    flex: 0 1 auto;
    min-width: 0;
}

.portal-mobile-brand .brand-mark {
    flex-shrink: 0;
}

.portal-mobile-brand-copy {
    min-width: 0;
}

.portal-mobile-header .fw-bold {
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.portal-menu-button {
    flex: 0 0 auto;
    width: 3.15rem;
    height: 3.15rem;
    min-width: 3.15rem;
    min-height: 3.15rem;
    padding: 0;
    border-radius: 1rem;
}

.portal-offcanvas {
    width: min(90vw, 24rem);
    background: linear-gradient(180deg, #f7fbfd 0%, #eef5f8 100%);
}

.portal-sidebar { padding: 1.8rem; min-height: calc(100vh - 2rem); position: sticky; top: 1rem; }
.portal-sidebar-mobile {
    min-height: auto;
    position: static;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.portal-sidebar .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    color: var(--ms-text-muted);
    border-radius: 1rem;
    padding: 0.95rem 1rem;
    font-weight: 600;
    min-height: 3.5rem;
}

.portal-sidebar .nav-link.active,
.portal-sidebar .nav-link:hover {
    color: var(--ms-primary-deep);
    background: rgba(46, 111, 149, 0.08);
}

.portal-main { padding: 1.35rem 0 3rem; }
.portal-topbar { padding: 1.35rem 1.5rem; margin-bottom: 1rem; }

.portal-shell .row,
.portal-shell [class*="col-"],
.portal-panel,
.portal-main,
.portal-sidebar {
    min-width: 0;
}

.portal-main .section-title,
.portal-main h1,
.portal-main h2,
.portal-main h3,
.portal-main p,
.portal-main .muted-copy,
.portal-main .fw-semibold,
.portal-main .table,
.portal-main .btn,
.portal-main .form-text,
.portal-main dd,
.portal-main dt,
.portal-main small {
    overflow-wrap: anywhere;
}

.appointment-card {
    padding: 1.35rem;
    border-radius: 1.4rem;
}

.appointment-card h3,
.appointment-card .h5,
.appointment-card .fw-semibold,
.table-shell td,
.table-shell th {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.stats-card {
    padding: 1.35rem;
}

.portal-panel,
.appointment-card,
.table-shell,
.form-section {
    overflow: hidden;
}

.table-shell {
    padding: 0.85rem;
}

.portal-panel .table-responsive,
.table-shell .table-responsive,
.portal-main .table-responsive {
    -webkit-overflow-scrolling: touch;
}

.portal-panel .table,
.table-shell .table,
.portal-main .table {
    min-width: 100%;
}

.portal-panel .d-flex,
.portal-panel .btn,
.portal-main .btn,
.portal-main a,
.portal-main input,
.portal-main select,
.portal-main textarea {
    max-width: 100%;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

.portal-card-scroll {
    display: grid;
    gap: 0.9rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
}

.status-pendente { background: rgba(185, 138, 61, 0.14); color: #8b6526; }
.status-confirmado { background: rgba(62, 139, 120, 0.14); color: #2b6e5f; }
.status-cancelado, .status-falta { background: rgba(179, 87, 87, 0.14); color: #954e4e; }
.status-concluido { background: rgba(46, 111, 149, 0.12); color: var(--ms-primary-deep); }

.table-premium { margin-bottom: 0; }
.table-premium thead th {
    color: var(--ms-text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom-color: rgba(219, 230, 238, 0.95);
}

.table-premium tbody td { vertical-align: middle; border-bottom-color: rgba(219, 230, 238, 0.75); }
.table-shell { padding: 1rem; }

.step-indicator {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.step-indicator-item {
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    background: rgba(248, 251, 253, 0.95);
    border: 1px solid rgba(219, 230, 238, 0.85);
    color: var(--ms-text-muted);
    font-weight: 600;
}

.step-indicator-item.active {
    background: rgba(46, 111, 149, 0.08);
    color: var(--ms-primary-deep);
    border-color: rgba(46, 111, 149, 0.18);
}

.loading-dot::after {
    content: "";
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    margin-left: 0.55rem;
    border-radius: 50%;
    background: currentColor;
    animation: msPulse 1.4s ease-in-out infinite;
}

@keyframes msPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.92); }
    50% { opacity: 1; transform: scale(1.06); }
}

@media (max-width: 991.98px) {
    .hero-section { padding-top: 6.5rem; }
    .hero-card, .auth-side, .auth-main { padding: 2rem; }
    .hero-stats, .step-indicator { grid-template-columns: 1fr; }
    .portal-sidebar { min-height: auto; position: static; }
    .location-meta-grid { grid-template-columns: 1fr; }
    .portal-main { padding-top: 0.8rem; }
    .portal-panel, .appointment-card, .stats-card, .table-shell { border-radius: 1.5rem; }
    .portal-shell {
        padding-top: 0.15rem;
    }
}

@media (max-width: 575.98px) {
    .navbar-premium .container {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    .navbar-premium .navbar-brand {
        gap: 0.65rem !important;
        margin-right: 0.5rem;
        flex: 1 1 auto;
        min-width: 0;
    }
    .navbar-premium .brand-mark-image img {
        height: 2.55rem;
        max-width: min(68vw, 18rem);
    }
    .navbar-premium .brand-text {
        font-size: 0.92rem;
    }
    .navbar-premium .brand-text small {
        font-size: 0.68rem;
    }
    .navbar-premium .navbar-toggler {
        padding: 0.35rem 0.45rem;
        margin-left: auto;
    }
    .navbar-premium .navbar-toggler-icon {
        width: 1.2rem;
        height: 1.2rem;
    }
    .navbar-premium .navbar-collapse {
        position: absolute;
        top: calc(100% + 0.5rem);
        left: 0.75rem;
        right: 0.75rem;
        margin-top: 0;
        border-radius: 1.25rem;
        border: 1px solid rgba(219, 230, 238, 0.9);
        background: rgba(255, 255, 255, 0.98);
        padding: 0.75rem;
        box-shadow: 0 18px 36px rgba(15, 37, 51, 0.08);
        z-index: 1095;
    }
    .navbar-premium .nav-link-premium {
        display: block;
        color: var(--ms-primary-deep);
        padding: 0.8rem 0.95rem;
    }
    .navbar-premium .nav-item .btn-outline-premium {
        width: 100%;
        margin-top: 0.35rem;
    }
    .hero-title { font-size: 2.3rem; }
    .schedule-row-public { flex-direction: column; align-items: flex-start; }
    .portal-shell { padding-inline: 0.35rem; }
    .portal-main { padding-bottom: 1.25rem; }
    .portal-topbar { padding: 1.15rem 1.1rem; }
    .portal-panel,
    .appointment-card,
    .stats-card,
    .form-section,
    .table-shell {
        padding: 1.1rem !important;
        border-radius: 1.25rem;
    }
    .btn-premium,
    .btn-outline-premium,
    .btn-soft-premium {
        min-height: 3.15rem;
        justify-content: center;
    }
    .portal-main .d-flex {
        flex-wrap: wrap;
    }
    .portal-main .d-flex.gap-2 > *,
    .portal-main .d-flex.gap-3 > *,
    .portal-main .d-flex.gap-4 > * {
        min-width: 0;
    }
    .portal-main .d-flex.flex-wrap.gap-3 .btn,
    .portal-main .d-flex.flex-wrap.gap-2 .btn,
    .portal-main .d-flex.flex-wrap.gap-4 .btn {
        flex: 1 1 100%;
    }
    .portal-panel .d-flex.flex-wrap.justify-content-between.align-items-center.gap-3,
    .portal-panel .d-flex.justify-content-between.align-items-center.mb-4,
    .portal-panel .d-flex.flex-wrap.justify-content-between.gap-3.mb-3 {
        align-items: flex-start !important;
    }
    .portal-panel .nav-link {
        padding-inline: 0.9rem;
    }
    .portal-offcanvas {
        width: min(92vw, 22rem);
    }
    .table-premium thead th,
    .table-premium tbody td {
        white-space: nowrap;
    }
    .section-title {
        font-size: clamp(1.9rem, 9vw, 2.45rem);
    }
    .privacy-banner {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        padding: 1rem;
        border-radius: 1.15rem;
    }
    .privacy-modal-card {
        padding: 1.15rem;
        border-radius: 1.2rem;
    }
    .display-6 {
        font-size: 2rem;
    }
    .portal-mobile-header .brand-mark {
        width: 2.45rem;
        height: 2.45rem;
    }
    .portal-mobile-header {
        padding-inline: 0.85rem;
    }
    .portal-mobile-header .fw-bold {
        font-size: 0.96rem;
    }
    .portal-mobile-header small {
        font-size: 0.78rem;
    }
}
