/* MATCHSIK v32.32 — compact, readable mobile revenue dashboard. */
@media (max-width:700px){
  #tabs:has(.tab.active[data-tab="revenue"]) + #content{
    display:block;
    min-width:0;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content > .card:first-child{
    padding:18px!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content > .card:first-child h2{
    margin-bottom:8px!important;
    font-size:22px!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content > .card:first-child .notice{
    margin:0!important;
    padding:12px 13px!important;
    font-size:11px!important;
    line-height:1.65!important;
  }

  /* KPI cards stay visible in two columns instead of becoming five tall full-width cards. */
  #tabs:has(.tab.active[data-tab="revenue"]) + #content > .grid.grid-4{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:9px!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content > .grid.grid-4 .kpi{
    min-height:112px!important;
    padding:15px!important;
    display:flex!important;
    flex-direction:column!important;
    justify-content:center!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content > .grid.grid-4 .kpi small{
    font-size:11px!important;
    line-height:1.35!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content > .grid.grid-4 .kpi strong{
    margin-top:7px!important;
    font-size:clamp(19px,5.7vw,26px)!important;
    line-height:1.15!important;
    overflow-wrap:anywhere!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content > .grid.grid-4 .kpi:last-child{
    grid-column:1/-1!important;
    min-height:96px!important;
  }

  #tabs:has(.tab.active[data-tab="revenue"]) + #content > section:last-child > h3{
    margin-top:2px!important;
    font-size:24px!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content > section:last-child > .muted{
    margin:0 0 12px!important;
    font-size:12px!important;
    line-height:1.6!important;
  }

  /* One teacher = one compact settlement card. */
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details.card{
    padding:16px!important;
    border-radius:17px!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details.card > summary{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    align-items:center!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details.card > summary > b{
    grid-column:1/-1!important;
    margin:0!important;
    font-size:18px!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details.card > summary > .status{
    width:100%!important;
    min-width:0!important;
    min-height:36px!important;
    justify-content:center!important;
    padding:7px 8px!important;
    font-size:10px!important;
    text-align:center!important;
    white-space:normal!important;
    line-height:1.3!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details.card > summary > strong{
    grid-column:1/-1!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    min-height:38px!important;
    margin-top:2px!important;
    border-radius:10px!important;
    background:#edf4ff!important;
    color:#1769ff!important;
    font-size:12px!important;
  }

  /* The former 10-column desktop table becomes readable monthly cards on mobile. */
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table-wrap{
    overflow:visible!important;
    margin-top:12px!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table{
    display:block!important;
    width:100%!important;
    min-width:0!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table thead{display:none!important}
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tbody,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot{
    display:grid!important;
    gap:10px!important;
    width:100%!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tbody tr,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot tr{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:0 12px!important;
    width:100%!important;
    padding:12px!important;
    border:1px solid #dce6f4!important;
    border-radius:13px!important;
    background:#f8fbff!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot tr{
    margin-top:2px!important;
    background:#eaf2ff!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th{
    position:static!important;
    display:flex!important;
    align-items:flex-start!important;
    justify-content:space-between!important;
    gap:8px!important;
    min-width:0!important;
    padding:7px 0!important;
    border:0!important;
    background:transparent!important;
    color:#17375d!important;
    font-size:11px!important;
    text-align:right!important;
    overflow-wrap:anywhere!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th::before{
    flex:0 0 auto!important;
    color:#6b819d!important;
    font-size:10px!important;
    font-weight:800!important;
    text-align:left!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td:nth-child(1)::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th:nth-child(1)::before{content:"월"}
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td:nth-child(2)::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th:nth-child(2)::before{content:"1:1 회차"}
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td:nth-child(3)::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th:nth-child(3)::before{content:"소수정예 인원회차"}
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td:nth-child(4)::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th:nth-child(4)::before{content:"1:1 매출"}
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td:nth-child(5)::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th:nth-child(5)::before{content:"소수정예 매출"}
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td:nth-child(6)::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th:nth-child(6)::before{content:"전체 매출"}
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td:nth-child(7)::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th:nth-child(7)::before{content:"1:1 급여"}
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td:nth-child(8)::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th:nth-child(8)::before{content:"소수정예 급여"}
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td:nth-child(9)::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th:nth-child(9)::before{content:"급여 합계"}
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table td:nth-child(10)::before,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot th:nth-child(10)::before{content:"운영잔액"}
}

@media (max-width:390px){
  #tabs:has(.tab.active[data-tab="revenue"]) + #content > .grid.grid-4 .kpi{
    min-height:104px!important;
    padding:13px!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details.card > summary{
    grid-template-columns:1fr!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details.card > summary > b,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details.card > summary > strong{
    grid-column:auto!important;
  }
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tbody tr,
  #tabs:has(.tab.active[data-tab="revenue"]) + #content details .table tfoot tr{
    grid-template-columns:1fr!important;
  }
}
