:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --panel-soft: #f7f9fb;
  --line: #dde4ea;
  --line-strong: #cfd8df;
  --text: #1b2430;
  --muted: #60707e;
  --muted-2: #8a98a7;
  --brand: #1f6feb;
  --brand-soft: rgba(31, 111, 235, 0.12);
  --success: #16794c;
  --success-soft: #e5f4ec;
  --warning: #b86f00;
  --warning-soft: #fff0d9;
  --danger: #ba2a3a;
  --danger-soft: #fbe5e7;
  --info: #0f766e;
  --info-soft: #dff5f2;
  --shadow: 0 18px 50px rgba(18, 30, 40, 0.08);
  --radius: 8px;
  font-family: "Segoe UI", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
}

input,
select,
textarea {
  outline: 0;
}

.app {
  display: grid;
  grid-template-columns: 244px minmax(560px, 1fr) minmax(420px, 0.9fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.app[hidden],
.auth-screen[hidden] {
  display: none !important;
}

.auth-screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(238, 243, 247, 0.86);
  backdrop-filter: blur(10px);
  z-index: 50;
}

.auth-screen.show {
  display: flex;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-brand {
  padding: 0 0 16px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
}

.app[data-module="matters"] {
  grid-template-columns: 244px minmax(0, 1fr) minmax(430px, 0.92fr);
}

.app[data-inspector="focus"] {
  grid-template-columns: 244px minmax(0, 0.92fr) minmax(500px, 1.08fr);
}

.app[data-inspector="wide"] {
  grid-template-columns: 244px minmax(0, 0.9fr) minmax(540px, 1.1fr);
}

.app[data-inspector="hidden"] {
  grid-template-columns: 244px minmax(0, 1fr) 0;
}

.app[data-inspector="hidden"] .inspector {
  display: none;
}

.app[data-module="overview"] {
  grid-template-columns: 244px minmax(0, 1fr) 0;
}

.app[data-module="overview"] .inspector,
.app[data-module="reports"] .inspector {
  display: none;
}

.app[data-module="reports"] {
  grid-template-columns: 244px minmax(0, 1fr) 0;
}

.app[data-module="matters"],
.app[data-module="supervise"],
.app[data-module="mine"],
.app[data-module="plan"] {
  grid-template-columns: 244px minmax(0, 1fr) 0;
}

.app[data-module="matters"] .inspector,
.app[data-module="supervise"] .inspector,
.app[data-module="mine"] .inspector,
.app[data-module="plan"] .inspector {
  display: none;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #edf2f5;
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 8px;
}

.brand strong {
  display: block;
  font-size: 16px;
}

.brand span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
}

.searchbox,
.select,
.sidebar-group,
.metric,
.section,
.table-wrap,
.list-wrap,
.inspector-head,
.inspector-body {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
}

.searchbox {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.searchbox input {
  border: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
}

.searchbox .icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.sidebar-group {
  padding: 9px;
  display: grid;
  gap: 7px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border-radius: var(--radius);
  text-align: left;
  color: var(--text);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.8);
}

.nav-item.active {
  color: var(--brand);
  background: #fff;
  box-shadow: 0 1px 0 rgba(18, 30, 40, 0.04);
}

.nav-item .label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.count {
  min-width: 24px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #e9edf2;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  font-size: 12px;
}

.nav-item.active .count {
  background: var(--brand-soft);
  color: var(--brand);
}

.scope-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.session-card {
  display: grid;
  gap: 10px;
}

.session-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.session-logout {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  color: #56606a;
  white-space: nowrap;
}

.sidebar-metrics {
  display: grid;
  gap: 8px;
}

.sidebar-metric {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
}

.sidebar-metric b {
  color: var(--text);
  font-size: 13px;
}

.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fbfdfe;
}

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

.title-block {
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  white-space: nowrap;
}

.subtitle {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  min-height: 0;
}

.subtitle:empty,
.inspector-subtitle:empty {
  display: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.toolbar .btn,
.toolbar .icon-btn {
  height: 32px;
}

.btn,
.icon-btn,
.pill,
.chip,
.toggle {
  border-radius: var(--radius);
}

.btn {
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  flex: 0 0 auto;
}

.icon-btn:hover {
  background: var(--panel-soft);
}

.btn:hover {
  background: var(--panel-soft);
}

.btn.ghost {
  background: #f8fbfd;
  border-color: #d5e0e8;
  color: #405263;
}

.btn.ghost:hover {
  background: #eef5fa;
  color: var(--text);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.nav-item:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(31, 111, 235, 0.34);
  outline-offset: 2px;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 10px 18px rgba(31, 111, 235, 0.16);
}

.btn.primary:hover {
  filter: brightness(0.97);
}

.btn.compact {
  height: 28px;
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.btn.danger {
  border-color: #f0b8bf;
  color: var(--danger);
  background: #fff;
}

.btn.danger:hover {
  background: var(--danger-soft);
}

.link-btn {
  padding: 0;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
}

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

.content {
  min-height: 0;
  overflow: auto;
  padding: 12px 14px 18px;
}

.main:has(.workbench-head) .content {
  display: flex;
  flex-direction: column;
}

.section {
  padding: 10px;
  margin-bottom: 10px;
}

.section h2 {
  margin: 0 0 8px;
  font-size: 14px;
}

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

.metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metric {
  padding: 11px;
  box-shadow: 0 1px 0 rgba(18, 30, 40, 0.02);
}

.metric .label {
  font-size: 10px;
  color: var(--muted);
}

.metric .value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
}

.metric .delta {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 10px;
  align-items: start;
}

.subsection {
  display: grid;
  gap: 10px;
}

.table-wrap,
.list-wrap {
  overflow: auto;
}

.table {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.row {
  background: #fff;
  min-height: 50px;
  display: grid;
  align-items: center;
  gap: 0;
}

.row.header {
  min-height: 32px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.row.selected {
  background: #f7fbff;
}

.icon-btn.active-state {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}

.app[data-inspector="focus"] .workbench-head {
  display: grid;
  gap: 8px;
}

.app[data-inspector="focus"] .workbench-stats {
  justify-content: flex-start;
}

.app[data-inspector="focus"] .table {
  gap: 8px;
  background: transparent;
}

.app[data-module="overview"] .content {
  padding-bottom: 16px;
}

.app[data-module="overview"] .section {
  background: transparent;
  border: 0;
  padding: 0;
  margin-bottom: 12px;
}

.app[data-module="overview"] .metric {
  border: 1px solid var(--line);
}

.app[data-module="overview"] .accent-item {
  padding: 9px 10px;
}

.app[data-module="overview"] .split {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
}

.app[data-module="overview"] .subtitle {
  display: none;
}

.app[data-module="overview"] .section h2 {
  font-size: 13px;
  margin-bottom: 6px;
}

.app[data-module="overview"] .workbench-head {
  margin-bottom: 6px;
}

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

.matter-item {
  display: grid;
  gap: 8px;
  padding: 0;
  position: relative;
}

.matter-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: transparent;
  pointer-events: none;
  z-index: 1;
}

.matter-item.root-matter::before {
  background: #b8d5f2;
}

.matter-item.child-matter::before {
  left: 12px;
  width: 2px;
  background: #cfe3f8;
}

.matter-item.selected {
  border: 1px solid #a9cbed;
  border-radius: var(--radius);
  background: #f2f8ff;
  box-shadow: inset 3px 0 0 #6faeea;
}

.matter-item-head {
  width: 100%;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  padding: 9px 10px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  align-items: start;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.root-matter .matter-item-head {
  border-color: #e3eaf1;
  background: #ffffff;
}

.child-matter .matter-item-head {
  border-color: #dcebf9;
  background: #f3f9ff;
}

.child-matter.depth-2 .matter-item-head,
.child-matter.depth-3 .matter-item-head,
.child-matter.depth-4 .matter-item-head {
  background: #eef6ff;
}

.root-matter .matter-name {
  font-weight: 650;
  color: #172635;
}

.child-matter .matter-name {
  font-weight: 500;
  color: #314252;
}

.matter-item-head:hover {
  border-color: #cfe1f2;
  background: #f7fbff;
}

.root-matter .matter-item-head:hover {
  border-color: #d5e2ee;
  background: #fafcff;
}

.child-matter.depth-1 {
  margin-left: 16px;
}

.child-matter.depth-2 {
  margin-left: 32px;
}

.child-matter.depth-3 {
  margin-left: 48px;
}

.child-matter.depth-4 {
  margin-left: 64px;
}

.matter-item.selected .matter-item-head {
  border-color: transparent;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.matter-item.selected.root-matter {
  background: #f0f7ff;
}

.matter-item.selected.child-matter {
  background: #f7fbff;
}

.matter-item-head .tree-cell {
  padding: 0;
}

.matter-row {
  grid-template-columns: 42px minmax(0, 1.8fr) 132px 112px 102px 90px;
}

.people-row {
  grid-template-columns: minmax(0, 1.5fr) 116px 136px 84px 56px;
}

.knowledge-row {
  grid-template-columns: minmax(0, 1.55fr) 112px minmax(0, 1.05fr) 88px 106px 56px;
}

.template-row {
  grid-template-columns: minmax(0, 1.45fr) 116px 92px minmax(0, 1fr) 92px;
}

.notification-row {
  grid-template-columns: 54px 66px minmax(0, 1.75fr) minmax(108px, 0.9fr) 88px 112px 74px 128px;
  align-items: start;
}

.notification-summary {
  margin-bottom: 10px;
}

.notification-filterbar {
  margin-bottom: 10px;
}

.notification-table .link-btn {
  margin-right: 6px;
}

.notification-row .matter-name {
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.notification-row .matter-meta {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-message {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  line-height: 1.6;
}

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

.mini-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #fff;
  text-align: left;
}

.mini-row.selected {
  border-color: #b4cbf5;
  box-shadow: inset 3px 0 0 var(--brand);
}

.mini-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-row {
  grid-template-columns: minmax(130px, 1fr) repeat(7, 82px) 72px;
}

.plan-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.plan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.plan-header h2 {
  margin: 0;
}

.plan-header .muted {
  margin-top: 4px;
}

.plan-filterbar {
  justify-content: flex-end;
  min-width: 300px;
}

.plan-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plan-dashboard {
  margin-bottom: 10px;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.plan-month-panel,
.plan-milestone-panel {
  padding: 12px;
}

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

.plan-month-card {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
}

.plan-month-card strong {
  font-size: 13px;
}

.plan-month-card span {
  font-size: 11px;
  color: var(--muted);
}

.plan-month-card:hover {
  border-color: #bcd1fb;
  background: #f8fbff;
}

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

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

.plan-overview-wrap {
  margin-bottom: 10px;
}

.plan-quarter-grid {
  min-width: 0;
}

.plan-quarter-row {
  grid-template-columns: 72px minmax(0, 1fr) minmax(180px, 280px);
}

.plan-weekline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plan-mini-week {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
  font-size: 10px;
  color: var(--muted);
}

.plan-mini-week.current-week {
  background: #eaf2ff;
  border-color: #bcd1fb;
  color: var(--brand);
}

.quarter-card {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px 10px;
  font-size: 11px;
}

.quarter-card strong {
  font-size: 12px;
}

.plan-year-table {
  min-width: 2200px;
}

.plan-row {
  grid-template-columns: minmax(220px, 280px) repeat(53, 42px);
}

.plan-week {
  display: grid;
  gap: 2px;
  font-size: 10px;
  line-height: 1.2;
}

.plan-week .muted {
  font-size: 9px;
}

.current-week {
  background: #f4f8ff;
}

.plan-block {
  display: grid;
  place-items: center;
  min-height: 22px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
}

.plan-block.active {
  background: var(--brand);
}

.plan-block.supervise {
  background: var(--warning);
}

.plan-block.overdue {
  background: var(--danger);
}

.plan-block.done {
  background: var(--success);
}

.plan-empty {
  display: block;
  min-height: 22px;
}

.plan-legend-row {
  grid-template-columns: 110px minmax(0, 1fr);
}

.plan-row[data-matter] {
  cursor: pointer;
}

.plan-row[data-matter]:hover {
  background: #f8fbff;
}

.plan-focus-row {
  grid-template-columns: minmax(0, 1.6fr) 120px 96px 84px;
}

.department-row {
  grid-template-columns: minmax(0, 1.5fr) 112px 130px 84px;
}

.supervise-list {
  display: grid;
}

.supervise-list-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px;
}

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

.supervise-row-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
}

.supervise-row-block.pending {
  background: #fff7db;
  border-color: #edd48a;
}

.supervise-row-block.done {
  background: #e8f6ee;
  border-color: #a8d5b8;
}

.supervise-row-block.selected {
  box-shadow: 0 0 0 1px rgba(31, 111, 235, 0.2);
}

.supervise-row-main {
  display: grid;
  gap: 6px;
}

.supervise-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.supervise-row-title-wrap {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.supervise-row-kicker {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.supervise-row-title-wrap h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.supervise-row-parent {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.supervise-row-state {
  display: grid;
  gap: 4px;
  justify-items: end;
  flex: 0 0 auto;
}

.supervise-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
}

.supervise-row-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.supervise-row-cell {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

.supervise-row-cell span {
  color: var(--muted);
  font-size: 10px;
}

.supervise-row-cell strong {
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
  word-break: break-word;
}

.supervise-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.supervise-table-row {
  grid-template-columns: 100px 60px 180px 180px 180px 96px 150px 118px 118px 126px 118px 86px minmax(220px, 2fr) minmax(160px, 1.2fr);
}

.supervise-table .row {
  min-height: 64px;
}

.supervise-table .row.header {
  position: sticky;
  top: 0;
  z-index: 2;
}

.supervise-table .row:not(.header) {
  cursor: pointer;
}

.supervise-table .cell {
  padding: 10px 10px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.supervise-table .row.header .cell {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.supervise-progress-cell,
.supervise-remark-cell {
  max-height: 112px;
  overflow: auto;
}

.supervise-detail-grid {
  margin-bottom: 8px;
}

.cell {
  padding: 7px 8px;
  min-width: 0;
}

.tree-cell {
  padding: 7px 8px;
  min-width: 0;
}

.tree-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.matter-name,
.record-name {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: keep-all;
}

.matter-title-block {
  display: grid;
  gap: 4px;
  min-width: 0;
  position: relative;
}

.matter-title-block .pill {
  margin-left: 2px;
}

.matter-parent {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matter-title-block::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: transparent;
}

.app[data-inspector="focus"] .matter-title-block[style*="padding-left:16px"]::before,
.app[data-inspector="focus"] .matter-title-block[style*="padding-left:32px"]::before,
.app[data-inspector="focus"] .matter-title-block[style*="padding-left:48px"]::before,
.app[data-inspector="focus"] .matter-title-block[style*="padding-left:64px"]::before {
  background: var(--line);
}

.matter-plan {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 11px;
  line-height: 1.3;
}

.matter-meta,
.record-meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: 6px;
  row-gap: 2px;
  color: var(--muted);
  font-size: 10px;
  min-width: 0;
  line-height: 1.35;
}

.matter-meta-sep {
  color: var(--muted-2);
}

.tree-toggle,
.tree-spacer {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
}

.tree-toggle {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 0;
}

.tree-toggle:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.tree-toggle .caret {
  display: block;
  font-size: 12px;
  line-height: 1;
  transform: rotate(-90deg);
  transition: transform 120ms ease;
}

.tree-toggle.expanded .caret {
  transform: rotate(0deg);
}

.tree-spacer {
  border: 1px solid transparent;
}

.status,
.tag,
.pill,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 7px;
  font-size: 11px;
}

.status {
  border: 1px solid transparent;
  justify-content: center;
}

.status.todo {
  background: #edf3ff;
  color: #2354b8;
}

.status.doing {
  background: var(--info-soft);
  color: var(--info);
}

.status.done {
  background: var(--success-soft);
  color: var(--success);
}

.status.blocked {
  background: var(--warning-soft);
  color: var(--warning);
}

.status.terminated {
  background: #eef1f4;
  color: var(--muted);
}

.pill,
.tag,
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.pill.muted,
.chip.muted {
  background: #f6f8fa;
}

.pill.brand {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: transparent;
}

.pill.success,
.chip.success {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}

.pill.warning,
.chip.warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: transparent;
}

.pill.danger,
.chip.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

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

.filter-chip {
  min-height: 34px;
  border: 1px solid #b4cbf5;
  background: #eff6ff;
  color: var(--brand);
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  cursor: pointer;
}

.filter-chip:hover {
  background: #dbeafe;
}

.workbench-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.workbench-head h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.workbench-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
}

.workbench-stats span {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  display: inline-flex;
  align-items: center;
}

.filterbar .select,
.filterbar input,
.filterbar .date {
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 0 9px;
  font-size: 13px;
}

.filterbar input {
  min-width: 160px;
}

.filterbar input.pending-search,
.searchbox input.pending-search {
  border-color: #f0bd68;
  background: #fffaf0;
}

.sync-status {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  white-space: nowrap;
}

.sync-status.saving {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: transparent;
}

.sync-status.saved,
.sync-status.loaded {
  color: var(--success);
  background: var(--success-soft);
  border-color: transparent;
}

.sync-status.offline {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 16px 40px rgba(18, 30, 40, 0.16);
  color: var(--text);
  font-size: 13px;
}

.toast.success {
  color: var(--success);
  background: var(--success-soft);
}

.toast.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.toast.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.muted {
  color: var(--muted);
}

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

.accent-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.accent-item .left {
  min-width: 0;
}

.accent-item .title {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accent-item .sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.detail-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 9px;
}

.report-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  gap: 10px;
  margin-bottom: 12px;
}

.report-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 10px;
}

.report-conclusion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.report-conclusion strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
}

.report-conclusion p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.report-conclusion.danger {
  border-color: #f3b4b4;
  box-shadow: inset 3px 0 0 #dc2626;
}

.report-conclusion.warning {
  border-color: #f2cf8d;
  box-shadow: inset 3px 0 0 #d97706;
}

.report-conclusion.success {
  border-color: #a7d8bd;
  box-shadow: inset 3px 0 0 #16a34a;
}

.report-kicker {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.report-rate {
  width: 74px;
  height: 74px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background: #f8fafc;
}

.report-rate span {
  font-size: 20px;
  font-weight: 750;
}

.report-rate small {
  color: var(--muted);
  font-size: 10px;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  gap: 8px;
  justify-content: flex-end;
}

.report-insight {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.insight-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.insight-row span {
  color: var(--muted);
}

.insight-row strong {
  color: var(--text);
}

.report-clickable {
  cursor: pointer;
}

.report-clickable:hover {
  background: #f8fbff;
}

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

.report-risk-list.compact {
  gap: 6px;
}

.report-risk-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.report-risk-item:hover {
  border-color: #b4cbf5;
  background: #f8fbff;
}

.risk-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.risk-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.risk-main span {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.risk-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.report-focus {
  margin-top: 10px;
}

.report-focus h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.report-history-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid rgba(180, 123, 14, 0.28);
  border-radius: 6px;
  background: #fff9e8;
  color: #6e5319;
}

.report-history-note span {
  line-height: 1.6;
}

.home-priority-grid,
.standard-type-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.home-priority-grid button,
.standard-type-summary > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.home-priority-grid button {
  display: grid;
  gap: 5px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.home-priority-grid button:hover {
  border-color: #8db6e8;
  background: #f5f9fe;
}

.home-priority-grid strong,
.standard-type-summary strong {
  font-size: 26px;
}

.home-priority-grid small,
.standard-type-summary span,
.standard-path {
  color: var(--muted);
}

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

.home-focus-list > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.home-focus-list > button:hover {
  border-color: #8db6e8;
  background: #f7fbff;
}

.home-focus-list span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.home-focus-list small {
  color: var(--muted);
}

.home-focus-list em {
  font-style: normal;
  white-space: nowrap;
}

.standard-type-summary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 14px;
}

.standard-type-summary > div {
  display: grid;
  gap: 6px;
}

.standard-type-summary > div.danger {
  border-color: rgba(186, 42, 58, 0.28);
  background: var(--danger-soft);
}

.standard-center-row {
  grid-template-columns: minmax(250px, 1.6fr) 100px 180px 140px 110px 80px 110px;
}

.standard-center-row .cell:first-child {
  display: grid;
  gap: 4px;
}

.archive-row {
  grid-template-columns: minmax(240px, 1.5fr) 100px 100px 110px 110px 110px minmax(220px, 1fr);
}

.report-summary .metric.report-clickable {
  cursor: pointer;
}

.report-summary .metric.report-clickable:hover,
.report-summary .metric.report-clickable:focus-visible {
  border-color: #8db6e8;
  background: #f7fbff;
  outline: none;
}

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

.checklist-form-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

@media (max-width: 1180px) {
  .home-priority-grid,
  .standard-type-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .home-priority-grid,
  .standard-type-summary,
  .checklist-form-row { grid-template-columns: 1fr; }
  .home-focus-list > button { align-items: flex-start; flex-direction: column; }
}

.section-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading-row h2,
.section-heading-row p,
.review-panel h3,
.action-review h3 {
  margin: 0;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.review-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  min-width: 0;
}

.review-panel h3,
.action-review h3 {
  font-size: 14px;
  margin-bottom: 14px;
}

.trend-rate {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.trend-rate strong { font-size: 30px; }
.trend-rate.up span { color: var(--success); }
.trend-rate.down span { color: var(--danger); }

.trend-compare,
.owner-review-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 11px;
  font-size: 13px;
}

.owner-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}

.review-reasons {
  display: grid;
  gap: 8px;
}

.review-reasons button,
.action-review-grid button {
  border: 1px solid var(--line);
  background: #f7fafc;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.review-reasons button {
  display: flex;
  justify-content: space-between;
  padding: 9px 10px;
}

.review-static-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafc;
}

.review-reasons button:hover,
.action-review-grid button:hover {
  border-color: #8db6e8;
  background: #f0f6fd;
}

.review-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.action-review {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.action-review-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.action-review-grid button {
  display: grid;
  gap: 5px;
  padding: 13px;
}

.action-review-grid span {
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 1080px) {
  .review-grid,
  .action-review-grid { grid-template-columns: 1fr; }
}

.insight-table .row {
  grid-template-columns: minmax(130px, 1.2fr) 92px minmax(0, 1fr) 88px;
}

.insight-row-grid {
  grid-template-columns: minmax(130px, 1.2fr) 92px minmax(0, 1fr) 88px;
}

.report-mini-row {
  grid-template-columns: minmax(0, 1.15fr) repeat(4, 72px);
}

.report-mini-row .cell {
  text-align: center;
  font-size: 12px;
}

.report-mini-row .cell:first-child {
  text-align: left;
}

.detail-block h3 {
  margin: 0;
  font-size: 14px;
}

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

.detail {
  display: grid;
  gap: 12px;
}

.detail-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-section-title span {
  color: var(--muted);
  font-size: 12px;
}

.field-grid {
  display: grid;
  gap: 8px;
}

.detail-title-grid {
  grid-template-columns: 1fr;
}

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

.span-full {
  grid-column: 1 / -1;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 11px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 0 8px;
  color: var(--text);
  font-size: 13px;
}

.field input,
.field select {
  height: 38px;
}

.field textarea {
  min-height: 100px;
  padding: 10px;
  resize: vertical;
  line-height: 1.55;
}

.select-wrap {
  position: relative;
}

.searchable-select {
  position: relative;
  display: grid;
  gap: 6px;
}

.searchable-select-trigger {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.searchable-select-trigger:focus-visible,
.searchable-select-search:focus-visible,
.searchable-select-option:focus-visible {
  outline: 2px solid rgba(31, 111, 235, 0.24);
  outline-offset: 1px;
}

.searchable-select-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-select-caret {
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.searchable-select[data-open="true"] .searchable-select-caret {
  transform: rotate(180deg);
}

.searchable-select-panel {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.searchable-select[data-open="true"] .searchable-select-panel {
  display: grid;
}

.searchable-select-search {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 0 9px;
  color: var(--text);
  font-size: 13px;
}

.searchable-select-options {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.searchable-select-option {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  color: var(--text);
}

.searchable-select-option.selected {
  background: #edf4ff;
  border-color: #bcd1fb;
  color: var(--brand);
}

.searchable-select-option:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.searchable-select-empty {
  padding: 8px 4px 2px;
  color: var(--muted);
  font-size: 12px;
}

.searchable-select-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.field .searchable-select,
.field-grid .searchable-select,
.detail .searchable-select {
  min-width: 0;
}

.field .searchable-select-trigger,
.field-grid .searchable-select-trigger,
.detail .searchable-select-trigger {
  min-width: 0;
}

.checkbox-list {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
  padding-right: 2px;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  font-size: 13px;
  color: var(--text);
}

.checkline input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid #b8c4cf;
  border-radius: 4px;
  background: #fff;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.checkline input[type="checkbox"]::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: transparent;
  transition: background-color 0.15s ease;
}

.checkline input[type="checkbox"]:checked {
  border-color: var(--brand);
  background: #eef5ff;
}

.checkline input[type="checkbox"]:checked::after {
  background: var(--brand);
}

.checkline input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(31, 111, 235, 0.22);
  outline-offset: 2px;
}

.checkline span,
.checkline small {
  color: var(--muted);
}

.multi-picker {
  position: relative;
  display: grid;
  gap: 6px;
}

.multi-picker[data-open="true"] .multi-menu {
  display: grid;
}

.multi-picked {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.multi-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
  font-size: 12px;
}

.multi-chip-remove {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1;
}

.multi-search {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 0 9px;
  color: var(--text);
  font-size: 14px;
}

.multi-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  grid-template-columns: 1fr;
  gap: 6px;
  max-height: 150px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.multi-option {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
}

.multi-option.selected {
  background: #edf4ff;
  border-color: #bcd1fb;
  color: var(--brand);
}

.multi-option:disabled {
  opacity: 0.7;
}

.multi-placeholder,
.multi-empty {
  color: var(--muted);
  font-size: 12px;
}

.stack {
  display: grid;
  gap: 6px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin: 2px -14px -14px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.button-row .btn {
  height: 36px;
}

.button-row.row-actions {
  flex-wrap: nowrap;
}

.button-row .icon-btn {
  width: 32px;
  height: 32px;
}

.comments {
  display: grid;
  gap: 6px;
}

.comment {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
}

.comment .meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.attachment-list {
  display: grid;
  gap: 6px;
}

.attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
}

.attachment .name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment .meta {
  color: var(--muted);
  font-size: 11px;
}

.matter-form {
  gap: 10px;
}

.detail-summary {
  gap: 10px;
}

.detail-summary h3 {
  margin-top: 2px;
  font-size: 17px;
  line-height: 1.2;
}

.detail-summary .summary-item strong {
  display: block;
}

.completion-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(86px, 120px) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.completion-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.completion-main > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.completion-main strong {
  font-size: 13px;
  line-height: 1.25;
  color: var(--text);
}

.completion-main span:not(.status) {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.completion-meter {
  height: 8px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.completion-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.completion-panel .btn {
  justify-self: end;
  white-space: nowrap;
}

.completion-entry {
  border-color: #b8d3f0;
  background: #f7fbff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.supervise-completion-entry {
  border-color: #e6c87e;
  background: #fffaf0;
  box-shadow: inset 3px 0 0 var(--warning);
}

.completion-entry-grid {
  grid-template-columns: minmax(180px, 0.45fr) minmax(320px, 1.55fr);
  align-items: start;
}

.completion-result-field textarea {
  min-height: 76px;
}

.completion-entry .span-full textarea {
  min-height: 58px;
}

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

.summary-item {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfd;
}

.summary-item span {
  color: var(--muted);
  font-size: 11px;
}

.summary-item strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.child-mini-row {
  grid-template-columns: minmax(0, 1.4fr) 110px 84px;
}

.child-mini-row.clickable {
  cursor: pointer;
}

.child-mini-row.clickable:hover {
  background: #eef5ff;
}

.child-mini-row.clickable:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: -2px;
}

.link-button.child-jump-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #1d4ed8;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.link-button.child-jump-button:hover {
  text-decoration: underline;
}

.detail-accordion {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.detail-accordion summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
}

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

.detail-accordion-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.recurring-note {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfd;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.inline-note,
.readonly-note {
  padding: 9px 10px;
  border: 1px solid #dbe8f5;
  border-radius: var(--radius);
  background: #f5f9fd;
  color: #426278;
  font-size: 12px;
  line-height: 1.5;
}

.readonly-note {
  border-color: #f1d7a5;
  background: #fff8eb;
  color: #8a5f12;
}

.detail-block.is-dirty {
  border-color: #f1c36d;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.detail-block.is-dirty .detail-head::after {
  content: "有未保存修改";
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.standard-panel {
  display: grid;
  gap: 10px;
}

.standard-panel div {
  display: grid;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.standard-panel div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.standard-panel span {
  color: var(--muted);
  font-size: 12px;
}

.standard-panel strong,
.standard-panel a {
  color: var(--text);
  font-weight: 600;
  line-height: 1.55;
  word-break: break-word;
}

.empty-state {
  display: grid;
  gap: 8px;
  place-items: center;
  text-align: center;
}

.inspector {
  min-width: 0;
  border-left: 1px solid var(--line);
  background: #fbfcfe;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
}

.inspector-head {
  margin: 10px 12px 6px;
  padding: 10px 12px;
  box-shadow: 0 8px 22px rgba(18, 30, 40, 0.06);
  position: sticky;
  top: 10px;
  z-index: 3;
  align-items: center;
}

.app[data-inspector="focus"] .inspector-head {
  display: none;
}

.inspector-close {
  width: 34px;
  height: 34px;
  border-color: #ccd8e2;
  background: #fff;
}

.inspector-close:hover {
  background: var(--danger-soft);
  border-color: rgba(186, 42, 58, 0.28);
  color: var(--danger);
}

.inspector-title {
  font-weight: 700;
  font-size: 14px;
}

.inspector-subtitle {
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.inspector-body {
  margin: 0 12px 12px;
  padding: 0;
  overflow: auto;
  min-height: 0;
  display: grid;
  gap: 12px;
  container-type: inline-size;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 30, 40, 0.42);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100vw - 56px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(18, 30, 40, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.modal-eyebrow {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.modal-title {
  margin: 4px 0 0;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
}

.modal-body {
  padding: 16px 18px 20px;
  overflow: auto;
  min-height: 0;
}

.matter-modal-card .detail {
  gap: 14px;
}

.matter-modal-card .detail-block {
  margin-bottom: 0;
}

.matter-modal-card .detail-summary h3 {
  font-size: 24px;
  line-height: 1.3;
}

.matter-modal-card .summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.matter-modal-card .detail-grid,
.matter-modal-card .field-grid.two,
.matter-modal-card .field-grid.three,
.matter-modal-card .detail-title-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.matter-modal-card .field.span-full,
.matter-modal-card .detail-grid .span-full {
  grid-column: 1 / -1;
}

.matter-modal-card .detail-accordion-body {
  padding: 14px;
}

.app[data-inspector="focus"] .inspector-body {
  margin: 14px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  min-height: 160px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

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

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.4fr) 56px;
  gap: 10px;
  align-items: center;
}

.bar-label,
.bar-value {
  min-width: 0;
  font-size: 12px;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-value {
  color: var(--muted);
  text-align: right;
  font-weight: 650;
}

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

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--info));
}

.bar-fill.success {
  background: linear-gradient(90deg, var(--success), #4ade80);
}

.bar-fill.warning {
  background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.bar-fill.danger {
  background: linear-gradient(90deg, var(--danger), #fb7185);
}

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

.report-summary .metric .value {
  font-size: 20px;
}

.report-summary .metric {
  padding: 11px;
}

.department-row .matter-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overview-list .overview-row {
  grid-template-columns: minmax(0, 1.5fr) 96px 110px;
}

.overview-row .matter-name {
  -webkit-line-clamp: 1;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.table {
  background: transparent;
}

.row.header {
  background: #f7f9fb;
}

.accent-item.selected {
  border-color: #b4cbf5;
  box-shadow: inset 3px 0 0 var(--brand);
}

.btn {
  height: 32px;
}

.icon-btn {
  width: 32px;
  height: 32px;
}

.metric,
.detail-block,
.accent-item,
.sidebar-group {
  box-shadow: 0 1px 0 rgba(18, 30, 40, 0.03);
}

.sidebar-group {
  border-radius: 8px;
}

.detail .field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail .field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail .button-row {
  align-items: center;
}

.detail .button-row .btn {
  flex: 0 0 auto;
}

.detail .field-grid.detail-title-grid {
  grid-template-columns: minmax(0, 1fr);
}

.detail .detail-block.matter-form .field-grid.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail .stack .muted {
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid transparent;
}

.badge.read {
  background: #eef2f6;
  color: var(--muted);
}

.badge.unread {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.info {
  background: var(--info-soft);
  color: var(--info);
}

.badge.success {
  background: var(--success-soft);
  color: var(--success);
}

.badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.muted {
  background: #eef2f6;
  color: var(--muted);
}

.icon-inline {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.icon-inline svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Visual refresh */
:root {
  --bg: #eef3f7;
  --panel: #ffffff;
  --panel-soft: #f6f9fb;
  --line: #d9e3ea;
  --line-strong: #bfd0dc;
  --text: #17212b;
  --muted: #5d6d7c;
  --muted-2: #8a99a8;
  --brand: #1769d2;
  --brand-soft: #e7f0ff;
  --success: #147a53;
  --success-soft: #e7f5ee;
  --warning: #a45f00;
  --warning-soft: #fff1d6;
  --danger: #b62536;
  --danger-soft: #fde7ea;
  --info: #087b84;
  --info-soft: #e2f5f6;
  --shadow: 0 14px 36px rgba(25, 42, 57, 0.1);
}

html,
body {
  background: var(--bg);
}

.app {
  background: #f5f8fa;
}

.sidebar {
  background: #e7eef3;
  border-right-color: #d2dee7;
  padding: 14px 12px;
}

.brand {
  padding: 8px 8px 10px;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0;
}

.brand span {
  font-size: 11px;
}

.searchbox,
.sidebar-group,
.metric,
.section,
.table-wrap,
.list-wrap,
.inspector-head,
.inspector-body,
.detail-block,
.accent-item {
  box-shadow: 0 1px 2px rgba(25, 42, 57, 0.04);
}

.searchbox {
  height: 40px;
  background: rgba(255, 255, 255, 0.86);
  border-color: #d5e0e8;
}

.sidebar-group {
  padding: 10px;
  background: rgba(255, 255, 255, 0.82);
  border-color: #d5e0e8;
}

.nav-list {
  gap: 5px;
}

.nav-item {
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid transparent;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.nav-item:hover {
  background: #f8fbfd;
  border-color: #dbe6ee;
}

.nav-item.active {
  background: #fff;
  border-color: #c8daf3;
  box-shadow: inset 3px 0 0 var(--brand), 0 6px 16px rgba(25, 42, 57, 0.06);
}

.count {
  background: #edf2f6;
  font-weight: 650;
}

.sidebar-metric {
  padding: 6px 7px;
  border-radius: 6px;
  background: #f8fbfd;
}

.main {
  background: #f7fafc;
}

.topbar {
  min-height: 64px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom-color: #d9e3ea;
  box-shadow: 0 1px 0 rgba(25, 42, 57, 0.03);
}

.topbar h1 {
  font-size: 20px;
  font-weight: 750;
}

.subtitle {
  font-size: 12px;
}

.content {
  padding: 16px 18px 22px;
}

.section {
  padding: 14px;
  margin-bottom: 14px;
  background: #fff;
  border-color: #dbe5ec;
  box-shadow: 0 8px 24px rgba(25, 42, 57, 0.05);
}

.section h2,
.workbench-head h2 {
  font-size: 16px;
  font-weight: 750;
}

.btn,
.icon-btn,
.filter-chip,
.searchable-select-trigger {
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.btn,
.icon-btn {
  border-color: #d1dde6;
  background: #fff;
  box-shadow: 0 1px 1px rgba(25, 42, 57, 0.04);
}

.btn:hover,
.icon-btn:hover {
  background: #f7fafc;
  border-color: #b9cad8;
  box-shadow: 0 4px 12px rgba(25, 42, 57, 0.08);
}

.btn:active,
.icon-btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: #1769d2;
  border-color: #1769d2;
  box-shadow: 0 8px 18px rgba(23, 105, 210, 0.18);
}

.btn.primary:hover {
  background: #125dbd;
  border-color: #125dbd;
  filter: none;
}

.btn[disabled],
.icon-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.btn[disabled]:hover,
.icon-btn[disabled]:hover {
  background: #fff;
  border-color: #d1dde6;
  transform: none;
}

.filterbar {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px;
  margin: 0 0 12px;
  border: 1px solid #dbe5ec;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.filterbar .select,
.filterbar input,
.filterbar .date {
  height: 36px;
  border-color: #cedce6;
  background: #fbfdfe;
}

.filterbar .select:hover,
.filterbar input:hover,
.filterbar .date:hover {
  border-color: #b9cad8;
}

.workbench-head {
  margin-bottom: 12px;
}

.workbench-head p {
  margin: 0;
}

.workbench-stats span,
.sync-status,
.pill,
.tag,
.chip,
.status,
.badge {
  font-weight: 650;
}

.matter-list {
  gap: 10px;
}

.matter-item::before {
  width: 4px;
}

.matter-item.root-matter::before {
  background: #6aa2df;
}

.matter-item.child-matter::before {
  background: #8fc6cb;
}

.matter-item-head {
  border-color: #dce7ef;
  box-shadow: 0 2px 8px rgba(25, 42, 57, 0.04);
}

.root-matter .matter-item-head,
.child-matter .matter-item-head,
.child-matter.depth-2 .matter-item-head,
.child-matter.depth-3 .matter-item-head,
.child-matter.depth-4 .matter-item-head {
  background: #fff;
}

.matter-item:hover .matter-item-head {
  border-color: #bfd3e3;
  box-shadow: 0 8px 22px rgba(25, 42, 57, 0.08);
}

.matter-item.selected {
  border-color: #a7c4eb;
  background: #eff6ff;
  box-shadow: inset 4px 0 0 var(--brand), 0 8px 20px rgba(23, 105, 210, 0.08);
}

.matter-item.selected .matter-item-head {
  background: #f6fbff;
}

.matter-name,
.record-name {
  font-size: 14px;
  line-height: 1.45;
}

.matter-meta,
.record-meta {
  font-size: 11px;
}

.tree-toggle {
  border-radius: 6px;
}

.metric {
  border-color: #dbe5ec;
  padding: 14px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(25, 42, 57, 0.05);
}

.metric .label {
  font-size: 11px;
}

.metric .value {
  font-size: 24px;
}

.table-wrap {
  border-color: #dbe5ec;
  box-shadow: 0 8px 22px rgba(25, 42, 57, 0.05);
}

.row {
  border-bottom: 1px solid #edf2f6;
}

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

.row:not(.header):hover {
  background: #f8fbfd;
}

.row.header {
  background: #f3f7fa;
  color: #536779;
}

.supervise-row-block {
  border-color: #dbe5ec;
  box-shadow: 0 4px 14px rgba(25, 42, 57, 0.05);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.supervise-row-block:hover {
  border-color: #bdd0de;
  box-shadow: 0 10px 24px rgba(25, 42, 57, 0.09);
}

.supervise-row-block.pending {
  background: #fffaf0;
  border-color: #efd59c;
}

.supervise-row-block.done {
  background: #f0fbf5;
  border-color: #b8dbc8;
}

.modal-backdrop {
  background: rgba(16, 28, 38, 0.48);
}

.modal-card {
  border-color: #d5e1ea;
  border-radius: var(--radius);
  box-shadow: 0 28px 80px rgba(16, 28, 38, 0.24);
}

.modal-head {
  background: #f8fbfd;
  padding: 18px 20px 16px;
}

.modal-title {
  font-size: 23px;
}

.modal-body {
  background: #fbfdfe;
}

.detail-block,
.detail-accordion,
.summary-item,
.recurring-note {
  border-color: #dbe5ec;
  box-shadow: 0 2px 8px rgba(25, 42, 57, 0.035);
}

.detail-summary h3 {
  letter-spacing: 0;
}

.field input,
.field select,
.field textarea,
.searchable-select-trigger {
  border-color: #cedce6;
  background: #fbfdfe;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #8db6e8;
  box-shadow: 0 0 0 3px rgba(23, 105, 210, 0.12);
}

.toast {
  box-shadow: 0 18px 48px rgba(16, 28, 38, 0.18);
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state {
  gap: 10px;
  background: #fbfdfe;
}

.empty-state .button-row {
  justify-content: center;
}

.sticky-actions {
  position: sticky;
  bottom: -1px;
  z-index: 2;
  padding: 10px;
  margin: 4px -10px -10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.detail-accordion[open] summary {
  border-bottom: 1px solid var(--line);
}

.detail-accordion summary::after {
  content: "展开";
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.detail-accordion[open] summary::after {
  content: "收起";
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  color: var(--muted);
  background: #f1f5f8;
  cursor: not-allowed;
}

.searchable-select[data-open="true"] .searchable-select-trigger {
  border-color: #8db6e8;
  box-shadow: 0 0 0 3px rgba(23, 105, 210, 0.12);
}

@media (max-width: 1280px) {
  .supervise-row-grid {
    grid-template-columns: 1fr;
  }

  .app {
    grid-template-columns: 252px minmax(0, 1fr);
  }

  .app[data-inspector="focus"],
  .app[data-inspector="wide"],
  .app[data-inspector="hidden"] {
    grid-template-columns: 252px minmax(0, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: 300px;
  }

  .app[data-inspector="hidden"] .inspector {
    display: none;
  }

  .detail-layout,
  .handover-panel {
    grid-template-columns: 1fr;
  }

  .plan-dashboard,
  .plan-quarter-summary,
  .plan-month-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .app[data-inspector="focus"],
  .app[data-inspector="wide"],
  .app[data-inspector="hidden"] {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: none;
  }

  .main {
    min-height: 60vh;
  }

  .topbar {
    position: sticky;
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 12px;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .toolbar .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .sync-status {
    margin-left: auto;
  }

  .filterbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filterbar .select,
  .filterbar input,
  .filterbar .date,
  .filterbar .btn {
    width: 100%;
  }

  .workbench-head {
    display: grid;
    gap: 10px;
  }

  .workbench-head-actions {
    justify-content: flex-start;
  }

  .child-matter.depth-1,
  .child-matter.depth-2,
  .child-matter.depth-3,
  .child-matter.depth-4 {
    margin-left: 8px;
  }

  .inspector {
    height: auto;
    min-height: 280px;
  }

  .metrics,
  .report-summary,
  .field-grid.two,
  .field-grid.three,
  .split,
  .matter-sheet-head,
  .plan-dashboard,
  .plan-quarter-summary,
  .plan-month-grid {
    grid-template-columns: 1fr;
  }

  .matter-row,
  .people-row,
  .knowledge-row,
  .template-row,
  .notification-row,
  .report-row {
    grid-template-columns: 1fr;
  }

  .row.header {
    display: none;
  }

  .cell,
  .tree-cell {
    padding: 8px 12px;
  }

  .detail .field-grid.two,
  .detail .field-grid.three {
    grid-template-columns: 1fr;
  }

  .modal-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
  }

  .modal-head,
  .modal-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .toast {
    right: 8px;
    bottom: 8px;
  }

  .matter-modal-card .summary-grid,
  .matter-modal-card .detail-grid,
  .matter-modal-card .field-grid.two,
  .matter-modal-card .field-grid.three,
  .matter-modal-card .detail-title-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 721px) and (max-width: 960px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 220px minmax(0, 1fr);
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .app[data-inspector="focus"],
  .app[data-inspector="wide"],
  .app[data-inspector="hidden"] {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .main {
    min-height: 60vh;
  }

  .inspector {
    grid-column: 1 / -1;
    height: auto;
    min-height: 280px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .app[data-inspector="hidden"] .inspector {
    display: none;
  }

  .modal-card {
    width: min(1040px, calc(100vw - 32px));
  }

  .matter-modal-card .summary-grid,
  .matter-modal-card .detail-grid,
  .matter-modal-card .field-grid.two,
  .matter-modal-card .field-grid.three,
  .matter-modal-card .detail-title-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 961px) and (max-width: 1280px) {
  .app[data-module="notifications"] {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .app[data-module="notifications"] .inspector {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: 260px;
  }
}

/* UX refinement pass: clearer scanning, search feedback, and operational status. */
.searchbox {
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.searchbox:focus-within {
  border-color: #9fc2ea;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.10);
  background: #fff;
}

.searchbox input::placeholder,
.filterbar input::placeholder {
  color: #8795a3;
}

.filterbar input.pending-search,
.searchbox input.pending-search {
  border-color: #e8b55f;
  background: #fff8ea;
  box-shadow: inset 0 -2px 0 rgba(232, 181, 95, 0.45);
}

.subtitle {
  max-width: min(760px, 70vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-metric {
  min-height: 28px;
  align-items: center;
  padding: 5px 7px;
  border-radius: 6px;
  background: #f8fafc;
}

.sidebar-metric.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.sidebar-metric.danger b {
  color: var(--danger);
}

.nav-item {
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-item:hover {
  transform: translateX(1px);
}

.workbench-head-actions {
  align-items: center;
}

.workbench-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.workbench-stats span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #dbe5ec;
  border-radius: 999px;
  padding: 0 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.matter-item-head:hover,
.row[data-person]:hover,
.row[data-knowledge]:hover,
.row[data-notification]:hover {
  border-color: #b9d1e8;
  background: #f8fbff;
}

.empty-state {
  min-height: 160px;
  padding: 24px;
  border: 1px dashed #cfdae4;
  border-radius: var(--radius);
  background: #fbfdff;
}

.empty-state.compact {
  min-height: 96px;
  padding: 16px;
}

.session-card {
  border: 1px solid #dbe5ec;
  background: #fff;
  border-radius: var(--radius);
  padding: 9px;
}

.session-logout:hover {
  border-color: #c7d3de;
  background: #f3f7fa;
  color: var(--text);
}

/* Parent-child matter refinement. */
.matter-row-shell {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.matter-row-shell > .tree-toggle,
.matter-row-shell > .tree-spacer {
  width: 34px;
  height: auto;
  min-height: 50px;
  border-radius: var(--radius);
  align-self: stretch;
  flex: 0 0 auto;
}

.matter-row-shell > .tree-toggle {
  display: inline-grid;
  place-items: center;
  border: 1px solid #c9d9e8;
  background: #f5f9fd;
  color: #41637d;
  font-size: 13px;
  font-weight: 650;
}

.matter-row-shell > .tree-toggle:hover {
  background: #eaf3fb;
  border-color: #9ec1df;
  color: #1f5f94;
}

.matter-row-shell > .tree-toggle .caret {
  font-size: 13px;
  transform: rotate(-90deg);
}

.matter-row-shell > .tree-toggle.expanded .caret {
  transform: rotate(0deg);
}

.matter-row-shell > .tree-toggle .toggle-label {
  display: none;
}

.matter-row-shell > .tree-spacer {
  border: 1px solid transparent;
}

.matter-item.has-children > .matter-row-shell .matter-item-head {
  border-color: #cfe0ec;
}

.matter-item.expanded > .matter-row-shell .matter-item-head {
  background: #fbfdff;
}

.matter-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.matter-title-row .matter-name {
  min-width: 0;
  flex: 1 1 260px;
}

.child-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 360px;
  flex: 0 1 360px;
  margin-left: auto;
}

.child-summary span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d8e3ec;
  border-radius: 999px;
  padding: 0 7px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.child-summary .child-summary-main {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: rgba(31, 111, 235, 0.18);
  font-weight: 650;
}

.child-summary .danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(186, 42, 58, 0.18);
}

.child-summary .warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(184, 111, 0, 0.18);
}

.child-matter .matter-row-shell {
  grid-template-columns: 34px minmax(0, 1fr);
}

.child-matter .matter-row-shell::before {
  content: "";
  grid-column: 1;
  justify-self: center;
  width: 2px;
  min-height: 100%;
  background: #c8dbe8;
  border-radius: 999px;
}

.child-matter .matter-row-shell > .tree-toggle,
.child-matter .matter-row-shell > .tree-spacer {
  grid-column: 1;
  grid-row: 1;
  z-index: 1;
}

.child-matter .matter-row-shell > .matter-item-head {
  grid-column: 2;
  grid-row: 1;
}

@media (max-width: 960px) {
  .matter-row-shell,
  .child-matter .matter-row-shell {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .matter-row-shell > .tree-toggle,
  .matter-row-shell > .tree-spacer {
    width: 30px;
  }

  .toggle-label {
    display: none;
  }

  .child-summary {
    max-width: 100%;
    justify-content: flex-start;
  }

  .matter-title-row {
    display: grid;
  }
}

/* Hotfix: parent-child row title must occupy the full content column. */
.matter-row-shell > .matter-item-head {
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
}

.matter-row-shell > .matter-item-head .tree-cell {
  width: 100%;
  min-width: 0;
}

.matter-row-shell .matter-title-block,
.matter-row-shell .matter-title-row {
  min-width: 0;
}

.matter-row-shell .matter-name {
  width: 100%;
  min-width: 0;
  word-break: normal;
  overflow-wrap: anywhere;
}

.matter-row-shell .matter-meta span,
.matter-row-shell .status,
.matter-row-shell .pill,
.next-card-kicker span,
.next-card-meta span,
.next-card .status,
.next-card .badge {
  white-space: nowrap;
  word-break: keep-all;
}

/* 30-day execution view: optimized for deciding what to do next. */
.app[data-module="next30"] {
  grid-template-columns: 244px minmax(0, 1fr) 0;
}

.app[data-module="next30"] .inspector {
  display: none;
}

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

.next-hero {
  align-items: stretch;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.next-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(78px, 1fr));
  gap: 8px;
  min-width: 420px;
}

.next-summary-grid div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #dbe5ec;
  border-radius: var(--radius);
  background: #f8fbfd;
}

.next-summary-grid span {
  color: var(--muted);
  font-size: 11px;
}

.next-summary-grid strong {
  font-size: 22px;
  line-height: 1.1;
}

.next-active-view {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid #d6e1ea;
  border-radius: var(--radius);
  background: #f8fbfd;
}

.next-active-view > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.next-active-view strong {
  color: var(--text);
  font-size: 13px;
}

.next-active-view em {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #dbe5ec;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-style: normal;
  font-weight: 650;
  white-space: nowrap;
}

.next-active-view .btn {
  height: 30px;
  flex: 0 0 auto;
}

.next-advice {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dbe5ec;
  border-radius: var(--radius);
  background: #fbfdff;
}

.next-advice-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.next-advice-title span {
  color: var(--text);
  font-weight: 650;
}

.next-advice-title b {
  font-weight: 650;
}

.next-advice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.next-advice-card {
  min-height: 86px;
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 10px;
  border: 1px solid #d6e1ea;
  border-left-width: 4px;
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
}

.next-advice-card:hover {
  background: #f8fbfd;
  border-color: #bed0df;
}

.next-advice-card span {
  color: var(--muted);
  font-size: 12px;
}

.next-advice-card strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
}

.next-advice-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.next-advice-card.danger {
  border-left-color: var(--danger);
}

.next-advice-card.warning {
  border-left-color: var(--warning);
}

.next-advice-card.info {
  border-left-color: var(--brand);
}

.next-group {
  display: grid;
  gap: 8px;
}

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

.next-group-head h3 {
  margin: 0;
  font-size: 15px;
}

.next-group-head span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

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

.next-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dbe5ec;
  border-left-width: 4px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 4px 14px rgba(25, 42, 57, 0.04);
}

.next-card.overdue {
  border-left-color: var(--danger);
  background: #fffafa;
}

.next-card.week {
  border-left-color: var(--warning);
}

.next-card.month {
  border-left-color: var(--brand);
}

.next-card.selected {
  box-shadow: inset 0 0 0 1px rgba(31, 111, 235, 0.35), 0 8px 20px rgba(23, 105, 210, 0.08);
}

.next-card-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.next-card-kicker,
.next-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.next-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
}

.next-card-path {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.next-more {
  margin-top: 8px;
  min-height: 44px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px dashed #cbd8e2;
  border-radius: var(--radius);
  background: #f8fbfd;
  color: var(--muted);
  font-size: 12px;
}

.next-more.compact {
  justify-content: center;
}

.next-more .btn {
  height: 30px;
  flex: 0 0 auto;
}

.danger-text {
  color: var(--danger);
  font-weight: 650;
}

@media (max-width: 960px) {
  .next-hero,
  .next-card {
    display: grid;
  }

  .next-summary-grid {
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .next-advice-grid {
    grid-template-columns: 1fr;
  }

  .next-active-view {
    align-items: flex-start;
    flex-direction: column;
  }

  .next-card {
    grid-template-columns: 1fr;
  }

  .next-card-actions {
    justify-content: flex-start;
  }

  .next-more {
    align-items: flex-start;
    flex-direction: column;
  }
}

.overview-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-color: #c9d9e8;
  background: #f7fbff;
}

.overview-action h2 {
  margin-bottom: 4px;
}

.overview-action .btn {
  min-width: 132px;
  justify-content: center;
}

@media (max-width: 720px) {
  .overview-action {
    display: grid;
  }
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid #d6e1ea;
  border-radius: 999px;
  background: #fff;
}

.segmented button {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
}

.segmented button span {
  margin-left: 4px;
  opacity: 0.8;
}

.next-scope-toggle {
  margin-top: 10px;
}

.next-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.next-bucket-toggle button.active {
  background: #1f6feb;
}

.owner-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.owner-focus > span {
  font-weight: 650;
  color: var(--text);
}

.owner-focus button {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid #d6e1ea;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.owner-focus button.active {
  background: var(--danger-soft);
  border-color: rgba(186, 42, 58, 0.22);
  color: var(--danger);
}

.owner-focus b {
  margin-left: 2px;
}

.owner-focus em {
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(186, 42, 58, 0.1);
  color: var(--danger);
  font-style: normal;
  font-size: 11px;
}

.age-focus button.active {
  background: #fff0d9;
  border-color: rgba(184, 111, 0, 0.24);
  color: var(--warning);
}

.dept-focus button.active {
  background: var(--info-soft);
  border-color: rgba(15, 118, 110, 0.22);
  color: var(--info);
}
