/* ==========================================================================
   growth-mobile.css — 성장 기록 모바일 레이어
   - 599px 이하 폰 폭에서 활성. 600px 이상은 입력장치와 무관하게 데스크톱 UI 유지.
   - 체크 화면은 모바일 전용 UI, 보고서는 화면 preview와 인쇄 root 분리.
  ========================================================================== */

#screen-growth .grm-mobile-only {
  display: none !important;
}

@media (min-width: 600px) {
  #screen-growth .grm-mobile-only {
    display: none !important;
  }
}

@media screen and (max-width: 599px) {
  #screen-growth .nav-bar,
  #screen-growth .growth-anon-banner,
  #screen-growth .growth-tabbar-wrap,
  #screen-growth > .growth-tab-panel {
    display: none !important;
  }

  #screen-growth .grm-mobile-only {
    display: block !important;
    min-height: 100vh;
    background: #f3f4f6;
    padding-bottom: calc(96px + var(--safe-bottom));
  }

  #screen-growth .grm-top-stat {
    position: sticky;
    top: 0;
    z-index: 12;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    padding-top: calc(6px + var(--safe-top));
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
  }
  #screen-growth .grm-top-back {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
    color: #1f2937;
    text-decoration: none;
    border-radius: 50%;
  }
  #screen-growth .grm-top-back:active { background: #f3f4f6; }
  #screen-growth .grm-print-count {
    flex: 1;
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    line-height: 1;
  }
  #screen-growth .grm-print-count b {
    font-size: 22px;
    font-weight: 800;
    color: #1e3a8a;
  }
  #screen-growth .grm-print-count span {
    font-size: 13px;
    color: #64748b;
    font-weight: 700;
  }
  #screen-growth .grm-clear-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid #dc2626;
    border-radius: 8px;
    background: #dc2626;
    color: #fff;
    cursor: pointer;
  }
  #screen-growth .grm-clear-btn[disabled] {
    background: #f8fafc;
    border-color: #e5e7eb;
    color: #94a3b8;
    opacity: 0.7;
    cursor: not-allowed;
  }

  #screen-growth .grm-anon-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff7ed;
    border-bottom: 1px solid #fed7aa;
    color: #7c2d12;
    font-size: 12px;
    font-weight: 700;
  }
  #screen-growth .grm-anon-banner[hidden] { display: none !important; }
  #screen-growth .grm-anon-banner button {
    min-height: 30px;
    padding: 0 10px;
    border: none;
    border-radius: 999px;
    background: #1e3a8a;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    font-family: inherit;
  }

  #screen-growth .grm-search {
    position: sticky;
    top: calc(45px + var(--safe-top));
    z-index: 11;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
  }
  #screen-growth .grm-search-icon {
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 15px;
  }
  #screen-growth .grm-search-input {
    flex: 1;
    min-width: 0;
    height: 36px;
    padding: 6px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #1f2937;
    font-size: 16px;
    font-family: inherit;
    outline: none;
  }
  #screen-growth .grm-search-input:focus {
    border-color: #1e3a8a;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
  }
  #screen-growth .grm-search-clear {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    font-size: 20px;
    line-height: 1;
    font-family: inherit;
  }

  #screen-growth .grm-body {
    padding: 10px 12px 18px;
  }
  #screen-growth .grm-check-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 2px 12px;
  }
  #screen-growth .grm-check-title {
    font-size: 20px;
    font-weight: 800;
    color: #1f2937;
  }
  #screen-growth .grm-check-summary {
    font-size: 13px;
    color: #64748b;
    font-weight: 700;
    white-space: nowrap;
  }
  #screen-growth .grm-check-summary b {
    color: #1e3a8a;
    font-size: 17px;
  }
  #screen-growth .grm-filter-meta {
    margin: -4px 2px 10px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
  }
  #screen-growth .grm-reset-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-shrink: 0;
  }
  #screen-growth .grm-reset-current,
  #screen-growth .grm-reset-all {
    min-height: 34px;
    flex-shrink: 0;
    padding: 0 10px;
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: #fff;
    color: #dc2626;
    font-size: 12px;
    font-weight: 800;
    font-family: inherit;
    white-space: nowrap;
  }
  #screen-growth .grm-reset-all {
    border-color: #dbe4f0;
    color: #1e3a8a;
  }
  #screen-growth .grm-reset-current[disabled],
  #screen-growth .grm-reset-all[disabled] {
    border-color: #e5e7eb;
    color: #94a3b8;
    background: #f8fafc;
  }

  #screen-growth .grm-cat-section {
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
  }
  #screen-growth .grm-cat-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
  }
  #screen-growth .grm-cat-title {
    font-size: 15px;
    font-weight: 800;
    color: #1f2937;
  }
  #screen-growth .grm-cat-count {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
  }
  #screen-growth .grm-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  #screen-growth .grm-card-grid.is-search {
    grid-template-columns: 1fr;
  }
  #screen-growth .grm-check-card {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 11px;
    background: #fff;
    border: 1.5px solid #dbe1ea;
    border-radius: 9px;
    color: #1f2937;
    cursor: pointer;
    user-select: none;
  }
  #screen-growth .grm-check-card:active { background: #f8fafc; }
  #screen-growth .grm-check-card.is-checked {
    background: #eff6ff;
    border-color: #1e3a8a;
    color: #1e3a8a;
    font-weight: 800;
  }
  #screen-growth .grm-check-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
  #screen-growth .grm-check-mark {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    background: #fff;
    color: transparent;
    font-size: 11px;
    font-weight: 900;
  }
  #screen-growth .grm-check-card.is-checked .grm-check-mark {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: #fff;
  }
  #screen-growth .grm-check-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    line-height: 1.25;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }
  #screen-growth .grm-check-meta {
    flex-shrink: 0;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
  }
  #screen-growth .grm-empty {
    margin: 40px auto;
    padding: 36px 18px;
    text-align: center;
    color: #64748b;
    background: #fff;
    border: 1.5px dashed #cbd5e1;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
  }

  #screen-growth .grm-bottom-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 12px 14px 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
    background: #fff;
    border-top: 1px solid #e5e7eb;
  }
  #screen-growth .grm-dock-trigger {
    flex: 1 1 0;
    min-width: 0;
    min-height: 56px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px;
    border: 1px solid #1e3a8a;
    border-radius: 10px;
    background: #1e3a8a;
    color: #fff;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
  }
  #screen-growth .grm-dock-trigger:active { filter: brightness(0.92); }
  #screen-growth .grm-dock-label {
    font-size: 11px;
    font-weight: 700;
    opacity: 0.72;
  }
  #screen-growth .grm-dock-value {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 900;
  }
  #screen-growth .grm-dock-arrow {
    font-size: 9px;
    opacity: 0.75;
  }

  #screen-growth .grm-age-list,
  #screen-growth .grm-priority-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px 24px;
  }
  #screen-growth .grm-age-card,
  #screen-growth .grm-priority-card {
    min-height: 56px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 15px;
    border: 1.5px solid #dbe1ea;
    border-radius: 10px;
    background: #fff;
    color: #1f2937;
    font-family: inherit;
    text-align: left;
  }
  #screen-growth .grm-age-card.is-selected,
  #screen-growth .grm-priority-card.is-selected {
    border-color: #1e3a8a;
    background: #eff6ff;
  }
  #screen-growth .grm-age-name,
  #screen-growth .grm-priority-name {
    display: block;
    font-size: 15px;
    font-weight: 800;
  }
  #screen-growth .grm-age-meta,
  #screen-growth .grm-priority-meta {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #64748b;
    font-weight: 700;
  }
  #screen-growth .grm-age-check,
  #screen-growth .grm-priority-check {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #1e3a8a;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
  }
  #screen-growth .is-selected .grm-age-check,
  #screen-growth .is-selected .grm-priority-check {
    display: inline-flex;
  }

  #screen-growth .grm-report-sheet {
    max-height: 88vh !important;
  }
  #screen-growth .grm-report-header {
    gap: 6px;
  }
  #screen-growth .grm-report-header .m-sheet-title {
    margin-right: auto;
  }
  #screen-growth .grm-report-zoom,
  #screen-growth .grm-report-print {
    min-height: 32px;
    padding: 0 11px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 900;
    font-family: inherit;
  }
  #screen-growth .grm-report-print {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: #fff;
  }
  #screen-growth .grm-report-print[disabled] {
    background: #f8fafc;
    border-color: #e5e7eb;
    color: #94a3b8;
  }
  #screen-growth .grm-report-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
  }
  #screen-growth .grm-report-tab {
    flex: 1;
    min-height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    color: #64748b;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
  }
  #screen-growth .grm-report-tab.is-active {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: #fff;
  }
  #screen-growth .grm-report-body {
    padding: 12px;
    overflow-x: hidden;
    background: #e5e7eb;
  }
  #screen-growth .grm-report-body.is-zoomed {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #screen-growth .grm-report-page-wrap {
    margin: 0 auto 16px;
  }
  #screen-growth .grm-report-page {
    width: 210mm !important;
    max-width: none !important;
    margin: 0 !important;
    transform: scale(var(--grm-report-scale, 1));
    transform-origin: top left;
    cursor: zoom-in;
  }
  #screen-growth .grm-report-body.is-zoomed .grm-report-page {
    cursor: zoom-out;
  }

  #screen-growth .grm-scroll-top {
    position: fixed;
    right: 12px;
    bottom: calc(96px + var(--safe-bottom) + 12px);
    z-index: 15;
    width: 44px;
    height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    background: #fff;
    color: #64748b;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
    font-size: 20px;
    font-family: inherit;
  }
  #screen-growth .grm-scroll-top.is-visible {
    display: inline-flex;
  }
}

@media screen and (min-width: 600px) and (max-width: 899px) {
  #screen-growth .grm-body {
    max-width: 980px;
    margin: 0 auto;
    padding: 14px 20px 24px;
  }
  #screen-growth .grm-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  #screen-growth .grm-card-grid.is-search {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #screen-growth .grm-bottom-dock {
    left: 50%;
    right: auto;
    width: min(920px, calc(100vw - 32px));
    transform: translateX(-50%);
    border-radius: 18px 18px 0 0;
  }
}

@media print {
  body.growth-print-active > :not(#growthPrintRoot) {
    display: none !important;
  }
  #growthPrintRoot {
    display: block !important;
    background: #fff !important;
  }
  #growthPrintRoot .growth-ar-doc,
  #growthPrintRoot .growth-ct-doc {
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: auto !important;
  }
  #growthPrintRoot .ct-hero,
  #growthPrintRoot .ct-card-name,
  #growthPrintRoot .ct-card-count,
  #growthPrintRoot .ct-card,
  #growthPrintRoot .ar-stats-table td.done,
  #growthPrintRoot .ar-stats-table th,
  #growthPrintRoot .ar-bar,
  #growthPrintRoot .ar-bar .seg,
  #growthPrintRoot .ar-legend span::before,
  #growthPrintRoot .ar-words-row b {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
