/* v2.5.3: lightweight screen presentation. Printed reports keep their own layout. */
@media screen {
  :root {
    --experience-ink:#193b49;
    --experience-muted:#5d7480;
    --experience-line:#d4e2e4;
    --experience-teal:#087e7d;
    --experience-soft:#edf6f4;
    --gray-400:#5f7581;
  }
  body { background:#f0f5f5; }
  :where(button,a,input,select,textarea,summary,[tabindex]):focus-visible { outline:3px solid #167d87; outline-offset:3px; }
  :where(input,textarea)::placeholder { color:#60747f; opacity:1; }

  /* Startup and sign-in contain no remote artwork or animation layers. */
  .splash { background:#f0f5f5; padding:24px; }
  .splash-content { width:100%; max-width:390px; text-align:center; padding:36px 24px; }
  .splash-logo { width:76px; height:76px; margin:0 auto 25px; display:flex; align-items:center; justify-content:center; border-radius:23px; background:#123f4c; animation:none; }
  .splash-eyebrow { color:#50777c; font-size:11px; font-weight:650; letter-spacing:.16em; }
  .splash-text { color:var(--experience-ink); font-size:23px; line-height:1.5; letter-spacing:.02em; font-weight:650; margin-top:10px; }
  #splash-status { margin:12px auto 0; max-width:300px; color:var(--experience-muted); font-size:14px; line-height:1.7; overflow-wrap:anywhere; }
  .splash-spinner { position:relative; width:100%; max-width:240px; height:4px; margin:26px auto 0; overflow:hidden; background:#d9e7e7; border:0; border-radius:10px; animation:none; }
  .splash-spinner::after { content:""; position:absolute; inset:0 auto 0 0; width:42%; border-radius:inherit; background:#148985; animation:avf-progress-drift 1.8s ease-in-out infinite; }
  #splash-retry { display:inline-flex; align-items:center; justify-content:center; min-height:44px; margin-top:23px; padding:10px 23px; border:1px solid #a9c6cb; border-radius:9px; background:#fff; color:#225b67; font:inherit; font-size:14px; font-weight:600; cursor:pointer; }
  #splash-retry[hidden],.splash-spinner[hidden] { display:none!important; }
  #page-login,#page-register { background:#f0f5f5; }
  #page-login .login-container { grid-template-columns:1fr 1.04fr; max-width:970px; border:1px solid #d3e0e2; border-radius:22px; box-shadow:0 16px 52px #183d480b; }
  .login-intro { background:#173e49; padding:50px 46px; position:relative; }
  .login-brand { color:#b9e7df; border-color:#62858b; border-radius:7px; margin-bottom:39px; font-size:11px; letter-spacing:.14em; }
  .login-intro h2 { font-size:36px; line-height:1.52; letter-spacing:.045em; font-weight:600; }
  .login-intro>p { color:#d0e0e4; line-height:1.85; margin-top:19px; }
  .login-path { display:flex; align-items:center; margin:38px 2px 0; max-width:290px; }
  .login-path span { flex:none; width:11px; height:11px; border:2px solid #7bc6bb; background:#234e57; border-radius:50%; }
  .login-path span:first-child { background:#9bd6ca; border-color:#9bd6ca; }
  .login-path i { height:1px; flex:1; background:#5c9294; }
  .login-features { display:flex; justify-content:space-between; max-width:296px; gap:8px; margin-top:12px; }
  .login-features span { padding:0; background:none; color:#c8e6e0; font-size:12px; }
  .login-intro .login-intro-note { font-size:11px; color:#9abec3; letter-spacing:.1em; margin-top:43px; }
  #page-login .login-card { padding:45px 42px 35px; }
  #page-login .login-logo { margin-bottom:19px; }
  #page-login .login-title { font-size:23px; color:var(--experience-ink); line-height:1.4; }
  #page-login .login-subtitle { color:var(--experience-muted); font-size:13px; letter-spacing:0; margin-bottom:26px; }
  .login-field-label { display:block; color:#355767; font-size:13px; font-weight:600; margin:0 0 7px; }
  #page-login .input-group { background:#fff; border-color:#bfcfd4; min-height:49px; border-radius:9px; margin-bottom:19px; padding:0 11px; }
  #page-login .input-group:focus-within { border-color:#238a8b; box-shadow:0 0 0 3px #168e8612; }
  #page-login .input-icon { color:#668491; }
  #page-login .pwd-toggle { color:#547786; }
  #page-login .btn-login { margin-top:7px; background:#176c71; border:1px solid #176c71; border-radius:9px; min-height:49px; }
  #page-login .btn-login:hover { background:#135c62; border-color:#135c62; }
  #page-login .btn-login:disabled { background:#356b73; opacity:1; cursor:wait; }
  #login-status { min-height:0; color:#536f7a; font-size:13px; line-height:1.65; overflow-wrap:anywhere; }
  #login-status:not(:empty) { margin-top:12px; }
  #login-status.is-error { color:#a63440; }
  #page-login .login-divider { margin:21px 0 17px; color:#5d7580; font-size:12px; }
  #page-login .btn-register { min-height:45px; border-radius:9px; border-color:#c5d6da; color:#345c6b; font-size:14px; }

  /* Stable, readable cards and actions; no layout animation when lists update. */
  .app-header { background:#173e49; border-bottom-color:#398f87; }
  .workspace-intro { padding-top:27px; padding-bottom:21px; }
  .workspace-intro h2 { color:var(--experience-ink); letter-spacing:.035em; }
  .workspace-eyebrow { color:#597b83; }
  .workspace-mode { color:#426774; background:#f8fbfa; border-color:#ccdedf; border-radius:7px; }
  .patient-filters { border-color:var(--experience-line); background:#f9fbfb; }
  .patient-filters summary { color:#2f5662; }
  .patient-filter-grid label { color:#446573; }
  .search-box input { background:#fff; border-color:#c2d6db; border-radius:11px; min-height:48px; }
  .patient-results .toolbar>.btn-primary { border-radius:10px; }
  .patient-list-heading { color:#58717d; }
  #patient-result-count { color:#3b5e6c; }
  .patient-results .patient-card { border-color:#d4e2e4; border-radius:13px; box-shadow:none; }
  .patient-results .patient-card:hover { border-color:#78aaa9; box-shadow:0 3px 11px #214d5407; }
  .patient-card-surface { border-radius:inherit; }
  .patient-details h3 { color:#25434f; }
  .patient-avatar,.patient-avatar.avatar-blue { background:#e9f1f3; color:#3e6479; border:1px solid #dbe8eb; box-shadow:none; }
  .patient-avatar.avatar-empty { color:#627884; background:#edf2f4; }
  .patient-code { color:#627c89; }
  .patient-meta { color:#5c7580; line-height:1.65; }
  .patient-record-count { border:1px solid #dfeaea; background:#f2f7f7; color:#496d76; }
  .patient-results .empty-state,.records-list>.empty-state { background:#f8fbfb; border:1px dashed #c2d7dc; border-radius:12px; color:#4d707b; }
  .empty-state { color:#607883; }
  .empty-state .empty-hint { color:#5e7580; font-size:13px; }
  .detail-context-bar p { color:#597681; }
  .detail-jump-nav a { border-color:#cbdcde; background:#fff; color:#376574; }
  .detail-workspace #patient-info-card { border-color:#d2e2e4; border-top:3px solid #529d95; border-radius:13px; }
  .patient-info-header { border-color:#e2ebed; }
  .info-label { color:#607782; }
  .detail-workspace>.records-section { border-color:#d4e2e4; border-radius:13px; }
  .section-header h2 { color:var(--experience-ink); }
  .record-card { background:#fbfdfd; border-color:#dae7e8; }
  .record-summary { color:#57717e; }
  .presence-panel { border-color:#d0e3de; background:#eff7f3; border-radius:11px; }
  .presence-panel p { color:#56756e; }
  .presence-panel li { border:1px solid #e2eeea; }

  /* Forms retain a single scroll area and a permanently reachable action footer. */
  .modal-header,.env-pc .modal-header { background:#f8fbfb; border-bottom-color:#d9e5e7; }
  .modal-header h2 { color:#254955; }
  .modal-body,.env-pc .modal-body { background:#f1f6f6; scrollbar-color:#b2c7cc transparent; }
  .modal-footer,.env-pc .modal-footer { border-top-color:#d4e2e4; box-shadow:0 -3px 10px #173e4904; }
  .modal-footer .btn-primary { background:#176f72; border-color:#176f72; }
  .form-section { border-color:#d4e3e5; border-radius:12px; }
  .form-section-title { color:#2d5964; border-bottom-color:#e1ecec; }
  .section-badge { background:#e7f3f0; border:1px solid #d5eae4; color:#27736b; }
  .form-label { color:#3e6170; }
  .form-input { background:#fff; border-color:#bfd2d8; }
  .form-input:focus { border-color:#248784; box-shadow:0 0 0 3px #087e7d13; }
  .form-input:disabled { color:#5e7783; background:#edf3f4; opacity:1; }
  .form-textarea { resize:vertical; }
  .checkbox-item { border-radius:6px; }
  .checkbox-item:focus-within { background:#edf7f4; }
  .avf-form-nav { display:flex; flex-direction:column; align-items:stretch; flex-shrink:0; gap:3px; max-width:100%; min-width:0; padding:8px 18px; border-bottom:1px solid #d7e5e7; background:#fff; }
  .avf-form-nav-meta { display:flex; align-items:center; flex-wrap:wrap; gap:3px 10px; padding:0 4px; min-width:0; font-size:11px; line-height:1.5; color:#62767e; }
  .avf-form-nav-label { color:#3f606b; font-size:12px; font-weight:600; flex-shrink:0; }
  .avf-form-nav-legend { color:#597168; }
  .avf-form-nav-hint { margin-left:auto; color:#426d82; font-weight:600; }
  .avf-form-nav-row { display:flex; align-items:center; gap:4px; min-width:0; }
  .avf-form-nav-links { display:flex; flex:1; gap:7px; align-items:center; min-width:0; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:thin; scrollbar-color:#a8c1c5 transparent; padding:4px; }
  .avf-form-nav-button { display:inline-flex; align-items:center; gap:6px; flex-shrink:0; border:1px solid #d4dbe0; color:#5e6a74; background:#f2f4f6; border-radius:7px; padding:6px 10px; min-height:34px; white-space:nowrap; font:inherit; font-size:12px; line-height:1.5; cursor:pointer; }
  .avf-form-nav-button::before { content:''; display:block; flex-shrink:0; width:6px; height:6px; border-radius:50%; background:#94a0aa; }
  .avf-form-nav-button.has-content { border-color:#aed9bf; background:#eaf7ef; color:#236c42; }
  .avf-form-nav-button.has-content::before { background:#32844e; }
  .avf-form-nav-button:hover { border-color:#6a969e; }
  .avf-form-nav-button.is-current { outline:2px solid #36768b; outline-offset:0; font-weight:600; }
  .avf-form-nav-arrow { display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; width:34px; min-height:38px; padding:0; border:1px solid #b8ccd4; border-radius:7px; background:#f1f7fa; color:#286178; font:inherit; font-size:27px; line-height:1; cursor:pointer; }
  .avf-form-nav-arrow:disabled { color:#a8b6bb; background:#f7f9fa; border-color:#e0e7e9; cursor:default; }
  .avf-form-nav-button:focus-visible,.avf-form-nav-arrow:focus-visible { outline:2px solid #165a78; outline-offset:2px; }
  .avf-form-nav-target { scroll-margin-block-start:12px; }
  .avf-form-nav[hidden],.avf-form-nav-arrow[hidden],.avf-form-nav-hint[hidden] { display:none!important; }

  /* Image placeholders use actual transfer progress when the response provides a total. */
  .protected-media-message { display:inline-flex; flex-direction:column; align-items:stretch; justify-content:center; gap:8px; max-width:100%; min-width:100px; padding:12px; background:#f0f6f6; color:#456b77; border-radius:7px; font-size:12px; line-height:1.5; text-align:center; overflow-wrap:anywhere; }
  .protected-media-status-text { display:block; }
  .protected-media-progress { display:block; width:100%; height:5px; appearance:none; border:0; border-radius:5px; overflow:hidden; background:#d8e8e6; accent-color:#258c82; }
  .protected-media-progress::-webkit-progress-bar { border-radius:5px; background:#d8e8e6; }
  .protected-media-progress::-webkit-progress-value { border-radius:5px; background:#258c82; }
  .protected-media-progress::-moz-progress-bar { border-radius:5px; background:#258c82; }
  .protected-media-progress:not([value]),.protected-media-progress:not([value])::-webkit-progress-bar { background:repeating-linear-gradient(90deg,#80b6ae 0 16px,#d8e8e6 16px 25px); }
  .protected-media-retry { align-self:center; min-height:40px; padding:7px 12px; border:1px solid #a6c3cb; border-radius:7px; background:#fff; color:#286678; font:inherit; font-size:12px; font-weight:600; cursor:pointer; pointer-events:auto; }
  .protected-media-message[data-phase="failed"] { background:#fff5f2; color:#935649; }
  .protected-media-message[hidden],.protected-media-progress[hidden],.protected-media-status-text[hidden],.protected-media-retry[hidden] { display:none!important; }
  img[data-protected-media-state="loading"],img[data-protected-media-state="failed"] { min-width:116px; min-height:110px; background:#eef4f5; color:#537784; }
  .image-preview img[data-protected-media-state="failed"] { min-height:145px; }
  .gallery-thumb,.detail-image { position:relative; }
  .gallery-thumb>.protected-media-message { position:absolute; inset:0; min-width:0; border-radius:0; pointer-events:none; }
  .detail-image>.protected-media-message { position:absolute; inset:0 0 26px; min-width:0; border-radius:0; pointer-events:none; }
  .image-preview>.protected-media-message { position:absolute; inset:26px 0 0; min-width:0; border-radius:0; padding:8px; pointer-events:none; }

  /* Determinate fills are set by measured progress; an unknown total has no % label. */
  .avf-loading-dock { position:fixed; right:max(20px,env(safe-area-inset-right,0px)); bottom:calc(22px + env(safe-area-inset-bottom,0px)); z-index:11010; width:min(360px,calc(100vw - 32px)); display:flex; flex-direction:column; gap:8px; pointer-events:none; }
  .avf-loading-panel { min-width:0; padding:15px 17px; border:1px solid #c8dddd; border-radius:11px; background:#f7fcfb; color:#284f5c; font-size:13px; line-height:1.6; overflow-wrap:anywhere; }
  .avf-loading-dock .avf-loading-panel { background:#fff; box-shadow:0 6px 24px #14363f16; pointer-events:auto; }
  .avf-loading-label { display:block; color:#24515d; font-weight:650; font-size:14px; }
  .avf-loading-detail { color:#55717c; font-size:12px; margin-top:4px; }
  .avf-loading-track { position:relative; width:100%; height:5px; margin-top:10px; background:#dcebea; border-radius:5px; overflow:hidden; }
  .avf-loading-fill { display:block; width:0; height:100%; background:#1b8e87; border-radius:inherit; transition:width 160ms ease; }
  .is-indeterminate .avf-loading-fill,.avf-loading-fill.is-indeterminate { width:40%!important; animation:avf-progress-drift 1.8s ease-in-out infinite; }
  .avf-loading-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
  .avf-loading-actions button { min-height:40px; padding:8px 14px; color:#246472; background:#fff; border:1px solid #b3ced3; border-radius:7px; font:inherit; font-weight:600; cursor:pointer; }
  .avf-loading-actions button:disabled { opacity:.6; cursor:wait; }
  .avf-loading-panel.is-error { border-color:#dfb6ba; background:#fff9f8; }
  .avf-loading-panel.is-error .avf-loading-label { color:#9c3845; }
  .avf-loading-panel.is-error .avf-loading-track { display:none; }
  .avf-loading-dock[hidden],.avf-loading-panel[hidden],.avf-loading-track[hidden],.avf-loading-fill[hidden],.avf-loading-actions[hidden],.avf-loading-actions button[hidden] { display:none!important; }
  @keyframes avf-progress-drift { 0%,100% { transform:translateX(-10%); } 50% { transform:translateX(160%); } }
}
@media screen and (max-width:1000px) {
  #page-login .login-container { max-width:850px; }
  .login-intro { padding:38px 32px; }
  .login-intro h2 { font-size:30px; }
  #page-login .login-card { padding:37px 31px 30px; }
}
@media screen and (max-width:760px) {
  #page-login,#page-register { padding:16px max(16px,env(safe-area-inset-right,0px)) max(24px,env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px)); }
  #page-login .login-container { max-width:440px; border-radius:17px; }
  .login-intro { padding:24px 25px 25px; }
  .login-brand { font-size:10px; margin-bottom:15px; padding:5px 9px; }
  .login-intro h2 { font-size:26px; line-height:1.42; }
  .login-intro>p { font-size:12px; line-height:1.75; margin-top:12px; max-width:none; }
  .login-path,.login-features,.login-intro .login-intro-note { display:none; }
  #page-login .login-card { padding:27px 25px 25px; }
  #page-login .login-title { font-size:21px; }
  #page-login .login-subtitle { margin-bottom:23px; }
  #page-login .input-group { min-height:50px; }
  .login-field-label { font-size:14px; }
  .splash-content { padding:24px 14px; }
  .splash-text { font-size:22px; }
  .patient-results .patient-card,.env-mobile .patient-results .patient-card { border-color:#d4e2e4; box-shadow:none; }
  .patient-results .toolbar>.btn { min-width:105px; }
  .patient-record-count { white-space:normal; text-align:center; }
  .patient-card-right { max-width:30%; }
  .detail-jump-nav a { min-height:44px; display:flex; align-items:center; justify-content:center; }
  .presence-panel summary { min-height:34px; line-height:34px; }
  .modal-header,.env-pc .modal-header { padding-left:16px; padding-right:16px; }
  .form-section { border-radius:10px; }
  .avf-form-nav { gap:3px; padding:7px 10px 4px; }
  .avf-form-nav-meta { gap:2px 6px; font-size:10px; }
  .avf-form-nav-label { font-size:11px; }
  .avf-form-nav-hint { flex-basis:100%; margin-left:0; }
  .avf-form-nav-button { min-height:40px; padding:8px 11px; font-size:13px; }
  .avf-form-nav-arrow { min-height:44px; width:32px; }
  .protected-media-retry { min-height:44px; }
  .avf-loading-dock { right:max(16px,env(safe-area-inset-right,0px)); bottom:calc(86px + env(safe-area-inset-bottom,0px)); }
  .avf-loading-panel { padding:13px 14px; }
  .avf-loading-actions button { min-height:44px; }
}
@media screen and (max-width:380px) {
  #page-login .login-card,.login-intro { padding-left:21px; padding-right:21px; }
  #page-login .login-title { font-size:19px; }
  .login-intro h2 { font-size:24px; }
  .patient-card-info { gap:9px; }
  .patient-avatar { width:37px; height:37px; border-radius:10px; font-size:17px; }
  .patient-results .toolbar { flex-wrap:wrap; }
  .patient-results .toolbar .search-box { flex-basis:100%; }
  .patient-results .toolbar>.btn { width:100%; }
}
@media screen and (prefers-reduced-motion:reduce) {
  .splash-spinner::after,.is-indeterminate .avf-loading-fill,.avf-loading-fill.is-indeterminate { animation:none; transform:none; width:100%!important; background:repeating-linear-gradient(90deg,#448f8c 0 16px,#b8d8d3 16px 24px); }
  .avf-loading-fill { transition:none; }
  .protected-media-progress,.protected-media-progress::-webkit-progress-value,.protected-media-progress::-moz-progress-bar { animation:none; transition:none; }
}
@media print {
  .avf-loading-dock,.avf-loading-panel,.avf-form-nav,.protected-media-message { display:none!important; }
}
