:root {
  --navy: #14335c;
  --navy-dark: #0d2544;
  --navy-active: #1f4d85;
  --sidebar-bg: #fafbfc;
  --sidebar-border: #e5e8ec;
  --sidebar-text: #333;
  --sidebar-muted: #8a939e;
  --content-bg: #f3f5f9;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.08);

  --bs-link-color: #1f4d85;
  --bs-link-color-rgb: 31, 77, 133;
  --bs-link-hover-color: #14335c;
  --bs-link-hover-color-rgb: 20, 51, 92;
}

/* 부트스트랩 기본 입력창 테두리(#ced4da)가 너무 옅어서 잘 안 보인다는 피드백에 따라 더 진하게 조정 */
.form-control,
.form-select,
.form-check-input {
  border-color: #99a1ad;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--navy-active);
}

body {
  margin: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Malgun Gothic', sans-serif;
}

.btn {
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn-primary {
  --bs-btn-bg: var(--navy-active);
  --bs-btn-border-color: var(--navy-active);
  --bs-btn-hover-bg: var(--navy);
  --bs-btn-hover-border-color: var(--navy);
  --bs-btn-active-bg: var(--navy-dark);
  --bs-btn-active-border-color: var(--navy-dark);
  --bs-btn-focus-shadow-rgb: 31, 77, 133;
}

.btn-outline-primary {
  --bs-btn-color: var(--navy-active);
  --bs-btn-border-color: var(--navy-active);
  --bs-btn-hover-bg: var(--navy-active);
  --bs-btn-hover-border-color: var(--navy-active);
  --bs-btn-active-bg: var(--navy);
  --bs-btn-active-border-color: var(--navy);
  --bs-btn-focus-shadow-rgb: 31, 77, 133;
}

.app-content-bare {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--sidebar-bg);
}

.login-box {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.login-box h1 {
  font-size: 1.15rem;
  color: var(--navy);
  margin-bottom: 20px;
  text-align: center;
}

.app-header {
  display: flex;
  align-items: center;
  height: 56px;
  background: var(--navy);
  color: #fff;
  padding: 0 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 10;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  margin-right: 24px;
  white-space: nowrap;
}

.app-header .brand .logo {
  width: 39px;
  height: 30px;
  object-fit: contain;
}

.app-tabs {
  display: flex;
  align-items: stretch;
  height: 100%;
}

.header-search {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  max-width: 360px;
  margin: 0 20px;
}

.header-search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--sidebar-muted);
  stroke-width: 1.6;
  pointer-events: none;
}

.header-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  color: #fff;
  padding: 6px 12px 6px 30px;
  font-size: 0.85rem;
}

.header-search input::placeholder {
  color: #b7c3d6;
}

.header-search input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  color: #14335c;
}

.header-search input:focus::placeholder {
  color: var(--sidebar-muted);
}

.header-search input:focus ~ .header-search-icon {
  stroke: var(--sidebar-muted);
}

.app-tabs a {
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: #cfd9e8;
  text-decoration: none;
  font-size: 0.95rem;
  height: 100%;
}

.app-tabs a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.app-tabs a.active {
  color: #fff;
  font-weight: 700;
  background: var(--navy-active);
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
  font-size: 0.9rem;
}

.app-header-right .user {
  color: #e8edf5;
}

.app-header-right .user strong {
  color: #fff;
}

.app-header-right .logout {
  background: none;
  color: #cfd9e8;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.app-header-right .logout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 56px);
}

.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid #d6dbe1;
  min-height: calc(100vh - 56px);
  padding: 18px 10px 30px;
}

.app-sidebar .side-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  margin-bottom: 4px;
  border-radius: 6px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.4;
}

.side-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-icon-badge {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.side-icon-badge.badge-navy {
  background: #e6edf7;
  color: var(--navy-active);
}

.side-icon-badge.badge-green {
  background: #e2f4e8;
  color: #1e8a45;
}

.side-icon-badge.badge-amber {
  background: #fbeed4;
  color: #b3760a;
}

.side-icon-badge.badge-purple {
  background: #ece4f8;
  color: #7c3fc4;
}

.side-icon-badge.badge-rose {
  background: #fbe3e3;
  color: #b02a37;
}

.side-icon-badge.badge-slate {
  background: #e7eaee;
  color: #56636e;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.side-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--sidebar-text);
  background: #eef0f3;
  border-radius: 10px;
  padding: 1px 8px;
  flex-shrink: 0;
}

.side-link.active .side-count {
  background: rgba(255, 255, 255, 0.25);
  color: inherit;
}

.status-dot.dot-inprogress {
  background: var(--navy-active);
}

.status-dot.dot-onhold {
  background: #d99a1f;
}

.status-dot.dot-closed {
  background: #2f9e52;
}

.status-dot.dot-reference {
  background: #8a8f98;
}

/* 현장별 목록 전용: 진행중 사건이 하나라도 있으면 빨간색(신경 써야 함), 0건이면 초록색(당장은 조용함).
   진행중/보류/종결 상태 자체를 나타내는 위 dot-inprogress(파란색)와는 다른 의미라 색을 구분한다. */
.status-dot.dot-danger {
  background: #e5342b;
}

.status-dot.dot-safe {
  background: #2f9e52;
}

.side-count-legend {
  text-align: right;
  font-size: 0.68rem;
  color: var(--sidebar-muted);
  padding: 0 16px 4px;
}

.app-sidebar .side-link:hover {
  background: #eef2f7;
}

.app-sidebar .side-link.active {
  background: #e6edf7;
  color: var(--navy);
  font-weight: 700;
  border-right: 3px solid var(--navy-active);
}

.app-sidebar .side-group {
  border-top: 1px solid var(--sidebar-border);
  margin-top: 14px;
  padding-top: 12px;
}

.app-sidebar .side-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px 12px;
  color: var(--navy);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  list-style: none;
}

.app-sidebar .side-group summary::-webkit-details-marker {
  display: none;
}

.app-sidebar .side-group summary::after {
  content: "▾";
  font-size: 0.7rem;
}

.app-sidebar .side-group[open] summary::after {
  content: "▴";
}

.app-sidebar .side-group .side-group {
  border-top: 1px dashed var(--sidebar-border);
  margin-top: 10px;
  margin-left: 8px;
  padding-top: 8px;
}

/* 현장 목록이 수십 개까지 늘어날 수 있어서, 사이드바 전체를 무한정 늘리지 않도록
   이 구간만 최대 높이를 두고 그 안에서 스크롤되게 한다. */
.side-scroll {
  max-height: 260px;
  overflow-y: auto;
}

.app-sidebar .side-group .side-group summary {
  padding: 4px 12px 8px;
  font-size: 0.85rem;
}

.app-content {
  flex: 1;
  min-width: 0;
  padding: 32px 36px;
  background: var(--content-bg);
}

.app-content h1 {
  margin-bottom: 24px;
}

.app-content h2:not(.detail-section-title) {
  margin-top: 88px;
  margin-bottom: 24px;
  color: var(--navy);
  font-weight: 700;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 88px;
  margin-bottom: 24px;
  gap: 16px;
}

.section-header-row:first-child {
  margin-top: 0;
}

.section-header-row > h2 {
  margin: 0 !important;
}

.section-link {
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--navy-active);
  text-decoration: none;
  font-weight: 600;
}

.section-link:hover {
  text-decoration: underline;
}

.app-content > h2:first-child {
  margin-top: 0;
}

/* Bootstrap's .row is a flex container, so its margin doesn't collapse with the
   preceding element like normal block siblings do. Reduce the heading's own
   margin-top here so the visible gap still matches the standard h2 spacing. */
.row > [class*="col"] > h2:first-child {
  margin-top: 44px;
}

.app-content p {
  line-height: 1.6;
  margin-bottom: 16px;
}

.app-content .form-label {
  font-weight: 600;
  color: var(--sidebar-text);
}

.app-content .cell-strong {
  font-weight: 600;
  color: var(--sidebar-text);
}

.cell-truncate {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0 40px;
}

.stat-card {
  position: relative;
  border: 1px solid #edeff2;
  border-top: 3px solid var(--sidebar-border);
  border-radius: 10px;
  padding: 18px 20px;
  min-width: 180px;
  background: #fff;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.stat-card.accent-navy { border-top-color: var(--navy-active); }
.stat-card.accent-green { border-top-color: #1e8a45; }
.stat-card.accent-amber { border-top-color: #b3760a; }
.stat-card.accent-slate { border-top-color: #56636e; }
.stat-card.accent-rose { border-top-color: #b02a37; }
.stat-card.accent-purple { border-top-color: #7c3fc4; }

.stat-value.value-navy { color: var(--navy-active); }
.stat-value.value-green { color: #1e8a45; }
.stat-value.value-amber { color: #b3760a; }
.stat-value.value-slate { color: #56636e; }
.stat-value.value-rose { color: #b02a37; }
.stat-value.value-purple { color: #7c3fc4; }

.stat-card:hover {
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.06);
  transform: translateY(-2px);
}

.stat-icon-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-badge.badge-navy {
  background: #e6edf7;
  color: var(--navy-active);
}

.stat-icon-badge.badge-green {
  background: #e2f4e8;
  color: #1e8a45;
}

.stat-icon-badge.badge-amber {
  background: #fbeed4;
  color: #b3760a;
}

.stat-icon-badge.badge-purple {
  background: #ece4f8;
  color: #7c3fc4;
}

.stat-icon-badge.badge-slate {
  background: #e7eaee;
  color: #56636e;
}

.stat-icon-badge.badge-rose {
  background: #fbe3e3;
  color: #b02a37;
}

.stat-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-card-sparkline {
  grid-column: span 2;
}

.sparkline-trend {
  font-size: 0.78rem;
  margin: 2px 0 8px;
}

.sparkline-trend.trend-up {
  color: #1e7a34;
}

.sparkline-trend.trend-down {
  color: #b02a37;
}

.sparkline-trend.trend-flat {
  color: var(--sidebar-muted);
}

.sparkline {
  width: 100%;
  height: 36px;
  display: block;
}

.sparkline .bar-past {
  fill: #d7e2ef;
}

.sparkline .bar-current {
  fill: var(--navy-active);
}

.sparkline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.sparkline-labels span {
  font-size: 0.68rem;
  color: var(--sidebar-muted);
  flex: 1;
  text-align: center;
}

.app-content table.table {
  margin-bottom: 44px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.app-content table.table th,
.app-content table.table td {
  padding: 12px 14px;
  vertical-align: middle;
}

/* 일정관리 "등록된 일정" 표만 기존 가로 구분선(부트스트랩 기본값, 연한 회색)을 더 진하게 —
   격자 테두리(table-bordered)를 넣어봤다가 다른 표들과 스타일이 달라 딱딱해 보인다는 피드백을
   받아서, 세로선 없이 기존 가로줄 색만 진하게 하는 쪽으로 되돌렸다. */
.app-content table.schedule-day-table th,
.app-content table.schedule-day-table td {
  border-bottom-color: #99a1ad;
}

/* 이 표는 .detail-card 안에 들어있는데, 표 자체도 위 .app-content table.table 규칙 때문에
   따로 흰 배경+그림자+둥근 모서리를 가진 "카드"처럼 그려진다 — 카드 안에 카드가 중첩되면서
   모서리가 둥글게 잘리는 지점에서 가로줄 길이가 짧아 보이고 살짝 곡선처럼 보이는 문제가 있었다.
   이미 .detail-card가 배경/그림자/테두리를 갖고 있으니, 표 자체의 카드 스타일은 없앤다. */
.detail-card table.schedule-day-table {
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
  margin-bottom: 0;
}

.app-content table.table-hover tbody tr {
  transition: background-color 0.12s ease;
}

.company-filter {
  background: #fff;
  border: 1px solid #edeff2;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.company-filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.company-filter-hide-zero {
  font-size: 0.85rem;
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
}

.company-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.company-filter-item {
  font-size: 0.85rem;
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 140px;
}

.cases-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.cases-filter-form {
  background: #fff;
  border: 1px solid #edeff2;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.cases-filter-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

/* 현장 검색 자동완성, 상태/보기방식/표시개수/정렬기준 커스텀 드롭다운 — 브라우저마다 기본 <select>
   드롭다운 모양이 달라 옆의 현장 검색창과 스타일이 어긋나 보이던 문제를 없애려고 전부 같은 모양의
   카드형 드롭다운으로 통일했다. 페이지 안 흐름에 끼어들어 아래 내용을 밀어내지 않도록 입력칸 바로
   아래에 떠서 나타난다. */
.site-filter-dropdown,
.custom-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e5ea;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 20;
  padding: 4px;
}

.site-filter-option,
.custom-select-option {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}

.site-filter-option:hover,
.custom-select-option:hover {
  background: #f3f6fb;
}

.custom-select-option.is-selected {
  font-weight: 600;
  color: var(--navy-active);
}

.custom-select-trigger {
  width: 100%;
  text-align: left;
  background-color: #fff;
  cursor: pointer;
}

.cases-filter-field .form-label {
  font-size: 0.78rem;
  color: var(--sidebar-text);
  margin-bottom: 2px;
  text-align: center;
}

/* 전체 사건함 필터 바 말고도, Bootstrap .row/.col-auto로 만든 다른 검색·필터 바(전체 계약서함,
   사건 상태 관리, 소송 현황 리포트 등)에도 라벨을 각 입력칸 너비 기준 가운데 정렬로 통일한다. */
.filter-label-center {
  display: block;
  width: 100%;
  text-align: center;
}

.cases-filter-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cases-filter-range input {
  width: 130px;
}

.pagination-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 14px 0 30px;
}

.pagination-bar .pagination-info {
  grid-column: 1;
  justify-self: start;
}

.pagination-bar .pagination-links {
  grid-column: 2;
  justify-self: center;
}

@media (max-width: 640px) {
  .pagination-bar {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .pagination-bar .pagination-info {
    grid-column: 1;
    justify-self: center;
  }
}

.pagination-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-links a.disabled {
  pointer-events: none;
  opacity: 0.4;
}

.pagination-ellipsis {
  padding: 0 4px;
  color: var(--sidebar-muted);
}

.table-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
}

.table-pager select {
  width: auto;
}

.table-pager-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.case-group-box {
  background: #fff;
  border: 1px solid #edeff2;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 10px 16px;
  margin-bottom: 10px;
}

.case-group-box summary {
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}

/* 원래 block(기본값)이라 파일명 줄 밑으로 떨어져서, "관련 문서" 표의 한 행이 문서종류/업로드일
   칸과 높이가 안 맞고 삐뚤어 보였다 — 파일명/반영됨 배지와 한 줄에 나란히 붙게 inline-block으로. */
.doc-summary-toggle {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}

.inline-edit-toggle {
  display: inline-block;
  vertical-align: middle;
}

.inline-edit-toggle summary {
  list-style: none;
}

.inline-edit-toggle summary::-webkit-details-marker {
  display: none;
}

.inline-edit-toggle form {
  margin-top: 6px;
}

.doc-summary-toggle summary {
  font-size: 0.78rem;
  color: var(--navy-active);
  cursor: pointer;
  font-weight: 500;
}

.doc-summary-box {
  margin-top: 6px;
  padding: 10px 12px;
  background: #f5f8fd;
  border: 1px solid #e2e9f4;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--sidebar-text);
  max-width: 480px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
  color: var(--sidebar-muted);
  text-align: center;
  background: #fff;
  border: 1px solid #edeff2;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  margin-bottom: 44px;
}

.empty-state svg {
  width: 30px;
  height: 30px;
  stroke: var(--sidebar-muted);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: 10px;
  opacity: 0.55;
}

.empty-state p {
  margin: 0;
  font-size: 0.88rem;
}

.app-content table.table thead th {
  color: var(--sidebar-muted);
  font-size: 0.82rem;
  font-weight: 700;
  border-bottom-width: 2px;
  white-space: nowrap;
  background: #fafbfd;
  text-align: center;
}

/* 대시보드(홈)의 "임박한 일정" / "최근 등록 사건", 일정관리의 "지난 일정" / "다가오는 일정" /
   "완료된 일정" 표 — 헤더뿐 아니라 값(td)도 가운데 정렬해서 현장/원고/피고 같은 짧은 값들이
   줄마다 들쭉날쭉해 보이지 않게 한다. 옆 칸이 여러 줄로 줄바꿈되어 행 높이가 늘어나도, 짧은
   한 줄짜리 값이 위쪽에 붙지 않고 그 행의 세로 가운데에 오도록 함께 맞춘다. 같은 종류의 목록형
   표는 모두 이 클래스를 붙여서, 화면마다 정렬 방식이 서로 달라 보이지 않게 한다.
   */
.centered-table td {
  text-align: center;
  vertical-align: middle;
}

/* 다만 AI 요약처럼 문단 형태의 "내용"은 가운데 정렬하면 오히려 읽기 불편해지므로, 가운데 정렬
   표 안에 있어도 이런 긴 글 상자만은 왼쪽 정렬을 유지한다. */
.centered-table .doc-summary-toggle,
.centered-table .doc-summary-box {
  text-align: left;
}

.sortable-header {
  color: inherit;
  text-decoration: none;
}

.sortable-header:hover {
  color: var(--navy-active);
  text-decoration: underline;
}

.sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.7rem;
  color: #c3cad4;
}

.sortable-header:hover .sort-arrow {
  color: var(--navy-active);
}

.sortable-header.is-active .sort-arrow {
  color: var(--navy-active);
}

.sortable-header.is-active {
  color: var(--navy-active);
}

.list-section-card .table {
  box-shadow: none;
  border-radius: 0;
}

.stat-card .stat-label {
  color: var(--sidebar-muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
  padding-right: 40px;
}

.stat-card .stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy-dark);
}

/* AI 사용량처럼 큰 숫자 하나만 보면 무슨 단위인지(건수인지 토큰인지) 헷갈릴 수 있는 카드에,
   숫자 옆에 작게 단위를 붙인다. 숫자와 같은 줄에 붙지만 크기/굵기는 확 낮춰서 숫자가 계속 눈에 띄게 한다. */
.stat-value-unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--sidebar-muted);
  margin-left: 4px;
}

.stat-card.warn .stat-value {
  color: #b02a37;
}

.stat-breakdown-panel {
  margin-top: -4px;
}

.stat-breakdown-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.stat-breakdown-group {
  flex: 1 1 260px;
  min-width: 220px;
}

.stat-breakdown-caption {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy-dark);
  margin-bottom: 10px;
}

.stat-breakdown {
  display: flex;
  flex-wrap: wrap;
  column-gap: 22px;
  row-gap: 10px;
}

.stat-breakdown-item.stat-breakdown-full {
  flex: 1 1 100%;
}

.stat-breakdown-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 1rem;
  color: var(--sidebar-text);
  white-space: nowrap;
  min-width: 0;
}

.stat-breakdown-item .stat-breakdown-name {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.stat-breakdown-item b {
  color: var(--navy-dark);
  font-weight: 700;
}

.stat-breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-breakdown-dot.dot-navy { background: var(--navy-active); }
.stat-breakdown-dot.dot-amber { background: #b3760a; }
.stat-breakdown-dot.dot-rose { background: #b02a37; }
.stat-breakdown-dot.dot-slate { background: #9aa3ad; }
.stat-breakdown-dot.dot-purple { background: #7c3fc4; }

.retainer-top5-layout {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(280px, 3fr);
  align-items: start;
  gap: 32px;
}

.retainer-top5-table {
  min-width: 0;
}

.retainer-top5-table table th,
.retainer-top5-table table td {
  padding: 8px 10px;
}

.retainer-top5-chart {
  min-width: 0;
  background: #fafbfc;
  border: 1px solid #edeff2;
  border-radius: 8px;
  padding: 14px 16px;
}

.rank-bar-caption {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sidebar-muted);
  margin-bottom: 10px;
}

/* 순위 막대 그래프 (TOP10 + 기타). 이름은 길이가 제각각이라 왼쪽 라벨 폭을 고정해서
   막대 시작 위치를 다 맞추고, 막대 자체는 남은 폭을 채운다. */
.rank-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.rank-bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 110px;
  align-items: center;
  gap: 12px;
}

.rank-bar-label {
  font-size: 0.85rem;
  color: var(--sidebar-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-bar-track {
  background: #eef0f3;
  border-radius: 5px;
  height: 18px;
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  border-radius: 5px;
  min-width: 4px;
}

.rank-bar-value {
  font-size: 0.82rem;
  color: var(--sidebar-text);
  text-align: right;
  white-space: nowrap;
}

/* TOP5 표 옆 좁은 칸에 넣을 때 쓰는 축소판: 라벨/수치 폭을 줄이고 막대를 더 얇게 그린다. */
.rank-bar-chart-compact {
  gap: 6px;
  margin-top: 0;
}

.rank-bar-chart-compact .rank-bar-row {
  grid-template-columns: 140px 1fr 74px;
  gap: 8px;
}

.rank-bar-chart-compact .rank-bar-label {
  font-size: 0.74rem;
}

/* 1~3위는 왼쪽 표의 일반 글씨 크기(1rem)와 맞춰서 더 잘 보이게 한다. 라벨 칸 너비는
   모든 줄이 동일해야 막대 시작점이 맞으므로, 라벨 칸 자체는 그대로 두고 글씨 크기만 키운다. */
.rank-bar-chart-compact .rank-bar-row:nth-child(-n+3) .rank-bar-label {
  font-size: 1rem;
}

.rank-bar-chart-compact .rank-bar-track {
  height: 12px;
}

.rank-bar-chart-compact .rank-bar-value {
  font-size: 0.7rem;
}

.rank-bar-chart-compact .rank-bar-value .text-muted {
  display: none;
}

.detail-card {
  background: #fff;
  border: 1px solid #edeff2;
  border-radius: 10px;
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
}

.detail-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--navy);
}

.badge-history {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 2px 2px 2px 8px;
  margin: 0 4px 4px 0;
  font-size: 0.8rem;
}

.badge-history-label {
  color: #212529;
  text-decoration: none;
}

.badge-history-label:hover {
  text-decoration: underline;
}

.badge-history-x {
  border: none;
  background: transparent;
  color: #adb5bd;
  font-size: 0.95rem;
  line-height: 1;
  padding: 2px 5px;
  cursor: pointer;
  border-radius: 3px;
}

.badge-history-x:hover {
  background: #e9ecef;
  color: #dc3545;
}

.recent-viewed-list {
  margin-top: 12px;
  border: 1px solid #e5e8ec;
  border-radius: 8px;
  overflow: hidden;
}

.recent-viewed-list > .text-muted {
  padding: 6px 10px;
  background: #f8f9fb;
  border-bottom: 1px solid #e5e8ec;
}

.recent-viewed-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  text-decoration: none;
  border-bottom: 1px solid #f0f2f5;
  font-size: 0.85rem;
}

.recent-viewed-item:last-child {
  border-bottom: none;
}

.recent-viewed-item:hover {
  background: #f6f8fc;
}

.recent-viewed-title {
  color: #212529;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-viewed-sub {
  color: var(--sidebar-muted);
  font-size: 0.78rem;
  flex-shrink: 0;
  white-space: nowrap;
}

/* 판례·법령 검색 결과 카드 (예전엔 표였는데, 사건명/사건번호/법원/날짜가 한 줄에 다 들어가서
   폭이 좁으면 잘리거나 가로 스크롤이 생기는 문제가 있어 카드형으로 바꿨다). */
.law-result-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.law-result-card {
  display: block;
  background: #fff;
  border: 1px solid #e5e8ec;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.law-result-card:hover {
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.1), 0 2px 4px rgba(16, 24, 40, 0.08);
  transform: translateY(-1px);
}

.law-result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.law-result-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.law-result-chip {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.law-result-chip.precedent {
  background: #e8eefc;
  color: var(--navy-active);
}

.law-result-chip.statute {
  background: #eaf6ee;
  color: #1e7a34;
}

.law-result-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #212529;
}

.law-result-date {
  font-size: 0.78rem;
  color: var(--sidebar-muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}

.law-result-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--sidebar-muted);
}

.law-disclaimer {
  background: #f8f9fb;
  border: 1px solid #e5e8ec;
  border-left: 4px solid var(--sidebar-muted);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.6;
}

.law-disclaimer p {
  margin: 0 0 8px;
  color: #444;
}

.law-disclaimer-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.law-disclaimer-list li {
  padding-left: 1.1em;
  text-indent: -1.1em;
}

.law-disclaimer-list li::before {
  content: "○ ";
}

/* 법령 상세: 국가법령정보센터처럼 좌측에 편/장/조 목차를 두고 누르면 해당 조문으로 이동한다. */
.law-article-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.law-toc {
  flex: 0 0 220px;
  max-height: 80vh;
  overflow-y: auto;
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid #e5eaf1;
  padding-right: 14px;
}

.law-toc a {
  display: block;
  padding: 5px 6px;
  border-radius: 5px;
  font-size: 0.85rem;
  text-decoration: none;
  color: #333;
  line-height: 1.4;
}

.law-toc a:hover {
  background: #f0f4fa;
}

.law-toc-header {
  font-weight: 700;
  color: var(--navy);
  margin-top: 10px;
}

.law-toc-header:first-child {
  margin-top: 0;
}

.law-toc-article {
  padding-left: 14px !important;
  color: #555;
}

.law-article-body {
  flex: 1;
  min-width: 0;
}

.law-article-block {
  scroll-margin-top: 20px;
  border-radius: 6px;
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

.law-article-block.law-highlight {
  background: #fff6d8;
  box-shadow: 0 0 0 8px #fff6d8;
  outline: 2px solid #f0c419;
}

@media (max-width: 900px) {
  .law-article-layout {
    flex-direction: column;
  }

  .law-toc {
    position: static;
    max-height: 260px;
    border-right: none;
    border-bottom: 1px solid #e5eaf1;
    padding-right: 0;
    padding-bottom: 10px;
    width: 100%;
  }
}

summary.detail-section-title {
  cursor: pointer;
  list-style: none;
}

summary.detail-section-title::-webkit-details-marker {
  display: none;
}

summary.detail-section-title::before {
  content: "▶ ";
  font-size: 0.75rem;
  color: var(--sidebar-muted);
}

details[open] > summary.detail-section-title::before {
  content: "▼ ";
}

.detail-card .detail-section-title:first-child {
  margin-top: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  margin: 0;
}

/* Chrome/Edge에서 CSS Grid의 auto 행 높이 계산이, 화면에 보이지도 않는(display:none)
   드롭다운 메뉴의 크기를 왜 그런지 같이 계산에 넣어버려서 "상태" 행 전체가 비정상적으로
   커지는 버그가 있다. contain:size로 이 박스의 크기를 내부 콘텐츠와 무관하게 고정해서
   그 계산에서 제외시킨다. */
.status-action-dropdown {
  contain: size layout;
  width: 64px;
  height: 32px;
  display: inline-flex;
  align-items: center;
}

.status-action-menu {
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  min-width: 140px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  z-index: 1050;
}

/* #caseStatusTable(관리자 목록)처럼 같은 드롭다운이 표에서 여러 줄 반복될 때는,
   위 .status-action-dropdown의 contain:size layout이 각 줄을 별도의 쌓임 맥락으로
   가둬버려서, 펼친 메뉴가 그 아래 있는 다음 줄들 뒤로 가려 보이는(글자가 겹쳐 보이는)
   문제가 있었다. 표 안에서는 grid 행높이 버그가 애초에 발생하지 않으므로 contain을 뺀다. */
#caseStatusTable .status-action-dropdown {
  contain: none;
}

/* Bootstrap은 .dropdown-menu.show 에서 display:block 을 주는데, 위에서 flex-direction 등
   레이아웃 속성만 항상 적용하고 display 자체는 Bootstrap의 show/hide 토글에 맡긴다.
   (이 규칙이 없으면 메뉴가 버튼을 눌러도, 안눌러도 항상 펼쳐진 채로 보이는 버그가 생긴다.) */
.status-action-menu.show {
  display: flex;
}

.status-action-menu .dropdown-item {
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 7px 12px;
  margin-bottom: 2px;
}

.status-action-menu .dropdown-item:last-child {
  margin-bottom: 0;
}

.status-action-menu .dropdown-item.action-close {
  color: #1e7a34;
}

.status-action-menu .dropdown-item.action-close:hover,
.status-action-menu .dropdown-item.action-close:focus {
  background: #e6f4ea;
  color: #1e7a34;
}

.status-action-menu .dropdown-item.action-appeal {
  color: #a15c00;
}

.status-action-menu .dropdown-item.action-appeal:hover,
.status-action-menu .dropdown-item.action-appeal:focus {
  background: #fde8d8;
  color: #a15c00;
}

.status-action-menu .dropdown-item.action-final-appeal {
  color: #6a2fb0;
}

.status-action-menu .dropdown-item.action-final-appeal:hover,
.status-action-menu .dropdown-item.action-final-appeal:focus {
  background: #efe3fb;
  color: #6a2fb0;
}

.status-action-menu .dropdown-item.action-reopen {
  color: var(--navy-active);
}

.status-action-menu .dropdown-item.action-reopen:hover,
.status-action-menu .dropdown-item.action-reopen:focus {
  background: #e6edf7;
  color: var(--navy-active);
}

.detail-grid.detail-grid-2col {
  grid-template-columns: 160px 1fr 160px 1fr;
  column-gap: 24px;
}

@media (max-width: 900px) {
  .detail-grid.detail-grid-2col {
    grid-template-columns: 160px 1fr;
  }
}

.detail-grid dt {
  padding: 12px 12px 12px 0;
  color: var(--sidebar-muted);
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 1px solid #f1f2f4;
}

.detail-grid dd:empty::after {
  content: "-";
  color: var(--sidebar-muted);
}

.detail-grid dd {
  padding: 12px 0;
  margin: 0;
  border-bottom: 1px solid #f1f2f4;
  white-space: pre-wrap;
  word-break: break-word;
}

.progress-timeline {
  position: relative;
  padding-left: 4px;
}

.timeline-entry {
  position: relative;
  padding: 0 0 20px 20px;
  border-left: 2px solid var(--sidebar-border);
}

.timeline-entry:last-child {
  border-left-color: transparent;
  padding-bottom: 2px;
}

.timeline-entry::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--navy-active);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--sidebar-border);
}

.timeline-entry-meta {
  font-size: 0.78rem;
  color: var(--sidebar-muted);
  margin-bottom: 4px;
}

.timeline-entry-content {
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill.status-inprogress {
  background: #e6edf7;
  color: var(--navy-active);
}

.status-pill.status-onhold {
  background: #fdf1d8;
  color: #8a5a00;
}

.status-pill.status-closed {
  background: #e6f4ea;
  color: #1e7a34;
}

.status-pill.status-appeal-progress {
  background: #fde8d8;
  color: #a15c00;
}

.status-pill.status-final-appeal-progress {
  background: #efe3fb;
  color: #6a2fb0;
}

.status-pill.risk-high {
  background: #fbe3e3;
  color: #a3231f;
}

.status-pill.risk-medium {
  background: #fdf1d8;
  color: #8a5a00;
}

.status-pill.risk-low {
  background: #eef0f3;
  color: var(--sidebar-text);
}

.status-pill.relevance-high {
  background: #e6f4ea;
  color: #1e7a34;
}

.status-pill.relevance-medium {
  background: #e6edf7;
  color: var(--navy-active);
}

.status-pill.status-reference-only {
  background: #eef0f3;
  color: var(--sidebar-muted);
}

.clause-card {
  background: #fff;
  border: 1px solid #edeff2;
  border-left: 4px solid #cfd4db;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 14px 18px;
  margin-bottom: 12px;
}

.clause-card.risk-high {
  border-left-color: #c0342f;
}

.clause-card.risk-medium {
  border-left-color: #b9821a;
}

.clause-card.risk-low {
  border-left-color: #9aa1ab;
}

.clause-card.relevance-high {
  border-left-color: #1e7a34;
}

.clause-card.relevance-medium {
  border-left-color: var(--navy-active);
}

.spinner-inline {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinner-rotate 0.7s linear infinite;
  margin-right: 6px;
  vertical-align: -0.15em;
}

.btn-outline-secondary .spinner-inline,
.btn-outline-primary .spinner-inline,
.btn-outline-danger .spinner-inline {
  border-color: rgba(0, 0, 0, 0.25);
  border-top-color: var(--navy-active);
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

.clause-card.risk-benefit {
  border-left-color: #1e7a34;
  background: #f6fbf7;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.history-delete-btn {
  opacity: 0.6;
  padding: 4px 6px;
  text-decoration: none;
}

.history-delete-btn:hover {
  opacity: 1;
}

.clause-card-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.clause-card-original {
  background: #f5f6f8;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--sidebar-text);
  white-space: pre-wrap;
  margin-top: 8px;
}

.dropzone {
  position: relative;
  border: 2px dashed #cfd4db;
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--navy-active);
  background: #f5f8fd;
}

.dropzone.has-file {
  border-style: solid;
  border-color: #1e7a34;
  background: #eaf6ec;
}

.dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-text {
  color: var(--sidebar-text);
  font-size: 0.92rem;
  pointer-events: none;
}

.clause-card-revision {
  background: #eaf6ec;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.85rem;
  color: #1e7a34;
  white-space: pre-wrap;
  margin-top: 8px;
}

.ai-panel {
  background: #f5f8fd;
  border: 1px solid #cfe0f5;
  border-radius: 10px;
  padding: 26px 28px;
  margin-bottom: 32px;
  box-shadow: var(--card-shadow);
}

.ai-panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.ai-panel-meta {
  color: var(--sidebar-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.ai-panel-summary {
  background: #fff;
  border: 1px solid #e2e9f4;
  border-radius: 6px;
  padding: 16px 18px;
  font-size: 1.02rem;
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 18px;
}

.ai-panel-empty {
  color: var(--sidebar-muted);
  padding: 10px 0;
}

.report-doc {
  background: #fff;
  border: 1px solid #e2e9f4;
  border-radius: 6px;
  padding: 20px 24px;
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 18px;
}

.report-doc p {
  margin: 0 0 14px;
}

.report-doc p:last-child {
  margin-bottom: 0;
}

.report-section-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--navy);
  margin: 22px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5eaf1;
}

.report-doc > .report-section-title:first-child {
  margin-top: 0;
}

.report-section-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--navy-active);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.report-sub-item {
  display: flex;
  gap: 6px;
  margin: 5px 0;
  padding-left: 4px;
}

/* 가./나./다. 항목 뒤에 세부 항목((1)(2)...)이 딸려오면 사건 단위 소제목으로 보고
   줄 전체를 굵게 표시하고, 다음 사건 항목과의 사이를 한 줄 띄운다. */
.report-sub-item:has(+ .report-subsub-item) {
  font-weight: 700;
}

.report-subsub-item + .report-sub-item,
.report-detail-item + .report-sub-item {
  margin-top: 22px;
}

.report-sub-label {
  color: var(--navy-active);
  font-weight: 700;
  flex-shrink: 0;
}

.report-subsub-item {
  display: flex;
  gap: 6px;
  margin: 3px 0 3px 24px;
  color: #333;
  font-size: 0.95rem;
}

.report-subsub-label {
  color: var(--sidebar-muted);
  flex-shrink: 0;
}

/* AI 보고서 번호 체계 5·6단계("○"/"▶")는 그 위 3단계 "(1)"(.report-subsub-item, 24px 들여쓰기)보다
   한 단계 더 깊은 항목이라, 최소한 그만큼은 들여쓰고 살짝 더 들여쓴다(32px). flex로 라벨("○ 현황:")
   칸과 내용 칸을 나눠서, 내용이 길어 줄바꿈되어도 둘째 줄이 맨 왼쪽이 아니라 내용이 시작하는
   지점(라벨 바로 뒤)에 맞춰 들여써지게 한다("행잉 인덴트") — 라벨 길이가 매번 달라도 항상 맞는다. */
.report-detail-item {
  display: flex;
  gap: 6px;
  margin: 2px 0 2px 32px;
}

/* "(1) 본안 사건: ..." 바로 다음에 오는 "○ 현황: ..."은 한 세트로 보고 붙여둔다(기본 margin 그대로).
   대신 그 세트가 끝나고 다음 항목이 시작될 때는 확실히 줄을 띄운다 — ① 번호 항목("(2)...") 없이
   "○"만 연달아 나오는 사건 목록(예: 종결 사건 나열)이면 다음 "○" 앞에서, ② "(1)" 다음 "○"로 이어지는
   구조면 그 "○" 다음에 오는 "(2)" 앞에서. */
.report-detail-item + .report-detail-item[data-entry-start] {
  margin-top: 12px;
}

.report-detail-item + .report-subsub-item {
  margin-top: 14px;
}

.report-detail-label {
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}

.report-detail-value {
  flex: 1;
  min-width: 0;
}

.print-only {
  display: none;
}

.print-header {
  margin-bottom: 20px;
}

.print-header .print-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
}

.print-header .print-meta {
  color: var(--sidebar-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.calendar-nav-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.calendar-nav {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.calendar-nav .calendar-nav-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  min-width: 130px;
  text-align: center;
}

.calendar-jump {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--sidebar-border);
  border-radius: 999px;
  padding: 6px 8px 6px 16px;
  box-shadow: var(--card-shadow);
}

.calendar-jump-label {
  font-size: 0.8rem;
  color: var(--sidebar-muted);
  white-space: nowrap;
}

.month-picker {
  position: relative;
}

.month-picker-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: #fff;
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 12px;
  z-index: 30;
}

.month-picker-year-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.month-picker-year-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy);
}

.month-picker-year-btn {
  border: none;
  background: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--sidebar-muted);
  padding: 4px 10px;
  border-radius: 6px;
}

.month-picker-year-btn:hover {
  background: #eef1f5;
  color: var(--navy);
}

.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.month-picker-cell {
  border: 1px solid var(--sidebar-border);
  background: #fff;
  border-radius: 8px;
  padding: 8px 0;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--navy);
}

.month-picker-cell:hover {
  background: #eef1f5;
}

.month-picker-cell.is-current-month {
  background: var(--navy-active);
  border-color: var(--navy-active);
  color: #fff;
  font-weight: 700;
}

@media (max-width: 820px) {
  .calendar-nav-bar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .calendar-nav {
    grid-column: 1;
  }

  .calendar-jump {
    grid-column: 1;
    justify-self: center;
  }
}

.calendar-grid-scroll {
  overflow-x: auto;
  margin-bottom: 20px;
}

.calendar-grid {
  --calendar-line: #aab1bb;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 2px solid var(--calendar-line);
  border-left: 2px solid var(--calendar-line);
  margin-bottom: 0;
}

@media (max-width: 700px) {
  /* 요일 7칸을 좁은 화면 폭에 억지로 구겨넣으면 일정 칸 안 글자가 안 보이게 된다.
     칸 하나에 최소 너비를 주고, 화면보다 넓어지면 이 달력 부분만 옆으로 스크롤되게 한다
     (페이지 전체가 옆으로 밀리지 않게). */
  .calendar-grid {
    min-width: 630px;
  }
}

.calendar-weekday {
  text-align: center;
  padding: 6px 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sidebar-muted);
  background: var(--sidebar-bg);
  border-right: 2px solid var(--calendar-line);
  border-bottom: 2px solid var(--calendar-line);
}

.calendar-cell {
  position: relative;
  min-height: 92px;
  border-right: 2px solid var(--calendar-line);
  border-bottom: 2px solid var(--calendar-line);
  padding: 4px 5px;
}

/* 날짜 숫자만 누르는 게 아니라 칸 어디를 눌러도 그 날짜가 선택되게 한다("stretched link"
   방식) — 날짜 링크의 보이지 않는 ::after를 칸 전체로 넓혀서 빈 공간 클릭도 받아준다.
   그 위에 있는 일정(deadline-chip) 링크들은 z-index로 올려서 원래대로 각자 클릭되게 둔다. */
.calendar-cell .cell-date::after {
  content: "";
  position: absolute;
  inset: 0;
}

.calendar-cell:hover {
  background: #f3f6fa;
}

.calendar-cell.is-today:hover {
  background: #e3edfb;
}

.calendar-cell.other-month {
  background: #fafbfc;
}

.calendar-cell.other-month .cell-date {
  color: #c3cad3;
}

.calendar-cell.is-today {
  background: #eef5ff;
}

.calendar-cell.is-selected {
  outline: 2px solid var(--navy-active);
  outline-offset: -2px;
}

.calendar-cell .cell-date {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 1px 5px;
  border-radius: 10px;
}

.calendar-cell.is-today .cell-date {
  background: var(--navy-active);
  color: #fff;
}

.calendar-weekday.is-sunday, .cell-date.is-sunday {
  color: #d0342c;
}

.calendar-weekday.is-saturday, .cell-date.is-saturday {
  color: #1a5fc4;
}

.calendar-cell.is-today .cell-date.is-sunday,
.calendar-cell.is-today .cell-date.is-saturday {
  color: #fff;
}

.deadline-chip {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 0.68rem;
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
}

.chip-hearing {
  background: #e6edf7;
  color: var(--navy-active);
}

.chip-judgment {
  background: #f3e6f7;
  color: #7a1f9e;
}

.chip-submission {
  background: #fdf1d8;
  color: #8a5a00;
}

.chip-statutory {
  background: #fbe3e3;
  color: #b02a37;
}

.chip-appeal {
  background: #ffe3cc;
  color: #b8500a;
}

.chip-other {
  background: #eceff1;
  color: #4a5560;
}

/* "+N건 더보기" / "접기" — 달력 칸 자체는 그 자리에 그대로 두고, 3건이 넘는 나머지 일정을 칸 안에서
   바로 아래로 펼쳤다 접었다 한다(칸이 늘어나는 만큼 아래 주(week) 줄은 밀려 내려간다). 실제 클릭은
   버튼이라 <a> 칩과 똑같이 보이도록 테두리 없는 버튼으로 만든다. */
.calendar-cell-toggle {
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.deadline-chip-extra {
  display: none;
}

.calendar-cell.is-expanded .deadline-chip-extra {
  display: block;
}

.type-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.dday-badge {
  display: inline-block;
  min-width: 52px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #eef2f7;
  color: var(--sidebar-text);
}

.dday-badge.dday-urgent {
  background: #fbe3e3;
  color: #b02a37;
}

.dday-badge.dday-soon {
  background: #fdf1d8;
  color: #8a5a00;
}

.list-section-card {
  background: #fff;
  border: 1px solid #edeff2;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 28px;
  border-left: 5px solid var(--sidebar-muted);
  box-shadow: var(--card-shadow);
}

.list-section-card.section-overdue {
  border-left-color: #b02a37;
}

.list-section-card.section-upcoming {
  border-left-color: var(--navy-active);
}

.list-section-card.section-completed {
  border-left-color: #8fa0ae;
}

.list-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.list-section-card .table {
  margin-bottom: 0;
}

.list-section-card .table th {
  font-size: 0.78rem;
  color: var(--sidebar-muted);
  font-weight: 700;
  border-top: none;
}

.list-section-card .table td {
  vertical-align: middle;
  font-size: 0.9rem;
}

.list-section-empty {
  color: var(--sidebar-muted);
  font-size: 0.9rem;
  padding: 4px 0;
}

.search-input-emphasized {
  border-color: #9aa4b2;
}

.search-input-emphasized:focus {
  border-color: var(--navy-active);
  box-shadow: 0 0 0 0.2rem rgba(30, 58, 95, 0.15);
}

summary.list-section-title {
  cursor: pointer;
  list-style: none;
}

summary.list-section-title::-webkit-details-marker {
  display: none;
}

summary.list-section-title::before {
  content: "▶ ";
  font-size: 0.75rem;
}

details[open] > summary.list-section-title::before {
  content: "▼ ";
}

@media print {
  .app-header,
  .app-sidebar,
  .no-print {
    display: none !important;
  }

  .app-shell {
    display: block;
    min-height: 0;
  }

  .app-content {
    padding: 0;
  }

  .print-only {
    display: block;
  }

  .stat-card,
  .table,
  .detail-card {
    break-inside: avoid;
  }

  /* 판례/법령 상세의 "참조조문", "전문" 같은 접힌 details 섹션도 인쇄할 때는 펼쳐서 다 보이게 한다 —
     안 그러면 화면에서 안 열어본 섹션은 인쇄물에서 통째로 빠져버린다. */
  details:not([open]) > *:not(summary) {
    display: block !important;
  }

  details > summary {
    list-style: none;
  }

  details > summary::-webkit-details-marker {
    display: none;
  }

  /* 판시사항/판결요지의 [1][2][3]... 항목, 법령 조문 하나하나를 체크 해제하면 그 항목만 인쇄에서
     빠진다 — 체크박스 자체는 no-print라 화면에서만 보이고 인쇄물에는 안 나온다. */
  .print-item-wrapper:has(input:not(:checked)) {
    display: none !important;
  }
}

.print-item-label {
  display: block;
  font-size: 0.8rem;
  color: var(--navy-active);
  font-weight: 500;
  margin: 10px 0 2px;
}

.print-item-label input {
  margin-right: 4px;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 10px;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 56px 0 0 0;
  background: rgba(20, 51, 92, 0.45);
  z-index: 999;
}

.sidebar-backdrop.open {
  display: block;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: inline-flex;
  }

  .app-header .brand-text,
  .app-tabs,
  .app-header-right .user {
    display: none;
  }

  .header-search {
    margin: 0 10px;
  }

  .app-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 80%;
    max-width: 280px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-content {
    padding: 20px 16px;
  }

  .app-content table.table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .app-content table.table thead,
  .app-content table.table tbody {
    display: table;
    width: 100%;
  }

  /* 순위 막대 그래프도 라벨(180px)+막대+수치(110px) 고정폭이 좁은 화면에서는 막대가
     0폭으로 찌그러지는 문제가 있었다. 라벨을 위 줄로 올리고 막대+수치만 아래 줄에 둔다. */
  .rank-bar-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "label label"
      "track value";
    row-gap: 4px;
  }

  .rank-bar-label {
    grid-area: label;
    white-space: normal;
  }

  .rank-bar-track {
    grid-area: track;
  }

  .rank-bar-value {
    grid-area: value;
  }

  .retainer-top5-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  /* 180px 짜리 카드가 2개면 375px 폭 화면에서 옆으로 살짝 넘쳐서(가로 스크롤 유발) 잘려 보이는
     문제가 있었다. 아주 좁은 화면에서는 grid를 접고 세로로 하나씩 쌓는다. */
  .stat-cards {
    display: flex;
    flex-direction: column;
  }
}

/* 소송 진행 현황 입력칸의 선택 목록 (progress-picker.js) — 현장 검색창 드롭다운과 같은 카드 모양에,
   묶음 제목만 얹은 것. 입력칸 바로 아래에 떠서 나타난다. */
.progress-picker {
  position: relative;
}

.progress-picker-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 240px;
  width: max-content;
  max-width: 340px;
  max-height: 300px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e5ea;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 20;
  padding: 4px;
}

.progress-picker-group {
  padding: 6px 10px 2px;
  font-size: 0.78rem;
  color: var(--sidebar-muted);
}

.progress-picker-option {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}

.progress-picker-option:hover {
  background: #f3f6fb;
}

/* 펼침 입력 폼(.inline-edit-toggle)은 inline-block이라 안의 내용만큼만 폭이 잡힌다 — 입력칸에 따로 최소 폭을
   주지 않은 폼(예: "+ 진행 현황 및 내용 추가")은 입력칸이 손톱만하게 줄어들어서, 이런 폼은 details를 block으로 바꿔 카드 폭 끝까지 넓힌다. */
.inline-edit-form-wide {
  width: 100%;
}

.inline-edit-toggle.inline-edit-toggle-wide {
  display: block;
}

/* 계약서 검토 결과 화면의 큰 목차(계약 개요 / 핵심 스펙 요약 / 누락된 필수 조항 / 독소조항 / 유리한 조항).
   예전엔 작고 연한 h6라 구분이 안 돼서, 사건 상세의 카드 제목처럼 진한 남색 글씨 + 아래 줄로 눈에 띄게 하고,
   위쪽 여백을 두 줄 정도 크게 줘서 목차끼리 떨어져 보이게 한다. */
.review-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  border-bottom: 2px solid var(--navy);
  padding-bottom: 6px;
  margin: 3rem 0 12px;
}

.review-section-title.review-section-first {
  margin-top: 1rem;
}

.case-doc-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.case-doc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--sidebar-muted);
}

.case-doc-badge.has {
  background: #e6f4ea;
  color: #1e7a34;
}

.case-doc-badge.na {
  opacity: 0.45;
}

.case-doc-icon {
  width: 18px;
  height: 18px;
}

.case-doc-icon-sm {
  width: 14px;
  height: 14px;
}

.case-doc-clip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.78rem;
  color: var(--sidebar-muted);
}

/* 사건함 — 휴대폰(폭 768px 이하)에서는 표 대신 사건 카드로 보여준다. 기기마다 화면 폭이 달라도 카드가 폭을 꽉 채우고
   글자가 줄바꿈되므로, 기기별로 따로 만들지 않고 이 폭 기준 하나로 처리한다. */
.cases-filter-toggle {
  display: none;
}

@media (max-width: 768px) {
  .cases-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
  }

  .cases-filter-toggle {
    display: inline-flex;
    align-items: center;
  }

  .cases-toolbar .cases-filter-form {
    display: none;
    width: 100%;
  }

  .cases-toolbar.is-open .cases-filter-form {
    display: flex;
  }

  .cases-filter-form .cases-filter-field {
    min-width: 0;
    flex: 1 1 calc(50% - 6px);
  }

  .app-content table.cases-table,
  .app-content table.cases-table tbody {
    display: block;
    width: 100%;
    overflow: visible;
    white-space: normal;
  }

  .app-content table.cases-table thead {
    display: none;
  }

  .app-content table.cases-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "no status"
      "title site"
      "plaintiff plaintiff"
      "defendant defendant"
      "court doc"
      "date actions";
    column-gap: 10px;
    row-gap: 3px;
    background: #fff;
    border: 1px solid #edeff2;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  .app-content table.cases-table td {
    display: block;
    border: 0;
    padding: 0;
    text-align: left;
    white-space: normal;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    font-size: 0.85rem;
    min-width: 0;
  }

  .app-content table.cases-table td[data-col="no"] {
    grid-area: no;
    font-size: 0.95rem;
  }

  .app-content table.cases-table td[data-col="status"] {
    grid-area: status;
    justify-self: end;
  }

  .app-content table.cases-table td[data-col="title"] {
    grid-area: title;
    font-size: 0.9rem;
  }

  .app-content table.cases-table td[data-col="site"] {
    grid-area: site;
    justify-self: end;
    font-size: 0.78rem;
    color: var(--sidebar-muted);
  }

  .app-content table.cases-table td[data-col="plaintiff"] {
    grid-area: plaintiff;
  }

  .app-content table.cases-table td[data-col="defendant"] {
    grid-area: defendant;
  }

  .app-content table.cases-table td[data-col="plaintiff"]::before,
  .app-content table.cases-table td[data-col="defendant"]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 2em;
    margin-right: 6px;
    font-size: 0.78rem;
    color: var(--sidebar-muted);
  }

  .app-content table.cases-table td[data-col="court"] {
    grid-area: court;
    align-self: center;
    font-size: 0.78rem;
    color: var(--sidebar-muted);
  }

  .app-content table.cases-table td[data-col="doc"] {
    grid-area: doc;
    justify-self: end;
  }

  .app-content table.cases-table td[data-col="date"] {
    grid-area: date;
    align-self: center;
    font-size: 0.78rem;
    color: var(--sidebar-muted);
  }

  .app-content table.cases-table td[data-col="actions"] {
    grid-area: actions;
    justify-self: end;
  }

  .app-content table.cases-table td[data-col="actions"] a {
    padding: 4px 6px;
  }
}

@media (max-width: 768px) {
  .app-content table.cases-table td[data-col="plaintiff"]:empty,
  .app-content table.cases-table td[data-col="defendant"]:empty {
    display: none;
  }
}

@media (max-width: 768px) {
  .cases-filter-field:has(> .cases-filter-range) {
    flex-basis: 100%;
  }

  .cases-filter-range {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .cases-filter-range input {
    min-width: 0;
    flex: 1 1 0;
  }
}

/* 휴대폰 "PC 화면 ↔ 모바일 화면" 전환 버튼 (view-mode.js가 작은 기기에서만 보이게 한다) */
.view-mode-switch {
  display: flex;
  justify-content: center;
  padding: 16px 0 24px;
}

.view-mode-switch[hidden] {
  display: none;
}

.app-sidebar .view-mode-switch {
  padding: 12px 0 20px;
}

/* 일정관리 달력 — 휴대폰에서는 일정 글자 대신 날짜 + 건수 배지만 보여주는 한 화면짜리 월 달력으로 바꾼다.
   날짜를 누르면(칸 어디를 눌러도) 그날 일정이 달력 아래에 나온다. */
.calendar-cell .cell-count {
  display: none;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--navy-active);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 768px) {
  .calendar-grid-scroll {
    overflow: visible;
  }

  .calendar-grid {
    min-width: 0;
    border-top-width: 1px;
    border-left-width: 1px;
    --calendar-line: #cfd5dd;
  }

  .calendar-weekday {
    border-right-width: 1px;
    border-bottom-width: 1px;
    padding: 5px 0;
    font-size: 0.75rem;
  }

  .calendar-cell {
    min-height: 56px;
    padding: 4px 0;
    border-right-width: 1px;
    border-bottom-width: 1px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .calendar-cell .deadline-chip,
  .calendar-cell .calendar-cell-toggle {
    display: none;
  }

  .calendar-cell .cell-count {
    display: inline-block;
  }

  .calendar-cell.other-month .cell-count {
    opacity: 0.45;
  }

  .stat-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-cards .stat-card {
    padding: 12px 14px;
  }

  .stat-cards .stat-value {
    font-size: 1.5rem;
  }
}

/* 열이 많은 표(mobile-tables.js가 .rc-table을 붙인 것)는 휴대폰에서 "라벨 : 값" 카드로 바꿔 그린다. */
@media (max-width: 768px) {
  .app-content table.table.rc-table,
  .app-content table.table.rc-table tbody {
    display: block;
    width: 100%;
    overflow: visible;
    white-space: normal;
  }

  .app-content table.table.rc-table thead {
    display: none;
  }

  .app-content table.table.rc-table tbody tr {
    display: block;
    background: #fff;
    border: 1px solid #edeff2;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 8px 12px;
    margin-bottom: 10px;
  }

  .app-content table.table.rc-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border: 0;
    padding: 4px 0;
    text-align: right;
    white-space: normal;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    font-size: 0.85rem;
    word-break: break-word;
  }

  .app-content table.table.rc-table td::before {
    content: attr(data-label);
    flex: 0 0 5.5em;
    text-align: left;
    font-size: 0.78rem;
    color: var(--sidebar-muted);
  }

  .app-content table.table.rc-table td[data-label=""]::before {
    display: none;
  }

  .app-content table.table.rc-table td:empty {
    display: none;
  }
}

/* 휴대폰에서는 라벨(160px 고정)과 값을 옆으로 나란히 두면 값 칸이 너무 좁아서, 라벨을 위, 값을 아래로 쌓는다. */
@media (max-width: 768px) {
  .detail-grid,
  .detail-grid.detail-grid-2col {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-grid dt {
    padding: 10px 0 2px;
    border-bottom: 0;
  }

  .detail-grid dd {
    padding: 0 0 10px;
  }

  .app-content input,
  .app-content select,
  .app-content textarea {
    max-width: 100%;
  }
}

/* 공백 없이 긴 파일명 같은 값이 카드 밖으로 밀고 나가지 않도록 어디서든 줄바꿈되게 한다. */
@media (max-width: 768px) {
  .app-content table.table.rc-table td {
    overflow-wrap: anywhere;
  }
}

/* Bootstrap의 .text-nowrap(!important)이 붙은 칸도 카드 안에서는 줄바꿈되게 한다. */
@media (max-width: 768px) {
  .app-content table.table.rc-table td,
  .app-content table.table.rc-table td .text-nowrap {
    white-space: normal !important;
  }
}

/* 표 행 hover(table-hover)의 회색 칠이 카드 안에서는 칸마다 조각나서 보이므로(터치 후에도 남음) 카드 모양에서는 끈다. */
@media (max-width: 768px) {
  .app-content table.cases-table tbody tr,
  .app-content table.table.rc-table tbody tr {
    --bs-table-hover-bg: transparent;
    --bs-table-accent-bg: transparent;
  }

  .app-content table.cases-table tbody tr > td,
  .app-content table.table.rc-table tbody tr > td {
    background: transparent !important;
    box-shadow: none !important;
  }
}

/* 대리인·수임 현황 "한눈에 보기" 줄(nowrap)과 숫자 카드가 좁은 화면에서 옆으로 삐져나오지 않게 한다. */
@media (max-width: 768px) {
  .stat-breakdown-item,
  .stat-breakdown-item.stat-breakdown-full {
    white-space: normal;
  }

  .stat-cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .stat-cards .stat-card {
    min-width: 0;
  }

  .stat-cards .stat-value {
    overflow-wrap: anywhere;
    font-size: 1.3rem;
  }
}

/* 일부 화면의 Bootstrap 여백(음수 margin) 때문에 1~2px 옆으로 밀리는 일이 없게, 휴대폰에서는 본문 영역 밖으로 나가는 부분을 잘라낸다.
   (clip은 스크롤 영역을 만들지 않아서 고정/드롭다운 동작에 영향이 없다.) */
@media (max-width: 768px) {
  .app-content {
    overflow-x: clip;
  }
}

/* "라벨 | 값" 두 칸짜리 표(계약 개요·핵심 스펙)는 휴대폰에서 라벨을 위, 값을 아래로 쌓아서 옆으로 스크롤되지 않게 한다. */
@media (max-width: 768px) {
  .app-content table.table.kv-table,
  .app-content table.table.kv-table tbody {
    display: block;
    width: 100%;
    overflow: visible;
    white-space: normal;
  }

  .app-content table.table.kv-table tr {
    display: block;
    padding: 8px 0;
    border-bottom: 1px solid #edeff2;
  }

  .app-content table.table.kv-table th,
  .app-content table.table.kv-table td {
    display: block;
    width: auto !important;
    border: 0;
    padding: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .app-content table.table.kv-table th {
    margin-bottom: 2px;
    font-size: 0.78rem;
    color: var(--sidebar-muted);
  }
}

/* 통계 카드 아래 보조 문구 (소가·인용금액 현황 등) */
.stat-card .stat-sub { font-size: 0.78rem; color: var(--sidebar-muted); margin-top: 2px; }

/* 계약서 이력의 파일명: 일정 길이를 넘으면 …로 줄이고(전체 이름은 마우스를 올리면 보임) 한 줄로 유지한다. 휴대폰 카드 화면에서는 전체를 보여준다. */
.cell-filename { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* 계약서 종류·당사·상대방 칸도 두 줄로 꺾이지 않게 한 줄로 두고, 칸마다 정한 최대 너비(--max)를 넘으면 …로 줄인다. */
.cell-clip { display: inline-block; max-width: var(--max, 340px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
@media (max-width: 768px) {
  .cell-filename, .cell-clip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
}

/* 소가·인용금액 현황: 금액 단위 표시 */
.stat-card .stat-value .stat-unit { font-size: 0.95rem; font-weight: 700; margin-left: 3px; color: #3a4558; }
.stat-card .stat-sub.stat-alt { color: #8a93a6; margin-top: 0; }
.unit-badge { display: inline-block; background: #fff7e6; border: 1px solid #f0c36a; color: #8a5a00; border-radius: 6px; padding: 1px 9px; font-weight: 700; font-size: 0.78rem; vertical-align: middle; }
.unit-note { display: inline; font-weight: 700; color: #8a5a00; font-size: 0.74rem; margin-left: 2px; white-space: nowrap; }
.unit-switch { display: inline-flex; align-items: center; gap: 6px; }

/* 소가·인용금액 현황: 제소/피소 구분을 눈에 띄게 (제목 막대 색, 카드 테두리, 가운데 구분선) */
.amount-side .side-title { border-left: 5px solid #2557b7; padding-left: 10px; font-weight: 700; }
.amount-side.side-defendant .side-title { border-left-color: #d9822b; }
.amount-side .stat-card { border: 1px solid #aeb9cd; border-top: 4px solid #2557b7; }
.amount-side.side-defendant .stat-card { border-top-color: #d9822b; }
@media (min-width: 992px) {
  .amount-side.side-defendant { border-left: 2px solid #9aa6bd; }
}

/* 소가·인용금액 현황의 표: 가로 구분선을 진하게 (격자 테두리는 쓰지 않는다) */
.app-content table.table.amount-table { --bs-table-border-color: #9ca9c0; }
.app-content table.table.amount-table > thead > tr > th { border-bottom: 2px solid #7f8ca6 !important; }
.app-content table.table.amount-table > tbody > tr > td { border-bottom: 1px solid #9ca9c0 !important; }
.app-content table.table.amount-table > tbody > tr.fw-bold > td { border-top: 2px solid #7f8ca6; background: #f6f8fc; }

/* 소취하 집계 표시: 소취하 줄 색, 기각금액 괄호, 비고 꼬리표 */
.app-content table.table.amount-table > tbody > tr.amount-wd > td { background: #fff9ec; }
.app-content table.table.amount-table td.amount-paren { color: #8a5a00; font-weight: 700; }
.app-content table.table.amount-table > tbody > tr.amount-sub > td { font-size: 0.85rem; color: var(--sidebar-muted); background: #fbfbfd; }
.amount-tag { display: inline-block; font-size: 0.74rem; font-weight: 700; padding: 1px 8px; border-radius: 5px; margin: 1px 2px; }
.amount-tag-wd { background: #fdebc8; color: #8a5a00; }
.amount-tag-inh { background: #e3ecfb; color: #2557b7; }
.stat-card .stat-sub.amount-wd-note { color: #8a5a00; font-weight: 700; margin-top: 2px; }

/* 착수금·성공보수 금액 바로 옆에 붙는 메모 */
.fee-note { display: inline-block; margin-left: 10px; padding: 1px 9px; border-radius: 6px; background: #f3f5f9; color: #4a5468; font-size: 0.85rem; font-weight: 400; }

/* 수임료 그래프 (대리인·수임 현황): 법인별 가로 막대 + 연도별 세로 막대. 착수금=진한 남색, 성공보수=연한 하늘색 */
.fee-chart-box { min-width: 0; }
.fee-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.82rem; color: #3a4558; margin-bottom: 6px; }
.fee-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.fee-legend-unit { margin-left: auto; color: var(--sidebar-muted); }
.fee-hatch { background: repeating-linear-gradient(45deg, #b9cdea, #b9cdea 4px, #e3ecf8 4px, #e3ecf8 8px); }

.fee-hbar { display: grid; grid-template-columns: 28px minmax(90px, 170px) 1fr 96px; gap: 10px; align-items: center; margin: 10px 0; font-size: 0.92rem; }
.fee-rank { width: 26px; height: 26px; border-radius: 50%; background: #eef2f9; color: #1b3f73; font-weight: 800; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; }
.fee-rank-other { background: #eef0f3; color: #6b7488; }
.fee-hname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fee-htrack { height: 26px; background: #eef0f3; border-radius: 7px; overflow: hidden; display: flex; }
.fee-htrack > div { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 0.74rem; font-weight: 700; white-space: nowrap; overflow: hidden; flex: 0 0 auto; }
.fee-hval { text-align: right; font-weight: 800; white-space: nowrap; }
.fee-hval small { font-size: 0.72rem; font-weight: 400; color: var(--sidebar-muted); margin-left: 2px; }

.fee-colchart { position: relative; margin: 38px 8px 0 54px; }
.fee-gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed #d5dbe6; }
.fee-gridline-base { border-top: 1px solid #9aa5b8; }
.fee-gridline span { position: absolute; left: -54px; top: -9px; width: 46px; text-align: right; font-size: 0.74rem; color: var(--sidebar-muted); }
.fee-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 10px; }
.fee-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.fee-colsum { font-size: 0.82rem; font-weight: 800; margin-bottom: 4px; white-space: nowrap; }
.fee-stack { width: 62%; max-width: 64px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 0 0; overflow: hidden; }
.fee-col-selected .fee-stack { outline: 2px solid #1b3f73; outline-offset: 2px; }
.fee-col-selected .fee-colsum { color: #1b3f73; }
.fee-xlabels { display: flex; gap: 10px; margin: 8px 8px 0 54px; }
.fee-xlabels span { flex: 1; min-width: 0; text-align: center; font-size: 0.82rem; color: #3a4558; }
.fee-xlabels .fee-xsel { font-weight: 800; color: #1b3f73; }

@media (max-width: 768px) {
  .fee-hbar { grid-template-columns: 24px 1fr 80px; }
  .fee-hbar .fee-htrack { grid-column: 1 / -1; order: 5; }
  .fee-colchart, .fee-xlabels { margin-left: 46px; }
}

/* 그래프 상자가 좁을 때(창이 좁거나 화면 분할): 막대를 이름 아래 줄로 내려서 충분한 길이를 확보한다 */
.fee-chart-box { container-type: inline-size; }
@container (max-width: 470px) {
  .fee-hbar { grid-template-columns: 28px 1fr auto; row-gap: 4px; }
  .fee-hbar .fee-htrack { grid-column: 1 / -1; }
  .fee-colsum { font-size: 0.74rem; }
  .fee-stack { width: 70%; }
}

/* 성공보수 지급 상태 배지 */
.fee-status { display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 6px; font-size: 0.76rem; font-weight: 700; vertical-align: middle; }
.fee-status-pending { background: #e8eef9; color: #1b3f73; }
.fee-status-paid { background: #e4efe9; color: #0f6e56; }
.fee-status-notpaid { background: #eceff5; color: #6b7488; }

/* 한눈에 보기: 문장이 긴 항목은 옆 칸을 침범하지 않게 줄바꿈 허용 */
.stat-breakdown-item.stat-breakdown-wrap {
  white-space: normal;
  flex-wrap: wrap;
  row-gap: 2px;
}

/* 연도 막대 아래 "진행중인 사건(미정 성공보수)" 라벨: 항상 두 줄, 그 안에서는 더 줄바꿈하지 않음 */
.fee-xlabels .fee-xlabel-bucket { white-space: nowrap; font-size: 0.78rem; line-height: 1.25; }

/* 사건 상세: 성공보수 지급 상태 배지를 누르면 3가지 중 골라 바로 저장 (배지 폭은 글자 수에 맞춘다) */
.fee-status-btn { border: 0; border-radius: 999px; padding: 3px 14px; line-height: 1.4; text-align: center; cursor: pointer; }
.fee-status-btn::after { content: "▾"; margin-left: 6px; font-size: 0.7rem; }
.fee-status-menu { min-width: 0; font-size: 0.82rem; padding: 4px; }
.fee-status-menu .dropdown-item { text-align: center; border-radius: 6px; padding: 5px 16px; }

/* 수임료 대비 성과 비교 (대리인·수임 현황, IsSuperAdmin 전용) */
.fee-result-subtitle { font-size: 0.95rem; font-weight: 700; color: var(--navy-dark); margin: 18px 0 6px; }
.fee-result-table .fee-result-grp { border-left: 2px solid #c9d1de; }
.fee-result-star { color: #b02a37; font-weight: 800; margin-left: 3px; cursor: help; }
.fee-result-note { background: #f5f8fd; border-radius: 6px; padding: 12px 16px; margin-top: 12px; font-size: 0.85rem; line-height: 1.75; color: #2f3a4f; }
.fee-result-note ol { margin: 6px 0 0; padding-left: 20px; }
.fee-result-note li { margin-bottom: 4px; }
.fee-result-details { margin-top: 12px; }
.fee-result-details > summary { cursor: pointer; font-weight: 700; font-size: 0.95rem; color: var(--navy-dark); padding: 6px 0; }
.fee-result-none { color: #b02a37; font-weight: 700; cursor: help; }

/* 표의 대리인 칸: 법인 이름은 굵게 한 줄, 담당변호사는 작은 회색 글씨로 아래 줄 (_AttorneyCell 부분 뷰) */
.atty-blk { display: block; }
.atty-blk + .atty-blk { margin-top: 6px; }
.atty-firm { display: block; font-weight: 700; }
.atty-law { display: block; font-size: 0.78rem; color: var(--sidebar-muted); margin-top: 1px; }
.atty-cell { min-width: 170px; }
