/* ============================================================
   ZeroDesk 모바일 레이어 (≤768px)
   - styles.css 다음에 로드. 모바일 전용 규칙은 전부 여기에만 둔다.
   - 데스크톱 규칙(!important, id 선택자)을 이기기 위해 html / #page-* 접두사 + !important 사용.
   - 범위: 공통 셸(하단 탭바·페이지 스크롤), 홈, 재고, 발주, 모달.
   ============================================================ */

@media (max-width: 768px) {
  /* ---------- 공통 셸 ---------- */
  html,
  html body,
  html .app-layout {
    flex-direction: column !important;
    height: 100dvh !important;
    overflow: hidden !important;
    background: var(--bg) !important;
  }
  html #app-sidebar,
  html .page {
    display: none !important;
  }
  html .page.active {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: calc(100dvh - 60px - env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
    background: var(--bg) !important;
  }

  /* 하단 탭바 */
  html #mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: calc(60px + env(safe-area-inset-bottom)) !important;
    padding: 0 0 env(safe-area-inset-bottom) !important;
    background: rgba(255, 255, 255, 0.92) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--border-strong) !important;
    z-index: 200 !important;
    align-items: stretch !important;
    justify-content: space-around !important;
  }
  html .mobile-nav-btn {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    height: 60px !important;
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
    color: var(--text-muted) !important;
    -webkit-tap-highlight-color: transparent;
  }
  html .mobile-nav-btn.active {
    color: var(--accent) !important;
  }
  html .mobile-nav-btn svg {
    width: 23px !important;
    height: 23px !important;
    stroke: currentColor !important;
  }
  html .mobile-nav-btn span {
    font-size: 10.5px !important;
    font-weight: var(--fw-semibold) !important;
    letter-spacing: -0.01em;
  }

  /* 입력 요소: iOS 확대 방지(16px 이상) */
  html input[type="search"],
  html input[type="text"],
  html input[type="number"],
  html input[type="month"],
  html input[type="date"],
  html select,
  html textarea {
    font-size: 16px !important;
  }

  /* ---------- 홈 ---------- */
  html #page-home .dashboard-page {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 16px 24px !important;
    background: none !important;
  }
  html #page-home .apple-page-head {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    margin: 0 !important;
    padding: 20px 0 16px !important;
    border: 0 !important;
    background: none !important;
  }
  html #page-home #apple-greeting {
    font-size: 26px !important;
    line-height: 1.25 !important;
    letter-spacing: -0.02em !important;
    margin: 0 !important;
    word-break: keep-all;
  }
  html #page-home .apple-page-head-sub {
    margin: 4px 0 0 !important;
    font-size: 14px !important;
    color: var(--text-soft) !important;
  }
  html #page-home .apple-page-head-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin: 0 !important;
  }
  html #page-home .apple-page-head-actions .apple-btn {
    width: 100% !important;
    height: 44px !important;
    padding: 0 12px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
    justify-content: center !important;
  }
  html #page-home #dashboardBirthdayBanner,
  html #page-home #dashboardBirthdayBanner.dashboard-birthday-banner {
    margin: 0 0 12px !important;
  }
  html #page-home .dashboard-cards {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
  }
  html #page-home .dashboard-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    min-width: 0 !important;
    min-height: 96px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 14px 14px 12px !important;
    border-radius: 16px !important;
    background: var(--bg-white) !important;
    border: 0 !important;
    box-shadow: var(--shadow-raised) !important;
  }
  html #page-home .dashboard-card-label {
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: var(--fw-semibold) !important;
    color: var(--text-soft) !important;
    white-space: nowrap !important;
    writing-mode: horizontal-tb !important;
  }
  html #page-home .dashboard-card-value-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
    margin: 8px 0 0 !important;
  }
  html #page-home .dashboard-card-value {
    font-size: 30px !important;
    line-height: 1 !important;
    font-weight: var(--fw-bold) !important;
    letter-spacing: -0.02em !important;
  }
  html #page-home .dashboard-card-unit {
    font-size: 11.5px !important;
    line-height: 1.35 !important;
    color: var(--text-muted) !important;
    white-space: normal !important;
    word-break: keep-all;
  }
  html #page-home .dashboard-main,
  html #page-home .dashboard-main-left,
  html #page-home .dashboard-main > *,
  html #page-home .dashboard-main-left > * {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }
  html #page-home .dashboard-main {
    display: flex !important;
  }
  html #page-home .dashboard-panel {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 18px 16px !important;
    border-radius: 16px !important;
    background: var(--bg-white) !important;
    border: 0 !important;
    box-shadow: var(--shadow-raised) !important;
    overflow: hidden !important;
  }
  html #page-home .dashboard-panel-title,
  html #page-home .dashboard-panel h2,
  html #page-home .dashboard-panel h3 {
    font-size: 17px !important;
    margin: 0 0 12px !important;
  }
  html #page-home .dashboard-sales-total {
    display: flex !important;
    align-items: baseline !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    margin: 0 0 10px !important;
  }
  html #page-home .dashboard-sales-value {
    font-size: 30px !important;
    line-height: 1.1 !important;
    letter-spacing: -0.02em !important;
    white-space: nowrap !important;
  }
  html #page-home .dashboard-sales-breakdown {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin: 0 !important;
  }
  html #page-home .dashboard-sales-breakdown-sep {
    display: none !important;
  }
  html #page-home .dashboard-sales-breakdown-item {
    display: inline-block !important;
    padding: 5px 10px !important;
    border-radius: 999px !important;
    background: var(--bg) !important;
    font-size: 12.5px !important;
    white-space: nowrap !important;
  }
  html #page-home .dashboard-team-sched {
    margin: 0 !important;
  }
  html #page-home .dashboard-team-sched-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }
  html #page-home .dashboard-team-sched-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 10px 0 !important;
    border-bottom: 0.5px solid var(--border) !important;
  }
  html #page-home .dashboard-team-sched-row:last-child {
    border-bottom: 0 !important;
  }
  html #page-home .dashboard-team-sched-name {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    font-size: 15px !important;
    line-height: 1.4 !important;
    word-break: keep-all;
    order: 0 !important;
  }
  html #page-home .dashboard-team-sched-type {
    flex: 0 0 auto !important;
    order: 1 !important;
  }
  html #page-home .dashboard-notice-form {
    display: flex !important;
    gap: 8px !important;
  }
  html #page-home .dashboard-notice-input {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  html #page-home .dashboard-yearly {
    margin: 12px 0 0 !important;
  }
  html #page-home .dashboard-notice-list {
    min-height: 0 !important;
  }
  html #page-home .dashboard-notice-input,
  html #page-home .dashboard-notice-form button {
    height: 44px !important;
    min-height: 0 !important;
    border-radius: 12px !important;
  }
  html #page-home .dashboard-notice-form button {
    flex: 0 0 auto !important;
    padding: 0 18px !important;
  }
  html #page-home .dashboard-yearly-chart {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* ---------- 재고 ---------- */
  html #page-stock.active {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  html #page-stock .stock-page {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
  }
  html #page-stock .stock-split,
  html #page-stock .stock-left {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    overflow: hidden !important;
  }
  html #page-stock .stock-right {
    display: none !important;
  }
  html #page-stock .stock-toolbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
    width: auto !important;
    margin: 0 !important;
    padding: 14px 16px 12px !important;
    background: var(--bg) !important;
    border: 0 !important;
    box-shadow: none !important;
  }
  html #page-stock .stock-team-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 2px !important;
    border-radius: 10px !important;
    background: rgba(118, 118, 128, 0.12) !important;
  }
  html #page-stock .stock-team-tab {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--text) !important;
    font-size: 14px !important;
    font-weight: var(--fw-semibold) !important;
    white-space: nowrap !important;
    box-shadow: none !important;
  }
  html #page-stock .stock-team-tab.active {
    background: var(--bg-white) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04) !important;
  }
  html #page-stock .stock-toolbar-right {
    display: flex !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 8px !important;
  }
  html #page-stock .stock-search-input {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: rgba(118, 118, 128, 0.12) !important;
    box-shadow: none !important;
  }
  html #page-stock .btn-stock-print,
  html #page-stock .stock-table thead,
  html #page-stock .stock-logs-section,
  html #stockLogsPanel,
  html .stock-logs-panel {
    display: none !important;
  }
  html #page-stock .stock-table-wrap {
    display: block !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 2px 16px 24px !important;
    background: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  html #page-stock .stock-table,
  html #page-stock .stock-table tbody {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
    border: 0 !important;
    background: none !important;
  }
  html #page-stock .stock-table tbody tr {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: baseline !important;
    position: relative !important;
    margin: 0 0 10px !important;
    padding: 14px 16px !important;
    background: var(--bg-white) !important;
    border: 0 !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-raised) !important;
  }
  html #page-stock .stock-table tbody tr:hover td {
    background: none !important;
  }
  html #page-stock .stock-table tbody td {
    display: block !important;
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    color: var(--text-soft) !important;
    text-align: left !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    vertical-align: baseline !important;
  }
  html #page-stock .stock-table tbody td.is-empty,
  html #page-stock .stock-table tbody td.sc-cat {
    display: none !important;
  }
  /* 카드 배치: [품명 | 현재고] / 단위 · 단가 · 유통기한 / 위치 · 공급처 / 메모 / 버튼
     tr::before, tr::after 를 줄바꿈 요소로 사용 */
  html #page-stock .stock-table tbody tr::before,
  html #page-stock .stock-table tbody tr::after {
    content: "" !important;
    display: block !important;
    flex: 0 0 100% !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
  html #page-stock .stock-table tbody tr::before {
    order: 3 !important;
  }
  html #page-stock .stock-table tbody tr::after {
    order: 7 !important;
  }
  html #page-stock .stock-table tbody td.sc-name {
    order: 1 !important;
    flex: 1 1 0 !important;
    padding-right: 12px !important;
    font-size: 16px !important;
    font-weight: var(--fw-semibold) !important;
    line-height: 1.35 !important;
    color: var(--text) !important;
    word-break: keep-all !important;
    overflow-wrap: anywhere !important;
  }
  html #page-stock .stock-table tbody td.sc-qty {
    order: 2 !important;
    flex: 0 0 auto !important;
    font-size: 24px !important;
    font-weight: var(--fw-bold) !important;
    line-height: 1.1 !important;
    letter-spacing: -0.02em !important;
    color: var(--text) !important;
    text-align: right !important;
    font-variant-numeric: tabular-nums;
  }
  html #page-stock .stock-table tbody td.sc-qty::after {
    content: "개" !important;
    margin-left: 2px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
  }
  html #page-stock .stock-table tbody td.sc-unit,
  html #page-stock .stock-table tbody td.sc-price {
    order: 4 !important;
    flex: 0 0 auto !important;
    margin-top: 6px !important;
    font-size: 13px !important;
  }
  html #page-stock .stock-table tbody td.sc-price {
    order: 5 !important;
  }
  html #page-stock .stock-table tbody td.sc-unit:not(.is-empty) + td.sc-price::before {
    content: "·" !important;
    margin: 0 6px;
    color: var(--text-muted);
  }
  html #page-stock .stock-table tbody td.sc-exp {
    order: 6 !important;
    flex: 0 0 auto !important;
    align-self: center !important;
    margin: 6px 0 0 8px !important;
    padding: 1px 8px !important;
    border-radius: 6px !important;
    background: var(--bg) !important;
    font-size: 12px !important;
    font-variant-numeric: tabular-nums;
  }
  html #page-stock .stock-table tbody td.sc-exp::before {
    content: "유통 " !important;
    color: inherit;
    opacity: 0.7;
  }
  html #page-stock .stock-table tbody td.stock-expiry-cell--warn {
    background: var(--warning-bg) !important;
    color: #b45309 !important;
  }
  html #page-stock .stock-table tbody td.stock-expiry-cell--danger {
    background: var(--danger-bg) !important;
    color: var(--danger) !important;
  }
  html #page-stock .stock-table tbody td.sc-exp .stock-expiry-icon {
    display: none !important;
  }
  html #page-stock .stock-table tbody td.sc-loc,
  html #page-stock .stock-table tbody td.sc-sup {
    order: 8 !important;
    flex: 0 0 auto !important;
    margin: 4px 12px 0 0 !important;
    font-size: 12px !important;
    color: var(--text-muted) !important;
  }
  html #page-stock .stock-table tbody td.sc-sup {
    order: 9 !important;
  }
  html #page-stock .stock-table tbody td.sc-loc::before {
    content: "위치  " !important;
    color: var(--text-muted);
    opacity: 0.75;
  }
  html #page-stock .stock-table tbody td.sc-sup::before {
    content: "공급처  " !important;
    color: var(--text-muted);
    opacity: 0.75;
  }
  /* 메모 */
  html #page-stock .stock-table tbody td.sc-memo {
    order: 10 !important;
    flex: 0 0 100% !important;
    margin-top: 8px !important;
    padding: 8px 10px !important;
    border-radius: 8px !important;
    background: var(--bg) !important;
    font-size: 12.5px !important;
    color: var(--text-soft) !important;
  }
  /* 버튼 */
  html #page-stock .stock-table tbody td.stock-actions-cell {
    order: 11 !important;
    flex: 0 0 100% !important;
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
    gap: 8px !important;
    margin-top: 12px !important;
  }
  html #page-stock .stock-table tbody td.stock-actions-cell button {
    width: 100% !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 10px !important;
    font-size: 15px !important;
    font-weight: var(--fw-semibold) !important;
    box-shadow: none !important;
  }
  html #page-stock .stock-table tbody td.stock-actions-cell .btn-stock-change {
    background: var(--accent) !important;
    border: 0 !important;
    color: #fff !important;
  }
  html #page-stock .stock-table tbody td.stock-actions-cell .btn-stock-edit {
    background: var(--bg) !important;
    border: 0 !important;
    color: var(--text) !important;
  }
  html #page-stock .stock-table tbody td.stock-table-empty {
    flex: 1 1 100% !important;
    padding: 32px 0 !important;
    text-align: center !important;
    color: var(--text-muted) !important;
  }

  /* ---------- 발주 ---------- */
  html #page-inventory.active {
    display: block !important;
  }
  html #page-inventory .inventory-page,
  html #page-inventory .inventory-main-row,
  html #page-inventory .inventory-right,
  html #page-inventory .inventory-right-split,
  html #page-inventory .inventory-cart-column,
  html #page-inventory .inventory-cart-history-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    flex: none !important;
  }
  html #page-inventory .inventory-page {
    padding: 16px 16px 24px !important;
  }
  html #page-inventory .inventory-sidebar,
  html #page-inventory .inventory-cart-panel,
  html #page-inventory .inventory-history-section {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 16px !important;
    border: 0 !important;
    border-radius: 16px !important;
    background: var(--bg-white) !important;
    box-shadow: var(--shadow-raised) !important;
    overflow: visible !important;
    flex: none !important;
  }
  html #page-inventory .inventory-sidebar-top,
  html #page-inventory .inventory-search-wrap,
  html #page-inventory .inventory-cart-head,
  html #page-inventory .inventory-history-head,
  html #page-inventory .inventory-cart-body-wrap,
  html #page-inventory .inventory-cart-body,
  html #page-inventory .inventory-cart-footer,
  html #page-inventory .inventory-table-wrap,
  html #page-inventory .inventory-list {
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    flex: none !important;
  }
  html #page-inventory .inventory-sidebar-top-row,
  html #page-inventory .inventory-cart-head,
  html #page-inventory .inventory-history-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin: 0 0 12px !important;
  }
  html #page-inventory .inventory-sidebar-head,
  html #page-inventory .inventory-cart-title,
  html #page-inventory .inventory-history-title {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: var(--fw-bold) !important;
    color: var(--text) !important;
  }
  html #page-inventory .btn-inventory-new-item {
    height: 32px !important;
    padding: 0 12px !important;
    border-radius: 999px !important;
    font-size: 13px !important;
  }
  html #page-inventory .inventory-search-input {
    width: 100% !important;
    max-width: none !important;
    height: 42px !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: rgba(118, 118, 128, 0.12) !important;
    box-shadow: none !important;
  }
  html #page-inventory .inventory-list {
    display: flex !important;
    flex-direction: column !important;
    margin-top: 8px !important;
    max-height: 50vh !important;
    overflow-y: auto !important;
  }
  html #page-inventory .inventory-list-hint {
    margin: 4px 2px 0 !important;
    font-size: 13px !important;
    color: var(--text-muted) !important;
  }
  html #page-inventory .inventory-result-row {
    padding: 10px 0 !important;
    border: 0 !important;
    border-bottom: 0.5px solid var(--border) !important;
    border-radius: 0 !important;
    background: none !important;
  }
  html #page-inventory .inventory-result-row:last-child {
    border-bottom: 0 !important;
  }
  html #page-inventory .inventory-cart-count {
    min-width: 24px !important;
    height: 24px !important;
    padding: 0 8px !important;
    border-radius: 999px !important;
    background: var(--accent) !important;
    color: #fff !important;
    font-size: 13px !important;
    line-height: 24px !important;
    text-align: center !important;
  }
  html #page-inventory .inventory-cart-body {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }
  html #page-inventory .inventory-cart-empty {
    margin: 0 !important;
    font-size: 13px !important;
    color: var(--text-muted) !important;
  }
  html #page-inventory .inventory-cart-line {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 12px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: var(--bg) !important;
    box-shadow: none !important;
  }
  html #page-inventory .inventory-cart-line-name {
    font-size: 15px !important;
    font-weight: var(--fw-semibold) !important;
  }
  html #page-inventory .inventory-cart-line-meta,
  html #page-inventory .inventory-cart-line-subtotal {
    font-size: 12.5px !important;
    margin-top: 2px !important;
  }
  html #page-inventory .inventory-cart-line-actions {
    display: grid !important;
    grid-template-columns: auto 1fr 1fr !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }
  html #page-inventory .inventory-cart-line-actions:not(:has(.btn-inventory-order-single)) {
    grid-template-columns: auto 1fr !important;
  }
  html #page-inventory .inventory-qty-group {
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    height: 38px !important;
    border-radius: 10px !important;
    background: var(--bg-white) !important;
    overflow: hidden !important;
  }
  html #page-inventory .inventory-qty-btn {
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    font-size: 18px !important;
    color: var(--accent) !important;
  }
  html #page-inventory .inventory-qty-input {
    width: 44px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    text-align: center !important;
    font-weight: var(--fw-semibold) !important;
  }
  html #page-inventory .btn-inventory-cart-remove,
  html #page-inventory .btn-inventory-order-single {
    width: 100% !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 8px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
    background: var(--bg-white) !important;
  }
  html #page-inventory .btn-inventory-cart-remove {
    border: 0 !important;
    color: var(--danger) !important;
  }
  html #page-inventory .btn-inventory-order-single {
    border: 0 !important;
    color: var(--accent) !important;
  }
  html #page-inventory .inventory-cart-footer {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  html #page-inventory .inventory-order-msg:not(:empty),
  html #page-inventory .btn-inventory-order:not([hidden]) {
    margin-top: 12px !important;
  }
  html #page-inventory .inventory-order-msg:empty {
    display: none !important;
  }
  html #page-inventory .btn-inventory-order {
    width: 100% !important;
    height: 48px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    font-weight: var(--fw-semibold) !important;
  }
  /* 발주 이력: 표 → 카드 */
  html #page-inventory .inventory-month-label {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 13px !important;
    color: var(--text-soft) !important;
  }
  html #page-inventory .inventory-month-input {
    height: 34px !important;
    padding: 0 8px !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: var(--bg) !important;
    font-size: 15px !important;
  }
  html #page-inventory .inventory-table,
  html #page-inventory .inventory-table tbody {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
    border: 0 !important;
  }
  html #page-inventory .inventory-table thead {
    display: none !important;
  }
  html #page-inventory .inventory-table tbody tr {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    padding: 12px 0 !important;
    border: 0 !important;
    border-bottom: 0.5px solid var(--border) !important;
    background: none !important;
  }
  html #page-inventory .inventory-table tbody tr:last-child {
    border-bottom: 0 !important;
  }
  html #page-inventory .inventory-table tbody tr:hover td {
    background: none !important;
  }
  html #page-inventory .inventory-table tbody td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    font-size: 12.5px !important;
    line-height: 1.45 !important;
    color: var(--text-muted) !important;
    text-align: left !important;
    white-space: normal !important;
    overflow: visible !important;
  }
  html #page-inventory .inventory-table tbody td.is-empty {
    display: none !important;
  }
  /* 카드 배치: [품명 | 수령] / 수량 · 총액 / 일시 · 공급처 · 발주자 */
  html #page-inventory .inventory-table tbody tr::before,
  html #page-inventory .inventory-table tbody tr::after {
    content: "" !important;
    display: block !important;
    flex: 0 0 100% !important;
    height: 0 !important;
  }
  html #page-inventory .inventory-table tbody tr::before {
    order: 3 !important;
  }
  html #page-inventory .inventory-table tbody tr::after {
    order: 6 !important;
  }
  html #page-inventory .inventory-table tbody td.ih-name {
    order: 1 !important;
    flex: 1 1 0 !important;
    padding-right: 10px !important;
    font-size: 15px !important;
    font-weight: var(--fw-semibold) !important;
    color: var(--text) !important;
    word-break: keep-all;
  }
  html #page-inventory .inventory-table tbody td.inventory-history-receive-cell {
    order: 2 !important;
    flex: 0 0 auto !important;
  }
  html #page-inventory .inventory-table tbody td.ih-qty,
  html #page-inventory .inventory-table tbody td.ih-total {
    order: 4 !important;
    margin-top: 4px !important;
    font-size: 13px !important;
    color: var(--text-soft) !important;
  }
  html #page-inventory .inventory-table tbody td.ih-qty::before {
    content: "수량 " !important;
  }
  html #page-inventory .inventory-table tbody td.ih-total {
    order: 5 !important;
  }
  html #page-inventory .inventory-table tbody td.ih-total::before,
  html #page-inventory .inventory-table tbody td.ih-sup::before,
  html #page-inventory .inventory-table tbody td.ih-by::before {
    content: "·" !important;
    margin: 0 6px;
    color: var(--text-muted);
  }
  html #page-inventory .inventory-table tbody td.ih-by::before {
    content: "· 발주 " !important;
    margin: 0 0 0 6px;
  }
  html #page-inventory .inventory-table tbody td.ih-date,
  html #page-inventory .inventory-table tbody td.ih-sup,
  html #page-inventory .inventory-table tbody td.ih-by {
    order: 7 !important;
    margin-top: 2px !important;
    font-size: 12px !important;
    font-variant-numeric: tabular-nums;
  }
  html #page-inventory .inventory-table tbody td.ih-sup {
    order: 8 !important;
  }
  html #page-inventory .inventory-table tbody td.ih-by {
    order: 9 !important;
  }
  html #page-inventory .inventory-history-actions-cell {
    display: flex !important;
    gap: 6px !important;
  }
  html #page-inventory .btn-inventory-receive,
  html #page-inventory .btn-inventory-history-del {
    height: 34px !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
    font-size: 14px !important;
    font-weight: var(--fw-semibold) !important;
    white-space: nowrap !important;
  }
  html #page-inventory .btn-inventory-receive {
    background: var(--accent) !important;
    border: 0 !important;
    color: #fff !important;
  }
  html #page-inventory .btn-inventory-history-del {
    padding: 0 8px !important;
    background: none !important;
    border: 0 !important;
    color: var(--text-muted) !important;
    font-weight: var(--fw-regular) !important;
    font-size: 13px !important;
  }
  html #page-inventory .inventory-history-received {
    display: inline-block !important;
    padding: 4px 10px !important;
    border-radius: 999px !important;
    background: var(--success-bg) !important;
    color: var(--success) !important;
    font-size: 12.5px !important;
    font-weight: var(--fw-semibold) !important;
    white-space: nowrap !important;
  }
  html #page-inventory .inventory-table tbody td.inventory-table-empty {
    flex: 1 1 100% !important;
    padding: 16px 0 !important;
    text-align: center !important;
  }

  /* ---------- 모달: 하단 시트 ---------- */
  html .overlay {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
  }
  html .overlay > .modal {
    width: 100% !important;
    max-width: none !important;
    max-height: calc(100dvh - 24px) !important;
    margin: 0 !important;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom)) !important;
    border-radius: 20px 20px 0 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  html .overlay > .modal input:not([type="checkbox"]):not([type="radio"]),
  html .overlay > .modal select {
    min-height: 44px !important;
  }
  html .stock-change-actions,
  html .overlay > .modal [class*="-actions"]:last-child {
    gap: 8px !important;
  }
  html .stock-change-actions button {
    flex: 1 1 0 !important;
    height: 48px !important;
    border-radius: 12px !important;
    font-size: 16px !important;
  }
}

@media (max-width: 768px) {
  /* 재고 변경 시트: 메모 영역의 옛 금색 박스 제거 */
  html .stock-change-modal .stock-change-field--memo {
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
  }
  html .stock-change-modal .stock-change-field--memo input {
    box-shadow: none !important;
  }
}

@media (max-width: 768px) {
  /* 시트 하단 버튼 줄: 가로 꽉 채운 큰 버튼 */
  html .overlay > .modal > [class$="-actions"]:last-child {
    display: flex !important;
    gap: 8px !important;
    margin-top: 20px !important;
    padding: 0 !important;
  }
  html .overlay > .modal > [class$="-actions"]:last-child > button {
    flex: 1 1 0 !important;
    height: 48px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    font-size: 16px !important;
  }
}

@media (max-width: 768px) {
  html #page-inventory .inventory-result-row {
    align-items: center !important;
  }
  html #page-inventory .inventory-result-info {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  html #page-inventory .inventory-result-name {
    font-size: 15px !important;
    font-weight: var(--fw-semibold) !important;
  }
  html #page-inventory .inventory-result-brief {
    margin-top: 2px !important;
    font-size: 12.5px !important;
    color: var(--text-muted) !important;
  }
  html #page-inventory .inventory-result-row::after {
    content: "›";
    flex: 0 0 auto;
    padding-left: 12px;
    font-size: 22px;
    line-height: 1;
    color: var(--border-strong);
  }
}

@media (max-width: 768px) {
  /* 유통기한 칩이 다음 줄로 넘어가도 들여쓰기 없이 */
  html #page-stock .stock-table tbody td.sc-price {
    margin-right: 8px !important;
  }
  html #page-stock .stock-table tbody td.sc-exp {
    margin-left: 0 !important;
  }
  /* 모바일에서는 스크롤바 숨김(터치 스크롤) */
  html .page.active,
  html .page.active * {
    scrollbar-width: none;
  }
  html .page.active::-webkit-scrollbar,
  html .page.active *::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 768px) {
  /* ---------- 팀 캘린더 ---------- */
  html #page-teamcal .teamcal-page {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 16px 12px 24px !important;
  }
  html #page-teamcal .teamcal-page-title {
    margin: 4px 4px 12px !important;
    font-size: 26px !important;
    letter-spacing: -0.02em !important;
  }
  html #page-teamcal .teamcal-toolbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin: 0 4px 12px !important;
  }
  html #page-teamcal .teamcal-toolbar-nav {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
  }
  html #page-teamcal .teamcal-month-label {
    min-width: 0 !important;
    width: auto !important;
    padding: 0 6px !important;
    font-size: 18px !important;
    white-space: nowrap !important;
  }
  html #page-teamcal .btn-teamcal-nav {
    width: 36px !important;
    height: 36px !important;
    flex: 0 0 36px !important;
  }
  html #page-teamcal #teamCalAddBtn {
    flex: 0 0 auto !important;
    height: 36px !important;
    padding: 0 14px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
  }
  html #page-teamcal .teamcal-grid,
  html #page-teamcal .teamcal-cal-wrapper {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }
  html #page-teamcal .teamcal-cell {
    min-width: 0 !important;
    padding: 4px 2px !important;
    overflow: hidden !important;
  }
  html #page-teamcal .teamcal-chip {
    display: block !important;
    max-width: 100% !important;
    margin: 2px 0 0 !important;
    padding: 2px 1px !important;
    border-radius: 5px !important;
    font-size: 10.5px !important;
    letter-spacing: -0.04em !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
  }
}

@media (max-width: 768px) {
  /* 공통 페이지 헤더(모바일): 작은 제목, 동작 버튼은 오른쪽 */
  html .page .zd-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 16px 16px 4px !important;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
    min-height: 0 !important;
    height: auto !important;
  }
  html .page .zd-title {
    margin: 0 !important;
    font-size: 24px !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
    white-space: nowrap !important;
  }
  html .page .zd-actions {
    display: flex !important;
    gap: 6px !important;
  }
  html #page-teamcal .zd-head {
    padding: 4px 4px 12px !important;
  }
  html #page-teamcal #teamCalAddBtn {
    height: 36px !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
  }
  html #page-stock .zd-head,
  html #page-inventory .zd-head {
    padding-bottom: 0 !important;
  }
  html #page-inventory .inventory-page {
    padding-top: 12px !important;
  }
  html #arUser,
  html #opUser,
  html #alUser {
    display: none !important;
  }
}
