:root {
  color-scheme: light;
  --sidebar-width: 224px;
  --sidebar-collapsed: 68px;
  --topbar-height: 52px;
  --tabbar-height: 40px;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f4f8;
  --text: #202737;
  --text-2: #515d70;
  --text-3: #8993a4;
  --line: #e7eaf0;
  --line-strong: #d9dee8;
  --primary: #2f6cf6;
  --primary-hover: #245ddc;
  --primary-soft: #edf3ff;
  --success: #0d9f78;
  --success-soft: #eaf8f3;
  --warning: #d88412;
  --warning-soft: #fff7e8;
  --danger: #df4d5c;
  --danger-soft: #fff0f2;
  --violet: #6c5dd3;
  --violet-soft: #f1efff;
  --teal: #0e8f9a;
  --teal-soft: #e9f8f9;
  --shadow-sm: 0 1px 2px rgba(23, 32, 52, 0.04);
  --shadow-md: 0 10px 30px rgba(24, 35, 58, 0.1);
  --shadow-drawer: -18px 0 44px rgba(22, 31, 49, 0.14);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

body.theme-dark {
  color-scheme: dark;
  --bg: #151922;
  --surface: #1d222d;
  --surface-2: #222936;
  --surface-3: #29313f;
  --text: #edf1f7;
  --text-2: #b6bfce;
  --text-3: #7f8999;
  --line: #2d3543;
  --line-strong: #3a4454;
  --primary: #6f9cff;
  --primary-hover: #86acff;
  --primary-soft: #263754;
  --success: #48c9a4;
  --success-soft: #203c36;
  --warning: #f1b75c;
  --warning-soft: #42351f;
  --danger: #ff7c89;
  --danger-soft: #46282e;
  --violet: #a99df7;
  --violet-soft: #332f50;
  --teal: #55c6cf;
  --teal-soft: #213d43;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.28);
  --shadow-drawer: -18px 0 44px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 13px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

svg {
  display: block;
}

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

.icon.sm {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.icon.lg {
  width: 20px;
  height: 20px;
  flex-basis: 20px;
}

.app {
  width: 100%;
  height: 100vh;
  display: flex;
  background: var(--bg);
}

.sidebar {
  position: relative;
  z-index: 14;
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  transition: width 240ms var(--ease), flex-basis 240ms var(--ease), transform 240ms var(--ease);
}

.brand {
  height: 68px;
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--primary) 25%, transparent);
}

.brand-copy,
.org-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.brand-copy strong,
.org-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span,
.org-copy span {
  overflow: hidden;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-fold {
  margin-left: auto;
}

.icon-button {
  position: relative;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-3);
}

.icon-button:active {
  transform: scale(0.94);
}

.icon-button.has-dot::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--danger);
  border: 1px solid var(--surface);
}

.nav-search-wrap {
  position: relative;
  height: 50px;
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
}

.nav-search-icon {
  position: absolute;
  left: 23px;
  z-index: 1;
  color: var(--text-3);
  pointer-events: none;
}

.nav-search {
  width: 100%;
  height: 32px;
  padding: 0 34px 0 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.nav-search::placeholder {
  color: var(--text-3);
}

.nav-search:focus {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 9%, transparent);
}

kbd {
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-3);
  font-family: inherit;
  font-size: 10px;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

.nav-search-wrap > kbd {
  position: absolute;
  right: 20px;
  pointer-events: none;
}

.side-nav {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px 8px 14px;
  scrollbar-gutter: stable;
}

.side-nav::-webkit-scrollbar,
.table-viewport::-webkit-scrollbar,
.drawer-body::-webkit-scrollbar,
.dashboard-scroll::-webkit-scrollbar,
.command-results::-webkit-scrollbar,
.column-menu-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.side-nav::-webkit-scrollbar-thumb,
.table-viewport::-webkit-scrollbar-thumb,
.drawer-body::-webkit-scrollbar-thumb,
.dashboard-scroll::-webkit-scrollbar-thumb,
.command-results::-webkit-scrollbar-thumb,
.column-menu-list::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: color-mix(in srgb, var(--text-3) 38%, transparent);
}

.nav-empty {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  color: var(--text-3);
  font-size: 11px;
}

.nav-group {
  margin-top: 3px;
}

.nav-parent,
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease;
}

.nav-parent {
  height: 36px;
  gap: 10px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 650;
}

.nav-parent:hover,
.nav-parent.active-group {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-parent .nav-chevron {
  margin-left: auto;
  transition: transform 180ms var(--ease);
}

.nav-group.open .nav-chevron {
  transform: rotate(180deg);
}

.nav-children {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 220ms var(--ease);
}

.nav-group.open .nav-children {
  grid-template-rows: 1fr;
}

.nav-children-inner {
  min-height: 0;
  overflow: hidden;
}

.nav-item {
  position: relative;
  height: 33px;
  margin: 1px 0;
  padding: 0 10px 0 38px;
  font-size: 12px;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 21px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background-color 150ms ease, transform 150ms ease;
}

.nav-item:hover {
  color: var(--primary);
  background: var(--surface-2);
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 650;
}

.nav-item.active::before {
  background: var(--primary);
  transform: scale(1.4);
}

.nav-badge {
  min-width: 20px;
  height: 18px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
}

.sidebar-footer {
  height: 58px;
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
}

.org-avatar,
.user-avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 11px;
  font-weight: 750;
}

.org-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 13;
  display: none;
  background: rgba(20, 27, 42, 0.38);
  opacity: 0;
}

.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
  flex-basis: var(--sidebar-collapsed);
}

.sidebar-collapsed .brand {
  justify-content: center;
  padding: 0;
}

.sidebar-collapsed .brand-copy,
.sidebar-collapsed .sidebar-fold,
.sidebar-collapsed .nav-search,
.sidebar-collapsed .nav-search-wrap > kbd,
.sidebar-collapsed .nav-parent span:not(.nav-icon),
.sidebar-collapsed .nav-chevron,
.sidebar-collapsed .nav-children,
.sidebar-collapsed .org-copy,
.sidebar-collapsed .sidebar-footer .icon-button {
  display: none;
}

.sidebar-collapsed .nav-search-wrap {
  justify-content: center;
  padding: 9px 0;
}

.sidebar-collapsed .nav-search-icon {
  position: static;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
}

.sidebar-collapsed .side-nav {
  padding-inline: 8px;
}

.sidebar-collapsed .nav-parent {
  justify-content: center;
  padding: 0;
}

.sidebar-collapsed .sidebar-footer {
  justify-content: center;
  padding: 0;
}

.main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  flex: 0 0 var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-actions,
.breadcrumbs,
.tab-actions,
.toolbar-group,
.page-heading-actions,
.legend,
.legend-item,
.queue-meta,
.drawer-title-line,
.drawer-action-group {
  display: flex;
  align-items: center;
}

.topbar-left {
  min-width: 0;
}

.mobile-menu {
  display: none;
}

.breadcrumbs {
  min-width: 0;
  gap: 7px;
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.breadcrumbs span,
.breadcrumbs strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumbs strong {
  max-width: 260px;
  color: var(--text);
  font-weight: 650;
}

.breadcrumb-home {
  color: var(--text-3);
}

.topbar-actions {
  flex: 0 0 auto;
  gap: 4px;
}

.global-search {
  width: 250px;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
  padding: 0 7px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
  text-align: left;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.global-search:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.global-search > span:nth-child(2) {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 3px;
  padding: 0 7px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
}

.user-menu:hover {
  background: var(--surface-2);
}

.user-avatar {
  width: 26px;
  height: 26px;
  background: var(--violet-soft);
  color: var(--violet);
}

.user-name {
  font-size: 12px;
}

.tabbar {
  height: var(--tabbar-height);
  flex: 0 0 var(--tabbar-height);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.page-tabs {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  overflow: hidden;
}

.page-tab {
  position: relative;
  height: 34px;
  max-width: 180px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease;
}

.page-tab:hover {
  color: var(--text-2);
  background: var(--surface-2);
}

.page-tab.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 650;
}

.page-tab.active::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 0;
  left: 8px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
}

.page-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-close {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  color: var(--text-3);
}

.tab-close:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.tab-actions {
  height: 100%;
  flex: 0 0 auto;
  gap: 2px;
}

.content {
  flex: 1;
  min-height: 0;
  padding: 10px;
  background: var(--bg);
}

.workspace {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.view-enter {
  animation: viewEnter 300ms var(--ease) both;
}

@keyframes viewEnter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dashboard-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: var(--surface-2);
}

.page-heading {
  min-height: 44px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.page-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 720;
  line-height: 1.35;
}

.page-heading p {
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.45;
}

.page-heading-actions {
  flex: 0 0 auto;
  gap: 8px;
}

.control,
.tool-button,
.primary-button,
.secondary-button,
.danger-button,
.text-button {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.control,
.tool-button,
.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-2);
}

.control {
  min-width: 116px;
  padding-right: 28px;
}

.control:hover,
.tool-button:hover,
.secondary-button:hover {
  border-color: color-mix(in srgb, var(--primary) 46%, var(--line));
  color: var(--primary);
  background: var(--primary-soft);
}

.primary-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--primary) 20%, transparent);
}

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

.danger-button {
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-button:hover {
  border-color: var(--danger);
}

.text-button {
  height: 28px;
  padding: 0 7px;
  background: transparent;
  color: var(--primary);
}

.text-button:hover {
  background: var(--primary-soft);
}

.primary-button:active,
.secondary-button:active,
.danger-button:active,
.tool-button:active {
  transform: translateY(1px);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric-card {
  position: relative;
  min-width: 0;
  min-height: 112px;
  overflow: hidden;
  padding: 13px 13px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms var(--ease);
}

.metric-card:hover {
  border-color: color-mix(in srgb, var(--metric-color, var(--primary)) 32%, var(--line));
  box-shadow: 0 8px 20px rgba(24, 35, 58, 0.07);
  transform: translateY(-2px);
}

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

.metric-label {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 560;
}

.metric-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: color-mix(in srgb, var(--metric-color, var(--primary)) 10%, var(--surface));
  color: var(--metric-color, var(--primary));
}

.metric-value {
  margin-top: 8px;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(19px, 1.55vw, 25px);
  font-variant-numeric: tabular-nums;
  font-weight: 740;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-bottom {
  min-height: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.metric-change {
  color: var(--text-3);
  font-size: 11px;
  white-space: nowrap;
}

.metric-change strong {
  margin-right: 3px;
  color: var(--success);
  font-weight: 650;
}

.metric-change.down strong {
  color: var(--danger);
}

.sparkline {
  width: 68px;
  height: 22px;
  flex: 0 0 68px;
  color: var(--metric-color, var(--primary));
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.8fr);
  gap: 12px;
  margin-bottom: 12px;
}

.lower-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
  margin-bottom: 0;
}

.section-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.section-head {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

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

.section-title strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 680;
}

.section-title span {
  display: block;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 10px;
}

.segmented {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.segmented button {
  height: 24px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
}

.segmented button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 650;
}

.chart-body {
  height: 230px;
  padding: 12px 14px 8px;
}

.cash-chart {
  width: 100%;
  height: 174px;
  overflow: visible;
}

.chart-grid-line {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.chart-label {
  fill: var(--text-3);
  font-family: inherit;
  font-size: 10px;
}

.chart-line-income,
.chart-line-expense {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-income { stroke: var(--primary); }
.chart-line-expense { stroke: var(--success); }
.chart-area-income { fill: color-mix(in srgb, var(--primary) 9%, transparent); }

.chart-dot {
  fill: var(--surface);
  stroke-width: 2;
}

.legend {
  justify-content: flex-end;
  gap: 14px;
  margin-top: 3px;
}

.legend-item {
  gap: 6px;
  color: var(--text-3);
  font-size: 11px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.legend-dot.green { background: var(--success); }

.queue-list {
  padding: 3px 0;
}

.queue-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 13px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background-color 150ms ease;
}

.queue-item:hover {
  background: var(--surface-2);
}

.queue-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
}

.queue-icon.warning { background: var(--warning-soft); color: var(--warning); }
.queue-icon.danger { background: var(--danger-soft); color: var(--danger); }
.queue-icon.success { background: var(--success-soft); color: var(--success); }
.queue-icon.violet { background: var(--violet-soft); color: var(--violet); }

.queue-copy {
  min-width: 0;
  flex: 1;
}

.queue-copy strong,
.queue-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-copy strong {
  font-size: 12px;
  font-weight: 600;
}

.queue-copy span {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 10px;
}

.queue-meta {
  flex: 0 0 auto;
  gap: 7px;
}

.queue-count {
  min-width: 25px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.risk-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.risk-table th,
.risk-table td {
  height: 40px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.risk-table th {
  height: 34px;
  background: var(--surface-2);
  color: var(--text-3);
  font-weight: 580;
}

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

.risk-table tbody tr {
  cursor: pointer;
  transition: background-color 150ms ease;
}

.risk-table tbody tr:hover {
  background: var(--surface-2);
}

.account-list {
  padding: 5px 13px 9px;
}

.account-row {
  min-height: 47px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

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

.account-name {
  min-width: 0;
}

.account-name strong,
.account-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name strong {
  font-size: 12px;
  font-weight: 590;
}

.account-name span {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 10px;
}

.account-amount {
  text-align: right;
}

.account-amount strong {
  display: block;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.account-amount span {
  display: block;
  margin-top: 4px;
  color: var(--success);
  font-size: 10px;
}

.page-toolbar {
  position: relative;
  z-index: 6;
  min-height: 54px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.toolbar-group {
  min-width: 0;
  gap: 7px;
}

.toolbar-group.right {
  flex: 0 0 auto;
}

.search-field {
  position: relative;
  width: min(300px, 24vw);
  min-width: 210px;
  height: 32px;
  flex: 0 1 300px;
}

.search-field > span {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 1;
  color: var(--text-3);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 100%;
  padding: 0 29px 0 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.search-field input::placeholder {
  color: var(--text-3);
}

.search-field input:focus {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 8%, transparent);
}

.search-clear {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 18px;
  height: 18px;
  display: none;
  place-items: center;
  padding: 0;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-3);
}

.search-field.has-value .search-clear {
  display: grid;
}

.chip-scroll {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: auto hidden;
  scrollbar-width: none;
}

.chip-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  height: 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  white-space: nowrap;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.filter-chip:hover {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 20%, var(--line));
}

.filter-chip.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 18%, var(--primary-soft));
  font-weight: 650;
}

.chip-count {
  min-width: 15px;
  color: inherit;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  opacity: 0.72;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  flex: 0 0 1px;
  margin: 0 2px;
  background: var(--line);
}

.tool-button.icon-only {
  width: 32px;
  padding: 0;
}

.tool-button.active {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
  background: var(--primary-soft);
  color: var(--primary);
}

.advanced-filters {
  min-height: 0;
  display: grid;
  grid-template-rows: 0fr;
  flex: 0 0 auto;
  border-bottom: 0 solid var(--line);
  background: var(--surface-2);
  transition: grid-template-rows 220ms var(--ease), border-bottom-width 220ms var(--ease);
}

.advanced-filters.open {
  grid-template-rows: 1fr;
  border-bottom-width: 1px;
}

.advanced-inner {
  min-height: 0;
  overflow: hidden;
}

.advanced-content {
  min-height: 62px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px;
}

.filter-field {
  min-width: 130px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-field label {
  color: var(--text-3);
  font-size: 10px;
}

.filter-field input,
.filter-field select,
.drawer-note textarea {
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: none;
  background: var(--surface);
  color: var(--text-2);
  font-size: 11px;
}

.filter-field.amount-range {
  min-width: 210px;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 5px;
}

.range-inputs input {
  width: 88px;
}

.filter-actions {
  display: flex;
  gap: 7px;
  margin-left: auto;
}

.summary-strip {
  min-height: 46px;
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  overflow-x: auto;
}

.summary-item {
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px;
  border-right: 1px solid var(--line);
}

.summary-item:last-child {
  border-right: 0;
}

.summary-item > span:first-child {
  color: var(--text-3);
  font-size: 10px;
}

.summary-item strong {
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  white-space: nowrap;
}

.summary-item strong.primary { color: var(--primary); }
.summary-item strong.danger { color: var(--danger); }
.summary-item strong.success { color: var(--success); }
.summary-item strong.warning { color: var(--warning); }

.bulk-bar {
  min-height: 0;
  display: grid;
  grid-template-rows: 0fr;
  flex: 0 0 auto;
  background: var(--primary-soft);
  color: var(--primary);
  transition: grid-template-rows 200ms var(--ease);
}

.bulk-bar.show {
  grid-template-rows: 1fr;
}

.bulk-inner {
  min-height: 0;
  overflow: hidden;
}

.bulk-content {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  overflow-x: auto;
  scrollbar-width: none;
}

.bulk-content::-webkit-scrollbar {
  display: none;
}

.bulk-content > * {
  flex-shrink: 0;
}

.bulk-content strong {
  margin-right: 6px;
  font-size: 12px;
  white-space: nowrap;
}

.bulk-content .secondary-button {
  height: 28px;
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
}

.bulk-clear {
  margin-left: auto;
}

.table-wrap {
  position: relative;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.table-viewport {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
}

.data-table {
  width: 100%;
  min-width: var(--table-width, 1500px);
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: var(--text-2);
  font-size: 11px;
}

.data-table th,
.data-table td {
  height: 38px;
  padding: 0 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: height 150ms ease, background-color 130ms ease;
}

.data-table.compact th,
.data-table.compact td {
  height: 32px;
  padding-inline: 8px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 620;
  box-shadow: inset 0 -1px 0 var(--line);
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.th-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}

.sort-icon {
  width: 12px;
  height: 12px;
  color: var(--text-3);
  opacity: 0.45;
}

.sorted .sort-icon {
  color: var(--primary);
  opacity: 1;
}

.sort-desc .sort-icon {
  transform: rotate(180deg);
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
}

.data-table tbody tr:hover td {
  background: var(--primary-soft);
}

.data-table tbody tr.selected td {
  background: color-mix(in srgb, var(--primary-soft) 76%, var(--surface));
}

.data-table tbody tr.row-risk td:first-of-type {
  box-shadow: inset 2px 0 0 var(--danger);
}

.data-table .select-col,
.data-table .index-col {
  position: sticky;
  z-index: 3;
  text-align: center;
}

.data-table th.select-col,
.data-table th.index-col {
  z-index: 6;
}

.data-table .select-col {
  left: 0;
  width: 42px;
  padding: 0;
  background: var(--surface);
}

.data-table th.select-col {
  background: var(--surface-2);
}

.data-table .index-col {
  left: 42px;
  width: 44px;
  color: var(--text-3);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}

.data-table th.index-col {
  background: var(--surface-2);
}

.data-table tbody tr:nth-child(even) .select-col,
.data-table tbody tr:nth-child(even) .index-col {
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
}

.data-table tbody tr:hover .select-col,
.data-table tbody tr:hover .index-col,
.data-table tbody tr.selected .select-col,
.data-table tbody tr.selected .index-col {
  background: var(--primary-soft);
}

input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.cell-money {
  text-align: right !important;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.cell-link {
  color: var(--primary);
  font-weight: 560;
}

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

.amount-highlight {
  min-width: 36px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--danger);
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.status {
  min-width: 42px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status.success {
  border-color: color-mix(in srgb, var(--success) 20%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.status.warning {
  border-color: color-mix(in srgb, var(--warning) 22%, var(--line));
  background: var(--warning-soft);
  color: var(--warning);
}

.status.danger {
  border-color: color-mix(in srgb, var(--danger) 20%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.status.info {
  border-color: color-mix(in srgb, var(--primary) 20%, var(--line));
  background: var(--primary-soft);
  color: var(--primary);
}

.status.neutral {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--text-3);
}

.status.violet {
  border-color: color-mix(in srgb, var(--violet) 20%, var(--line));
  background: var(--violet-soft);
  color: var(--violet);
}

.muted-dash {
  color: var(--text-3);
}

.summary-row td {
  position: sticky;
  top: 38px;
  z-index: 2;
  height: 32px;
  background: var(--surface-3) !important;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.data-table.compact .summary-row td {
  top: 32px;
}

.table-empty {
  min-height: 300px;
  display: grid;
  place-items: center;
  padding: 30px;
  color: var(--text-3);
  text-align: center;
}

.empty-visual {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-3);
}

.table-empty strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text-2);
  font-size: 13px;
}

.table-empty p {
  margin: 0;
  font-size: 11px;
}

.table-footer {
  min-height: 42px;
  flex: 0 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-3);
  font-size: 11px;
}

.table-footer strong {
  color: var(--text-2);
  font-weight: 620;
}

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

.page-button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 11px;
}

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

.page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.column-menu {
  position: absolute;
  top: 47px;
  right: 12px;
  z-index: 12;
  width: 270px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px) scale(0.98);
  transform-origin: top right;
  transition: opacity 150ms ease, transform 180ms var(--ease), visibility 150ms ease;
}

.column-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.column-menu-head,
.column-menu-foot {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.column-menu-head strong {
  font-size: 12px;
}

.column-menu-list {
  max-height: 320px;
  overflow: auto;
  padding: 6px;
}

.column-option {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 7px;
  border-radius: 5px;
  color: var(--text-2);
  font-size: 11px;
}

.column-option:hover {
  background: var(--surface-2);
}

.column-menu-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.loading-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: blur(1px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms ease, visibility 150ms ease;
}

.loading-layer.show {
  opacity: 1;
  visibility: visible;
}

.loading-box {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow-md);
  font-size: 11px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

.drawer,
.command {
  position: fixed;
  inset: 0;
  z-index: 40;
  visibility: hidden;
  pointer-events: none;
}

.drawer.open,
.command.open {
  visibility: visible;
  pointer-events: auto;
}

.mask,
.command-mask {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(18, 25, 38, 0.38);
  opacity: 0;
  transition: opacity 220ms ease;
}

.drawer.open .mask,
.command.open .command-mask {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(780px, 96vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow-drawer);
  transform: translateX(100%);
  transition: transform 320ms var(--ease);
}

.drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-head {
  min-height: 72px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-title-wrap {
  min-width: 0;
}

.drawer-title-line {
  gap: 9px;
}

.drawer-title-line h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-title-wrap p {
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--text-3);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-tabs {
  height: 42px;
  flex: 0 0 42px;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-tab {
  position: relative;
  height: 42px;
  padding: 0 2px;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
}

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

.drawer-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--primary);
}

.drawer-body {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 14px 18px 24px;
  background: var(--surface-2);
}

.drawer-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.overview-item {
  min-width: 0;
  padding: 11px;
  border-right: 1px solid var(--line);
}

.overview-item:last-child {
  border-right: 0;
}

.overview-item span,
.overview-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-item span {
  color: var(--text-3);
  font-size: 10px;
}

.overview-item strong {
  margin-top: 7px;
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.risk-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 23%, var(--line));
  border-radius: 7px;
  background: var(--warning-soft);
  color: var(--warning);
}

.risk-banner strong {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
}

.risk-banner p {
  margin: 0;
  color: color-mix(in srgb, var(--warning) 72%, var(--text));
  font-size: 10px;
  line-height: 1.5;
}

.detail-section {
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.detail-section-head {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

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

.detail-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-row:nth-child(even) {
  border-right: 0;
}

.detail-row span {
  color: var(--text-3);
  font-size: 10px;
}

.detail-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 560;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.attachment {
  min-width: 0;
  height: 74px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.attachment-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
}

.attachment-copy {
  min-width: 0;
}

.attachment-copy strong,
.attachment-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-copy strong {
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
}

.attachment-copy span {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 9px;
}

.drawer-note {
  padding: 12px;
}

.drawer-note textarea {
  width: 100%;
  min-height: 72px;
  padding: 9px;
  resize: vertical;
  line-height: 1.5;
}

.timeline {
  padding: 16px 18px 8px;
}

.timeline-item {
  position: relative;
  min-height: 72px;
  padding: 0 0 16px 28px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: -7px;
  left: 7px;
  width: 1px;
  background: var(--line-strong);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  position: absolute;
  top: 1px;
  left: 0;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 35%, var(--line));
}

.timeline-item.pending .timeline-dot {
  background: var(--warning);
}

.timeline-item.future .timeline-dot {
  background: var(--line-strong);
}

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

.timeline-head strong {
  font-size: 11px;
  font-weight: 650;
}

.timeline-head span {
  color: var(--text-3);
  font-size: 9px;
}

.timeline-item p {
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.45;
}

.related-list {
  padding: 8px 12px;
}

.related-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

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

.related-row > span:first-child {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-3);
}

.related-copy {
  min-width: 0;
  flex: 1;
}

.related-copy strong,
.related-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-copy strong { font-size: 11px; }
.related-copy span { margin-top: 4px; color: var(--text-3); font-size: 9px; }

.drawer-foot {
  min-height: 58px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.drawer-foot-note {
  color: var(--text-3);
  font-size: 10px;
}

.drawer-action-group {
  gap: 8px;
}

.command {
  z-index: 60;
}

.command-mask {
  background: rgba(18, 25, 38, 0.48);
  backdrop-filter: blur(3px);
}

.command-panel {
  position: relative;
  z-index: 1;
  width: min(640px, calc(100vw - 30px));
  max-height: min(620px, calc(100vh - 80px));
  display: flex;
  flex-direction: column;
  margin: 9vh auto 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 26px 80px rgba(17, 24, 39, 0.22);
  opacity: 0;
  transform: translateY(-12px) scale(0.985);
  transition: opacity 180ms ease, transform 240ms var(--ease);
}

.command.open .command-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.command-input-wrap {
  height: 58px;
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.command-input-wrap > span {
  color: var(--text-3);
}

.command-input-wrap input {
  min-width: 0;
  height: 100%;
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.command-input-wrap input::placeholder {
  color: var(--text-3);
}

.command-results {
  min-height: 180px;
  max-height: 440px;
  overflow: auto;
  padding: 8px;
}

.command-section-label {
  padding: 8px 8px 5px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
}

.command-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  text-align: left;
}

.command-item:hover,
.command-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.command-item-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-3);
}

.command-item:hover .command-item-icon,
.command-item.active .command-item-icon {
  background: var(--surface);
  color: var(--primary);
}

.command-item-copy {
  min-width: 0;
  flex: 1;
}

.command-item-copy strong,
.command-item-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-item-copy strong {
  font-size: 12px;
  font-weight: 620;
}

.command-item-copy span {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 9px;
}

.command-empty {
  min-height: 170px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 11px;
}

.command-foot {
  height: 38px;
  flex: 0 0 38px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 9px;
}

.command-foot span:last-child {
  margin-left: auto;
}

.command-foot kbd {
  min-width: 17px;
  height: 17px;
  margin-right: 2px;
  padding: 0 3px;
  font-size: 8px;
}

.toast-stack {
  position: fixed;
  top: 64px;
  right: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow-md);
  font-size: 11px;
  opacity: 0;
  transform: translateX(18px);
  animation: toastIn 220ms var(--ease) forwards;
}

.toast.out {
  animation: toastOut 180ms ease forwards;
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--success-soft);
  color: var(--success);
}

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

@keyframes toastIn {
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(12px); }
}

@media (max-width: 1280px) {
  .global-search {
    width: 190px;
  }

  .toolbar-group.right .tool-button .button-label {
    display: none;
  }

  .toolbar-group.right .tool-button {
    width: 32px;
    padding: 0;
  }
}

@media (max-width: 920px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 1080px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    flex-basis: var(--sidebar-width);
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }

  .mobile-menu {
    display: inline-grid;
    margin-right: 5px;
  }

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

  .mobile-nav-open .sidebar-backdrop {
    display: block;
    opacity: 1;
  }

  .sidebar-collapsed .sidebar {
    width: var(--sidebar-width);
  }

  .sidebar-collapsed .brand-copy,
  .sidebar-collapsed .sidebar-fold,
  .sidebar-collapsed .nav-search,
  .sidebar-collapsed .nav-parent span:not(.nav-icon),
  .sidebar-collapsed .nav-chevron,
  .sidebar-collapsed .nav-children,
  .sidebar-collapsed .org-copy,
  .sidebar-collapsed .sidebar-footer .icon-button {
    display: initial;
  }

  .sidebar-collapsed .brand,
  .sidebar-collapsed .sidebar-footer {
    justify-content: flex-start;
    padding: 0 12px;
  }

  .sidebar-collapsed .nav-search-wrap {
    justify-content: flex-start;
    padding: 9px 12px;
  }

  .sidebar-collapsed .nav-search-icon {
    position: absolute;
    left: 23px;
    width: auto;
    height: auto;
    display: block;
    background: transparent;
  }

  .sidebar-collapsed .nav-search-wrap > kbd {
    display: inline-flex;
  }

  .sidebar-collapsed .nav-parent {
    justify-content: flex-start;
    padding: 0 9px;
  }

  .global-search {
    width: 34px;
    padding: 0;
    justify-content: center;
    background: transparent;
    border-color: transparent;
  }

  .global-search > span:nth-child(2),
  .global-search kbd,
  .user-name,
  #userChevron {
    display: none;
  }

  .dashboard-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .advanced-content {
    flex-wrap: wrap;
    align-items: flex-end;
  }

  .filter-actions {
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding-inline: 8px;
  }

  .topbar-actions {
    gap: 0;
  }

  #fullscreenBtn,
  .breadcrumbs > span:nth-of-type(-n+3) {
    display: none;
  }

  .user-menu {
    margin-left: 0;
    padding-inline: 3px;
  }

  .tabbar {
    padding-inline: 6px;
  }

  .content {
    padding: 6px;
  }

  .dashboard-scroll {
    padding: 12px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading-actions {
    overflow-x: auto;
  }

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

  .metric-card {
    min-height: 104px;
  }

  .metric-card:first-child {
    grid-column: 1 / -1;
  }

  .page-toolbar {
    min-height: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-group {
    width: 100%;
  }

  .toolbar-group.right {
    justify-content: flex-end;
  }

  .search-field {
    width: 190px;
    min-width: 190px;
    flex-basis: 190px;
  }

  .summary-strip {
    min-height: 42px;
  }

  .summary-item {
    min-width: 135px;
  }

  .table-footer > span:nth-child(2) {
    display: none;
  }

  .drawer-panel {
    width: 100vw;
  }

  .drawer-overview {
    grid-template-columns: repeat(2, 1fr);
  }

  .overview-item:nth-child(2) {
    border-right: 0;
  }

  .overview-item:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

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

  .detail-row,
  .detail-row:nth-child(even) {
    border-right: 0;
  }

  .attachment-list {
    grid-template-columns: 1fr;
  }

  .drawer-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .drawer-foot-note {
    display: none;
  }

  .drawer-action-group {
    width: 100%;
  }

  .drawer-action-group > button {
    flex: 1;
  }

  .toast-stack {
    right: 10px;
    left: 10px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card:first-child {
    grid-column: auto;
  }

  .chart-body {
    height: 210px;
  }

  .cash-chart {
    height: 155px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    padding-block: 10px;
  }

  .advanced-content {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-field,
  .filter-field.amount-range {
    width: 100%;
  }

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

  .command-foot span:last-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
