:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #6b7a90;
  --border: #e3e9f1;
  --primary: #205f9c;
  --primary-soft: #eef4fc;
  --danger: #d8202f;
  --danger-soft: #fde7e9;
  --normal: #205f9c;
  --low: #6b7a90;
  --urgent: #d8202f;
  --shadow: 0 1px 2px rgba(20, 36, 64, .04), 0 4px 12px rgba(20, 36, 64, .04);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

button {
  font: inherit;
  cursor: pointer;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); margin: 0; }

/* Login */

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 20px;
}

.login-card p {
  margin: 0 0 20px;
}

.field {
  display: block;
  margin: 12px 0;
}

.field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
}

button.primary {
  display: block;
  width: 100%;
  padding: 11px 16px;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-weight: 600;
  margin-top: 16px;
}

button.primary:hover { filter: brightness(1.05); }

button.ghost {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--ink);
}

button.ghost:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* Dashboard */

.dashboard-view { min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
}

.brand-title { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--muted); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-badge {
  padding: 4px 10px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 28px 40px;
  display: grid;
  gap: 16px;
}

/* KPIs */

.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.kpi-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.kpi-danger .kpi-num { color: var(--danger); }

/* Panels */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: 1.2fr 1fr;
}

@media (max-width: 1024px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

/* Bars */

.bars {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 48px;
  gap: 10px;
  align-items: center;
}

.bar-label {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar-track {
  background: #f0f3f8;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.bar-fill.urgent { background: var(--danger); }
.bar-fill.normal { background: var(--normal); }
.bar-fill.low    { background: var(--low); }

.bar-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 18px 0;
  text-align: center;
}

/* Pie / donut */

.pie {
  position: relative;
  width: 200px;
  height: 200px;
}

.pie svg {
  width: 100%;
  height: 100%;
  display: block;
}

.pie-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  pointer-events: none;
}

.pie-center-num {
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.pie-center-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.pie-legend {
  display: grid;
  gap: 10px;
  max-height: 200px;
  overflow-y: auto;
  align-content: start;
}

.pie-legend-item {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.pie-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.pie-name {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-count {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
}

.pie-pct {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}

@media (max-width: 720px) {
  .pie-legend {
    width: 100%;
    max-height: none;
  }
}

/* 饼图切片：可悬停 + 高亮 */
.pie-seg {
  cursor: pointer;
  transition: stroke-width .12s ease, opacity .12s ease;
}

.pie svg:hover .pie-seg:not(.active) { opacity: .55; }
.pie-seg.active { stroke-width: 34; }

.pie-tip {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  background: rgba(23, 32, 51, .94);
  color: #fff;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(20, 36, 64, .25);
}

.pie-tip-name { font-weight: 700; }
.pie-tip-pct { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pie-tip-sub { color: rgba(255, 255, 255, .72); }

/* 总览首行：左侧饼图卡片压缩到≈饼图大小，右侧状态分布占满剩余空间 */
.overview-top-row {
  display: flex;
  gap: 16px;
  align-items: stretch;   /* 三块等高对齐，内容不足的面板底部留白 */
  flex-wrap: wrap;
}

.overview-top-row .pie-card {
  flex: 0 0 auto;
  width: 264px;              /* 饼 220 + 面板内边距 ≈ 卡片刚好包住饼图 */
}

.overview-top-row > .panel:not(.pie-card) {
  flex: 1 1 320px;
}

/* 总览左上角：只放饼图（无图例），悬停看占比 */
.overview-pie-solo {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px 0 2px;
}

.overview-pie-solo .pie {
  width: 220px;
  height: 220px;
}

.overview-pie-solo .pie-center-num {
  font-size: 32px;
}

@media (max-width: 1024px) {
  .overview-top-row .pie-card { width: 100%; }
}

/* 总览里的饼图：饼 + 图例并排（旧布局，保留以防复用） */
.overview-pie-wrap {
  display: flex;
  gap: 28px;
  align-items: center;
  flex-wrap: wrap;
}

.overview-pie-wrap .pie-legend {
  flex: 1;
  min-width: 220px;
  max-height: none;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Type archive */

/* Two-zone layout inside the single archive panel: pie+legend as a
   narrow left rail, the grid of category groups fills the rest. Stacks
   to one column below 1024px so the pie isn't crushed. */
.archive-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

@media (min-width: 1024px) {
  .archive-body {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
  }
}

.archive-overview {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  padding: 4px 0 0;
}

.archive-overview .pie {
  width: 180px;
  height: 180px;
}

.archive-overview .pie-center-num {
  font-size: 26px;
}

/* In the side rail the legend reads top-to-bottom and fills the rail
   width instead of scrolling. */
.archive-overview .pie-legend {
  width: 100%;
  max-height: none;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.archive-overview .pie-legend-item {
  padding: 2px 0;
}

@media (max-width: 1023px) {
  .archive-overview {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: center;
  }
  .archive-overview .pie-legend {
    flex: 1;
    min-width: 220px;
  }
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.archive-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
  padding: 14px 16px;
}

.archive-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.archive-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
}

.archive-group-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.archive-group-count {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary);
  font-size: 16px;
}

.archive-leaf {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 6px 8px;
  margin: 0 -8px;
  font-size: 13px;
  align-items: baseline;
  background: transparent;
  border: 0;
  border-radius: 6px;
  width: calc(100% + 16px);
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.archive-leaf:hover,
.archive-leaf:focus-visible {
  background: var(--primary-soft);
  outline: none;
}

.archive-leaf:focus-visible {
  box-shadow: 0 0 0 2px var(--primary);
}

.archive-leaf-name {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-leaf-slug {
  color: var(--muted);
  font-size: 11px;
  margin-left: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.archive-leaf-count {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
}

.archive-leaf-count.zero {
  color: var(--muted);
  font-weight: 400;
}

/* Legend */

.legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item { display: inline-flex; align-items: center; gap: 6px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dot-created { background: var(--primary); }
.dot-resolved { background: #5cba88; }

/* Trend chart */

.trend-chart {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 2 / 1;
  margin: 0 auto;
  position: relative;
}

.trend-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

.trend-grid {
  stroke: #eef2f8;
  stroke-width: 1;
}

.trend-axis-label {
  fill: #3a4763;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.trend-line-created {
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.trend-line-resolved {
  fill: none;
  stroke: #5cba88;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.trend-area-created {
  fill: rgba(32, 95, 156, .08);
  stroke: none;
}

.trend-dot-created { fill: var(--primary); }
.trend-dot-resolved { fill: #5cba88; }

/* 紧急：细虚线 + 红点，比原来的散点更易读 */
.trend-line-urgent {
  fill: none;
  stroke: rgba(216, 32, 47, .85);
  stroke-width: 1.4;
  stroke-dasharray: 4 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Hover 竖向引导线 + 浮动数值卡 */
.trend-guide {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: .35;
  pointer-events: none;
}

.trend-tip {
  position: absolute;
  z-index: 5;
  min-width: 116px;
  padding: 8px 10px;
  background: rgba(23, 32, 51, .94);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(20, 36, 64, .25);
}

.trend-tip .tip-title {
  font-weight: 700;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.trend-tip .tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trend-tip .tip-row strong {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.trend-tip .tip-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.trend-tip .tip-net {
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, .18);
}

.trend-tip .tip-net.good strong { color: #7ee2a0; }
.trend-tip .tip-net.bad strong { color: #ff8a93; }

/* 趋势视图通用涨/跌配色（红=不利，绿=有利） */
#view-trend .good { color: #2a7a3a; }
#view-trend .bad { color: var(--danger); }

/* Recent table */

.table-wrap {
  overflow-x: auto;
}

.recent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

/* 创建时间列加明显：加粗 + 主色调 */
.recent-table tbody td:nth-child(5) {
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.recent-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 10px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--border);
}

.recent-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.recent-table tbody tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pill-urgent { background: var(--danger-soft); color: var(--danger); }
.pill-normal { background: var(--primary-soft); color: var(--primary); }
.pill-low    { background: #eef1f5;             color: var(--muted); }

.status-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  background: #eef1f5;
  color: var(--ink);
  font-size: 12px;
}

.status-closed { background: #ebf3ef; color: #2f7d52; }
.status-submitted { background: #fff4e1; color: #ad6b00; }
.status-accepted { background: var(--primary-soft); color: var(--primary); }
.status-dispatched { background: #ecf2fc; color: var(--primary); }
.status-in_progress { background: #fff0e0; color: #b15c00; }
.status-pending_closure { background: #f1eaff; color: #6b3fae; }
.status-reopened { background: var(--danger-soft); color: var(--danger); }
.status-note { background: #eef1f5; color: var(--muted); }
.status-followup { background: #eef1f5; color: var(--muted); }
.status-assigned { background: #ecf2fc; color: var(--primary); }

/* Disabled access-key field on login (planned but inactive). */

.disabled-key-field { opacity: .55; }
.disabled-key-field input:disabled {
  background: #f7f9fc;
  cursor: not-allowed;
}

/* Section anchor nav under the topbar. */

.section-nav {
  position: sticky;
  top: 64px;
  z-index: 5;
  display: flex;
  gap: 6px;
  padding: 8px 28px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  overflow-x: auto;
}

.section-nav a {
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.section-nav a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Last-refresh chip + clickable recent row. */

.last-refresh {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.recent-row { cursor: pointer; }
.recent-row:hover td { background: var(--primary-soft); }

/* Drilldown drawer. */

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 36, 64, .35);
  z-index: 50;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(20, 36, 64, .12);
  display: flex;
  flex-direction: column;
  z-index: 60;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.drawer-head h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.drawer-tools {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfe;
}

.drawer-tools select,
.drawer-tools input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  font: inherit;
}

.drawer-tools input { flex: 1; min-width: 0; }

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 20px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.drawer-row {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.drawer-row:hover,
.drawer-row:focus-visible {
  background: var(--primary-soft);
  border-color: var(--primary);
  outline: none;
}

.drawer-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-row-no {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.drawer-row-meta {
  color: var(--muted);
  font-size: 12px;
}

.drawer-row-desc {
  color: var(--ink);
  font-size: 13px;
}

@media (max-width: 720px) {
  .drawer { width: 100vw; border-left: 0; }
  .drawer-tools { flex-direction: column; }
}

/* Workflow modal. */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 36, 64, .45);
  z-index: 70;
}

.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--panel);
  border-radius: 12px;
  padding: 20px 22px 24px;
  box-shadow: 0 20px 60px rgba(20, 36, 64, .25);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-head h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.workflow-summary {
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.workflow-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* 关键信息（地点 / 案情）加明显 */
.workflow-summary-row.workflow-key {
  gap: 10px;
  align-items: baseline;
}

.workflow-key .key-label {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 6px;
  padding: 2px 8px;
  line-height: 1.6;
}

.workflow-key .key-value {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}

.workflow-steps {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 18px;
  padding-bottom: 4px;
}

.workflow-step {
  flex: 1;
  min-width: 96px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  background: #fff;
  font-size: 12px;
  color: var(--muted);
}

.workflow-step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #eef1f5;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.workflow-step-name {
  color: var(--ink);
  font-size: 12px;
}

.workflow-step.done {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.workflow-step.done .workflow-step-no {
  background: var(--primary);
  color: #fff;
}

.workflow-step.active {
  background: #fff7e6;
  border-color: #f59f00;
}
.workflow-step.active .workflow-step-no {
  background: #f59f00;
  color: #fff;
}

.workflow-section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 18px 0 10px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.timeline-row:last-child { border-bottom: 0; }

.timeline-time {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timeline-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.timeline-note {
  color: var(--ink);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 720px) {
  .timeline-row { grid-template-columns: 1fr; }
  .modal { padding: 0; }
  .modal-card { max-height: 100vh; border-radius: 0; width: 100vw; }
  .workflow-steps { flex-wrap: wrap; }
}

/* ----------------------------------------------------------------- */
/* Phase 3 dashboard: top tabs, range/bucket controls, detail panels */
/* ----------------------------------------------------------------- */

.section-tabs {
  position: sticky;
  top: 64px;
  z-index: 5;
  display: flex;
  gap: 6px;
  padding: 8px 28px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  overflow-x: auto;
}

.section-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.section-tab:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.section-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.range-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-wrap: wrap;
  /* 跟随 topbar(0) + section-tabs(64) 之下吸顶，下滑时不上移 */
  position: sticky;
  top: 108px;
  z-index: 4;
}

.range-control,
.bucket-control {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.range-control button,
.bucket-control button {
  padding: 6px 12px;
  background: #fff;
  color: var(--ink);
  border: 0;
  border-right: 1px solid var(--border);
  font-size: 13px;
}

.range-control button:last-child,
.bucket-control button:last-child {
  border-right: 0;
}

.range-control button.active,
.bucket-control button.active {
  background: var(--primary);
  color: #fff;
}

.range-control button:hover:not(.active),
.bucket-control button:hover:not(.active) {
  background: var(--primary-soft);
}

#range-window-label {
  margin-left: auto;
}

.view { display: grid; gap: 14px; }

/* Metric grids reused across overview / category analytics / recent summary */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.metric-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.metric-cell {
  padding: 12px 14px;
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.metric-cell.danger {
  background: var(--danger-soft);
  border-color: rgba(216, 32, 47, .35);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.metric-cell.danger .metric-value { color: var(--danger); }

/* Clickable KPI cards (Task 4 step 3) */
.kpi[data-overview-card] {
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.kpi[data-overview-card]:hover {
  background: var(--primary-soft);
}
.kpi.kpi-danger[data-overview-card]:hover {
  background: var(--danger-soft);
}

/* Status aging table */

.aging-table { padding: 0 4px; }

.aging-table-inner {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.aging-table-inner thead th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

/* 数量 / 均龄期 / 最大龄期 三列表头靠右，与下面的数字对齐 */
.aging-table-inner thead th:nth-child(n+2) {
  text-align: right;
}

.aging-table-inner tbody td {
  padding: 8px;
  border-bottom: 1px dashed var(--border);
}

.aging-table-inner tbody tr:last-child td {
  border-bottom: 0;
}

.aging-table-inner .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Trend detail summary + legend + urgent dots */

.panel-head-tools {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.trend-legend {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

/* Two-column body for the trend panel: chart on the left, pill stats on
   the right. Collapses to single column under 1024px. */
.trend-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (min-width: 1024px) {
  .trend-body {
    grid-template-columns: minmax(0, 1fr) 220px;
  }
}

/* 顶部 KPI 统计条 */
.trend-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

@media (min-width: 720px) {
  .trend-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .trend-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.trend-kpi {
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.trend-kpi-label {
  color: var(--muted);
  font-size: 12px;
}

.trend-kpi-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.trend-kpi-value.good { color: #2a7a3a; }
.trend-kpi-value.bad { color: var(--danger); }

.trend-kpi-foot {
  min-height: 16px;
  font-size: 12px;
}

.trend-kpi-delta { font-weight: 700; }
.trend-kpi-delta.good { color: #2a7a3a; }
.trend-kpi-delta.bad { color: var(--danger); }
.trend-kpi-note { color: var(--muted); }

/* 侧栏：积压与节奏分析（文字数字，非图形） */
.trend-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trend-summary-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.trend-srow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.trend-slabel { color: var(--muted); flex: 0 0 auto; }

.trend-sval {
  text-align: right;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.trend-sval small {
  display: block;
  font-weight: 600;
  font-size: 11px;
  color: var(--muted);
}

.trend-sval.good { color: #2a7a3a; }
.trend-sval.bad { color: var(--danger); }

.trend-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 6px 12px;
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

@media (min-width: 1024px) {
  .trend-stat {
    justify-content: space-between;
    border-radius: 8px;
  }
}

.trend-stat strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.dot-urgent { background: rgba(216, 32, 47, .85); }

/* Urgent is rendered as standalone red dots (mode: 'dots') so it doesn't
   overlap the primary created/closed lines. No line stroke needed. */
.trend-dot-urgent {
  fill: rgba(216, 32, 47, .85);
  stroke: #fff;
  stroke-width: 1;
}

.change-up   { color: #d8202f; font-weight: 600; }
.change-down { color: #2a7a3a; font-weight: 600; }

/* Drawer tabs (Task 6) */

.drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--border);
  background: #fbfcfe;
}

.drawer-tab {
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.drawer-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.drawer-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.drawer-section-title {
  margin: 14px 0 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .04em;
}

.drawer-range {
  margin-bottom: 8px;
}

.drawer-list-inline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.drawer-list-inline > li > .drawer-row {
  margin: 0;
}

.keyword-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
}

.keyword-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.keyword-list strong { font-variant-numeric: tabular-nums; }

/* Recent analytics filter bar */

.recent-tools {
  display: flex;
  gap: 8px;
  padding: 10px 0 12px;
  flex-wrap: wrap;
}

.recent-tools select,
.recent-tools input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
}

.recent-tools input { flex: 1; min-width: 140px; }

.recent-foot {
  padding-top: 10px;
}

/* Admin user management (Task 2) */

.table-tools {
  display: flex;
  gap: 8px;
  padding: 4px 0 12px;
  flex-wrap: wrap;
}

.table-tools input,
.table-tools select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
}

.table-tools input { flex: 1; min-width: 200px; }

.admin-table {
  display: grid;
  gap: 4px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr 1fr 1.6fr auto;
  gap: 10px;
  padding: 10px 12px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.admin-row-head {
  background: #fbfcfe;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

.admin-row .ghost {
  justify-self: end;
  padding: 5px 12px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.tag-admin   { background: rgba(32, 95, 156, .12); color: var(--primary); }
.tag-handler { background: rgba(92, 186, 136, .15); color: #1f7a48; }
.tag-student { background: #eef1f5; color: var(--muted); }

.user-status-active   { background: #e7f6ee; color: #1f7a48; }
.user-status-disabled { background: #fde7e9; color: var(--danger); }

/* Audit log feed */

.audit-list { display: grid; gap: 8px; }

.audit-row {
  padding: 10px 12px;
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.audit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.audit-action {
  font-weight: 600;
  color: var(--ink);
}

.audit-meta {
  color: var(--ink);
  font-size: 13px;
  margin: 4px 0 2px;
}

.audit-change { word-break: break-all; }

/* User create/edit modal form */

.compact-modal {
  width: min(560px, 100%);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.form-grid label input,
.form-grid label select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.form-grid .wide { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
}

.form-actions .ghost,
.form-actions .primary {
  width: auto;
  margin: 0;
  padding: 8px 18px;
}

@media (max-width: 720px) {
  .admin-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .admin-row-head { display: none; }
  .admin-row .ghost { justify-self: start; }
  .form-grid { grid-template-columns: 1fr; }
  .range-bar { padding: 10px 16px; gap: 8px; }
  .section-tabs { padding: 8px 16px; }
  #range-window-label { margin-left: 0; }
}

/* --- Admin incident delete + per-incident chat (plan 2026-06-07) --- */

.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* danger button — used by both the workflow-modal delete entry and the
   confirm button inside the delete modal. */
button.danger {
  padding: 8px 16px;
  background: var(--danger);
  color: #fff;
  border: 0;
  border-radius: 7px;
  font-weight: 600;
}

button.danger:hover { filter: brightness(1.05); }
button.danger:disabled { opacity: .6; cursor: not-allowed; }

.form-actions .danger {
  width: auto;
  margin: 0;
  padding: 8px 18px;
}

.danger-modal {
  border-top: 4px solid var(--danger);
}

.danger-copy {
  margin: 6px 0 12px;
  padding: 10px 12px;
  background: var(--danger-soft);
  border: 1px solid #f5c2c7;
  border-radius: 8px;
  color: #7d1019;
  font-size: 13px;
  line-height: 1.5;
}

.workflow-chat {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
}

.workflow-chat h3 {
  margin: 0;
  font-size: 15px;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.chat-head .muted { flex: 1; min-width: 0; }

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  min-height: 80px;
  overflow-y: auto;
  padding: 10px;
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.chat-list .empty {
  color: var(--muted);
  text-align: center;
  padding: 10px 0;
}

.chat-message {
  max-width: 78%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-message.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-meta {
  color: var(--muted);
  font-size: 12px;
}

.chat-bubble {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.mine .chat-bubble {
  background: var(--primary-soft);
  border-color: #b8d3ff;
  color: var(--ink);
}

.chat-send-error {
  margin-top: 4px;
  padding: 6px 10px;
  background: var(--danger-soft);
  border: 1px solid #f5c2c7;
  border-radius: 6px;
  font-size: 12px;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.chat-form input {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.chat-form input:disabled { background: #f3f5fa; }

.chat-form .primary {
  width: auto;
  margin: 0;
  padding: 9px 18px;
}

@media (max-width: 720px) {
  .modal-head-actions { gap: 6px; }
  .chat-message { max-width: 92%; }
  .chat-list { max-height: 260px; }
  .chat-form { grid-template-columns: 1fr; }
  .chat-form .primary { width: 100%; }
}

/* 登录页 API 健康状态条（plan 2026-06-07 Task 2） */
.login-status {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
  padding: 8px 10px;
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
}

.status-ok { background: #2f9e44; }
.status-bad { background: var(--danger); }
.status-muted { background: var(--muted); }

button.compact {
  padding: 4px 9px;
  font-size: 12px;
}

/* 典型案例管理（plan 2026-06-10） */
.cases-list { display: flex; flex-direction: column; gap: 12px; }
.case-row {
  display: flex; align-items: center; gap: 16px; padding: 12px;
  background: var(--card, #fff); border: 1px solid var(--border, #e6e6e6); border-radius: 10px;
}
.case-row-cover {
  width: 96px; height: 64px; border-radius: 8px; overflow: hidden; flex: none;
  background: #f3f3f3; display: flex; align-items: center; justify-content: center;
}
.case-row-cover img { width: 100%; height: 100%; object-fit: cover; }
.case-row-main { flex: 1; min-width: 0; }
.case-row-title { font-weight: 600; }
.case-row-meta {
  color: var(--muted, #888); font-size: 13px; margin-top: 4px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.case-publisher-tag {
  display: inline-flex; align-items: center; max-width: 180px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.case-row-actions { display: flex; gap: 8px; flex: none; }
.btn-mini {
  padding: 4px 12px; border: 1px solid var(--border, #ccc); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 13px;
  min-height: 30px; line-height: 1.2; white-space: nowrap;
}
.btn-mini.danger {
  min-width: 54px;
  background: var(--danger); border-color: var(--danger);
  color: #fff; font-weight: 700;
}
.btn-mini.danger:hover { filter: brightness(1.05); }
/* 紧凑型「新增案例」按钮：右上角动作，不占整行。 */
.cases-panel-head { align-items: flex-start; }
.case-new-btn {
  flex: none; width: auto; margin: 0;
  padding: 7px 13px; border: 0; border-radius: 7px;
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: 13px; line-height: 1.2; white-space: nowrap;
  cursor: pointer;
}
.case-new-btn:hover { filter: brightness(1.05); }
.field-cap { font-size: 13px; color: var(--muted, #888); margin-bottom: 6px; }

/* 窄屏：保持删除按钮文字可见、操作区不挤压封面。 */
@media (max-width: 720px) {
  .cases-panel-head { align-items: flex-start; }
  .case-row { align-items: flex-start; }
  .case-row-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 150px; }
  .case-publisher-tag { max-width: 140px; }
}

/* --- 典型案例：块编辑器 + 手机实时预览（plan 2026-06-11-case-content-blocks-preview）--- */

.case-modal-card { width: min(980px, 100%); }

.case-modal-body { display: flex; gap: 18px; align-items: flex-start; }
.case-modal-body #case-form { flex: 1; min-width: 0; }

/* 块编辑器 */
.case-blocks { display: grid; gap: 8px; margin: 0 0 8px; }
.case-blocks-empty { padding: 14px; border: 1px dashed var(--border); border-radius: 8px; text-align: center; }
.case-block {
  display: flex; gap: 8px; align-items: flex-start;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: #fbfcfe;
}
.case-block textarea {
  flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; font: inherit; color: var(--ink); resize: vertical; overflow: hidden;
}
.case-block-image { align-items: center; }
.case-block-image img { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; flex: none; }
.case-cover-tag {
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex: none;
}
.case-block-ops { display: flex; gap: 4px; margin-left: auto; flex: none; }
.case-block-ops button {
  width: 26px; height: 26px; border: 1px solid var(--border); background: #fff;
  border-radius: 6px; cursor: pointer; line-height: 1; padding: 0; color: var(--ink);
}
.case-block-ops button:disabled { opacity: .35; cursor: default; }
.case-block-ops button.danger { color: var(--danger); border-color: var(--danger); }
.case-block-adders { display: flex; gap: 8px; align-items: center; }

/* 预览面板：375px 手机框，样式逐条复刻 pages/caseDetail（rpx ÷ 2），改前先读 spec §4 */
.case-preview-pane { flex: 0 0 375px; position: sticky; top: 0; }
.case-preview-caption { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.case-preview-caption-sub { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.case-cover-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: #fff; }
.case-cover-frame {
  width: 100%; aspect-ratio: 351 / 160; border-radius: 8px; background: #f1f5f9;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.case-cover-frame img { width: 100%; height: 100%; object-fit: cover; }
.case-phone { border: 1px solid var(--border); border-radius: 18px; overflow: hidden; background: #fff; }
.case-phone-nav { background: #205f9c; color: #fff; text-align: center; font-size: 14px; font-weight: 600; padding: 11px 0; }
.case-phone-screen { padding: 16px; min-height: 220px; background: #fff; }
.pv-title { font-size: 20px; font-weight: 600; line-height: 1.4; margin-bottom: 12px; color: #172033; }
.pv-publisher {
  display: inline-flex; align-items: center; margin-bottom: 10px; padding: 4px 9px;
  border-radius: 999px; background: #eef4fc; color: #205f9c; font-size: 12px; font-weight: 700;
}
.pv-body { font-size: 15px; color: #333; line-height: 1.7; white-space: pre-wrap; margin-bottom: 16px; }
.pv-image { width: 100%; border-radius: 6px; display: block; margin-bottom: 10px; }

/* 宽屏双栏并排，页签隐藏；窄屏折叠为 编辑/预览 页签切换 */
.case-pane-tabs { display: none; gap: 6px; }
.case-pane-tab {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  border-radius: 7px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.case-pane-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (max-width: 860px) {
  .case-pane-tabs { display: flex; }
  .case-modal-body { display: block; }
  .case-preview-pane { position: static; margin-top: 4px; }
  .case-modal-body.show-preview #case-form { display: none; }
  .case-modal-body:not(.show-preview) .case-preview-pane { display: none; }
}

/* 0 值类目的计数弱化显示（配合"无数据类目也列出"的约定） */
.bar-num.zero, .pie-count.zero { color: var(--muted); font-weight: 600; }

/* --- 独立封面 + 固定比例裁切器（plan 2026-06-12-case-cover-crop）--- */

.case-cover-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.case-cover-thumb { width: 234px; flex: none; }
.case-cover-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.case-cover-actions .ghost { width: auto; margin: 0; }
.danger-text { color: var(--danger); border-color: var(--danger); }
.case-cover-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.case-cover-picker img {
  width: 96px; height: 64px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); cursor: pointer;
}
.case-cover-picker img:hover { border-color: var(--primary); }

.case-crop-modal { z-index: 80; }
.case-crop-card { width: min(760px, 100%); }
.case-crop-viewport {
  position: relative; width: 702px; max-width: 100%; height: 320px; margin: 0 auto;
  overflow: hidden; border-radius: 8px; background: #0f1722; cursor: grab; touch-action: none;
}
.case-crop-viewport:active { cursor: grabbing; }
.case-crop-viewport img {
  position: absolute; left: 0; top: 0; transform-origin: 0 0;
  user-select: none; pointer-events: none; max-width: none;
}
.case-crop-controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.case-crop-controls input[type="range"] { flex: 1; }
.case-crop-controls .ghost, .case-crop-controls .primary { width: auto; margin: 0; padding: 8px 18px; }
