:root {
  --bg: #f3f6fa;
  --panel: #fff;
  --ink: #102036;
  --muted: #5d6f85;
  --accent: #1167b1;
  --line: #dbe4ee;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: linear-gradient(180deg, #102036 0%, #142943 100%);
  color: #fff;
  padding: 22px 16px;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  padding: 4px;
  flex: 0 0 auto;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #b8c4d3;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.nav-group {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 9px;
  background: rgba(255, 255, 255, .03);
  padding: 6px;
}

.nav-group summary {
  list-style: none;
  padding: 10px 10px;
  border-radius: 7px;
  cursor: pointer;
  color: #eef6ff;
  font-weight: 700;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary::after {
  content: "⌄";
  float: right;
  color: #8db8dd;
}

.nav-group[open] summary::after {
  content: "⌃";
}

.nav-group button,
.nav-group a {
  margin-top: 4px;
  padding-left: 18px;
}

nav a,
nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #d4dfed;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

nav a.active,
nav a:hover,
nav button.active,
nav button:hover {
  background: #eef6ff;
  color: #0f3966;
  font-weight: 700;
}

main {
  min-height: 100vh;
  margin-left: 260px;
  padding: 28px;
}

header {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.header-actions button {
  white-space: nowrap;
  min-width: max-content;
}

.current-user {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.login-panel {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  box-shadow: 0 20px 55px rgba(16, 32, 54, .08);
}

.login-brand {
  display: grid;
  gap: 10px;
}

.login-logo {
  width: 92px;
  height: 92px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
  padding: 8px;
}

.form-error {
  border: 1px solid #f5b5ae;
  background: #fff1f0;
  color: #b42318;
  border-radius: 7px;
  padding: 10px 12px;
}

h1,
h2,
p {
  margin-top: 0;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
}

button:hover {
  border-color: #a8c4de;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.draft-button {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.primary-light {
  background: #eef6ff;
  border-color: #b9d8f4;
  color: var(--accent);
}

.danger {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}

.danger-light {
  background: #fff5f5;
  border-color: #fecaca;
  color: #b42318;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 20px;
}

.panel {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 24px;
}

.hero-panel {
  margin-top: 0;
}

#pageHint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

.page-rule-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-rule-link:hover {
  border: 0;
  color: #0f4f88;
}

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

.panel-head h2 {
  min-width: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.top-workflow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.top-workflow-grid .panel {
  margin: 0;
}

.top-workflow-grid .todo-list {
  grid-template-columns: 1fr;
  max-height: 260px;
  overflow: auto;
}

.todo-panel {
  border-color: #bdd7f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.copied-panel {
  border-color: #c8e6d2;
  background: linear-gradient(180deg, #ffffff 0%, #f7fcf9 100%);
}

.todo-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.todo-item {
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 14px;
  border-color: #cbdff2;
  background: #fff;
}

.todo-item:hover {
  border-color: #7ab4e6;
  box-shadow: 0 8px 24px rgba(15, 64, 110, .08);
}

.todo-action-item {
  border: 1px solid #cbdff2;
  border-radius: 8px;
}

.copied-item:hover {
  border-color: #8bd2a4;
}

.todo-open {
  display: grid;
  gap: 6px;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
}

.todo-open:hover {
  box-shadow: none;
}

.copy-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.copy-actions button {
  min-height: 30px;
  padding: 5px 10px;
}

.copy-read {
  opacity: .72;
}

.copy-read-note {
  color: var(--muted);
  font-size: 12px;
}

.copied-filter {
  min-width: 112px;
}

.todo-type {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.todo-item strong {
  color: #07182b;
}

.todo-item em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.todo-item .badge {
  justify-self: start;
}

.todo-empty {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .top-workflow-grid {
    grid-template-columns: 1fr;
  }
}

.dashboard-filter-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid #cbdff2;
  border-radius: 10px;
  background: rgba(248, 251, 255, .96);
  box-shadow: 0 10px 26px rgba(15, 64, 110, .08);
  backdrop-filter: blur(8px);
}

.dashboard-filter-bar > div {
  display: grid;
  gap: 4px;
  align-self: center;
}

.dashboard-filter-bar strong {
  color: #07182b;
  font-size: 18px;
}

.dashboard-filter-bar > div span {
  color: var(--muted);
  font-size: 12px;
}

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

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.dashboard-filter {
  align-items: center;
}

.dashboard-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

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

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

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

.dashboard-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.mini-table-wrap {
  max-height: 280px;
}

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

@media (max-width: 1100px) {
  .dashboard-summary .dashboard-grid.two {
    grid-template-columns: 1fr;
  }
}

.dashboard-summary .mini-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.dashboard-summary .mini-table th,
.dashboard-summary .mini-table td {
  padding: 6px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dashboard-summary .mini-table .dashboard-bar {
  min-width: 0;
  width: 100%;
  max-width: 118px;
}

.mini-table th,
.mini-table td {
  font-size: 13px;
}

.dashboard-bar {
  display: inline-flex;
  align-items: center;
  min-width: 118px;
  height: 20px;
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: #e8f0f8;
  color: #0f3559;
}

.dashboard-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: #8fc5ee;
}

.dashboard-bar b {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
  font-size: 12px;
}

.chart-card {
  overflow: hidden;
}

.pie-chart-card {
  overflow: hidden;
}

.line-chart svg {
  display: block;
  width: 100%;
  height: auto;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.line-chart text {
  font-size: 12px;
  fill: var(--muted);
}

.line-chart .chart-value {
  font-size: 10px;
  font-weight: 700;
  fill: #17324d;
}

.chart-axis {
  stroke: #b7c6d6;
  stroke-width: 1;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.pie-chart {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.pie-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.pie-svg {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  justify-self: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pie-summary-list {
  display: grid;
  gap: 6px;
  align-content: start;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pie-summary-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  color: #17324d;
  font-size: 13px;
  line-height: 1.35;
}

.pie-summary-item i {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
}

.pie-summary-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pie-summary-item strong {
  white-space: nowrap;
}

.pie-top-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  min-height: 26px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.pie-top-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-top-legend i {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pie-slice {
  stroke: #ffffff;
  stroke-width: 1.2;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.pie-slice:hover {
  filter: brightness(1.06);
  opacity: 0.92;
}

.pie-label-line {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1;
}

.pie-label text {
  fill: #17324d;
  font-size: 12px;
  font-weight: 600;
}

.pie-center-title {
  fill: var(--muted);
  font-size: 13px;
}

.pie-center-value {
  fill: var(--text);
  font-size: 16px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .pie-layout {
    grid-template-columns: 1fr;
  }

  .pie-svg {
    max-width: 100%;
  }

  .pie-label text {
    font-size: 11px;
  }
}

.access-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.role-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.role-pill {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.role-pill span {
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}

.role-pill button {
  justify-self: start;
}

.access-user-table {
  min-width: 980px;
}

.permission-matrix {
  min-width: 1180px;
}

.permission-matrix th,
.permission-matrix td {
  text-align: center;
  vertical-align: middle;
}

.permission-matrix .sticky-col {
  text-align: left;
  min-width: 260px;
}

.permission-matrix small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.matrix-module-row td {
  background: #eef6ff;
  color: #0f3966;
  font-weight: 800;
  text-align: left;
}

.matrix-cell input {
  width: 15px;
  min-height: 15px;
}

.master-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.master-tabs button {
  background: #f8fafc;
}

.master-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

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

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

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

.config-card h3 {
  margin: 0 0 5px;
  font-size: 17px;
}

.config-card p {
  margin: 0;
  font-size: 13px;
}

.finance-subject-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.finance-subject-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.finance-subject-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.finance-subject-card-head h3 {
  margin: 0 0 5px;
  font-size: 17px;
}

.finance-subject-card-head p {
  margin: 0;
  font-size: 13px;
}

.finance-subject-tree {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.finance-subject-node {
  display: grid;
  gap: 8px;
}

.finance-subject-children {
  display: grid;
  gap: 8px;
  margin-left: 18px;
  padding-left: 14px;
  border-left: 2px solid #dbeafe;
}

.finance-subject-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #d7e5f4;
  border-radius: 8px;
  background: #fff;
}

.finance-subject-row.disabled {
  background: #f8fafc;
  color: #64748b;
}

.finance-subject-name {
  min-width: 0;
}

.finance-subject-name strong {
  display: inline;
  color: #08213d;
}

.finance-subject-name small {
  display: block;
  margin-top: 3px;
  color: #74849a;
}

.level-mark {
  display: inline-flex;
  justify-content: center;
  min-width: 30px;
  margin-right: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.finance-subject-actions {
  justify-content: flex-end;
}

.option-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

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

.workflow-card {
  display: grid;
  gap: 12px;
}

.workflow-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.automation-rule-table {
  min-width: 1580px;
}

.automation-rule-table .automation-long-cell {
  max-width: 360px;
  white-space: normal;
  line-height: 1.5;
}

.automation-log-table {
  min-width: 1320px;
}

.automation-log-table th:nth-child(1),
.automation-log-table td:nth-child(1) {
  width: 150px;
}

.automation-log-action,
.automation-log-remark {
  max-width: 300px;
  white-space: normal;
  line-height: 1.5;
}

.workflow-card h3 {
  margin: 0 0 6px;
}

.workflow-card p {
  margin: 0;
}

.workflow-steps {
  display: grid;
  gap: 8px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 28px minmax(92px, 1fr) minmax(76px, auto);
  gap: 8px;
  align-items: center;
  border: 1px solid #e2edf7;
  border-radius: 8px;
  background: #f8fbff;
  padding: 9px 10px;
}

.workflow-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #dcecff;
  color: #155fa0;
  font-weight: 700;
}

.workflow-step em {
  justify-self: end;
  color: #155fa0;
  font-style: normal;
  font-size: 13px;
}

.workflow-step small {
  grid-column: 2 / 4;
  color: var(--muted);
}

.workflow-edit-table {
  min-width: 1120px;
}

.workflow-edit-table input,
.workflow-edit-table select {
  min-height: 34px;
  padding: 6px 8px;
}

.workflow-edit-table input[type="checkbox"] {
  width: 15px;
  min-height: 15px;
}

.option-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #e6edf5;
  border-radius: 7px;
  background: #fff;
}

.option-row span {
  font-weight: 700;
}

.option-row small,
.muted-option {
  color: var(--muted);
}

.mini-empty {
  padding: 14px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: #334155;
}

.table-wrap table th,
.table-wrap table td {
  padding: 5px 10px;
  vertical-align: middle;
  line-height: 1.25;
}

.table-wrap table button {
  min-height: 28px;
  padding: 4px 8px;
  line-height: 18px;
}

.table-wrap table input:not([type="checkbox"]),
.table-wrap table select {
  min-height: 28px;
  height: 28px;
  padding: 3px 8px;
  font-size: 13px;
  line-height: 18px;
}

.table-wrap table input[type="checkbox"] {
  width: 14px;
  min-height: 14px;
  height: 14px;
}

.table-wrap .table-inline-input {
  height: 28px;
  padding: 3px 8px;
}

.table-wrap .customer-tags-summary {
  min-height: 28px;
  height: 28px;
  padding: 3px 7px;
}

.table-wrap .tag-pill {
  padding: 1px 6px;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

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

.color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color);
  margin-right: 6px;
  vertical-align: -1px;
}

.modal {
  margin: 0;
  background: #fff;
  width: min(760px, calc(100vw - 40px));
}

.modal.wide-mode {
  width: min(1180px, calc(100vw - 56px));
}

.modal.detail-mode {
  width: min(1380px, calc(100vw - 56px));
  height: min(820px, calc(100vh - 56px));
  display: flex;
  flex-direction: column;
}

.modal.target-mode {
  width: min(1500px, calc(100vw - 56px));
  height: min(820px, calc(100vh - 56px));
  display: flex;
  flex-direction: column;
}

.modal.column-settings-mode {
  width: min(720px, calc(100vw - 48px));
}

.modal.flow-rule-mode {
  width: min(860px, calc(100vw - 48px));
}

.modal.field-rule-mode {
  width: min(1040px, calc(100vw - 48px));
}

.modal.import-result-mode {
  width: min(980px, calc(100vw - 48px));
}

dialog {
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 24px 90px rgba(15, 23, 42, .28);
}

dialog::backdrop {
  background: rgba(15, 23, 42, .45);
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-actions {
  justify-content: flex-end;
  gap: 8px;
  border-bottom: 0;
  border-top: 1px solid var(--line);
}

.modal-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.modal-body.detail-body {
  display: block;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.modal-body.target-body {
  display: block;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.modal.column-settings-mode .modal-body {
  display: block;
  max-height: min(620px, calc(100vh - 180px));
  overflow: auto;
}

.modal.flow-rule-mode .modal-body {
  display: block;
  max-height: min(680px, calc(100vh - 160px));
  overflow: auto;
}

.modal.field-rule-mode .modal-body {
  display: block;
  max-height: min(720px, calc(100vh - 160px));
  overflow: auto;
}

.modal.import-result-mode .modal-body {
  display: block;
  max-height: min(680px, calc(100vh - 160px));
  overflow: auto;
}

.import-result-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.import-result-summary div {
  padding: 14px 16px;
  border: 1px solid #dbe8f6;
  border-radius: 8px;
  background: #f8fbff;
}

.import-result-summary strong {
  display: block;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.15;
}

.import-result-summary span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.import-result-table-wrap {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-result-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.import-result-table th,
.import-result-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.import-result-table th {
  background: #f6f9fc;
  color: var(--ink);
  white-space: nowrap;
}

.import-result-table td:last-child {
  white-space: normal;
  word-break: break-word;
}

.flow-rule-content {
  display: grid;
  gap: 12px;
}

.flow-rule-brief {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #cfe3f7;
  border-radius: 8px;
  background: #f5f9ff;
  color: #31506f;
}

.flow-rule-brief strong {
  display: block;
  margin-bottom: 6px;
  color: #17324d;
  font-size: 17px;
}

.flow-rule-brief p {
  margin: 0;
  color: #31506f;
  line-height: 1.7;
}

.flow-rule-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.flow-rule-highlights span {
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid #b9d8f4;
  border-radius: 999px;
  background: #fff;
  color: #0f4f88;
  font-size: 13px;
  line-height: 1.5;
}

.flow-rule-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff;
}

.flow-rule-section h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px;
  font-size: 17px;
}

.flow-rule-section h3 span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #eef6ff;
  color: var(--accent);
  font-size: 13px;
}

.flow-rule-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #263b55;
}

.flow-rule-list li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  margin: 9px 0;
  line-height: 1.7;
}

.flow-rule-list li > span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  place-items: center;
  border-radius: 50%;
  background: #f1f5f9;
  color: #58708c;
  font-size: 12px;
}

.flow-rule-list p {
  margin: 0;
  color: #263b55;
}

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

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

.column-setting-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 240px;
  font-weight: 700;
}

.column-setting-row input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  accent-color: var(--accent);
}

.column-setting-row label span {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.column-setting-row .actions {
  flex: 0 0 auto;
}

.column-reset-button {
  margin-top: 10px;
}

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

.field span,
.check-field {
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  min-height: 38px;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  min-height: 38px;
  background: #fff;
  font: inherit;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.check-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.check-field input {
  width: 15px;
  min-height: 15px;
}

.choice-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.choice-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid #cbd8e6;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  user-select: none;
}

.choice-pill input {
  width: 14px;
  min-height: 14px;
  accent-color: var(--accent);
}

.choice-pill:has(input:checked) {
  border-color: #7ab4e6;
  background: #eef6ff;
  color: #0f3966;
  font-weight: 700;
}

.multi-dropdown {
  position: relative;
}

.multi-dropdown summary {
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.multi-dropdown summary::-webkit-details-marker {
  display: none;
}

.multi-dropdown summary::after {
  content: "v";
  float: right;
  color: var(--muted);
}

.multi-dropdown[open] summary::after {
  content: "^";
}

.multi-dropdown-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  margin-top: 8px;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.inline-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.supplier-search-box {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.inline-picker input {
  flex: 1;
}

.supplier-search-box input {
  width: 100%;
}

.inline-picker button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.supplier-option-list {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
}

.supplier-option {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.supplier-option:hover,
.supplier-option.active {
  background: #eaf4ff;
}

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

.supplier-option span,
.supplier-option-empty {
  color: var(--muted);
  font-size: 12px;
}

.supplier-option-empty {
  padding: 10px;
}

.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.quick-supplier-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

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

.quick-supplier-grid .field:has(textarea),
.quick-supplier-grid .field.full {
  grid-column: 1 / -1;
}

.supplier-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.supplier-info-grid b {
  color: var(--text);
  font-weight: 600;
}

.attachment-field {
  gap: 8px;
}

.attachment-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed #b8cadb;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.attachment-picker input {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
}

.attachment-picker b {
  color: var(--accent);
}

.attachment-picker em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-item {
  display: inline-flex;
  align-items: center;
  max-width: 360px;
  border: 1px solid #cbdff2;
  border-radius: 999px;
  overflow: hidden;
  background: #eef6ff;
}

.attachment-link,
.attachment-download,
.attachment-legacy,
.attachment-remove {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  color: #155fa0;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-link {
  max-width: 240px;
}

.attachment-download {
  flex-shrink: 0;
  border-left: 1px solid #cbdff2;
  background: #f8fbff;
  font-size: 12px;
}

.attachment-legacy {
  max-width: 260px;
  border: 1px solid #cbdff2;
  border-radius: 999px;
  background: #eef6ff;
}

.attachment-remove {
  border: 1px solid #ffd3d3;
  border-radius: 999px;
  background: #fff5f5;
  color: #b42318;
  cursor: pointer;
}

.attachment-preview-modal {
  width: min(1080px, calc(100vw - 48px));
  height: min(760px, calc(100vh - 48px));
}

.attachment-preview-body {
  flex: 1;
  min-height: 520px;
  padding: 0;
  background: #f8fafc;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.attachment-preview-frame {
  width: 100%;
  height: 100%;
  min-height: 560px;
  border: 0;
  background: #fff;
}

.attachment-preview-image {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  object-fit: contain;
}

.attachment-preview-media {
  width: min(900px, 100%);
  max-height: calc(100vh - 180px);
}

.attachment-preview-empty {
  max-width: 460px;
  padding: 40px;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}

.attachment-preview-empty strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  margin-bottom: 8px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #b8cadb;
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.compact-filter {
  grid-template-columns: minmax(150px, 180px);
  justify-content: end;
}

[data-finance-transfer-filter] {
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 150px);
  justify-content: stretch;
}

[data-generic-resource-filter="inputInvoices"],
[data-generic-resource-filter="outputInvoices"] {
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 200px) minmax(120px, 150px);
  justify-content: stretch;
}

[data-finance-transfer-filter] > *,
[data-generic-resource-filter="inputInvoices"] > *,
[data-generic-resource-filter="outputInvoices"] > * {
  min-width: 0;
  width: 100%;
}

@media (max-width: 600px) {
  [data-finance-transfer-filter] {
    grid-template-columns: minmax(0, 1fr) 120px;
  }

  [data-generic-resource-filter="inputInvoices"],
  [data-generic-resource-filter="outputInvoices"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  [data-generic-resource-filter="inputInvoices"] > input[name="keyword"],
  [data-generic-resource-filter="outputInvoices"] > input[name="keyword"] {
    grid-column: 1 / -1;
  }
}

.panel-finance-order .panel-head {
  align-items: flex-start;
}

.panel-finance-order .list-head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.finance-order-filter {
  grid-template-columns: minmax(190px, 1.2fr) repeat(4, minmax(130px, 1fr)) minmax(120px, 0.8fr) minmax(120px, 0.8fr) minmax(115px, 130px);
  justify-content: stretch;
  max-width: none;
  margin-left: 0;
}

.filter-field {
  display: grid;
  gap: 4px;
}

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

.filter-field input {
  min-height: 38px;
}

.dashboard-filter-bar .filter-field input,
.dashboard-filter-bar .filter-field select {
  min-height: 38px;
  font-size: 14px;
  line-height: 20px;
}

.data-table th,
.data-table td {
  white-space: nowrap;
}

.employee-overview-head {
  flex-wrap: wrap;
  gap: 12px;
}

.employee-overview-month {
  width: 180px;
  max-width: 100%;
}

.report-table-wrap {
  margin-top: 12px;
}

.report-table-scroll {
  max-height: calc((var(--report-visible-rows, 15) * 40px) + 46px);
  overflow: auto;
}

.report-table-scroll .report-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 4;
}

.report-table-scroll .report-table th:first-child {
  z-index: 5;
}

.report-table th:not(:first-child),
.report-table td:not(:first-child) {
  text-align: right;
}

.report-table td:first-child,
.report-table th:first-child {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}

.report-table th:first-child {
  background: #f8fafc;
  z-index: 3;
}

.select-col {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
}

.select-col input {
  width: 15px;
  min-height: 15px;
}

.selectable-table .select-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
}

.selectable-table th.select-col {
  z-index: 4;
  background: #f8fafc;
}

.selectable-table .sticky-col {
  left: 44px;
}

.selectable-table .second-sticky {
  left: 214px;
}

.list-head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.supplier-filter {
  grid-template-columns: minmax(260px, 360px) minmax(150px, 180px);
  justify-content: space-between;
}

.supplier-table {
  min-width: 1280px;
}

.supplier-table .supplier-product-cell {
  max-width: 180px;
}

.supplier-table .supplier-invoice-cell {
  max-width: 420px;
}

.supplier-table .supplier-remark-cell {
  max-width: 180px;
}

.supplier-table .supplier-product-cell,
.supplier-table .supplier-invoice-cell,
.supplier-table .supplier-remark-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-table {
  min-width: 2100px;
}

.opportunity-table {
  min-width: 1720px;
}

.pi-table {
  min-width: 2100px;
}

.sales-order-table {
  min-width: 2380px;
}

.production-table {
  min-width: 2520px;
}

.production-table .sticky-col {
  min-width: 96px;
  max-width: 96px;
  width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selectable-table.production-table .second-sticky,
.production-table .second-sticky {
  left: 140px;
  min-width: 180px;
  max-width: 180px;
  width: 180px;
}

.production-table .content-col {
  overflow: hidden;
  text-overflow: ellipsis;
}

.production-no-cell {
  min-width: 170px;
  white-space: nowrap;
}

.production-no-cell .flow-pending-badge {
  vertical-align: middle;
}

.table-inline-input {
  width: 100%;
  min-width: 112px;
  height: 32px;
  border: 1px solid #cbdff2;
  border-radius: 6px;
  background: #fff;
  padding: 4px 8px;
  color: var(--text);
}

.production-inline-select {
  min-width: 118px;
}

.production-inline-date {
  min-width: 132px;
}

.production-inline-text {
  min-width: 360px;
}

.customer-inline-select {
  min-width: 136px;
}

.customer-tags-editor {
  position: relative;
  min-width: 170px;
}

.customer-tags-summary {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  height: 32px;
  min-width: 160px;
  max-width: 220px;
  border: 1px solid #cbdff2;
  border-radius: 6px;
  background: #fff;
  padding: 4px 8px;
  color: #155fa0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.customer-tags-floating {
  position: fixed;
  z-index: 1200;
  display: grid;
  gap: 4px;
  border: 1px solid #cbdff2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  padding: 8px;
}

.customer-tags-floating-title {
  padding: 2px 4px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.customer-tags-floating-list {
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
}

.customer-tag-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.customer-tag-option:hover {
  background: #f1f7fd;
}

.customer-tag-option:has(input:checked) {
  background: #eef6ff;
  color: #0f3966;
  font-weight: 700;
}

.customer-tag-option input {
  width: 14px;
  min-height: 14px;
  padding: 0;
  border-radius: 3px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

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

.tag-pill.compact {
  padding: 2px 7px;
  font-size: 12px;
}

.shipment-table {
  min-width: 2180px;
}

.target-table,
.target-edit-table {
  min-width: 1880px;
}

.target-table th,
.target-table td,
.target-edit-table th,
.target-edit-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.target-name-col {
  min-width: 150px;
}

.target-month-input {
  width: 116px;
  min-width: 116px;
}

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

.target-year-field {
  width: 180px;
}

.year-input {
  width: 112px;
}

.target-summary {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
}

.customer-table th,
.customer-table td {
  vertical-align: middle;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 170px;
  background: #fff;
}

th.sticky-col {
  z-index: 3;
  background: #f8fafc;
}

.sticky-action {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 174px;
  min-width: 174px;
  background: #fff;
}

th.sticky-action {
  z-index: 3;
  background: #f8fafc;
}

.customer-action-col {
  width: 134px;
  min-width: 134px;
  max-width: 134px;
}

.public-customer-action-col {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
}

.customer-action-col .actions,
.public-customer-action-col .actions {
  white-space: nowrap;
}

.opportunity-action-col {
  width: 160px;
  min-width: 160px;
}

.pi-action-col {
  width: 286px;
  min-width: 286px;
}

.sales-order-action-col {
  width: 130px;
  min-width: 130px;
}

.production-action-col {
  width: 150px;
  min-width: 150px;
}

.shipment-action-col {
  width: 160px;
  min-width: 160px;
}

.second-sticky {
  left: 170px;
  min-width: 260px;
}

th.second-sticky {
  z-index: 3;
}

.sales-order-table .sticky-col {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selectable-table.sales-order-table .second-sticky,
.sales-order-table .second-sticky {
  left: 264px;
  width: 150px;
  min-width: 150px;
  max-width: 150px;
}

.sales-order-table .sticky-col .link-btn,
.sales-order-table .second-sticky .link-btn {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-table {
  min-width: 2580px;
}

.purchase-table .sticky-col {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selectable-table.purchase-table .second-sticky,
.purchase-table .second-sticky {
  left: 172px;
  width: 128px;
  min-width: 128px;
  max-width: 128px;
}

.purchase-table .sticky-col .link-btn,
.purchase-table .second-sticky .link-btn {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-action-col {
  width: 230px;
  min-width: 230px;
}

.purchase-action-col .actions {
  flex-wrap: nowrap;
}

.purchase-action-col button {
  white-space: nowrap;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  padding: 10px 14px;
}

.table-total {
  color: var(--text);
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pager button {
  min-height: 32px;
  padding: 6px 10px;
}

.content-col {
  max-width: 360px;
  white-space: normal;
  line-height: 1.45;
}

.link-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: #1d75cf;
}

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

.danger-text {
  color: #b42318;
}

.detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  min-height: 100%;
}

.detail-main {
  min-width: 0;
}

.workflow-log-panel {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: calc(min(820px, calc(100vh - 56px)) - 116px);
  overflow: auto;
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.workflow-log-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.workflow-log-head h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.workflow-log-link {
  padding: 0;
}

.workflow-log-meta {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.workflow-log-list {
  position: relative;
  display: grid;
  gap: 12px;
}

.workflow-log-list::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #dbe7f3;
}

.workflow-log-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
}

.workflow-log-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: 8px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  background: #fff;
}

.workflow-log-item.done .workflow-log-dot {
  border-color: #10b981;
  background: #10b981;
}

.workflow-log-item.active .workflow-log-dot {
  border-color: #0b6fc6;
  background: #dff1ff;
}

.workflow-log-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.workflow-log-item.done .workflow-log-card {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.workflow-log-item.active .workflow-log-card {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.workflow-log-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.workflow-log-title strong {
  min-width: 0;
  font-size: 14px;
}

.workflow-log-title span {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 2px 8px;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
}

.workflow-log-item.done .workflow-log-title span {
  background: #dcfce7;
  color: #047857;
}

.workflow-log-item.active .workflow-log-title span {
  background: #dbeafe;
  color: #1d4ed8;
}

.workflow-log-sub,
.workflow-log-line,
.workflow-log-time,
.workflow-log-remark {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.workflow-log-time {
  color: #334155;
}

.workflow-log-remark {
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  color: var(--text);
}

.approval-rate-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f0f7ff;
  padding: 12px;
  margin-bottom: 14px;
}

.approval-rate-field {
  min-width: 240px;
  margin: 0;
}

.approval-rate-bar .subtle {
  margin: 0 0 8px;
}

.detail-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.detail-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.detail-tabs button.active {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.detail-tab-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 12px;
}

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

.detail-field {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
  min-height: 72px;
}

.detail-field span {
  color: var(--muted);
  font-size: 13px;
}

.detail-field strong {
  font-size: 15px;
  font-weight: 600;
  word-break: break-word;
}

.detail-attachment-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.detail-attachment-panel h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

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

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

.detail-attachment-field span {
  color: var(--muted);
  font-size: 13px;
}

.detail-attachment-field strong {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.detail-table th,
.detail-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  text-align: left;
}

.detail-table th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 4px 2px 0;
  border: 1px solid color-mix(in srgb, var(--tag) 36%, #fff);
  border-radius: 999px;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--tag) 12%, #fff);
  color: #122033;
}

.tag-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tag);
}

.follow-cell {
  display: inline-block;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.customer-table .tag-pill,
.customer-table .customer-tags-summary {
  white-space: nowrap;
}

.customer-table .customer-tags-summary {
  flex-wrap: nowrap;
  overflow: hidden;
}

.note {
  margin: 12px 0 0;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  border: 1px solid transparent;
}

.badge.info {
  background: #eef6ff;
  border-color: #bfdbfe;
  color: #155fa0;
}

.badge.success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.badge.muted {
  color: #58708c;
  background: #eef3f8;
  border-color: #d6e2ee;
}

.badge.danger-soft {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b42318;
}

.badge.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.badge.flow-pending-badge {
  margin-left: 6px;
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
  font-weight: 700;
}

.flow-pending-row td {
  background: #fffaf0;
}

.flow-pending-row .sticky-col,
.flow-pending-row .select-col,
.flow-pending-row .sticky-action {
  background: #fffaf0;
}

.flow-pending-row .select-col {
  box-shadow: inset 4px 0 0 #f59e0b;
}

.flow-pending-row:hover td,
.flow-pending-row:hover .sticky-col,
.flow-pending-row:hover .select-col,
.flow-pending-row:hover .sticky-action {
  background: #fff3d6;
}

.production-done td {
  background: #ecfdf5;
}

.production-active td {
  background: #fff7ed;
}

.production-pending td {
  background: #fef2f2;
}

.production-done .sticky-col,
.production-done .select-col,
.production-done .sticky-action {
  background: #ecfdf5;
}

.production-active .sticky-col,
.production-active .select-col,
.production-active .sticky-action {
  background: #fff7ed;
}

.production-pending .sticky-col,
.production-pending .select-col,
.production-pending .sticky-action {
  background: #fef2f2;
}

.purchase-row-done td {
  background: #ecfdf5;
}

.purchase-row-warning td {
  background: #fffbeb;
}

.purchase-row-danger td {
  background: #fef2f2;
}

.purchase-row-done .sticky-col,
.purchase-row-done .select-col,
.purchase-row-done .sticky-action {
  background: #ecfdf5;
}

.purchase-row-warning .sticky-col,
.purchase-row-warning .select-col,
.purchase-row-warning .sticky-action {
  background: #fffbeb;
}

.purchase-row-danger .sticky-col,
.purchase-row-danger .select-col,
.purchase-row-danger .sticky-action {
  background: #fef2f2;
}

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

.form-section-title {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding: 10px 0 6px;
  color: var(--accent);
  font-weight: 800;
  border-bottom: 1px solid #cfe3f7;
}

.product-items-field {
  gap: 10px;
}

.product-items-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-items-head .note {
  margin: 0;
}

.product-items-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-items-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

.product-items-table th,
.product-items-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  white-space: nowrap;
}

.product-items-table th {
  background: #f8fafc;
  color: #17324d;
  font-size: 13px;
}

.product-items-table td:nth-child(1),
.product-items-table td:nth-child(2) {
  min-width: 190px;
}

.product-items-table td:nth-child(3),
.product-items-table td:nth-child(4),
.product-items-table td:nth-child(5),
.product-items-table td:nth-child(6) {
  min-width: 110px;
}

.product-items-table input {
  min-height: 34px;
  padding: 7px 8px;
}

.readonly-items .product-items-wrap {
  background: #f8fafc;
}

.readonly-items .product-items-table input {
  background: #eef3f8;
  color: #476178;
  cursor: not-allowed;
}

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

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

.required-mark {
  margin-left: 4px;
  color: #dc2626;
  font-style: normal;
  font-weight: 800;
}

.field-rule-table {
  min-width: 1120px;
}

.field-rule-table td:nth-child(5) {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-rule-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.field-rule-form-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  text-align: left;
  border: 1px solid #d7e5f4;
  border-radius: 8px;
  background: #f8fbff;
}

.field-rule-form-card:hover {
  border-color: #7cb5ef;
  background: #eef7ff;
}

.field-rule-form-title {
  color: #08213d;
  font-size: 18px;
  font-weight: 800;
}

.field-rule-form-meta,
.field-rule-form-summary {
  color: #5b6b82;
  font-size: 13px;
}

.field-rule-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-rule-matrix-wrap {
  margin-top: 14px;
  max-height: min(520px, calc(100vh - 320px));
  overflow: auto;
}

.field-rule-matrix {
  min-width: 720px;
}

.field-rule-matrix th:not(:first-child),
.field-rule-matrix td:not(:first-child) {
  width: 110px;
  text-align: center;
}

.field-rule-matrix td:first-child {
  min-width: 260px;
}

.field-rule-matrix td strong {
  display: block;
  color: #08213d;
  white-space: normal;
}

.field-rule-matrix td small {
  display: block;
  margin-top: 4px;
  color: #74849a;
  font-size: 12px;
}

.field-rule-readonly input,
.field-rule-readonly select,
.field-rule-readonly textarea {
  background: #f4f7fb;
  color: #667085;
}

.dialog-note.full,
.summary-list.full {
  grid-column: 1 / -1;
}

.summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 170px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.summary-list span {
  padding: 5px 8px;
  border: 1px solid #cfe3f7;
  border-radius: 6px;
  background: #fff;
  color: #193650;
  font-size: 13px;
}

li {
  margin: 8px 0;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
  }

  main {
    margin-left: 0;
  }

  header,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics,
  .modal-body,
  .dashboard-filter-bar {
    grid-template-columns: 1fr;
  }

  .modal.detail-mode {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
  }

  .modal.target-mode {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
  }

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

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

  .workflow-log-panel {
    position: static;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 16px 0 0;
  }

  .finance-subject-layout,
  .finance-subject-row {
    grid-template-columns: 1fr;
  }

  .finance-subject-actions {
    justify-content: flex-start;
  }

  .target-summary {
    grid-template-columns: 1fr;
  }
}
