
  @font-face {
    font-family: "Baloo 2";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("/fonts/baloo2-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }
  @font-face {
    font-family: "Baloo 2";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("/fonts/baloo2-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }
  @font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("/fonts/nunito-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }
  @font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("/fonts/nunito-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }
  :root {
    color-scheme: light;
    --indigo: #525FE1;
    --indigo-deep: #3B2FA5;
    --indigo-hover: #4550C9;
    --navy: #14142B;
    --navy-muted: #6E6E8A;
    --page-bg: #FAF9F6;
    --card-bg: #ffffff;
    --chip-bg: #F4F3FB;
    --border: #E7E6F2;
    --shadow: 0 24px 48px -24px rgba(20, 20, 60, 0.22);
    --shadow-sm: 0 8px 20px -10px rgba(20, 20, 60, 0.14);
    --present-bg: #E4F5EC;
    --present-text: #1F8355;
    --absent-bg: #FCE7E4;
    --absent-text: #C24632;
    --pending-bg: #FDF0DA;
    --pending-text: #B4770B;
    --cal-present-past-bg: #E2ECE4;
    --cal-present-past-text: #698572;
    --cal-absent-past-bg: #EDCAC0;
    --cal-absent-past-text: #9B5845;
  }
  * { box-sizing: border-box; }
  /* Cross-fade from one page to the next instead of a blank flash while
     it loads (Safari 18.2+, Chrome 126+; others just navigate as before). */
  @view-transition { navigation: auto; }
  @media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
  /* Without this, any element whose own class sets "display" (most of
     them, since almost nothing here relies on the browser default) stays
     visible when JS sets .hidden = true — an author style always beats
     the UA's unstyled [hidden] rule at equal specificity. */
  [hidden] { display: none !important; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body {
    margin: 0;
    min-height: 100vh;
    font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.55;
    background: var(--page-bg);
    color: var(--navy);
    -webkit-font-smoothing: antialiased;
  }
  img, svg { max-width: 100%; height: auto; }

  /* Fixed, full-bleed color layer behind everything else. iOS Safari only
     tints the status bar to match a page's color when that color is on a
     position: fixed element spanning the viewport — a normal in-flow
     background (even at the very top of the page) is not picked up. */
  .chrome-bg { position: fixed; inset: 0; z-index: -1; background: var(--page-bg); }

  /* Standard page shell: brand header + single card. Used everywhere
     except the split auth screens (login gate, invite). */
  .wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: max(20px, env(safe-area-inset-top)) 20px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }
  @media (min-width: 640px) { .wrap { max-width: 600px; padding: max(40px, env(safe-area-inset-top)) 24px 56px; } }
  @media (min-width: 1024px) { .wrap { max-width: 660px; padding: max(64px, env(safe-area-inset-top)) 24px 72px; } }
  .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
  .wrap .brand-text { flex: 1; min-width: 0; }
  .header-icon-link {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--navy-muted);
    -webkit-tap-highlight-color: transparent;
  }
  .header-icon-link .icon { width: 20px; height: 20px; }
  @media (hover: hover) { .header-icon-link:hover { color: var(--navy); } }
  .brand img { flex: none; width: 36px; height: 36px; border-radius: 9px; }
  @media (min-width: 640px) {
    .brand { gap: 12px; margin-bottom: 28px; }
    .brand img { width: 42px; height: 42px; }
  }
  .brand-text h2 {
    font-family: "Baloo 2", "Nunito", sans-serif;
    font-size: clamp(1.05rem, 0.97rem + 0.3vw, 1.2rem);
    font-weight: 600;
    margin: 0;
    color: var(--navy);
  }
  .brand-text p { margin: 1px 0 0; font-size: 0.78rem; color: var(--navy-muted); }
  .card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    padding: 24px 20px;
  }
  @media (min-width: 640px) { .card { border-radius: 24px; padding: 36px 32px; box-shadow: var(--shadow); } }
  /* margin-bottom (not a sibling-combinator margin-top) so spacing
     between stacked cards is unaffected by a hidden <dialog> or
     <script> sitting between them in the DOM. */
  .card { margin-bottom: 24px; }
  .card-section-title {
    font-family: "Baloo 2", sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--navy-muted);
    margin: 0 0 12px;
  }
  .card-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; }
  .card-title-row h1 { margin: 0; }
  .card-actions { display: flex; gap: 8px; flex: none; }
  .icon-button {
    flex: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--indigo);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
  }
  .icon-button .icon { display: flex; flex: none; width: 18px; height: 18px; box-sizing: content-box; }
  .icon-button .icon svg { display: block; width: 100%; height: 100%; }
  .icon-button:active { background: var(--chip-bg); }
  @media (hover: hover) { .icon-button:hover { border-color: var(--navy-muted); } }
  .icon-button.primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
  @media (hover: hover) { .icon-button.primary:hover { background: var(--indigo-hover); border-color: var(--indigo-hover); } }
  .icon-button.danger { color: #B8402C; border-color: #B8402C; }
  @media (hover: hover) { .icon-button.danger:hover { background: #FBEAE7; } }
  .icon-button.whatsapp { color: #25D366; border-color: #25D366; }
  @media (hover: hover) { .icon-button.whatsapp:hover { background: #E3FCEC; } }

  /* Split auth shell: indigo brand panel with the signature house/book
     illustration, white form panel — side by side on desktop,
     illustration hidden on mobile. */
  /* min-height (not a fixed height + overflow: hidden) so the real page
     scrolls naturally on mobile — iOS Safari's floating toolbar only gets
     out of the way of content on genuine page scroll, not an inner div's
     overflow, and a fixed-height box here left the last button permanently
     covered with nothing to scroll into. */
  .auth-shell {
    max-width: 1040px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: var(--page-bg);
  }
  @media (min-width: 900px) {
    .auth-shell { justify-content: center; padding: 40px 24px; background: none; }
  }
  .auth-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
  }
  @media (min-width: 900px) {
    .auth-card {
      flex-direction: row;
      min-height: 620px;
      border-radius: 28px;
      overflow: hidden;
      box-shadow: var(--shadow);
    }
  }
  /* Mobile: bubble/star background image behind the hero illustration,
     a curved white sheet overlapping its bottom edge. Desktop (>=900px):
     classic side-by-side indigo split panel, overridden below. */
  .auth-illustration {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    height: 36vh;
    height: 36dvh;
    min-height: 220px;
    overflow: hidden;
    background-color: var(--indigo);
    background-image: linear-gradient(rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15)), url("/images/panel-bg.webp");
    background-size: cover, cover;
    background-position: center, center;
  }
  .auth-illustration img.hero { display: none; }
  .auth-illustration h1, .auth-illustration p { display: none; }
  @media (min-width: 900px) {
    .auth-illustration {
      flex-direction: column;
      justify-content: center;
      align-items: center;
      flex: 1;
      height: auto;
      padding: 48px;
      text-align: center;
      color: #fff;
      background-color: var(--indigo);
      background-image: linear-gradient(160deg, var(--indigo) 0%, var(--indigo-deep) 100%);
    }
    .auth-illustration img.hero { display: block; height: auto; width: 100%; max-width: 280px; max-width: min(280px, 78%); margin-bottom: 28px; filter: drop-shadow(0 20px 30px rgba(0,0,0,0.25)); }
    .auth-illustration h1, .auth-illustration p { display: block; }
    .auth-illustration h1 {
      color: #fff;
      font-size: clamp(1.5rem, 1.25rem + 1vw, 1.9rem);
      margin: 0 0 12px;
    }
    .auth-illustration p { color: rgba(255, 255, 255, 0.86); font-size: 1rem; margin: 0; max-width: 320px; }
  }
  .auth-card { flex: 1; }
  @media (min-width: 900px) { .auth-card { flex: none; min-height: 620px; overflow: hidden; } }
  .auth-form {
    position: relative;
    flex: 1 0 auto;
    margin-top: -28px;
    background: var(--card-bg);
    border-radius: 28px 28px 0 0;
    padding: 30px 24px calc(84px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  @media (min-width: 640px) { .auth-form { padding: 30px 40px calc(84px + env(safe-area-inset-bottom)); } }
  @media (min-width: 900px) {
    .auth-form {
      flex: 1;
      margin-top: 0;
      padding: 56px;
      justify-content: center;
      border-radius: 0;
      box-shadow: none;
    }
  }
  .auth-form .brand {
    position: relative;
    z-index: 1;
    margin-bottom: 18px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
  }
  .auth-form .brand img {
    width: 180px;
    height: 180px;
    margin-top: -160px;
    filter: drop-shadow(0 12px 22px rgba(20, 20, 60, 0.3));
  }
  .auth-form .brand-text h2 { font-size: 1.5rem; }
  @media (min-width: 900px) { .auth-form .brand { display: none; } }

  .tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--navy-muted);
    background: var(--chip-bg);
    border: 1px solid var(--border);
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  }
  .tabs a.active { color: #fff; background: var(--indigo); border-color: var(--indigo); }
  @media (hover: hover) {
    .tabs a:not(.active):hover { border-color: var(--indigo); color: var(--indigo); }
  }
  .tabs a.is-loading { opacity: 0.7; }
  .tabs a.is-loading::after {
    content: "";
    width: 11px;
    height: 11px;
    flex: none;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
  }
  a.breadcrumb {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--indigo);
    text-decoration: none;
  }
  @media (hover: hover) { a.breadcrumb:hover { color: var(--indigo-hover); } }
  h1 {
    font-family: "Baloo 2", "Nunito", sans-serif;
    font-size: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 14px;
    color: var(--navy);
    line-height: 1.18;
  }
  p { font-size: 1rem; margin: 0 0 16px; word-break: break-word; color: var(--navy); }
  p:last-child { margin-bottom: 0; }
  p.muted { color: var(--navy-muted); font-size: 0.94rem; }
  p.muted.small { font-size: 0.8rem; margin-top: -8px; }
  h3 {
    font-family: "Baloo 2", "Nunito", sans-serif;
    font-size: 1.08rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--navy);
  }
  .kid-card { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--border); }
  .kid-card:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
  .kid-card h3 { margin: 0; }
  .kid-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
  .kid-avatar {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--indigo);
    color: #fff;
    font-family: "Baloo 2", sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
  }
  .invite-kids { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 18px; }
  .invite-kid { display: flex; align-items: center; gap: 10px; font-weight: 700; }
  .invite-kid .kid-avatar { width: 34px; height: 34px; font-size: 0.95rem; }
  .status-pill {
    display: inline-block;
    margin-top: 3px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
  }
  .status-pill.present { background: var(--present-bg); color: var(--present-text); }
  .status-pill.absent { background: var(--absent-bg); color: var(--absent-text); }
  .status-pill.pending { background: var(--pending-bg); color: var(--pending-text); }
  .status-pill.closed { background: var(--chip-bg); color: var(--navy-muted); border: 1px solid var(--border); }
  .date-pill {
    position: relative;
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--navy);
    font-weight: 700;
    font-size: 0.82rem;
    white-space: nowrap;
    cursor: pointer;
  }
  .date-pill-chevron { color: var(--navy-muted); font-size: 0.7rem; }
  .date-pill input[type="date"] { position: absolute; inset: 0; opacity: 0; margin: 0; padding: 0; border: none; cursor: pointer; }
  .day-strip { display: flex; align-items: center; gap: 8px; margin-top: 20px; margin-bottom: 26px; }
  .day-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 4px;
    border-radius: 14px;
    background: var(--chip-bg);
    color: var(--navy);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .day-card-label { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: var(--navy-muted); }
  .day-card-num { font-size: 1.05rem; font-family: "Baloo 2", sans-serif; font-weight: 700; color: var(--navy); }
  .day-card.active { background: var(--indigo); box-shadow: var(--shadow-sm); }
  .day-card.active .day-card-label { color: rgba(255, 255, 255, 0.8); }
  .day-card.active .day-card-num { color: #fff; }
  .day-strip-arrow {
    flex: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--chip-bg);
    color: var(--indigo);
    font-size: 1.2rem;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  @media (hover: hover) { .day-strip-arrow:hover { background: var(--border); } }
  .stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin: 14px 0 18px; }
  .stat-card { background: var(--chip-bg); border-radius: 14px; padding: 14px 14px 12px; }
  .stat-card .stat-value { font-family: "Baloo 2", sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
  .stat-card .stat-label { font-size: 0.78rem; color: var(--navy-muted); margin-top: 3px; }
  .kid-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin: 0 -10px;
    border-radius: 14px;
    font-size: 0.95rem;
    transition: background 0.15s ease;
  }
  .kid-list-item .kid-list-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .kid-list-item .kid-list-name strong { font-weight: 700; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kid-list-item .kid-list-name .status { font-size: 0.82rem; color: var(--navy-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
  .kid-list-item > .status { color: var(--navy-muted); font-size: 0.85rem; white-space: nowrap; }
  a.kid-list-item { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
  @media (hover: hover) { a.kid-list-item:hover { background: var(--chip-bg); } }
  .calendar { margin-top: 10px; }
  .cal-header { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 14px; }
  .cal-month-label {
    font-family: "Baloo 2", sans-serif;
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--indigo);
  }
  .cal-nav-arrow {
    flex: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--indigo);
    font-size: 1.5rem;
    line-height: 1;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .cal-nav-arrow:active { background: var(--chip-bg); }
  @media (hover: hover) { .cal-nav-arrow:hover { background: var(--chip-bg); } }
  .cal-weekdays, .cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
  @media (min-width: 640px) { .cal-weekdays, .cal-week { gap: 6px; } }
  .cal-weekdays { padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
  .cal-weekdays span { text-align: center; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--indigo); }
  .cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-size: 0.85rem;
    background: var(--chip-bg);
    color: var(--navy);
    transition: filter 0.1s ease;
  }
  .cal-day.empty { background: transparent; }
  .cal-day.absent { background: #D9503C; color: #fff; font-weight: 700; }
  .cal-day.present { background: var(--present-bg); color: var(--present-text); }
  .cal-day.past.absent { background: var(--cal-absent-past-bg); color: var(--cal-absent-past-text); }
  .cal-day.past.present { background: var(--cal-present-past-bg); color: var(--cal-present-past-text); }
  .cal-day.today { box-shadow: inset 0 0 0 2px var(--indigo); font-weight: 700; }
  .cal-day.weekend { opacity: 0.4; }
  .cal-day.holiday {
    position: relative;
    background: var(--pending-bg);
    color: var(--pending-text);
    font-weight: 700;
    opacity: 1;
  }
  .cal-day.holiday.past { opacity: 0.65; }
  .cal-day.holiday::after {
    content: "";
    position: absolute;
    top: 4px;
    right: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
  }
  @media (hover: hover) { button.cal-day:hover { filter: brightness(0.96); } }
  .cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 0.78rem; color: var(--navy-muted); }
  .cal-legend + p.muted.small { margin-top: 12px; }
  .cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
  .cal-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; border: 1px solid rgba(20, 20, 43, 0.18); }
  .cal-legend i.absent { background: #D9503C; border-color: #D9503C; }
  .cal-legend i.present { background: var(--present-text); border-color: var(--present-text); }
  .cal-legend i.today { border: 2px solid var(--indigo); }
  .cal-legend i.holiday { background: var(--pending-text); border-color: var(--pending-text); }
  .cal-day-form { display: contents; }
  .cal-day .spinner { width: 14px; height: 14px; border-width: 2px; }
  button.cal-day {
    border: none;
    padding: 0;
    margin: 0;
    font-family: "Nunito", sans-serif;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
  }
  button.cal-day:active { filter: brightness(0.93); }
  button.cal-day.absent, button.cal-day.today { font-weight: 700; }
  a.button, button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    line-height: 1.25;
    padding: 14px 18px;
    margin: 0 0 10px;
    border-radius: 14px;
    border: none;
    background: var(--indigo);
    color: #fff;
    font-family: "Nunito", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  }
  a.button:active, button:active { background: var(--indigo-hover); transform: translateY(1px); }
  a.button.secondary, button.secondary { background: var(--card-bg); color: var(--indigo); border: 1.5px solid var(--indigo); }
  a.button.danger, button.danger { background: var(--card-bg); color: #B8402C; border: 1.5px solid #B8402C; }
  a.button.whatsapp, button.whatsapp { background: #25D366; }
  a.button:last-of-type, button:last-of-type, .button-row:last-child { margin-bottom: 0; }
  @media (hover: hover) {
    a.button:hover, button:hover { background: var(--indigo-hover); box-shadow: var(--shadow-sm); }
    a.button.secondary:hover, button.secondary:hover { background: var(--chip-bg); }
    a.button.danger:hover, button.danger:hover { background: #FBEAE7; }
    a.button.whatsapp:hover, button.whatsapp:hover { background: #1DA851; }
  }
  a.button:focus-visible, button:focus-visible, a.button-provider:focus-visible, .tabs a:focus-visible, input:focus-visible {
    outline: 2px solid var(--indigo);
    outline-offset: 2px;
  }
  .button-row { display: flex; gap: 8px; margin-bottom: 10px; }
  .button-row a.button, .button-row button { margin-bottom: 0; }
  .provider-buttons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
  a.button-provider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 16px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--navy);
    font-family: "Nunito", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  }
  .provider-buttons a.button-provider.whatsapp {
    background: #25D366;
    border-color: #25D366;
    color: #fff;
  }
  a.button-provider.disabled { opacity: 0.55; pointer-events: none; cursor: default; }
  a.button-provider:active { background: var(--chip-bg); }
  .provider-buttons a.button-provider.whatsapp:active { background: #1DA851; border-color: #1DA851; }
  a.button-provider svg { width: 20px; height: 20px; flex: none; }
  @media (hover: hover) {
    a.button-provider:hover { border-color: var(--navy-muted); box-shadow: var(--shadow-sm); }
    .provider-buttons a.button-provider.whatsapp:hover { background: #1DA851; border-color: #1DA851; box-shadow: var(--shadow-sm); }
  }
  input, select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 13px 16px;
    font-size: 1rem;
    font-weight: 400;
    font-family: "Nunito", sans-serif;
    margin: 0 0 18px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--chip-bg);
    color: var(--navy);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }
  input:focus, select:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 18%, transparent);
  }
  label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--navy-muted);
  }
  form { margin: 0; }
  dialog {
    border: none;
    border-radius: 20px;
    padding: 24px 22px;
    max-width: 420px;
    width: calc(100% - 48px);
    background: var(--card-bg);
    color: var(--navy);
    box-shadow: var(--shadow);
  }
  dialog::backdrop { background: rgba(20, 20, 45, 0.5); }
  dialog h2 {
    font-family: "Baloo 2", "Nunito", sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 14px;
    color: var(--navy);
  }
  /* top/right are set inline by JS right before showModal(), anchored to
     the avatar button's actual position — the page content is a centered
     fixed-width column at wider viewports, not full-bleed, so a viewport-
     edge-relative offset here would drift away from the button. */
  dialog.account-menu {
    position: fixed;
    left: auto;
    bottom: auto;
    margin: 0;
    width: 210px;
    max-width: calc(100vw - 40px);
    padding: 6px;
    border-radius: 16px;
  }
  dialog.account-menu::backdrop { background: transparent; }
  /* button.account-menu-item duplicates every rule at matching specificity
     (element + class, not just class) — a plain .account-menu-item alone
     loses to the global "a.button, button" reset on a <button> (unlike an
     <a>, which that selector doesn't touch unless it also has class
     "button"), leaking that reset's border/background/centering back in. */
  .account-menu-item, button.account-menu-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: none;
    color: var(--navy);
    font-family: "Nunito", sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .account-menu-item .icon, button.account-menu-item .icon { flex: none; width: 18px; height: 18px; color: var(--navy-muted); }
  .account-menu-item.danger, button.account-menu-item.danger { color: #B8402C; background: none; border: none; }
  .account-menu-item.danger .icon, button.account-menu-item.danger .icon { color: #B8402C; }
  @media (hover: hover) { .account-menu-item:hover { background: var(--chip-bg); } }
  .account-menu-divider { height: 1px; margin: 6px 4px; background: var(--border); }

  .nav-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--indigo);
    z-index: 9999;
    opacity: 0;
    transition: width 4s cubic-bezier(0.1, 0.8, 0.2, 1), opacity 0.2s ease;
  }
  .spinner {
    width: 16px;
    height: 16px;
    border: 2.5px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.6s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  @media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.4s; } }
  button:disabled { opacity: 0.65; cursor: default; }
  a.is-loading { opacity: 0.55; pointer-events: none; }

  .invoice-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
  .invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px 0;
    margin-bottom: 16px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  @media (max-width: 480px) { .invoice-parties { grid-template-columns: 1fr; } }
  .invoice-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
  .invoice-actions > * { margin: 0; }
  .invoice-table-wrap { overflow-x: auto; margin-bottom: 20px; }
  .invoice-table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 0.88rem; }
  .invoice-table th, .invoice-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
  .invoice-table th { color: var(--navy-muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; }
  .invoice-table td.num, .invoice-table th.num { text-align: right; }
  .invoice-table td:nth-child(2), .invoice-table th:nth-child(2) { white-space: normal; }
  .invoice-total-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 2px solid var(--navy); }
  /* No min-width (unlike .invoice-table) — the whole point is fitting a
     kid name + 5 day columns on one phone screen with no horizontal
     scroll, so columns need to shrink with the viewport instead. */
  .matrix-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; table-layout: fixed; }
  .matrix-table th, .matrix-table td { padding: 4px 2px; border-bottom: 1px solid var(--border); }
  .matrix-table th { color: var(--navy-muted); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.02em; font-weight: 700; }
  .matrix-table th:first-child, .matrix-table td:first-child { text-align: left; width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  @media (min-width: 640px) { .matrix-table { font-size: 0.92rem; } .matrix-table th { font-size: 0.72rem; } }
  @media print {
    .no-print, footer, .brand, .tabs { display: none !important; }
    body, .chrome-bg { background: #fff !important; }
    .wrap { max-width: none; padding: 0; }
    .invoice-sheet { box-shadow: none; border: none; padding: 0; }
  }
