/* mobile.css — 휴대폰(안드로이드 앱·모바일 브라우저) 레이아웃. PC판 화면은 변경하지 않음 */
html.rk-offline body::before{content:'서버 연결 끊김 — 재연결 중…';position:fixed;top:0;left:0;right:0;z-index:100000;background:#c0392b;color:#fff;text-align:center;font-size:12px;padding:3px 0}
#rkMenuBtn,#rkSbShade{display:none}
@media (max-width: 820px){
  html,body{height:100%}
  body{display:block;overflow:hidden;font-size:14px;-webkit-text-size-adjust:100%}
  #sidebar{position:fixed;visibility:hidden;top:0;bottom:0;left:0;width:260px;z-index:5000;transform:translateX(-100%);transition:transform .22s ease,visibility .22s;box-shadow:4px 0 24px rgba(0,0,0,.3);padding-top:env(safe-area-inset-top)}
  body.rk-sb-open #sidebar{transform:none;visibility:visible}
  #rkSbShade{display:block;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:4999;opacity:0;pointer-events:none;transition:opacity .2s}
  body.rk-sb-open #rkSbShade{opacity:1;pointer-events:auto}
  .sb-nav a{padding:13px 20px;font-size:15px}
  #content{position:fixed;inset:0;display:flex;flex-direction:column;padding-top:env(safe-area-inset-top)}
  .topbar{height:auto;min-height:52px;padding:6px 10px;gap:6px;flex-wrap:wrap}
  .topbar h2{font-size:16px;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #rkMenuBtn{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border:none;background:none;color:var(--blue);font-size:24px;margin-right:2px;flex-shrink:0;cursor:pointer}
  .topbar-actions{flex-wrap:wrap;gap:6px;width:100%;justify-content:flex-start}
  .topbar-actions:empty{display:none}
  .page{padding:10px 10px calc(20px + env(safe-area-inset-bottom));-webkit-overflow-scrolling:touch}

  /* 여러 열 그리드 → 1열 (KPI 류는 2열) */
  .stats,.kpi-grid,.kpi5,.db-row4,.wstock-kpi-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important}
  .dash-layout,.dash-layout2,.db-row3,.db-row2,.form-grid,.form-grid.cols3,.wf-layout,.imp-col-row{grid-template-columns:minmax(0,1fr) !important}
  .wf-layout{height:auto}
  [style*="grid-template-columns"]{grid-template-columns:minmax(0,1fr) !important}
  [style*="repeat(3"],[style*="repeat(4"],[style*="repeat(5"],[style*="repeat(6"]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important}
  .cal-grid,[style*="repeat(7"]{grid-template-columns:repeat(7,minmax(0,1fr)) !important}
  .cal-cell{min-width:0;overflow:hidden;padding:2px !important;min-height:64px}
  .cal-event{font-size:9px !important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:1px 2px !important}
  [style*="grid-column"]{grid-column:auto !important}

  /* 고정 폭 요소가 화면을 넘지 않게 */
  [style*="width:"]:not(td):not(th):not(svg):not(img):not(canvas):not([style*="%"]){max-width:100%}
  [style*="min-width"]{min-width:0 !important}
  .card,.panel,.page>div{max-width:100%}
  img,canvas,svg{max-width:100%}
  .search-bar{flex-wrap:wrap}
  .search-bar input{max-width:none;flex:1 1 160px}
  [style*="display:flex"]{flex-wrap:wrap}
  .cal-day-panel{min-width:0}

  /* 표: 가로 스크롤 */
  table{display:block;overflow-x:auto;white-space:nowrap;-webkit-overflow-scrolling:touch;max-width:100%}
  td,th{white-space:nowrap}

  /* 팝업: 전체 화면 */
  .modal{width:100vw !important;max-width:100vw !important;height:100%;max-height:100% !important;border-radius:0}
  .modal-hd{border-radius:0;padding:12px 14px;padding-top:calc(12px + env(safe-area-inset-top))}
  .modal-body{padding:14px}
  .modal-foot{padding:10px 14px calc(10px + env(safe-area-inset-bottom));flex-wrap:wrap}

  /* 터치 대상·입력(16px 미만이면 안드로이드가 확대) */
  input,select,textarea{font-size:16px !important}
  .btn,button{min-height:36px}
  .toast{left:12px;right:12px;bottom:calc(16px + env(safe-area-inset-bottom))}
}
