/* 운영 대시보드 새 칸(사장님 10/15) — index-extra.js 가 붙이는 칸·줄. 기존 칸 모양(dashboard-page.css)에 맞춘다.
 * 다크 판은 scripts/build_dark_css.py 가 assets/dark/index-extra.css 로 만든다(직접 고치지 않는다). */

.ops-new {
  display: inline-flex;
  align-items: center;
  height: 18px;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3538cd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  vertical-align: middle;
}

.ops-state {
  margin: 0;
  padding: 14px;
  border: 1px dashed #d6dce7;
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
}

.ops-state b {
  margin-right: 4px;
  color: #344054;
}

.ops-state.is-forbidden b,
.ops-state.is-error b {
  color: var(--dashboard-danger);
}

/* ---------- 매출 시트(RD) 공식 카드: 첫 줄 [주문 원장 | 재고자산](지금 ERP 그대로) 아래 줄 전체 폭 ---------- */
.dashboard-business-pulse.has-ops-rd {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-business-pulse.has-ops-rd > .ops-rd-card {
  grid-column: 1 / -1;
}

.ops-rd-note {
  margin: -6px 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.ops-rd-note b {
  color: #344054;
}

.ops-rd-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ops-rd-tile {
  position: relative;
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid #dce3f3;
  border-radius: 12px;
  background: #f6f8ff;
  color: var(--ink);
}

.ops-rd-tile > span {
  color: #667085;
  font-size: 11px;
  font-weight: 750;
}

.ops-rd-tile em {
  margin-left: 2px;
  color: #98a2b3;
  font-style: normal;
  font-weight: 600;
}

.ops-rd-tile strong {
  min-width: 0;
  font-size: clamp(18px, 1.6vw, 24px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.ops-rd-tile small {
  color: #667085;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.ops-rd-tile small b {
  color: var(--ink);
}

.ops-rd-tile .dashboard-delta {
  white-space: nowrap;
}

/* 작은 추세선(받은 일별 값, 장식) — 칸 오른쪽 위 */
.ops-spark {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 92px;
  height: 34px;
  overflow: visible;
  pointer-events: none;
}

.ops-spark polyline {
  fill: none;
  stroke: #2a78d6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.ops-rd-goal {
  width: 100%;
  margin-top: 4px;
}

.ops-flag {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff4e5;
  color: var(--dashboard-warning);
  font-size: 10px;
  font-style: normal;
}

/* ---------- 기존 칸 아래에 붙는 한 줄 ---------- */
.ops-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #dce3f3;
  border-radius: 11px;
  background: #f8faff;
  color: var(--ink);
  font-size: 12px;
}

a.ops-line:hover,
.ops-line-pair a:hover {
  border-color: #aebce6;
}

.ops-line > .ops-new {
  flex: none;
  margin-left: 0;
}

.ops-line > span,
.ops-line-pair a > span {
  min-width: 0;
  flex: 1;
}

.ops-line b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.ops-line small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.ops-line > strong {
  flex: none;
  color: #4867d5;
  font-size: 13px;
}

.ops-line-pair {
  flex-wrap: wrap;
}

.ops-line-pair a {
  display: flex;
  min-width: 180px;
  flex: 1 1 200px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink);
}

.ops-line-pair a + a {
  border-left-color: #e4e8ef;
}

/* 「지금 처리할 일」 목록 안(품절 위험 SKU 바로 아래) 「곧 품절」 줄: 목록 줄 모양(점 · 이름/설명 · 오른쪽 숫자) 그대로,
   설명만 여러 줄로(기준이 다르다는 안내를 자르지 않게) */
.dashboard-action-list .ops-soon-row small {
  overflow: visible;
  white-space: normal;
}

.dashboard-action-list .ops-soon-row strong .ops-new {
  margin-left: 4px;
}

.dashboard-action-list .ops-soon-row > b {
  white-space: nowrap;
}

/* (옛 상자 모양 — 목록 안에서는 이제 .ops-soon-row 를 쓴다) */
.dashboard-action-list .ops-line-item > a.ops-line {
  display: flex;
  min-height: 0;
  grid-template-columns: none;
  margin: 2px 0 6px;
  padding: 9px 10px;
  border: 1px solid #dce3f3;
  border-radius: 10px;
}

.dashboard-action-list .ops-line-item > a.ops-line small {
  overflow: visible;
  white-space: normal;
}

/* ---------- 상품 할 일 칸: 「지금 처리할 일」 아래 한 줄 전체 ---------- */
.dashboard-grid > .ops-panel {
  grid-column: 1 / -1;
}

/* 11/20 「아직 한눈에 안 들어옴」: 오늘 할 일 목록을 전체 폭으로 — 오른쪽 러닝·다이 칸(240~300px)은 목록 아래 전체 폭 띠로(내용 그대로) */
.ops-todo-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.ops-todo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ops-todo-item {
  display: grid;
  min-width: 0;
  min-height: 92px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 4px 8px;
  padding: 12px 13px;
  border: 1px solid #e4e8ef;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--ink);
}

a.ops-todo-item:hover {
  border-color: #bec9ec;
  background: #fff;
}

.ops-todo-item > span {
  font-size: 12px;
  font-weight: 750;
}

.ops-todo-item > b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
}

.ops-todo-item > small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.ops-todo-item.is-danger > b {
  color: var(--dashboard-danger);
}

.ops-todo-item.is-warning > b {
  color: var(--dashboard-warning);
}

.ops-todo-item.is-zero > b {
  color: #98a2b3;
}

.ops-todo-item.is-state {
  border-style: dashed;
}

.ops-todo-item .ops-todo-state {
  color: var(--muted);
  font-size: 12px;
}

.ops-todo-side {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 12px;
  border: 1px solid #e4e8ef;
  border-radius: 12px;
  background: #fbfcff;
}

.ops-todo-side > .ops-todo-verdicts {
  flex: 1 1 340px;
}

.ops-todo-side > .ops-todo-reorder,
.ops-todo-side > .ops-state {
  flex: 1 1 300px;
}

.ops-todo-side-title {
  flex: 0 0 auto;
  margin: 0;
  font-size: 12px;
  font-weight: 800;
}

.ops-todo-side-title small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.ops-todo-verdicts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.ops-todo-verdicts a {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e4e8ef;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.ops-todo-verdicts span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
}

.ops-todo-verdicts b {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.ops-todo-reorder {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #dce3f3;
  border-radius: 10px;
  background: #f6f8ff;
  color: var(--ink);
  font-size: 12px;
}

.ops-todo-reorder > span {
  min-width: 0;
  flex: 1;
}

.ops-todo-reorder b {
  font-variant-numeric: tabular-nums;
}

.ops-todo-reorder small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.ops-todo-reorder > strong {
  color: #4867d5;
}

/* ---------- 상품 오늘 할 일(10/22 2차 재설계): ① 리오더 · ② 재고 한눈에 위 3줄 + 기획전 미신청 + 전체 링크.
 * 상품 관리 「오늘 할 일」과 같은 줄(GET /api/products/today) — 개수 알약 + 상태 말(색만으로 구분하지 않음) · 문장 · 조각·돈·기준 ---------- */
.ops-today {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 12px;
}

.ops-today-group {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.ops-today-title {
  margin: 0;
  padding: 0 2px 5px;
  border-bottom: 1px solid #e4e8ef;
  font-size: 12px;
  font-weight: 800;
}

/* 묶음 머리 할 일 있는 줄 수(11/20 타일) */
.ops-today-gcount {
  margin-left: 2px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.ops-today-title a {
  color: var(--ink);
}

.ops-today-title small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

/* 11/20 작은 타일(상품 관리 「오늘 할 일」 「요약」 .ch-tz-* 과 같은 크기·같은 모양 — 사장님 「이 카드뉴스 나쁘지 않다」, 어디서나 같게):
 * 1줄 큰 숫자 + 단위(급함 색) + 오른쪽 상태 말 작은 알약 / 2줄 할 일(한 줄 말줄임) / 3줄 첫 단추 글. 타일 전체 = 첫 단추 링크, 나머지 글은 title. */
.ops-tz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ops-tz {
  min-width: 0;
}

.ops-tz-tile {
  display: flex;
  height: 100%;
  min-height: 68px;
  box-sizing: border-box;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 7px 10px;
  border: 1px solid #e4e8ef;
  border-left: 3px solid #98a2b3;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}

.ops-tz[data-tone="dn"] .ops-tz-tile {
  border-left-color: var(--dashboard-danger);
}

.ops-tz[data-tone="warn"] .ops-tz-tile {
  border-left-color: var(--dashboard-warning);
}

.ops-tz[data-tone="up"] .ops-tz-tile {
  border-left-color: var(--dashboard-safe, #087a55);
}

.ops-tz[data-tone="state"] .ops-tz-tile {
  border-style: dashed;
}

a.ops-tz-tile:hover {
  border-top-color: #c9d1df;
  border-right-color: #c9d1df;
  border-bottom-color: #c9d1df;
  background: #fff;
}

.ops-tz-tile:focus-visible {
  outline: 2px solid #4867d5;
  outline-offset: 2px;
}

.ops-tz-top {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 3px;
}

.ops-tz-top b {
  color: var(--ink);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  letter-spacing: -.02em;
  line-height: 22px;
}

.ops-tz[data-tone="dn"] .ops-tz-top b {
  color: var(--dashboard-danger);
}

.ops-tz[data-tone="warn"] .ops-tz-top b {
  color: var(--dashboard-warning);
}

.ops-tz-unit {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* 상태 말(「오늘」「4일째」「지남」 …): 단위를 덮지 않고 오른쪽 작은 알약 */
.ops-tz-badge {
  display: inline-flex;
  height: 16px;
  flex: none;
  align-items: center;
  align-self: center;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef1f6;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.ops-tz[data-tone="dn"] .ops-tz-badge {
  background: #fdeceb;
  color: var(--dashboard-danger);
}

.ops-tz[data-tone="warn"] .ops-tz-badge {
  background: #fdf1e3;
  color: var(--dashboard-warning);
}

.ops-tz-what {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-tz-act {
  min-width: 0;
  overflow: hidden;
  color: #4867d5;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 칸 머리 설명 ⓘ(설명 글은 title·aria-label 로 그대로) */
.ops-todo-about {
  display: inline-grid;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  place-items: center;
  border: 1px solid #c9d1df;
  border-radius: 50%;
  color: var(--muted);
  font-size: 10px;
  font-style: italic;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}

.ops-today-none {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* 0건·준비 중·참고 줄 수(없애지 않고 셈 — 줄은 상품 관리 「오늘 할 일」에서) · 접힌 7칸 머리의 기간 줄(늘 보임) */
.ops-today-quiet {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.ops-todo-when {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.ops-today-all {
  justify-self: start;
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

.ops-todo-all {
  margin-top: 12px;
}

.ops-todo-all > summary {
  color: #4867d5;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.ops-todo-all > summary small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.ops-todo-all[open] > summary {
  margin-bottom: 10px;
}

/* ---------- 이번 주 입고 칸: 승인·처리 대기 다음 줄 전체 ---------- */
.ops-arrival-sum {
  margin: -6px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.ops-arrival-sum b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ops-arrival-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ops-arrival-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 112px minmax(0, 1fr) auto 84px;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-top: 1px solid #f0f2f6;
}

.ops-arrival-row.is-first {
  border-top-color: #e4e8ef;
}

.ops-arrival-list > .ops-arrival-row:first-child {
  border-top: 0;
}

.ops-arrival-day {
  color: #344054;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.ops-arrival-day b {
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3538cd;
  font-size: 10px;
}

.ops-arrival-name {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.ops-arrival-name strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-arrival-name small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-arrival-source {
  padding: 2px 8px;
  border-radius: 999px;
  background: #ecfdf3;
  color: #067647;
  font-size: 10.5px;
  font-weight: 750;
}

.ops-arrival-source.is-reorder {
  background: #eef4ff;
  color: #2447bd;
}

.ops-arrival-row > b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ops-arrival-late {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #f0c9c6;
  border-radius: 11px;
  background: #fff8f7;
  color: var(--ink);
  font-size: 12px;
}

.ops-arrival-late b {
  color: var(--dashboard-danger);
  font-variant-numeric: tabular-nums;
}

.ops-arrival-late small {
  min-width: 0;
  flex: 1;
  color: #7a5652;
  font-size: 10.5px;
}

.ops-arrival-late > strong {
  color: var(--dashboard-danger);
}

/* 전체 폭 RD 카드 안 네 칸: 좁아지면 2칸 */
@media (max-width: 1180px) {
  .ops-rd-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1320px) {
  .ops-todo-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1050px) {
  .dashboard-business-pulse.has-ops-rd {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .ops-todo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 오늘 할 일 타일: 좁으면 140px 칸(상품 관리 요약과 같게) — 가로 스크롤 없음 */
  .ops-tz-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .ops-todo-verdicts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-arrival-row {
    grid-template-areas: "day day" "name qty" "source qty";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 10px;
  }

  .ops-arrival-row:not(.is-first) {
    grid-template-areas: "name qty" "source qty";
  }

  .ops-arrival-day {
    grid-area: day;
  }

  .ops-arrival-row:not(.is-first) .ops-arrival-day {
    display: none;
  }

  .ops-arrival-name {
    grid-area: name;
  }

  .ops-arrival-source {
    grid-area: source;
    justify-self: start;
  }

  .ops-arrival-row > b {
    grid-area: qty;
  }
}

@media (max-width: 460px) {
  .ops-rd-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 휴대폰: 타일 한 줄에 2개 */
  .ops-tz-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-todo-verdicts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (forced-colors: active) {
  .ops-rd-tile,
  .ops-line,
  .ops-todo-item,
  .ops-tz-tile,
  .ops-todo-side,
  .ops-arrival-late {
    border: 1px solid CanvasText;
  }
}
