:root {
  color-scheme: light;
  --cng-bg: #f5f5f7;
  --cng-surface: #ffffff;
  --cng-surface-raised: rgb(255 255 255 / 88%);
  --cng-text: #1d1d1f;
  --cng-muted: #6e6e73;
  --cng-line: rgb(29 29 31 / 10%);
  --cng-line-strong: rgb(29 29 31 / 16%);
  --cng-blue: #0066cc;
  --cng-blue-bright: #0071e3;
  --cng-blue-dark: #0055b3;
  --cng-pink: #9d174d;
  --cng-green: #087a55;
  --cng-radius-sm: 12px;
  --cng-radius: 18px;
  --cng-radius-lg: 28px;
  --cng-shadow-sm: 0 1px 2px rgb(0 0 0 / 3%), 0 8px 24px rgb(0 0 0 / 6%);
  --cng-shadow: 0 18px 50px rgb(0 0 0 / 10%);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  overflow-x: clip;
  background: var(--cng-bg);
  color: var(--cng-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", Helvetica, Arial, sans-serif;
  font-synthesis: none;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body > *,
#main-content {
  min-width: 0;
}

#main-content {
  isolation: isolate;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button,
summary {
  -webkit-tap-highlight-color: transparent;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid rgb(0 113 227 / 24%);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: #1d1d1f;
  color: #fff;
  box-shadow: var(--cng-shadow-sm);
  transform: translateY(-180%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  outline-color: #fff;
  transform: translateY(0);
}

/* Global navigation */
.site-header-shell {
  position: sticky;
  z-index: 100;
  top: 0;
  width: 100%;
  border-bottom: 1px solid rgb(29 29 31 / 8%);
  background: rgb(255 255 255 / 78%);
  box-shadow: 0 1px 0 rgb(255 255 255 / 45%);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.site-header {
  width: min(calc(100% - clamp(1.5rem, 4vw, 3.5rem)), 1400px);
  min-height: 80px;
  margin-inline: auto;
  padding-block: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1rem, 2vw, 2rem);
}

.brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--cng-text);
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 0;
}

.site-header .primary-navigation {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.12rem;
}

.nav-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.58rem 0.68rem;
  border-radius: 999px;
  color: #424245;
  font-size: 0.84rem;
  font-weight: 520;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--cng-text);
  background: rgb(29 29 31 / 5.5%);
}

.nav-link.is-active {
  color: var(--cng-blue);
  background: rgb(0 113 227 / 8%);
  box-shadow: inset 0 0 0 1px rgb(0 113 227 / 5%);
}

.nav-link:active {
  transform: scale(0.97);
}

.nav-link svg,
.consultorio-nav svg {
  width: 1.18rem;
  height: 1.18rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.nav-dropdown > summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown > summary::after {
  width: 0.38rem;
  height: 0.38rem;
  margin: -0.18rem 0.1rem 0 0.08rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

.nav-dropdown[open] > summary::after {
  margin-top: 0.15rem;
  transform: rotate(225deg);
}

.nav-dropdown[open] > summary {
  color: var(--cng-text);
  background: rgb(29 29 31 / 5.5%);
}

.nav-dropdown-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.5rem);
  left: 50%;
  min-width: 210px;
  padding: 0.45rem;
  border: 1px solid rgb(29 29 31 / 10%);
  border-radius: 16px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 18px 48px rgb(0 0 0 / 14%);
  transform: translateX(-50%);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.nav-dropdown-menu a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0.62rem 0.75rem;
  border-radius: 11px;
  color: #424245;
  font-size: 0.86rem;
  font-weight: 520;
  transition: color 160ms ease, background-color 160ms ease;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus-visible {
  color: var(--cng-blue);
  background: rgb(0 113 227 / 7%);
}

.nav-practice-menu {
  min-width: 224px;
}

.nav-practice-menu a + a {
  border-top: 1px solid rgb(29 29 31 / 6%);
}

.consultorio-nav {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  margin-left: 0.38rem;
  padding: 0.48rem 0.82rem;
  border: 1px solid rgb(29 29 31 / 78%);
  border-radius: 999px;
  background: #1d1d1f;
  color: #fff;
  box-shadow: 0 3px 10px rgb(0 0 0 / 10%);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition:
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.consultorio-nav:hover,
.consultorio-nav:focus-visible {
  border-color: #000;
  background: #000;
  color: #fff;
  box-shadow: 0 6px 18px rgb(0 0 0 / 16%);
  transform: translateY(-1px);
}

.consultorio-nav:active {
  transform: scale(0.97);
}

.nav-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: none;
  padding: 0;
  border: 1px solid var(--cng-line);
  border-radius: 50%;
  background: rgb(255 255 255 / 78%);
  color: var(--cng-text);
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.nav-toggle:hover {
  border-color: var(--cng-line-strong);
  background: #fff;
}

.nav-toggle:active {
  transform: scale(0.95);
}

.nav-toggle > span:not(.sr-only) {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 1.5px;
  display: block;
  margin: 0;
  border-radius: 2px;
  background: currentColor;
  transition:
    top 180ms ease,
    opacity 140ms ease,
    transform 180ms ease;
}

.nav-toggle > span:nth-child(2) {
  top: 15px;
}

.nav-toggle > span:nth-child(3) {
  top: 21px;
}

.nav-toggle > span:nth-child(4) {
  top: 27px;
}

.nav-toggle[aria-expanded="true"] > span:nth-child(2) {
  top: 21px;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] > span:nth-child(3) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] > span:nth-child(4) {
  top: 21px;
  transform: rotate(-45deg);
}

/* Footer */
.site-footer-shell {
  margin-top: clamp(2.5rem, 6vw, 5rem);
  border-top: 1px solid var(--cng-line);
  background: #f5f5f7;
}

.site-footer {
  width: min(calc(100% - clamp(1.5rem, 5vw, 4rem)), 1240px);
  margin-inline: auto;
  padding: 1.75rem 0 1.25rem;
  display: block;
  color: var(--cng-muted);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  color: var(--cng-text);
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.footer-brand img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.footer-top nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 1.35rem;
  font-size: 0.82rem;
  font-weight: 480;
}

.footer-top nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  transition: color 160ms ease;
}

.footer-top nav a:hover,
.footer-top nav a:focus-visible {
  color: var(--cng-blue);
}

.site-footer hr {
  margin: 1.1rem 0 0.9rem;
  border: 0;
  border-top: 1px solid var(--cng-line);
}

.site-footer > p {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.005em;
}

.site-footer > p a:hover,
.site-footer > p a:focus-visible {
  color: var(--cng-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Shared controls */
.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.58rem 1rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  transition:
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.button:hover {
  box-shadow: 0 6px 16px rgb(0 0 0 / 10%);
  transform: translateY(-1px);
}

.button:active {
  box-shadow: none;
  transform: scale(0.98);
}

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

.button-primary:hover {
  background: #831843;
}

.button-dark {
  background: #1d1d1f;
  color: #fff;
}

.button-dark:hover {
  background: #000;
}

.button-whatsapp {
  background: #15805d;
  color: #fff;
}

.button-whatsapp:hover {
  background: #096b4b;
}

.text-link {
  color: var(--cng-blue);
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover,
.text-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Authentication screens. Scoped so dashboard cards retain their own layout. */
.auth-shell {
  min-height: max(660px, calc(100dvh - 80px));
  display: grid;
  place-items: center;
  padding: clamp(2rem, 6vw, 5rem) 1rem;
  background:
    linear-gradient(135deg, rgb(7 18 34 / 34%), rgb(7 18 34 / 12%)),
    url("/assets/images/login/background.jpg") center / cover no-repeat;
}

.auth-shell > .auth-card {
  width: min(100%, 420px);
  min-width: 0;
  padding: clamp(1.5rem, 4vw, 2.15rem);
  border: 1px solid rgb(255 255 255 / 68%);
  border-radius: 24px;
  background: rgb(255 255 255 / 90%);
  box-shadow:
    0 1px 0 rgb(255 255 255 / 80%) inset,
    0 24px 70px rgb(0 0 0 / 22%);
  -webkit-backdrop-filter: saturate(160%) blur(22px);
  backdrop-filter: saturate(160%) blur(22px);
}

.auth-shell > .auth-card::before {
  width: 64px;
  height: 64px;
  display: block;
  margin: 0 auto 0.35rem;
  background: url("/assets/images/logo.png") center / contain no-repeat;
  content: "";
}

.auth-shell > .auth-card .eyebrow {
  margin-bottom: 0.2rem;
  text-align: center;
  color: var(--cng-blue);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.auth-shell > .auth-card h1 {
  margin: 0.15rem 0 0.45rem;
  text-align: center;
  color: var(--cng-text);
  font-size: clamp(1.55rem, 5vw, 1.85rem);
  font-weight: 680;
  letter-spacing: -0.04em;
  line-height: 1.12;
}

.auth-shell > .auth-card > p {
  max-width: 34ch;
  margin: 0.45rem auto;
  text-align: center;
  color: var(--cng-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.auth-shell > .auth-card form {
  display: grid;
  gap: 0.9rem;
  margin: 1.35rem 0 0.95rem;
}

.auth-shell > .auth-card label > span {
  margin-bottom: 0.38rem;
  color: #424245;
  font-size: 0.8rem;
  font-weight: 600;
}

.auth-shell > .auth-card input {
  min-height: 48px;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgb(29 29 31 / 16%);
  border-radius: 12px;
  background: rgb(255 255 255 / 82%);
  color: var(--cng-text);
  box-shadow: 0 1px 1px rgb(0 0 0 / 2%) inset;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.auth-shell > .auth-card input:hover {
  border-color: rgb(29 29 31 / 26%);
  background: #fff;
}

.auth-shell > .auth-card input:focus {
  border-color: var(--cng-blue-bright);
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 4px rgb(0 113 227 / 13%);
}

.auth-shell > .auth-card .button-primary {
  min-height: 48px;
  border-radius: 12px;
  background: var(--cng-blue-bright);
}

.auth-shell > .auth-card .button-primary:hover {
  background: var(--cng-blue-dark);
}

.auth-shell > .auth-card--login {
  width: min(100%, 460px);
}

.auth-account-type {
  min-width: 0;
  margin: 1.15rem 0;
  padding: 0;
  border: 0;
}

.auth-account-type > legend {
  width: 100%;
  margin-bottom: .55rem;
  padding: 0;
  color: #424245;
  font-size: .8rem;
  font-weight: 700;
  text-align: center;
}

.auth-type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
  gap: 4px;
  margin: 1.15rem 0;
  padding: 4px;
  border: 1px solid rgb(29 29 31 / 9%);
  border-radius: 14px;
  background: rgb(118 118 128 / 10%);
}

.auth-type-option {
  min-height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #52525b;
  font-size: .84rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.auth-account-type .auth-type-switch {
  margin: 0;
}

.auth-account-type .auth-type-option {
  min-width: 0;
  min-height: 64px;
  align-content: center;
  gap: .13rem;
  padding: .5rem .55rem;
  line-height: 1.2;
  text-align: center;
}

.auth-type-option strong {
  font-size: .82rem;
  font-weight: 750;
}

.auth-type-option small {
  color: #71717a;
  font-size: .68rem;
  font-weight: 500;
  line-height: 1.25;
}

.auth-type-option strong,
.auth-type-option small {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.auth-type-option:hover,
.auth-type-option:focus-visible {
  color: var(--cng-blue-dark);
}

.auth-type-option.is-active {
  background: #fff;
  color: var(--cng-text);
  box-shadow: 0 1px 4px rgb(0 0 0 / 12%);
}

.auth-type-option.is-active small {
  color: #52525b;
}

.google-auth-button {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  margin-top: 1.15rem;
  padding: .75rem 1rem;
  border: 1px solid rgb(29 29 31 / 16%);
  border-radius: 13px;
  background: #fff;
  color: #202124;
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 8px rgb(15 23 42 / 7%);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.google-auth-button:hover,
.google-auth-button:focus-visible {
  border-color: rgb(29 29 31 / 28%);
  box-shadow: 0 7px 20px rgb(15 23 42 / 11%);
  transform: translateY(-1px);
}

.google-auth-button svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
}

.auth-shell > .auth-card .auth-google-note {
  margin-top: .55rem;
  font-size: .78rem;
}

.auth-password-fallback {
  margin: 1rem 0 .75rem;
  border-top: 1px solid rgb(29 29 31 / 10%);
}

.auth-password-fallback > summary {
  width: fit-content;
  margin: .9rem auto 0;
  color: var(--cng-blue-dark);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 700;
}

.auth-password-fallback > p {
  margin: .75rem 0 0;
  color: var(--cng-muted);
  font-size: .8rem;
  line-height: 1.45;
}

.auth-password-fallback[open] > summary {
  margin-bottom: .4rem;
}

.auth-shell > .auth-card .auth-password-fallback form {
  margin-top: .85rem;
}

@media (prefers-reduced-motion: reduce) {
  .auth-type-option,
  .google-auth-button {
    transition: none;
  }
}

.dashboard-heading,
.dashboard-grid,
.data-form,
.table-card,
.operations-grid {
  --primary: var(--cng-pink);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header-shell,
  .nav-dropdown-menu {
    background: rgb(255 255 255 / 98%);
  }

  .auth-shell > .auth-card {
    background: rgb(255 255 255 / 98%);
  }
}

@media (max-width: 1120px) {
  .consultorio-nav span {
    display: none;
  }

  .consultorio-nav {
    width: 40px;
    padding-inline: 0.4rem;
  }
}

@media (max-width: 900px) {
  .site-header {
    min-height: 70px;
    align-items: center;
    padding-block: 0;
  }

  .brand {
    font-size: 1.06rem;
  }

  .brand img {
    width: 54px;
    height: 54px;
  }

  .nav-toggle {
    display: block;
  }

  .site-header .primary-navigation {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: clamp(0.65rem, 3vw, 1.5rem);
    left: clamp(0.65rem, 3vw, 1.5rem);
    max-height: calc(100dvh - 82px);
    display: none;
    align-items: stretch;
    justify-content: stretch;
    gap: 0.12rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.6rem;
    border: 1px solid rgb(29 29 31 / 10%);
    border-radius: 20px;
    background: rgb(255 255 255 / 94%);
    box-shadow: 0 24px 64px rgb(0 0 0 / 18%);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);
  }

  .site-header .primary-navigation.is-open {
    display: grid;
  }

  .site-header .primary-navigation.is-open a {
    display: flex;
  }

  .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 0.68rem 0.8rem;
    border-radius: 13px;
    font-size: 0.92rem;
  }

  .nav-link svg,
  .consultorio-nav svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  .nav-dropdown > summary::after {
    margin-left: auto;
    margin-right: 0.4rem;
  }

  .nav-dropdown-menu {
    position: static;
    min-width: 0;
    margin: 0.05rem 0.3rem 0.42rem 2.1rem;
    padding: 0.18rem;
    border: 0;
    border-radius: 12px;
    background: rgb(29 29 31 / 3.5%);
    box-shadow: none;
    transform: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .nav-practice-menu {
    min-width: 0;
  }

  .nav-dropdown-menu a {
    min-height: 40px;
    border-radius: 10px;
  }

  .consultorio-nav {
    width: auto;
    min-height: 44px;
    justify-content: flex-start;
    margin: 0.25rem 0 0;
    padding: 0.68rem 0.82rem;
    border-radius: 13px;
    font-size: 0.9rem;
  }

  .consultorio-nav span {
    display: inline;
  }

  .auth-shell {
    min-height: max(620px, calc(100dvh - 70px));
  }
}

@media (max-width: 640px) {
  .site-header,
  .site-footer {
    width: calc(100% - 1.25rem);
  }

  .site-header {
    align-items: center;
    padding-block: 0;
  }

  .brand {
    gap: 0.3rem;
    font-size: 1rem;
  }

  .brand img {
    width: 50px;
    height: 50px;
  }

  .footer-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .footer-top nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.15rem 0.7rem;
  }

  .footer-top nav a {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .site-footer > p {
    text-align: left;
  }

  .auth-shell {
    min-height: calc(100dvh - 70px);
    padding: 1.25rem 0.75rem;
  }

  .auth-shell > .auth-card {
    padding: 1.5rem 1.2rem;
    border-radius: 20px;
  }
}

@media (max-width: 560px) {
  .auth-type-switch {
    grid-template-columns: 1fr;
  }

  .auth-account-type .auth-type-option {
    min-height: 58px;
  }
}

@media (max-width: 380px) {
  .brand span {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .footer-top nav {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
