:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #657181;
  --line: #dce2ea;
  --teal: #0f766e;
  --teal-soft: #e6f4f1;
  --blue: #2563eb;
  --amber: #b7791f;
  --rose: #b42318;
  --green: #237a57;
  --shadow: 0 16px 40px rgba(20, 35, 55, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  color: var(--ink);
  background: var(--bg);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    Arial,
    sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(860px, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #17202a;
  color: #fff;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #e7b044;
  color: #17202a;
  font-weight: 800;
  font-size: 22px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
}

.brand p,
.database-status p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  text-align: left;
}

.nav-tab.active,
.nav-tab:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.1);
}

.database-status {
  position: absolute;
  right: 18px;
  bottom: 24px;
  left: 18px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.status-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 99px;
  background: #48d597;
  box-shadow: 0 0 0 5px rgba(72, 213, 151, 0.14);
}

.main {
  padding: 28px;
  overflow: hidden;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-header h2,
.section-heading h3 {
  margin: 4px 0 0;
}

.page-header h2 {
  font-size: 28px;
}

.section-heading h3 {
  font-size: 20px;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.primary-btn,
.ghost-btn,
.small-btn {
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-btn {
  padding: 10px 14px;
  color: #fff;
  background: var(--teal);
}

.ghost-btn {
  padding: 10px 14px;
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.ghost-btn.danger {
  color: var(--rose);
}

.small-btn {
  padding: 7px 9px;
  color: var(--teal);
  border-color: #b7d8d2;
  background: var(--teal-soft);
  font-size: 12px;
}

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

.dashboard-warning-banner {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 13px 16px;
  border: 1px solid #f3c064;
  border-left: 6px solid var(--amber);
  border-radius: 8px;
  background: #fff8e6;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 24px rgba(183, 121, 31, 0.12);
}

.dashboard-warning-banner:hover {
  background: #fff4d6;
}

.dashboard-warning-banner .banner-kicker {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #17202a;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.dashboard-warning-banner strong {
  flex: 1 1 auto;
  font-size: 16px;
}

.dashboard-warning-banner span:last-child {
  flex: 0 0 auto;
  color: #7a5515;
  font-size: 13px;
  font-weight: 800;
}

.metric-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(20, 35, 55, 0.05);
}

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

.metric-card strong {
  display: block;
  margin-top: 9px;
  font-size: 24px;
}

.metric-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.tree-workspace,
.form-panel,
.approval-panel,
.table-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tree-workspace:fullscreen {
  padding: 14px;
  background: var(--bg);
}

.tree-workspace.fullscreen-mode {
  position: fixed;
  inset: 12px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}

.tree-workspace.fullscreen-mode .tree-toolbar {
  flex: 0 0 auto;
}

.tree-workspace:fullscreen .tree-layout,
.tree-workspace.fullscreen-mode .tree-layout {
  flex: 1 1 auto;
  height: calc(100vh - 88px);
  min-height: 0;
}

.tree-toolbar,
.library-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.zoom-control {
  display: inline-flex;
  align-items: center;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.zoom-control button {
  width: 38px;
  height: 38px;
  border: 0;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.zoom-control button:hover {
  background: #eef2f6;
}

.zoom-control span {
  min-width: 52px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.tree-action-group {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.tree-toolbar .tree-action-group .ghost-btn,
.tree-toolbar .tree-action-group .primary-btn,
.tree-toolbar > .ghost-btn {
  height: 40px;
  padding: 8px 12px;
  white-space: nowrap;
}

.tree-name-only {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tree-name-only input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.search-box {
  display: flex;
  min-width: 330px;
  flex: 1;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search-box.wide {
  min-width: 420px;
}

.search-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.search-box input {
  border: 0;
  outline: 0;
  padding: 4px 0;
}

select {
  width: auto;
  min-width: 150px;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

.tree-layout {
  display: grid;
  grid-template-columns: 240px minmax(480px, 1fr) 300px;
  height: calc(100vh - 280px);
  min-height: 520px;
}

.search-panel,
.detail-panel {
  overflow: auto;
  background: #fbfcfd;
}

.search-panel {
  border-right: 1px solid var(--line);
}

.detail-panel {
  border-left: 1px solid var(--line);
}

.panel-title {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.panel-title span {
  color: var(--muted);
}

.search-results {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.result-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.result-item.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.result-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

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

.tree-board {
  overflow: auto;
  background:
    linear-gradient(#edf2f6 1px, transparent 1px),
    linear-gradient(90deg, #edf2f6 1px, transparent 1px),
    #ffffff;
  background-size: 28px 28px;
}

.path-rail {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 58px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
}

.path-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.path-steps {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.path-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  max-width: 230px;
  padding: 7px 9px;
  border: 1px solid #cfdbe7;
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.path-step.active {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.step-index {
  display: grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 99px;
  background: #e8eef5;
  color: #234;
  font-size: 12px;
  font-weight: 900;
}

.path-step.active .step-index {
  background: var(--teal);
  color: #fff;
}

.step-body {
  min-width: 0;
}

.step-name,
.step-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.step-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.path-arrow {
  color: #90a2b5;
  font-weight: 900;
}

.path-chip {
  padding: 7px 9px;
  border: 1px solid #b7d8d2;
  border-radius: 8px;
  font-size: 12px;
}

.equity-tree {
  min-width: 1280px;
  padding: 18px 24px 56px;
  transform-origin: top left;
}

.tree-list,
.tree-list ul {
  margin: 0;
  padding-left: 56px;
  list-style: none;
}

.tree-list > li {
  padding-left: 0;
}

.tree-node-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 46px;
}

.tree-node-wrap::before {
  position: absolute;
  left: -50px;
  width: 50px;
  height: 1px;
  background: #b9c6d3;
  content: "";
}

.tree-list > li > .tree-node-wrap::before {
  display: none;
}

.tree-list ul {
  position: relative;
}

.tree-list ul::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 6px;
  width: 1px;
  background: #b9c6d3;
  content: "";
}

.tree-node {
  width: 330px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #cdd7e2;
  border-left: 7px solid #94a3b8;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.12),
    0 8px 18px rgba(20, 35, 55, 0.08);
}

.tree-node.level-1 {
  background: #ecfdf5;
}

.tree-node.level-2 {
  background: #eff6ff;
}

.tree-node.level-3 {
  background: #fff7ed;
}

.tree-node.level-4,
.tree-node.level-5 {
  background: #f7fbf9;
}

.tree-node.relation-wholly {
  border-color: #86efac;
  border-left-color: #16a34a;
  box-shadow:
    inset 0 0 0 1px rgba(22, 163, 74, 0.2),
    0 8px 18px rgba(20, 35, 55, 0.08);
}

.tree-node.relation-control {
  border-color: #93c5fd;
  border-left-color: #2563eb;
  box-shadow:
    inset 0 0 0 1px rgba(37, 99, 235, 0.2),
    0 8px 18px rgba(20, 35, 55, 0.08);
}

.tree-node.relation-minority {
  border-color: #fbbf24;
  border-left-color: #d97706;
  box-shadow:
    inset 0 0 0 1px rgba(217, 119, 6, 0.22),
    0 8px 18px rgba(20, 35, 55, 0.08);
}

.tree-node.relation-actual {
  border-color: #c4b5fd;
  border-left-color: #7c3aed;
  box-shadow:
    inset 0 0 0 1px rgba(124, 58, 237, 0.2),
    0 8px 18px rgba(20, 35, 55, 0.08);
}

.tree-node.relation-branch {
  border-color: #cbd5e1;
  border-left-color: #64748b;
  box-shadow:
    inset 0 0 0 1px rgba(100, 116, 139, 0.2),
    0 8px 18px rgba(20, 35, 55, 0.08);
}

.tree-node.relation-other {
  border-color: #cbd5e1;
  border-left-color: #94a3b8;
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.18),
    0 8px 18px rgba(20, 35, 55, 0.08);
}

.tree-node.selected {
  outline: 3px solid rgba(15, 118, 110, 0.2);
}

.tree-node.match {
  background: #fff9e8;
  outline: 2px solid rgba(228, 181, 77, 0.35);
}

.node-head {
  display: flex;
  align-items: center;
  gap: 7px;
}

.toggle {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  font-weight: 800;
}

.toggle.placeholder {
  visibility: hidden;
}

.node-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
  line-height: 1.25;
  font-size: 13px;
}

.node-content {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.node-meta {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 0;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.node-meta span {
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(205, 215, 226, 0.75);
}

.node-meta .level-badge {
  background: #17202a;
  color: #fff;
  border-color: #17202a;
}

.node-code {
  display: block;
  margin-top: 4px;
  color: #718096;
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
}

.detail-card {
  padding: 16px;
}

.detail-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.identity-strip {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid #bfd6d2;
  border-radius: 8px;
  background: var(--teal-soft);
}

.identity-strip span,
.identity-strip em {
  color: #47716c;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.identity-strip strong {
  color: #053f3a;
  font-family: Consolas, "Courier New", monospace;
}

.detail-grid {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.detail-field {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.detail-field strong,
.detail-field p {
  margin: 0;
  overflow-wrap: anywhere;
}

.shareholders-field {
  grid-column: 1 / -1;
}

.shareholder-list {
  display: grid;
  gap: 7px;
}

.shareholder-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fbfcfd;
}

.shareholder-item strong {
  font-size: 13px;
}

.shareholder-item em {
  padding: 4px 7px;
  border-radius: 99px;
  background: #fff5d6;
  color: var(--amber);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.children-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.child-link {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(520px, 0.95fr) minmax(420px, 1.05fr);
  gap: 16px;
}

.warning-layout {
  display: grid;
  grid-template-columns: minmax(440px, 0.85fr) minmax(520px, 1.15fr);
  gap: 16px;
  margin-bottom: 16px;
}

.form-panel,
.approval-panel,
.warning-panel,
.warning-results {
  padding: 18px;
}

.warning-panel,
.warning-results {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.request-form {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

.warning-form {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

.warning-condition-builder {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.condition-builder-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

.warning-condition-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1.15fr) minmax(96px, 0.75fr) minmax(90px, 0.75fr) 58px;
  gap: 8px;
  align-items: center;
}

.warning-condition-row select,
.warning-condition-row input {
  min-width: 0;
  padding: 9px 10px;
  font-size: 13px;
}

.warning-condition-row .condition-joiner {
  font-weight: 800;
  color: var(--blue);
}

.icon-text-btn {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.icon-text-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.warning-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.form-row.single-col {
  grid-template-columns: 1fr;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

label input,
label select,
label textarea {
  padding: 10px 11px;
  color: var(--ink);
  font-weight: 400;
}

.request-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.request-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.request-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.request-card h4 {
  margin: 0;
  font-size: 16px;
}

.status-pill {
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 99px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.pending {
  background: #fff5d6;
  color: var(--amber);
}

.status-pill.approved {
  background: #e5f6ef;
  color: var(--green);
}

.status-pill.rejected {
  background: #fde8e5;
  color: var(--rose);
}

.request-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.request-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.inline-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.inline-check input {
  width: auto;
}

.warning-rule-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  max-height: 430px;
  overflow: auto;
}

.warning-rule-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: 8px;
  background: #fff;
}

.warning-rule-card.disabled {
  opacity: 0.58;
}

.warning-rule-card header,
.warning-results-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.warning-rule-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.severity-pill {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.severity-pill.high {
  background: #fde8e5;
  color: var(--rose);
}

.severity-pill.medium {
  background: #fff5d6;
  color: var(--amber);
}

.severity-pill.low {
  background: #e5f6ef;
  color: var(--green);
}

.warning-rule-count {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-top: 12px;
}

.warning-rule-count strong {
  font-size: 24px;
}

.warning-rule-count span {
  color: var(--muted);
}

.warning-rule-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.warning-results {
  padding: 0;
  overflow: hidden;
}

.warning-results-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.warning-result-list {
  max-height: calc(100vh - 430px);
  min-height: 260px;
  overflow: auto;
}

.warning-result-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(150px, 0.7fr) minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.warning-result-row:nth-child(even) {
  background: #fbfcfd;
}

.warning-company strong,
.warning-result-row strong {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.warning-company span,
.warning-result-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.library-filters {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  align-items: stretch;
}

.library-filters .search-box {
  flex: 2 1 420px;
}

.library-filters select {
  flex: 1 1 150px;
  min-width: 145px;
}

.library-filters .ghost-btn {
  min-height: 40px;
  white-space: nowrap;
}

.advanced-filter-panel {
  flex: 1 1 100%;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d6e3e1;
  border-radius: 8px;
  background: #f7fbfa;
}

.advanced-filter-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--ink);
}

.advanced-filter-head span,
.advanced-empty {
  color: var(--muted);
  font-size: 13px;
}

.advanced-rules {
  display: grid;
  gap: 8px;
}

.advanced-rule {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(130px, 0.75fr) minmax(220px, 1.4fr) auto;
  gap: 8px;
  align-items: center;
}

.advanced-rule select,
.advanced-rule input {
  width: 100%;
  min-width: 0;
}

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

.table-shell {
  overflow: hidden;
}

.library-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.library-summary strong {
  color: var(--ink);
}

.library-header,
.library-main {
  display: grid;
  grid-template-columns: minmax(340px, 1.5fr) repeat(6, minmax(98px, 0.7fr));
  gap: 14px;
  align-items: center;
}

.library-header {
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #f4f7f8;
  color: #53626c;
  font-size: 13px;
  font-weight: 900;
}

.library-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-list {
  max-height: calc(100vh - 250px);
  overflow: auto;
}

.library-row {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.library-row:nth-child(even) {
  background: #fbfcfd;
}

.library-main {
  width: 100%;
  padding: 16px 18px;
  border: 0;
  background: transparent;
  text-align: left;
}

.library-main:hover {
  background: #f3f8fb;
}

.library-row.open .library-main {
  background: #edf8f5;
}

.library-company strong {
  display: block;
  overflow-wrap: anywhere;
  color: #111827;
  font-size: 17px;
  line-height: 1.35;
}

.library-company span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.library-code {
  color: #07534d !important;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 800;
}

.library-cell {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
}

.library-extra {
  display: none;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 10px;
  padding: 0 18px 18px;
}

.library-row.open .library-extra {
  display: grid;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .database-status {
    position: static;
    margin-top: 16px;
  }

  .main {
    padding: 16px;
  }

  .metric-grid,
  .workbench-grid,
  .warning-layout,
  .warning-result-row,
  .warning-condition-row,
  .form-row {
    grid-template-columns: 1fr;
  }

  .tree-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .search-panel,
  .detail-panel {
    max-height: 280px;
    border: 0;
  }

  .tree-board {
    min-height: 520px;
  }

  .library-header,
  .library-main,
  .library-extra {
    grid-template-columns: 1fr;
  }

  .library-header {
    display: none;
  }

  .advanced-rule {
    grid-template-columns: 1fr;
  }

  .tree-toolbar,
  .library-filters,
  .dashboard-warning-banner,
  .page-header {
    flex-direction: column;
  }

  select,
  .search-box,
  .search-box.wide {
    width: 100%;
    min-width: 0;
  }
}
