/* ============================================================
   ZeroDesk 공통 UI 레이어 (PC, 769px 이상)
   - styles.css 다음, mobile.css 앞에 로드.
   - 모든 탭이 같은 페이지 골격(헤더·여백·카드·버튼·입력·표)을 쓰도록 맞춘다.
   - 기존 탭별 규칙(!important 포함)을 이기기 위해 html 접두사 + !important.
   ============================================================ */

:root {
  --zd-gutter: 32px;
  --zd-head-h: 72px;
  --zd-radius-card: 16px;
  --zd-radius-ctl: 10px;
  --zd-ctl-h: 36px;
  --zd-card-border: 1px solid var(--hairline, rgba(0, 0, 0, 0.08));
}

@media (min-width: 769px) and (max-width: 1279px) {
  :root {
    --zd-gutter: 24px;
  }
}

@media (min-width: 769px) {
  /* ---------- 페이지 골격 ---------- */
  html .page.active {
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg) !important;
  }

  /* 공통 헤더: 제목 왼쪽, 동작 버튼 오른쪽 */
  html .page .zd-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 12px 16px !important;
    flex: 0 0 auto !important;
    position: static !important;
    width: auto !important;
    max-width: none !important;
    min-height: var(--zd-head-h) !important;
    height: auto !important;
    margin: 0 !important;
    padding: 20px var(--zd-gutter) 16px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  html .page .zd-head-main,
  html .page .zd-head > .apple-page-head-left,
  html .page .zd-head > .ar-header-left {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 2px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  html .page .zd-title {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 26px !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
    color: var(--text) !important;
    white-space: nowrap !important;
  }
  html .page .zd-title::after,
  html .page .zd-head::after {
    content: none !important;
    display: none !important;
  }
  html .page .zd-sub {
    margin: 0 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: var(--text-soft) !important;
  }
  html .page .zd-actions,
  html .page .zd-head > .ar-header-center,
  html .page .zd-head > .ar-header-right {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  html .page .zd-head > .ar-header-center {
    margin-left: auto !important;
  }
  /* 사이드바에 이미 사용자 정보가 있으므로 헤더의 중복 표시는 숨김 */
  html #arUser,
  html #opUser,
  html #alUser {
    display: none !important;
  }

  /* 본문 여백: 모든 탭 동일 (헤더 아래, 좌우 gutter) */
  html #page-home > .dashboard-page,
  html #page-team > .team-page,
  html #page-teamcal > .teamcal-page,
  html #page-cost > .cost-page-wrap,
  html #page-closing > .closing-page,
  html #page-settings > .settings-page {
    flex: 1 0 auto !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 0 32px !important;
    background: none !important;
  }
  html .page.active > .dashboard-page > *:not(.zd-head),
  html .page.active > .team-page > *:not(.zd-head),
  html .page.active > .teamcal-page > *:not(.zd-head),
  html .page.active > .cost-page-wrap > *:not(.zd-head),
  html .page.active > .settings-page > *:not(.zd-head) {
    margin-left: var(--zd-gutter) !important;
    margin-right: var(--zd-gutter) !important;
  }
  /* 설정·비용: 화면 폭을 다 쓴다(큰 모니터에서 오른쪽이 비지 않게) */
  html #page-settings .settings-page > *:not(.zd-head),
  html #page-cost .cost-page-wrap > *:not(.zd-head) {
    max-width: none !important;
  }
  html #page-cost .cost-page-top {
    margin-bottom: 0 !important;
  }
  html #page-cost .cost-header-month {
    font-size: 13px !important;
    color: var(--text-soft) !important;
  }

  /* 결산: 헤더 아래 분할 본문 */
  html #page-closing .closing-page {
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: 0 !important;
  }
  html #page-closing .closing-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 var(--zd-gutter) 24px !important;
    gap: 20px !important;
    background: none !important;
    border: 0 !important;
  }
  html #page-closing .closing-main,
  html #page-closing .closing-side-panel {
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
  }

  /* 재고·발주: 헤더 + 앱형 본문(본문 내부 스크롤) */
  html #page-stock.active,
  html #page-arrange.active {
    overflow: hidden !important;
  }
  html #page-stock .stock-page {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 0 var(--zd-gutter) 24px !important;
  }
  html #page-inventory .inventory-page {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 0 var(--zd-gutter) 24px !important;
  }

  /* 어레인지 3종: 흰 상단 바 → 공통 헤더 */
  html #page-arrange .ar-main,
  html #page-order-parse .op-main,
  html #page-order-parse .al-main {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 var(--zd-gutter) 24px !important;
    background: none !important;
  }

  /* 홈: 헤더가 기본 header 숨김 규칙에 가려지지 않도록 */
  html #page-home .apple-page-head {
    display: flex !important;
  }
  html #page-home #apple-greeting em {
    font-style: normal !important;
    color: var(--accent) !important;
  }
  /* 홈: 화면 높이를 다 쓰도록 세로 배치. 가운데 줄(매출·근무·공지)이 남는 높이를 가져감 */
  html #page-home .dashboard-page {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }
  html #page-home .dashboard-cards {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    align-items: stretch !important;
  }
  html #page-home .dashboard-main {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }
  /* 월별 매출 차트: 화면 높이에 맞춰 늘고 줄어서, 큰 화면은 빈 곳 없이·작은 화면은 스크롤 최소로 */
  html #page-home .dashboard-yearly-chart {
    height: clamp(140px, calc(100vh - 880px), 320px) !important;
  }
  html #page-home .dashboard-card--list .dashboard-card-value {
    font-size: 34px !important;
  }

  html #page-home .dashboard-cards,
  html #page-home .dashboard-main {
    padding: 0 !important;
    gap: 16px !important;
  }
  html #page-home .dashboard-page > *:not(.zd-head) + *:not(.zd-head) {
    margin-top: 16px !important;
  }
  html #page-home .dashboard-page > .dashboard-yearly {
    margin-bottom: 0 !important;
  }
  html #page-home #dashboardBirthdayBanner:empty {
    display: none !important;
  }

  /* ---------- 카드 ---------- */
  html .page .dashboard-card,
  html .page .dashboard-panel,
  html .page .op-panel,
  html .page .al-panel,
  html .page .cost-card,
  html .page .settings-section-accordion,
  html .page .inventory-sidebar,
  html .page .inventory-cart-panel,
  html .page .inventory-history-section,
  html .page .stock-table-wrap,
  html .page .stock-logs-panel,
  html .page .teamcal-cal-wrapper,
  html .page .ar-wrap-outer,
  html .page .closing-side-panel > *,
  html .page .team-member-grid > * {
    background: var(--bg-white) !important;
    border: var(--zd-card-border) !important;
    border-radius: var(--zd-radius-card) !important;
    box-shadow: none !important;
  }

  /* ---------- 버튼 ---------- */
  html .page :is(
      .apple-btn,
      .btn-teamcal-primary:not(.stock-team-tab),
      .btn-teamcal-secondary,
      .ar-pill-btn,
      .op-btn,
      .al-btn,
      .btn-settings-primary,
      .btn-settings-secondary,
      .btn-closing-primary,
      .btn-closing-secondary,
      .cost-btn-rules,
      .cost-btn-analyze,
      .btn-stock-print,
      .btn-inventory-new-item,
      .btn-inventory-order,
      .staff-add-btn
    ),
  html .overlay :is(.btn-save-cal, .btn-cancel) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    height: var(--zd-ctl-h) !important;
    min-height: 0 !important;
    padding: 0 16px !important;
    border-radius: var(--zd-radius-ctl) !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    letter-spacing: -0.01em !important;
    white-space: nowrap !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s !important;
  }
  /* 주 버튼 */
  html .page :is(
      .apple-btn--blue,
      .btn-teamcal-primary:not(.stock-team-tab):not(.btn-stock-print),
      .ar-pill-btn--primary,
      .op-btn--primary,
      .al-btn--primary,
      .btn-settings-primary,
      .btn-closing-primary,
      .cost-btn-analyze,
      .btn-inventory-order,
      .staff-add-btn
    ),
  html .overlay .btn-save-cal {
    background: var(--accent) !important;
    border: 1px solid var(--accent) !important;
    color: #fff !important;
  }
  html .page :is(
      .apple-btn--blue,
      .btn-teamcal-primary:not(.stock-team-tab):not(.btn-stock-print),
      .ar-pill-btn--primary,
      .op-btn--primary,
      .al-btn--primary,
      .btn-settings-primary,
      .btn-closing-primary,
      .cost-btn-analyze,
      .btn-inventory-order,
      .staff-add-btn
    ):hover:not(:disabled),
  html .overlay .btn-save-cal:hover {
    background: var(--accent-hover, #0058b0) !important;
    border-color: var(--accent-hover, #0058b0) !important;
  }
  /* 보조 버튼 */
  html .page :is(
      .apple-btn--ghost,
      .btn-teamcal-secondary,
      .ar-pill-btn:not(.ar-pill-btn--primary),
      .op-btn--ghost,
      .al-btn--ghost,
      .btn-settings-secondary,
      .btn-closing-secondary,
      .cost-btn-rules,
      .btn-stock-print,
      .btn-inventory-new-item
    ),
  html .overlay .btn-cancel {
    background: var(--bg-white) !important;
    border: 1px solid var(--border-strong) !important;
    color: var(--text) !important;
  }
  html .page :is(
      .apple-btn--ghost,
      .btn-teamcal-secondary,
      .ar-pill-btn:not(.ar-pill-btn--primary),
      .op-btn--ghost,
      .al-btn--ghost,
      .btn-settings-secondary,
      .btn-closing-secondary,
      .cost-btn-rules,
      .btn-stock-print,
      .btn-inventory-new-item
    ):hover:not(:disabled),
  html .overlay .btn-cancel:hover {
    background: var(--bg) !important;
  }
  html .page :is(.op-btn, .al-btn, .cost-btn-analyze, .btn-closing-primary):disabled {
    opacity: 0.4 !important;
    cursor: not-allowed;
  }
  /* 아이콘 버튼(이전/다음/새로고침) */
  html .page :is(.ar-icon-btn, .btn-teamcal-nav, .btn-closing-cal-nav) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: var(--zd-ctl-h) !important;
    height: var(--zd-ctl-h) !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--zd-radius-ctl) !important;
    background: var(--bg-white) !important;
    color: var(--text) !important;
    font-size: 18px !important;
    line-height: 1 !important;
    box-shadow: none !important;
  }
  html .page :is(.ar-icon-btn, .btn-teamcal-nav, .btn-closing-cal-nav):hover {
    background: var(--bg) !important;
  }

  /* ---------- 입력 ---------- */
  html .page :is(
      .zd-head input[type="date"],
      .zd-head input[type="month"],
      .zd-head select,
      .stock-search-input,
      .inventory-search-input,
      .inventory-month-input,
      .stock-logs-date-input,
      .cost-page-wrap select
    ) {
    height: var(--zd-ctl-h) !important;
    min-height: 0 !important;
    padding: 0 12px !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--zd-radius-ctl) !important;
    background: var(--bg-white) !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: 14px !important;
    color: var(--text) !important;
  }
  html .page :is(.stock-search-input, .inventory-search-input) {
    padding-left: 34px !important;
    background: var(--bg-white)
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E")
      no-repeat 12px center !important;
  }
  html .page :is(input, select, textarea):focus-visible {
    outline: none !important;
    border-color: var(--accent-focus, #0071e3) !important;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18) !important;
  }

  /* 세그먼트 탭(재고 간호/피부/데스크) */
  html #page-stock .stock-team-tabs {
    display: inline-grid !important;
    grid-auto-flow: column !important;
    grid-auto-columns: 1fr !important;
    gap: 2px !important;
    padding: 2px !important;
    border: 0 !important;
    border-radius: var(--zd-radius-ctl) !important;
    background: rgba(118, 118, 128, 0.12) !important;
  }
  html #page-stock .stock-team-tab {
    height: 32px !important;
    min-width: 76px !important;
    padding: 0 16px !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--text) !important;
    font-size: 14px !important;
    font-weight: 600 !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 :is(.stock-table, .inventory-table, .settings-staff-table) thead th {
    height: 40px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    background: var(--surface-alt, #fbfbfd) !important;
    border-bottom: var(--zd-card-border) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-soft) !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  /* ---------- 사이드바: 1200px 미만이면 아이콘만 ---------- */
}

@media (min-width: 769px) and (max-width: 1199px) {
  :root {
    --sidebar-w: 72px !important;
  }
  html #app-sidebar {
    width: 72px !important;
    min-width: 72px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  html #app-sidebar .sidebar-wordmark,
  html #app-sidebar .sidebar-nav-label,
  html #app-sidebar .sidebar-user-name,
  html #app-sidebar .sidebar-role,
  html #app-sidebar #sidebarRole {
    display: none !important;
  }
  html #app-sidebar .sidebar-brand-row {
    justify-content: center !important;
  }
  html #app-sidebar .sidebar-sep {
    height: 1px !important;
    margin: 10px 8px !important;
    padding: 0 !important;
    overflow: hidden !important;
    font-size: 0 !important;
    background: var(--hairline, rgba(0, 0, 0, 0.08)) !important;
  }
  html #app-sidebar .sidebar-nav-btn {
    justify-content: center !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    gap: 0 !important;
  }
}

/* ============================================================
   재고 (PC)
   ============================================================ */
@media (min-width: 769px) {
  html #page-stock .stock-split {
    display: flex !important;
    gap: 16px !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
  }
  html #page-stock .stock-left {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
  }
  html #page-stock .stock-right {
    flex: 0 0 300px !important;
    width: 300px !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html #page-stock .stock-logs-panel {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
  }
  /* 툴바: 카드 밖, 표 위 한 줄 */
  html #page-stock .stock-toolbar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    flex: 0 0 auto !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
  }
  html #page-stock .stock-toolbar-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
  }
  html #page-stock .stock-search-input {
    width: 260px !important;
    max-width: none !important;
  }
  /* 표: 고정 레이아웃 + 폭에 따라 덜 중요한 열부터 숨김 */
  html #page-stock .stock-table-wrap {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    container-type: inline-size;
    container-name: stocktable;
  }
  html #page-stock .stock-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
  }
  html #page-stock .stock-table :is(th, td) {
    display: table-cell !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  html #page-stock .stock-table :is(th, td):nth-child(2) {
    display: none !important;
  }
  html #page-stock .stock-table th:nth-child(1) { width: auto !important; }
  html #page-stock .stock-table th:nth-child(3) { width: 14% !important; }
  html #page-stock .stock-table th:nth-child(4) { width: 84px !important; }
  html #page-stock .stock-table th:nth-child(5) { width: 17% !important; }
  html #page-stock .stock-table th:nth-child(6) { width: 100px !important; }
  html #page-stock .stock-table th:nth-child(7) { width: 72px !important; }
  html #page-stock .stock-table th:nth-child(8) { width: 112px !important; }
  html #page-stock .stock-table th:nth-child(9) { width: 14% !important; }
  html #page-stock .stock-table th:nth-child(10) { width: 148px !important; }
  html #page-stock .stock-table :is(th, td):nth-child(1) {
    padding-left: 20px !important;
  }
  html #page-stock .stock-table td:nth-child(1) {
    font-weight: 600 !important;
    color: var(--text) !important;
  }
  html #page-stock .stock-table :is(th, td):nth-child(6),
  html #page-stock .stock-table :is(th, td):nth-child(7) {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
  }
  html #page-stock .stock-table td:nth-child(7) {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--text) !important;
  }
  html #page-stock .stock-table td:nth-child(8) {
    font-variant-numeric: tabular-nums;
  }
  html #page-stock .stock-table tbody td {
    height: 48px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: 1px solid var(--hairline-faint, rgba(0, 0, 0, 0.04)) !important;
    font-size: 14px !important;
    vertical-align: middle !important;
  }
  html #page-stock .stock-table tbody td.stock-actions-cell {
    padding-right: 16px !important;
    text-align: right !important;
  }
  html #page-stock .stock-table td.stock-actions-cell button {
    height: 30px !important;
    padding: 0 12px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
  }
  html #page-stock .stock-table td.stock-actions-cell .btn-stock-change {
    background: var(--accent) !important;
    border: 1px solid var(--accent) !important;
    color: #fff !important;
  }
  html #page-stock .stock-table td.stock-actions-cell .btn-stock-edit {
    margin-left: 6px !important;
    background: var(--bg-white) !important;
    border: 1px solid var(--border-strong) !important;
    color: var(--text) !important;
  }
  html #page-stock .stock-table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
  }
  html #page-stock .stock-table tbody td.stock-actions-cell {
    white-space: nowrap !important;
    overflow: visible !important;
  }
  html #page-stock .stock-table tbody td.stock-expiry-cell--danger,
  html #page-stock .stock-table tbody td.stock-expiry-cell--warn {
    background: none !important;
    font-weight: 600 !important;
  }
  html #page-stock .stock-table tbody td.stock-expiry-cell--danger {
    color: var(--danger) !important;
  }
  html #page-stock .stock-table tbody td.stock-expiry-cell--warn {
    color: #b45309 !important;
  }
  html #page-stock .stock-table tbody td .stock-expiry-icon {
    display: none !important;
  }
  /* 표 폭에 따라 숨기는 순서: 메모 → 공급처 → 위치 → 단위 */
  @container stocktable (max-width: 1099px) {
    html #page-stock .stock-table :is(th, td):nth-child(9) { display: none !important; }
  }
  @container stocktable (max-width: 939px) {
    html #page-stock .stock-table :is(th, td):nth-child(3) { display: none !important; }
  }
  @container stocktable (max-width: 759px) {
    html #page-stock .stock-table :is(th, td):nth-child(4) { display: none !important; }
  }
  @container stocktable (max-width: 719px) {
    html #page-stock .stock-table :is(th, td):nth-child(5) { display: none !important; }
  }
}
/* 화면이 좁으면 변경 이력 패널을 줄인다 (표가 우선) */
@media (min-width: 769px) and (max-width: 1439px) {
  html #page-stock .stock-right {
    flex-basis: 260px !important;
    width: 260px !important;
  }
}
@media (min-width: 769px) and (max-width: 1099px) {
  html #page-stock .stock-right {
    display: none !important;
  }
}

/* ============================================================
   카드 제목·탭별 다듬기 (PC)
   ============================================================ */
@media (min-width: 769px) {
  /* 카드 안 제목: 모든 탭 같은 크기·굵기 */
  html .page :is(
      .dashboard-panel-title,
      .closing-section-title,
      .closing-cal-section-title,
      .closing-month-sum-heading,
      .op-panel-title,
      .al-panel-title,
      .cost-card-title,
      .inventory-sidebar-head,
      .inventory-cart-title,
      .inventory-history-title,
      .stock-logs-panel-title,
      .settings-section-accordion-title,
      .settings-form-title
    ) {
    margin-top: 0 !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    color: var(--text) !important;
    text-transform: none !important;
  }

  /* 오더지·학습: 분석 버튼 높이 통일 */
  html .page :is(.op-panel, .al-panel) > :is(.op-btn, .al-btn) {
    width: 100% !important;
    height: 40px !important;
  }

  /* 발주: 장바구니는 내용만큼(최대 45%), 총액 열 넓힘 */
  html #page-inventory .inventory-cart-panel {
    flex: 0 1 auto !important;
    min-height: 120px !important;
    max-height: 45% !important;
  }
  html #page-inventory .inventory-table :is(th, td):nth-child(5) {
    width: 120px !important;
    text-align: right !important;
    font-variant-numeric: tabular-nums;
  }
  html #page-inventory .inventory-table :is(th, td):nth-child(1) {
    font-variant-numeric: tabular-nums;
  }
  html #page-inventory .inventory-table tbody td {
    height: 48px !important;
    font-size: 14px !important;
  }
  html #page-inventory .inventory-table tbody td:nth-child(2) {
    font-weight: 600 !important;
    color: var(--text) !important;
  }
  html #page-inventory :is(.btn-inventory-cart-remove, .btn-inventory-order-single, .btn-inventory-receive, .btn-inventory-history-del) {
    height: 30px !important;
    padding: 0 12px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
  }
  html #page-inventory .btn-inventory-receive,
  html #page-inventory .btn-inventory-order-single {
    background: var(--accent) !important;
    border: 1px solid var(--accent) !important;
    color: #fff !important;
  }
  html #page-inventory :is(.btn-inventory-cart-remove, .btn-inventory-history-del) {
    background: var(--bg-white) !important;
    border: 1px solid var(--border-strong) !important;
    color: var(--danger) !important;
  }
  html #page-inventory .inventory-history-received {
    display: inline-flex !important;
    align-items: center !important;
    height: 26px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    background: var(--success-bg) !important;
    color: var(--success) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border: 0 !important;
  }

  /* 캘린더: 요일 머리글은 표 머리글과 같은 톤, 일정 칩은 브랜드 색 */
  html #page-teamcal .teamcal-weekday-row {
    background: var(--surface-alt, #fbfbfd) !important;
    border-bottom: var(--zd-card-border) !important;
  }
  html #page-teamcal .teamcal-weekday {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-soft) !important;
  }
  html #page-teamcal .teamcal-weekday--sun {
    color: var(--danger) !important;
  }
  html #page-teamcal .teamcal-weekday--sat {
    color: var(--accent) !important;
  }
  html #page-teamcal .teamcal-chip {
    background: var(--accent-light, #e8f1fb) !important;
    color: var(--accent) !important;
    border: 0 !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
  }
  html #page-teamcal .teamcal-toolbar {
    margin: 0 var(--zd-gutter) 12px !important;
  }

  /* 결산 캘린더: 칸이 좁으면 금액 라벨 숨김, 금액은 한 줄 */
  html #page-closing .closing-cal-cell--day {
    container-type: inline-size;
    min-width: 0 !important;
  }
  html #page-closing .closing-cal-stat {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 11px !important;
    line-height: 1.4 !important;
    font-variant-numeric: tabular-nums;
  }
  @container (max-width: 150px) {
    html #page-closing :is(.closing-cal-stat-label, .closing-cal-stat-full) {
      display: none !important;
    }
    html #page-closing .closing-cal-stat-short {
      display: inline !important;
    }
  }
}
/* 결산 캘린더 금액 축약 표기: 기본은 숨김(칸이 좁을 때만 표시) */
.closing-cal-stat-short {
  display: none;
}

/* 발주 레이아웃: 왼쪽 검색, 오른쪽 장바구니+이력 (모든 PC 폭) */
@media (min-width: 769px) {
  html #page-inventory .inventory-page {
    display: flex !important;
    flex-direction: column !important;
  }
  html #page-inventory .inventory-main-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 16px !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
  }
  html #page-inventory .inventory-sidebar {
    flex: 0 0 300px !important;
    width: 300px !important;
    max-width: none !important;
    max-height: none !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html #page-inventory .inventory-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
  }
  html #page-inventory .inventory-right {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
  }
  html #page-inventory .inventory-table :is(th, td):nth-child(1) {
    width: 128px !important;
    white-space: nowrap !important;
  }
  html #page-inventory .inventory-table :is(th, td):nth-child(7) {
    width: 164px !important;
  }
  html #page-inventory .inventory-history-actions-cell {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 6px !important;
  }
}
@media (min-width: 769px) and (max-width: 1279px) {
  html #page-inventory .inventory-sidebar {
    flex-basis: 260px !important;
    width: 260px !important;
  }
}
@media (min-width: 769px) {
  html #page-inventory .inventory-table-wrap {
    container-type: inline-size;
    container-name: invtable;
  }
  html #page-inventory .inventory-table {
    table-layout: fixed !important;
    width: 100% !important;
  }
  html #page-inventory .inventory-table :is(th, td) {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  html #page-inventory .inventory-table :is(th, td):nth-child(7) {
    overflow: visible !important;
  }
  @container invtable (max-width: 799px) {
    html #page-inventory .inventory-table :is(th, td):nth-child(6) { display: none !important; }
  }
  @container invtable (max-width: 679px) {
    html #page-inventory .inventory-table :is(th, td):nth-child(3) { display: none !important; }
  }
}
@media (min-width: 769px) {
  html #page-closing .closing-body--split {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
  }
  html #page-closing .closing-main {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
  }
  html #page-closing .closing-side-panel {
    flex: 0 0 clamp(340px, 36%, 520px) !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
  }
  html #page-closing .closing-cal-cell--day {
    padding: 4px 5px !important;
  }
}
@media (min-width: 769px) {
  html #page-closing .closing-side-panel {
    flex-basis: clamp(380px, 40%, 520px) !important;
  }
  html #page-closing .closing-cal-section {
    padding: 18px 16px !important;
  }
  html #page-closing .closing-cal-grid-inner,
  html #page-closing [class*="closing-cal-weekday-row"] {
    gap: 3px !important;
  }
  @container (max-width: 64px) {
    html #page-closing .closing-cal-stat {
      font-size: 10px !important;
      letter-spacing: -0.03em !important;
      text-overflow: clip !important;
    }
    html #page-closing .closing-cal-stat--card {
      display: none !important;
    }
  }
}
@media (min-width: 1600px) {
  html #page-stock .stock-right {
    flex-basis: 340px !important;
    width: 340px !important;
  }
}

/* ---------- 화면 크기별 보정 ---------- */
@media (min-width: 769px) and (max-width: 1439px) {
  /* 홈 요약 카드: 1440px 미만에서는 2×2 (목록 글자가 잘리지 않게) */
  html #page-home .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (min-width: 1600px) {
  /* 홈: 넓은 화면에서는 아래 줄을 [매출·근무 | 공지 | 월별 차트] 3칸으로 놓아 한 화면에 다 들어오게 */
  html #page-home .dashboard-page {
    display: grid !important;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto minmax(0, 1fr) !important;
    column-gap: 16px !important;
    row-gap: 0 !important;
  }
  html #page-home .dashboard-page > .zd-head {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
  }
  html #page-home #dashboardBirthdayBanner {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
  }
  html #page-home .dashboard-cards {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
  }
  html #page-home .dashboard-main {
    grid-column: 1 !important;
    grid-row: 4 !important;
    margin-right: 0 !important;
  }
  html #page-home .dashboard-page > .dashboard-yearly {
    grid-column: 2 !important;
    grid-row: 4 !important;
    margin-left: 0 !important;
    margin-top: 16px !important;
    margin-bottom: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html #page-home .dashboard-yearly-chart {
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 180px !important;
  }
}
@media (min-width: 1600px) {
  /* 결산: 입력 칸은 원래 폭(920px) 한 줄 그대로 두고, 남는 폭은 오른쪽 달력·월별 집계가 가져감.
     오른쪽은 화면 높이에 맞춰 고정(스크롤해도 따라옴)하고, 달력 칸이 남는 높이를 채움. */
  html #page-closing .closing-page,
  html #page-closing .closing-body {
    overflow: visible !important;
  }
  html #page-closing .closing-main {
    flex: 0 1 940px !important;
    max-width: 940px !important;
  }
  html #page-closing .closing-side-panel {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 380px !important;
    position: sticky !important;
    top: 16px !important;
    align-self: flex-start !important;
    height: calc(100vh - 112px) !important;
    overflow-y: auto !important;
  }
  html #page-closing .closing-cal-section {
    flex: 1 0 auto !important;
    min-height: 0 !important;
  }
  html #page-closing .closing-month-sum-section {
    flex: 0 0 auto !important;
  }
  html #page-closing .closing-cal-grid {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html #page-closing .closing-cal-grid-inner {
    flex: 1 1 auto !important;
    grid-template-rows: auto !important;
    grid-auto-rows: minmax(80px, 1fr) !important;
  }
  html #page-closing .closing-cal-cell {
    min-height: 0 !important;
    height: auto !important;
  }
}
@media (min-width: 1800px) {
  /* 큰 모니터: 홈 차트와 목록 글자를 조금 키움 */
  html #page-home .dashboard-card-row {
    font-size: 14px !important;
    padding: 6px 0 !important;
  }
}

/* 결산: 내용이 화면보다 길면 페이지가 스크롤되게 (아이맥 27인치 등에서 정액권 칸이 잘리던 문제) */
@media (min-width: 769px) {
  html #page-closing.page.active {
    overflow-y: auto !important;
  }
}
