[hidden] { display: none !important; }
/* Touch-first application shell. Desktop keeps the full workspace. */
.app-tabs, .app-wordmark, .drawer-close, .mobile-account, .app-shortcuts, .mobile-only { display: none; }
.menu-backdrop[hidden] { display: none; }
.day-number { color: var(--text); }
.day.today > .day-number { background: var(--green); color: var(--surface); padding: 3px 7px; border-radius: 50%; }

@media (max-width: 760px), (max-width: 1100px) and (pointer: coarse) {
  :root:not([data-theme=dark]) { --bg: #f3f6f6; --line: #e2e8e9; --soft: #e9f2f3; }
  :root { --app-shadow: 0 6px 24px rgba(22, 61, 70, .045); }
  body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; -webkit-tap-highlight-color: transparent; }
  .app-shell { background: #f3f6f6; }
  :root[data-theme=dark] .app-shell { background: var(--bg); }
  .app-shell .workspace { margin-left: 0; }
  .app-shell header {
    position: sticky; top: 0; z-index: 15; height: auto; min-height: 72px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .app-wordmark { display: flex; align-items: center; gap: 9px; color: var(--text); margin-right: auto; min-width: 0; }
  .app-wordmark:hover { text-decoration: none; }
  .app-wordmark > span:last-child { font-size: 19px; font-weight: 750; line-height: 1.1; letter-spacing: -.5px; }
  .app-wordmark small { margin-top: 4px; font-size: 9px; letter-spacing: .3px; font-weight: 500; }
  .app-wordmark .logo-mark { width: 29px; height: 29px; margin: 0; border-width: 1.5px; }
  .app-wordmark .logo-mark::after { inset: 6px; }
  .app-shell .header-title, .app-shell .header-actions .user, .app-shell .header-actions > form { display: none; }
  .app-shell .header-actions { gap: 0; }
  .app-shell #menu-toggle { order: 3; display: flex; }
  .app-shell .icon-button, .app-shell .notifications-button {
    display: inline-flex; align-items: center; justify-content: center; min-width: 42px; min-height: 44px;
    border-radius: 13px; padding: 8px; font-size: 22px;
  }
  .app-shell .notifications-button { position: relative; }
  .notifications-button span {
    position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 1px 4px;
    background: var(--green); color: var(--surface); font-size: 9px; line-height: 15px;
    border: 2px solid var(--surface); border-radius: 10px;
  }
  .notifications-button span.is-zero { display: none; }
  .app-shell main { padding: 24px 18px calc(100px + env(safe-area-inset-bottom)); max-width: 620px; }
  .app-shell main > footer { display: none; }
  h1 { font: 750 28px/1.2 system-ui, -apple-system, sans-serif; letter-spacing: -.8px; margin: 5px 0 9px; overflow-wrap: anywhere; }
  h2 { font-size: 17px; font-weight: 700; letter-spacing: -.25px; }
  h3 { font-size: 15px; }
  .eyebrow { font-size: 9px; letter-spacing: 1.6px; }
  .page-heading { gap: 16px; margin-bottom: 22px; }
  .page-heading .muted { font-size: 12px; line-height: 1.6; }
  .page-heading > .form-actions { width: 100%; }
  .page-heading > .form-actions .button { flex: 1; }
  .button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; border-radius: 13px; padding: 12px 17px; font-size: 13px;
    font-weight: 650; line-height: 1.35;
  }
  .button:active, .app-shortcuts a:active { transform: scale(.98); }
  .button.secondary { background: var(--surface); border-color: var(--line); }
  .text-button { min-height: 44px; padding: 10px 4px; font-weight: 600; }
  .card { padding: 20px; border-radius: 20px; border-color: var(--line); box-shadow: var(--app-shadow); }
  .card-heading { gap: 10px; align-items: flex-start; }
  .card-heading a { font-weight: 650; font-size: 11px; min-height: 32px; display: inline-flex; align-items: center; flex-shrink: 0; }
  .slots { margin-top: 18px; }
  .two-columns { gap: 18px; }
  .home-welcome {
    position: relative; border: 0; border-radius: 24px; padding: 26px 22px;
    background: linear-gradient(130deg, #123e49, #226573); color: #fff;
    box-shadow: 0 10px 28px rgba(24, 83, 97, .15);
  }
  .home-welcome::after { content: ''; position: absolute; width: 150px; height: 150px; border: 1px solid #ffffff18; border-radius: 50%; right: -52px; top: -45px; pointer-events: none; }
  .home-welcome .desktop-only { display: none; }
  .home-welcome .mobile-only { display: block; }
  .home-welcome .eyebrow { color: #d4c29d; font-size: 8px; letter-spacing: 1.7px; }
  .home-welcome h2 { font: 650 26px/1.25 system-ui, sans-serif; letter-spacing: -.6px; margin: 13px 0; }
  .home-welcome p { color: #dae8eb; font-size: 12px; max-width: 270px; margin-bottom: 20px; }
  .home-welcome .button { background: #fff; color: #185361; border-color: #fff; }
  .home-welcome .button.secondary { background: #ffffff0e; color: #fff; border-color: #ffffff35; }
  .home-welcome > div { width: 100%; }
  .home-welcome .hero-actions { display: flex; gap: 8px; }
  .home-welcome .hero-actions .button { flex: 1; }
  .home-welcome .button { font-size: 11px; padding: 10px 12px; margin: 0 4px 0 0; min-height: 44px; }
  .app-shortcuts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0 22px; }
  .app-shortcuts a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; min-height: 96px; padding: 12px 6px; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; color: var(--green); box-shadow: var(--app-shadow); }
  .app-shortcuts .nav-icon { width: 24px; height: 24px; }
  .app-shortcuts span { width: auto; position: relative; font-size: 10px; font-weight: 650; }
  .app-shortcuts b { position: absolute; right: -9px; top: -42px; background: var(--green); color: var(--surface); border-radius: 50%; min-width: 17px; padding: 1px 4px; font-size: 9px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 20px 0; }
  .metrics article { padding: 17px 14px; border-radius: 18px; box-shadow: var(--app-shadow); }
  .metrics article > span { display: block; font-size: 10px; line-height: 1.5; }
  .metrics strong { font-size: 25px; line-height: 1.25; letter-spacing: -.6px; margin: 9px 0 5px; overflow-wrap: anywhere; }
  .metrics small, .metrics a { font-size: 10px; line-height: 1.5; }
  .appointment { padding: 17px 0; gap: 12px; flex-wrap: wrap; }
  .appointment > div { min-width: 0; overflow-wrap: anywhere; }
  .client-welcome { background: linear-gradient(130deg, #123e49, #226573); border-radius: 24px; padding: 24px; color: #fff; box-shadow: 0 10px 28px #18536118; }
  .client-welcome .eyebrow { color: #d4c29d; }
  .client-welcome h1 { font-size: 25px; }
  .client-welcome .muted { color: #dce8eb; }
  .client-welcome > .button { background: #fff; color: #185361; border-color: #fff; width: 100%; }
  .session-date { display: flex; align-items: center; gap: 12px; }
  .session-date .nav-icon { width: 24px; height: 24px; color: var(--green); }
  .session-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
  .session-actions .button { min-height: 44px; font-size: 12px; }
  .session-link { display: inline-flex; min-height: 40px; align-items: center; font-size: 12px; }
  .appointment strong { font-size: 13px; }
  .appointment small { font-size: 11px; margin-top: 3px; }
  .appointment > .badge { font-size: 9px; }
  .appointment > form { margin-left: auto; }
  .calendar-chip { min-width: 46px; border-radius: 13px; padding: 10px 7px; font-size: 19px; }
  .empty { border-radius: 14px; background: var(--bg); margin-top: 12px; padding: 28px 15px; font-size: 13px; }
  .empty p { font-size: 11px; }
  .form-card { max-width: none; }
  .form-card form > .button, .form-card .form-actions > .button { flex: 1; width: 100%; }
  input, select, textarea { font-size: 16px; min-height: 48px; border-radius: 12px; padding: 12px 13px; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 19px; height: 19px; flex-shrink: 0; }
  form label { font-size: 12px; margin-bottom: 8px; }
  .filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
  .filters label { grid-column: 1 / -1; }
  .filters input, .filters select { width: 100%; min-width: 0; max-width: none; }
  .filters a { font-size: 12px; min-height: 36px; display: flex; align-items: center; }
  .filters .button { font-size: 12px; }
  fieldset { border: 0; padding: 0; margin: 18px 0; min-width: 0; }
  legend { font-size: 12px; font-weight: 650; margin-bottom: 10px; }
  #id_dias { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #id_dias label { display: flex; align-items: center; gap: 10px; margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 48px; background: var(--bg); }
  #id_dias label:has(input:checked) { background: var(--soft); border-color: var(--green); color: var(--green); }
  .work-routine { margin-bottom: 18px; }
  .work-routine > summary { display: flex; gap: 12px; align-items: center; list-style: none; margin: -2px 0; font-size: 14px; font-weight: 700; min-height: 44px; }
  .work-routine > summary::-webkit-details-marker { display: none; }
  .work-routine > summary::after { content: '+'; font-size: 24px; margin-left: auto; font-weight: 400; }
  .work-routine[open] > summary::after { content: '−'; }
  .calendar { min-width: 0; gap: 3px; }
  .weekday { font-size: 9px; padding: 8px 0; }
  .day { min-height: 73px; padding: 5px 2px; border: 0; border-radius: 9px; background: var(--bg); text-align: center; font-size: 11px; }
  .day-number { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 25px; color: var(--text); }
  .day.today > .day-number { background: var(--green); color: var(--surface); border-radius: 50%; }
  .calendar .calendar-event { font-size: 8px; padding: 3px 0; margin: 3px 0 0; border-radius: 4px; line-height: 1.35; }
  .calendar .calendar-event .event-person, .calendar .calendar-event small { display: none; }
  .period-calendar { grid-template-columns: repeat(7, minmax(180px, 1fr)); min-width: 0; }
  .period-calendar.daily { grid-template-columns: 1fr; }
  .period-column { background: var(--bg); border-radius: 14px; }
  .calendar-wrap { overscroll-behavior-x: contain; }
  .app-records, .app-records tbody { display: block; width: 100%; }
  .app-records thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .app-records tr { display: block; padding: 17px; margin-bottom: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; }
  .app-records td { display: block; border: 0; padding: 5px 0; font-size: 12px; overflow-wrap: anywhere; }
  .app-records td:first-child { font-size: 15px; font-weight: 700; padding-bottom: 8px; }
  .app-records td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: 9px; font-weight: 600; letter-spacing: .7px; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
  .app-records td:last-child a, .app-records .row-actions button { display: inline-flex; align-items: center; min-height: 40px; padding-right: 10px; }
  .app-records .notes-link { font-size: 11px; margin: 0; }
  .app-records td.empty { text-align: center; font-weight: 400; }
  .app-records .row-actions { gap: 8px; }
  .notice { border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 13px; font-size: 12px; padding: 14px; }
  .back { display: inline-flex; align-items: center; min-height: 36px; font-weight: 600; }
  .app-tabs {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed; z-index: 20; bottom: 0; left: 0; right: 0;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -5px 24px #123e4907;
  }
  .app-tabs a, .app-tabs button {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; min-height: 52px; margin: 0 3px; padding: 7px 4px; border-radius: 15px;
    background: none; border: 0; color: var(--muted); font-size: 10px; font-weight: 600; line-height: 1.1;
  }
  .app-tabs a:hover { text-decoration: none; }
  .app-tabs span { width: auto; font-size: 10px; line-height: 1.2; }
  .app-tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .app-tabs [aria-current=page], .app-tabs button.active { background: var(--soft); color: var(--green); }
  .app-tabs [aria-current=page] svg { stroke-width: 2.1; }
  .menu-backdrop { display: block; position: fixed; inset: 0; z-index: 30; padding: 0; border: 0; background: #071c2780; backdrop-filter: blur(3px); }
  .app-shell #sidebar {
    z-index: 40; inset: auto 0 0; width: 100%; max-height: 85dvh; padding: 25px 22px calc(28px + env(safe-area-inset-bottom));
    border: 0; border-radius: 26px 26px 0 0; transform: translateY(105%); visibility: hidden;
    transition: transform .23s ease, visibility .23s; overscroll-behavior: contain;
  }
  .app-shell.menu-open #sidebar { transform: translateY(0); visibility: visible; box-shadow: 0 -16px 50px #0002; }
  .app-shell.menu-open { overflow: hidden; }
  .app-shell #sidebar::before { content: ''; display: block; position: absolute; top: 10px; left: calc(50% - 18px); width: 36px; height: 4px; border-radius: 4px; background: var(--line); }
  .drawer-close { display: inline-flex; position: absolute; top: 20px; right: 16px; }
  #sidebar .brand { padding: 8px 48px 16px 0; gap: 12px; }
  #sidebar .brand-name { font: 700 17px/1.4 system-ui, sans-serif; max-width: 220px; }
  #sidebar .nav-label { margin: 16px 0 9px; font-size: 9px; }
  #sidebar nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #sidebar nav .nav-label { grid-column: 1 / -1; }
  #sidebar nav a { margin: 0; font-size: 11px; padding: 13px 10px; min-height: 54px; border: 1px solid var(--line); border-radius: 13px; gap: 10px; }
  #sidebar nav a.active { border-color: var(--green); }
  #sidebar .sidebar-footer { margin: 20px 0 0; font-size: 10px; }
  .mobile-account { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
  .mobile-account strong { font-size: 11px; overflow-wrap: anywhere; min-width: 0; }
  .mobile-account form { flex-shrink: 0; margin: 0; }
  .mobile-account .button { min-height: 40px; padding: 10px 14px; font-size: 11px; }
  .keyboard-open .app-tabs { display: none; }
  .keyboard-open main { padding-bottom: 30px; }
  .app-auth { background: var(--bg); }
  .app-auth .login-layout { padding: calc(40px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom)); min-height: 100dvh; max-width: 480px; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 26px; }
  .app-auth .login-intro { text-align: center; }
  .app-auth .login-intro .logo-mark { width: 52px; height: 52px; margin: 0 0 10px; }
  .app-auth .login-intro .logo-mark::after { inset: 11px; }
  .app-auth .login-intro .eyebrow { font-size: 9px; letter-spacing: 1px; }
  .app-auth .login-intro h1 { font: 700 25px/1.3 system-ui, sans-serif; margin: 13px 0; }
  .app-auth .login-intro > p:not(.eyebrow), .app-auth .login-intro > small { display: none; }
  .app-auth .login-card { border: 1px solid var(--line); border-radius: 24px; padding: 26px 22px; box-shadow: var(--app-shadow); }
  .app-auth .login-card h2 { font: 700 21px/1.3 system-ui, sans-serif; margin: 0 0 8px; letter-spacing: -.4px; }
  .app-auth .login-card p { font-size: 12px; }
  .app-auth .login-card .eyebrow { display: none; }
  .app-auth .login-card form { margin-top: 22px; }
  .app-auth .login-card > p { text-align: center; }
  .confirmation-dialog { border-radius: 22px; padding: 25px; }
  :root[data-theme=dark] .home-welcome { background: linear-gradient(130deg, #1c4d59, #246170); }
}
@media (max-width: 360px) {
  .app-shell main { padding-left: 12px; padding-right: 12px; }
  .app-wordmark small { font-size: 8px; }
  .app-shell header { padding-left: 12px; padding-right: 8px; gap: 5px; }
  .app-shell .icon-button, .app-shell .notifications-button { min-width: 36px; }
  .home-welcome { padding: 22px 18px; }
  .home-welcome .button { font-size: 10px; padding: 10px; }
}
@media print { .app-tabs, .app-wordmark, .menu-backdrop, .app-shortcuts { display: none !important; } }

@media (max-width:760px),(max-width:1100px) and (pointer:coarse){
.app-wordmark .logo-mark{width:36px;height:36px;border:0}
.app-wordmark .app-brand-name{font:600 23px/1.1 Georgia,serif;letter-spacing:0}
.app-wordmark .app-brand-name small{font:600 8px/1.2 system-ui,sans-serif;letter-spacing:1.8px;margin:0 0 3px;color:var(--muted)}
.app-auth .login-intro .logo-mark{width:66px;height:66px}
}
