/* ── E.I. System 공통 모바일 스타일 ── */
@media (max-width: 640px) {

  /* 헤더 공통 */
  .app-header, .hdr {
    height: auto !important;
    flex-wrap: wrap !important;
    padding: 6px 10px !important;
    gap: 4px !important;
  }
  .header-left, .hdr-left { flex: 1; min-width: 0; overflow: hidden; }
  .app-title, .hdr-title {
    font-size: 11px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
  }
  .header-right, .hdr-right { gap: 4px !important; flex-wrap: nowrap !important; }
  .header-btn, .save-btn, .hbtn {
    padding: 4px 7px !important;
    font-size: 10px !important;
    min-width: unset !important;
    white-space: nowrap;
  }
  .user-info { font-size: 10px !important; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* 연도/월 탭 */
  .year-area { padding: 4px 8px !important; gap: 4px !important; }
  .year-selector { min-width: 70px !important; font-size: 11px !important; }
  .month-tabs, .month-selector {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 2px !important;
    padding-bottom: 2px;
  }
  .month-tabs::-webkit-scrollbar, .month-selector::-webkit-scrollbar { display: none; }
  .month-tab, .month-btn {
    padding: 3px 7px !important;
    font-size: 11px !important;
    flex-shrink: 0 !important;
    white-space: nowrap;
  }

  /* 메인 콘텐츠 1열 */
  .main-content {
    grid-template-columns: 1fr !important;
    padding: 4px !important;
    gap: 6px !important;
  }
  .col, .left-col, .mid-col, .right-col { gap: 8px !important; }

  /* 카드 */
  .card { border-radius: 10px !important; }
  .card-hd { font-size: 12px !important; padding: 7px 10px !important; }

  /* 테이블 가로 스크롤 */
  .card > div[style*="overflow"] { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .tbl { font-size: 11px !important; min-width: 320px; }
  .tbl th, .tbl td { padding: 3px 4px !important; }

  /* 요약카드 그리드 */
  .sum-grid {
    grid-template-columns: 1fr !important;
  }
  .sum-panel {
    border-right: none !important;
    border-bottom: 1px solid #e2e8f0;
  }
  .sum-panel:last-child { border-bottom: none !important; }

  /* 수입/지출 요약 카드 2열 */
  .sum-grid-cards {
    grid-template-columns: 1fr 1fr !important;
  }

  /* 버튼 */
  .add-row-btn { font-size: 12px !important; padding: 6px !important; }

  /* 입력 */
  input.ci { font-size: 11px !important; }
}

/* 아이폰 노치 대응 */
@supports (padding: max(0px)) {
  .app-header, .hdr {
    padding-left: max(10px, env(safe-area-inset-left)) !important;
    padding-right: max(10px, env(safe-area-inset-right)) !important;
    padding-top: max(6px, env(safe-area-inset-top)) !important;
  }
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
