/* Capa mobile-first de Nodly. Comparte datos y acciones con la experiencia desktop. */
.mobile-bottom-nav,.mobile-sheet-backdrop,.mobile-only-view,.mobile-patient-actions{display:none}
.mobile-bottom-nav[hidden]{display:none!important}

@media(max-width:768px){
  :root{--mobile-nav-height:72px;--mobile-safe-bottom:env(safe-area-inset-bottom,0px)}
  html,body{overscroll-behavior-y:none;background:#f7f8f4}
  body.authenticated:not(.superadmin-mode){padding-bottom:calc(var(--mobile-nav-height) + var(--mobile-safe-bottom))}
  body.authenticated:not(.superadmin-mode) .prototype-bar,
  body.authenticated:not(.superadmin-mode) .sidebar{display:none!important}
  body.authenticated:not(.superadmin-mode) .app-shell{display:block;min-height:100dvh}
  body.authenticated:not(.superadmin-mode) .main-area{margin:0!important;width:100%;height:auto;min-height:100dvh;overflow:visible;background:#f7f8f4}
  body.authenticated:not(.superadmin-mode) .topbar{position:sticky;top:0;z-index:35;height:calc(58px + env(safe-area-inset-top,0px));padding:env(safe-area-inset-top,0px) 16px 0;background:rgba(247,248,244,.92);backdrop-filter:blur(18px);border-bottom:1px solid rgba(41,71,53,.08)}
  body.authenticated:not(.superadmin-mode) .topbar:before{content:'Nodly';font:600 22px/1 'DM Serif Display',serif;color:#294735;letter-spacing:-.02em}
  body.authenticated:not(.superadmin-mode) .mobile-menu,
  body.authenticated:not(.superadmin-mode) .topbar .search,
  body.authenticated:not(.superadmin-mode) .timezone-button,
  body.authenticated:not(.superadmin-mode) .module-help-button{display:none!important}
  body.authenticated:not(.superadmin-mode) .top-actions{margin-left:auto}
  body.authenticated:not(.superadmin-mode) .view{padding:18px 16px 8px;max-width:none;min-height:calc(100dvh - 150px)}
  body.authenticated:not(.superadmin-mode) .page-head{align-items:flex-start}
  body.authenticated:not(.superadmin-mode) .page-head>div:first-child .eyebrow{display:none}
  body.authenticated:not(.superadmin-mode) .page-head h1{font-size:28px;line-height:1.08}
  body.authenticated:not(.superadmin-mode) .page-head p{font-size:13px;line-height:1.5}

  .mobile-bottom-nav{position:fixed;z-index:100;left:0;right:0;bottom:0;height:calc(var(--mobile-nav-height) + var(--mobile-safe-bottom));padding:6px 10px var(--mobile-safe-bottom);display:grid;grid-template-columns:repeat(5,1fr);align-items:start;background:rgba(255,255,255,.96);border-top:1px solid rgba(41,71,53,.12);box-shadow:0 -8px 30px rgba(24,49,36,.08);backdrop-filter:blur(20px)}
  .mobile-bottom-nav button{appearance:none;border:0;background:none;color:#718078;min-height:58px;border-radius:14px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font:600 10px/1 Inter,sans-serif;touch-action:manipulation}
  .mobile-bottom-nav button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  .mobile-bottom-nav button.active{color:#245e4d;background:#edf5f0}
  .mobile-bottom-nav .mobile-create{position:relative;transform:translateY(-17px);gap:5px;color:#294735}
  .mobile-bottom-nav .mobile-create span{display:grid;place-items:center;width:54px;height:54px;border-radius:19px;background:#294735;color:white;font-size:30px;font-weight:400;box-shadow:0 8px 20px rgba(41,71,53,.28)}

  .mobile-sheet-backdrop{position:fixed;z-index:150;inset:0;display:flex;align-items:flex-end;background:rgba(17,35,25,.42);padding:0;opacity:1;transition:opacity .2s}
  .mobile-sheet-backdrop[hidden]{display:none}
  .mobile-sheet{width:100%;max-height:min(82dvh,690px);overflow:auto;background:#fff;border-radius:26px 26px 0 0;padding:10px 18px calc(22px + env(safe-area-inset-bottom,0px));box-shadow:0 -15px 50px rgba(17,35,25,.18);animation:mobile-sheet-in .24s ease-out}
  .mobile-sheet-handle{display:block;width:42px;height:5px;margin:0 auto 18px;border-radius:9px;background:#d4ddd7}
  .mobile-sheet header{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
  .mobile-sheet header h2{margin:0;font:400 25px/1.1 'DM Serif Display',serif;color:#243b2f}
  .mobile-sheet header button{width:44px;height:44px;border:0;border-radius:14px;background:#f1f4f1;font-size:21px;color:#40564a}
  .mobile-sheet-actions{display:grid;gap:7px}
  .mobile-sheet-action{min-height:58px;border:0;background:white;border-radius:16px;display:flex;align-items:center;gap:13px;padding:8px 10px;text-align:left;color:#293c32;font:600 14px Inter,sans-serif}
  .mobile-sheet-action:active{background:#edf5f0}
  .mobile-sheet-action i{display:grid;place-items:center;width:43px;height:43px;border-radius:14px;background:#edf5f0;color:#276451;font-style:normal;font-size:19px}
  .mobile-sheet-action small{display:block;color:#7a8981;font-weight:400;margin-top:3px}
  @keyframes mobile-sheet-in{from{transform:translateY(100%)}to{transform:none}}

  .mobile-only-view{display:block}
  .mobile-home{margin:-2px -2px 10px}
  .mobile-greeting{margin:4px 2px 20px}
  .mobile-greeting small{display:block;color:#748178;font-size:12px;text-transform:capitalize;margin-bottom:3px}
  .mobile-greeting h1{margin:0;font:400 30px/1.12 'DM Serif Display',serif;color:#294735}
  .mobile-home-section{margin:0 0 22px}
  .mobile-section-title{display:flex;align-items:end;justify-content:space-between;margin:0 2px 10px}
  .mobile-section-title h2{margin:0;font:400 20px/1.2 'DM Serif Display',serif;color:#2b3e34}
  .mobile-section-title button{border:0;background:none;color:#39715e;font:600 12px Inter,sans-serif;min-height:36px}
  .mobile-today-list{display:grid;gap:7px}
  .mobile-appointment-row{width:100%;border:0;background:#fff;display:grid;grid-template-columns:52px 1fr auto;align-items:center;gap:11px;padding:11px;border-radius:17px;text-align:left;box-shadow:0 3px 14px rgba(27,55,40,.055)}
  .mobile-appointment-row time{display:flex;flex-direction:column;align-items:center;font-size:15px;font-weight:700;color:#315a49}
  .mobile-appointment-row time small{font-size:9px;font-weight:600;color:#8a968f;margin-top:2px}
  .mobile-appointment-row>span{min-width:0}
  .mobile-appointment-row strong{display:block;font-size:13px;color:#25372e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mobile-appointment-row em{display:block;margin-top:3px;font-size:10px;font-style:normal;color:#7c8982;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mobile-appointment-row>b{font-size:19px;color:#91a097}
  .mobile-empty-day{padding:20px;border-radius:18px;background:#edf5f0;text-align:center;color:#567064;font-size:13px}
  .mobile-next-card{position:relative;overflow:hidden;background:#294735;color:white;border-radius:23px;padding:19px;box-shadow:0 12px 27px rgba(41,71,53,.19)}
  .mobile-next-card:after{content:'';position:absolute;width:150px;height:150px;border-radius:50%;background:rgba(210,235,223,.08);right:-53px;top:-64px}
  .mobile-next-card>small{display:block;color:#b9d2c5;font-size:10px;text-transform:uppercase;letter-spacing:.1em}
  .mobile-next-main{display:flex;align-items:center;gap:12px;margin:13px 0 16px}
  .mobile-next-main .avatar{flex:0 0 46px;width:46px;height:46px}
  .mobile-next-main strong{display:block;font-size:17px}
  .mobile-next-main span{display:block;margin-top:4px;color:#cfe1d7;font-size:12px}
  .mobile-next-actions{display:grid;grid-template-columns:1.25fr repeat(2,.8fr);gap:7px}
  .mobile-next-actions button,.mobile-next-actions a{min-height:44px;border:0;border-radius:13px;display:flex;align-items:center;justify-content:center;background:white;color:#294735;text-decoration:none;font:600 11px Inter,sans-serif}
  .mobile-next-actions .secondary{background:rgba(255,255,255,.12);color:white}
  .mobile-quick-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
  .mobile-quick-grid button{border:0;background:#fff;min-width:0;min-height:83px;border-radius:18px;padding:10px 5px;color:#395148;font:600 10px/1.2 Inter,sans-serif;box-shadow:0 3px 13px rgba(27,55,40,.05)}
  .mobile-quick-grid i{display:grid;place-items:center;margin:0 auto 8px;width:37px;height:37px;border-radius:13px;background:#edf5f0;color:#28634f;font-style:normal;font-size:18px}

  body.mobile-view-inicio .skydash-home{display:none}
  body.mobile-view-pacientes .view>.page-head,
  body.mobile-view-pacientes .patient-summary,
  body.mobile-view-pacientes .inactivity-breakdown,
  body.mobile-view-pacientes .package-alert,
  body.mobile-view-pacientes .patient-filterbar,
  body.mobile-view-pacientes .table-card:has(.patient-table){display:none!important}
  .mobile-patient-directory{display:block;margin-top:10px}
  .mobile-patient-directory-head{display:flex;gap:8px;margin-bottom:12px}
  .mobile-patient-directory-head label{position:relative;flex:1}
  .mobile-patient-directory-head input{width:100%;height:48px;border:1px solid #dce4de;border-radius:15px;background:white;padding:0 13px 0 40px;font-size:16px}
  .mobile-patient-directory-head label:before{content:'⌕';position:absolute;left:14px;top:12px;color:#6f8077;font-size:19px}
  .mobile-patient-directory-head button{width:48px;border:0;border-radius:15px;background:#294735;color:white;font-size:24px}
  .mobile-patient-list{display:grid;gap:9px}
  .mobile-patient-card{background:#fff;border-radius:19px;padding:15px;box-shadow:0 3px 14px rgba(27,55,40,.05)}
  .mobile-patient-card header{display:flex;align-items:center;gap:11px}
  .mobile-patient-card .avatar{width:43px;height:43px;flex:0 0 43px}
  .mobile-patient-card header>div:nth-child(2){min-width:0;flex:1}
  .mobile-patient-card h3{margin:0;font-size:14px;color:#2a3e33;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mobile-patient-card header small{display:block;color:#7a8981;font-size:10px;margin-top:3px}
  .mobile-patient-status{padding:5px 8px;border-radius:99px;background:#edf5f0;color:#35705c;font-size:9px;font-weight:700}
  .mobile-patient-facts{display:grid;grid-template-columns:1.3fr .9fr;gap:8px;margin:13px 0}
  .mobile-patient-facts span{padding:9px 10px;background:#f7f9f6;border-radius:12px}
  .mobile-patient-facts small,.mobile-patient-facts strong{display:block}
  .mobile-patient-facts small{font-size:9px;color:#87928c;margin-bottom:3px}
  .mobile-patient-facts strong{font-size:11px;color:#405449;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mobile-patient-card footer{display:grid;grid-template-columns:1.25fr 1fr 1fr;gap:7px}
  .mobile-patient-card footer button,.mobile-patient-card footer a{min-height:42px;border:0;border-radius:12px;background:#edf5f0;color:#35624f;display:flex;align-items:center;justify-content:center;text-decoration:none;font:600 10px Inter,sans-serif}
  .mobile-patient-card footer button:first-child{background:#294735;color:white}

  body.mobile-view-agenda .agenda-commandbar{display:flex;flex-wrap:wrap;gap:10px}
  body.mobile-view-agenda .agenda-command-identity{width:100%}
  body.mobile-view-agenda .agenda-command-actions .agenda-settings-button,
  body.mobile-view-agenda .agenda-command-actions [data-agenda-new="event"],
  body.mobile-view-agenda .agenda-command-actions .agenda-focus-button,
  body.mobile-view-agenda .agenda-filters{display:none!important}
  body.mobile-view-agenda .agenda-command-actions [data-agenda-new="appointment"]{position:fixed;z-index:80;right:17px;bottom:calc(88px + env(safe-area-inset-bottom,0px));width:54px;height:54px;border-radius:18px;padding:0;font-size:0;box-shadow:0 8px 20px rgba(41,71,53,.25)}
  body.mobile-view-agenda .agenda-command-actions [data-agenda-new="appointment"]:after{content:'+';font-size:30px}
  body.mobile-view-agenda .agenda-toolbar{position:static;display:flex;gap:8px;overflow:auto;padding:4px 0 10px}
  body.mobile-view-agenda .agenda-mobile-filter{display:none}
  body.mobile-view-agenda .segmented{width:100%;display:grid;grid-template-columns:repeat(4,1fr)}
  body.mobile-view-agenda .agenda-workspace{display:block}
  body.mobile-view-agenda .agenda-editor{display:none}
  body.mobile-view-agenda .week-calendar{border:0;background:transparent;box-shadow:none;padding:0;overflow:visible}
  body.mobile-view-agenda .agenda-list{gap:8px}

  .modal-backdrop{align-items:flex-end;padding:0!important}
  .modal{width:100%!important;max-width:none!important;max-height:92dvh!important;border-radius:25px 25px 0 0!important;padding:22px 16px calc(18px + env(safe-area-inset-bottom,0px))!important;animation:mobile-sheet-in .24s ease-out}
  .modal-close{width:44px;height:44px;right:10px;top:9px}
  .modal .form-grid{grid-template-columns:1fr!important}
  .modal .form-group,.modal .form-group.full{grid-column:1!important}
  .modal input,.modal select,.modal textarea{font-size:16px!important;min-height:48px}
  .modal textarea{min-height:120px}
  .modal-actions{bottom:calc(-18px - env(safe-area-inset-bottom,0px));padding-bottom:calc(8px + env(safe-area-inset-bottom,0px))}
  .patient-detail-modal .patient-detail-head{display:block}
  .patient-detail-modal .patient-detail-actions{display:none}
  .patient-detail-modal .patient-record-tabs{position:sticky;top:-22px;z-index:2;overflow:auto;display:flex;background:#fff;padding:9px 0;scrollbar-width:none}
  .patient-detail-modal .patient-record-tabs button{flex:0 0 auto;min-height:42px}
  .patient-detail-modal .patient-detail-metrics{grid-template-columns:repeat(2,1fr)}
  .patient-detail-modal .patient-detail-grid{grid-template-columns:1fr}
  .mobile-patient-actions{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin:14px 0}
  .mobile-patient-actions a,.mobile-patient-actions button{min-height:48px;border:0;border-radius:13px;background:#edf5f0;color:#315f4d;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;text-decoration:none;font:600 9px Inter,sans-serif}
  .mobile-patient-actions span{font-size:18px}
  .mobile-patient-actions .primary{background:#294735;color:#fff}
  .voice-review-note{background:#edf5f0;border-radius:14px;padding:12px;margin:11px 0;color:#536d60;font-size:11px;line-height:1.5}
  .voice-controls{display:flex;gap:8px;margin:10px 0}
  .voice-controls button{flex:1;min-height:50px;border:0;border-radius:14px;font-weight:700}
  .voice-record{background:#294735;color:#fff}
  .voice-record.is-listening{background:#a94848;animation:voice-pulse 1.2s infinite}
  @keyframes voice-pulse{50%{box-shadow:0 0 0 8px rgba(169,72,72,.12)}}
}

@media(max-width:370px){
  body.authenticated:not(.superadmin-mode) .view{padding-left:12px;padding-right:12px}
  .mobile-bottom-nav{padding-left:4px;padding-right:4px}
  .mobile-bottom-nav button{font-size:9px}
  .mobile-quick-grid{gap:5px}
  .mobile-quick-grid button{min-height:78px;font-size:9px}
  .mobile-next-actions{grid-template-columns:1fr 1fr}
  .mobile-next-actions button:first-child{grid-column:1/-1}
}
