:root {
  --brand: #165dff;
  --brand-dark: #0e42d2;
  --brand-soft: #eef4ff;
  --accent: #0f766e;
  --accent-soft: #e8f7f5;
  --text-1: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --fill-1: #ffffff;
  --fill-2: #f7f8fa;
  --fill-3: #f2f3f5;
  --line-1: #f0f2f5;
  --line-2: #e5e6eb;
  --success: #00a870;
  --warning: #ff7d00;
  --danger: #f53f3f;
  --purple: #7b61ff;
  --shadow-card: 0 8px 22px rgba(15, 35, 95, 0.05);
  --shadow-layer: 0 18px 46px rgba(29, 33, 41, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: var(--text-1);
  background: #f5f7fa;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

body {
  min-width: 1180px;
}

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

button {
  cursor: pointer;
}

.topbar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(90deg, #1556ef, #0f766e);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.brand-badge {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-size: 11px;
  letter-spacing: 0;
}

.global-search {
  width: 250px;
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: inherit;
  background: rgba(255, 255, 255, 0.1);
  font-size: 13px;
  line-height: 1;
}

.icon-btn.light {
  color: var(--text-2);
  border-color: var(--line-2);
  background: #fff;
}

.user-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
}

.layout {
  display: grid;
  min-height: calc(100vh - 44px);
  grid-template-columns: 184px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
  border-right: 1px solid var(--line-1);
}

.menu-group-title {
  margin: 16px 16px 8px;
  color: var(--text-3);
  font-size: 12px;
}

.menu-wrap {
  display: grid;
  gap: 2px;
}

.menu-item {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--text-2);
  background: transparent;
  font-size: 14px;
  text-align: left;
}

.menu-item.active {
  color: var(--brand);
  background: rgba(22, 93, 255, 0.08);
  font-weight: 600;
}

.menu-item.disabled {
  color: #b7bec9;
  cursor: not-allowed;
}

.menu-icon {
  width: 14px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  font-size: 9px;
  line-height: 1;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--line-1);
  color: var(--text-3);
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 14px 16px 18px;
}

.breadcrumb {
  margin: 2px 2px 12px;
  color: var(--text-3);
  font-size: 12px;
}

.panel {
  min-height: calc(100vh - 88px);
  padding: 18px;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.page-title {
  margin: 0;
  color: var(--text-1);
  font-size: 20px;
  font-weight: 600;
}

.page-subtitle {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 12px;
}

.page-subtitle:empty,
.page-meta:empty,
.hint:empty {
  display: none;
}

.page-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 12px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 4px;
  border-bottom: 1px solid var(--line-2);
}

.tab-btn {
  position: relative;
  padding: 12px 0 11px;
  border: 0;
  color: var(--text-2);
  background: transparent;
  font-size: 14px;
}

.tab-btn.active {
  color: var(--brand);
  font-weight: 600;
}

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

.filter-card {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line-1);
  border-radius: 8px;
  background: #fff;
}

.filter-grid {
  display: grid;
  gap: 14px 16px;
  grid-template-columns: repeat(6, minmax(132px, 1fr));
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  color: var(--text-1);
  background: #fff;
  font-size: 12px;
}

.field input,
.field select {
  height: 30px;
  padding: 0 10px;
}

.field textarea {
  min-height: 72px;
  padding: 8px 10px;
  resize: vertical;
}

.field input[readonly],
.field select:disabled {
  color: var(--text-2);
  background: var(--fill-2);
}

.field.wide {
  grid-column: span 2;
}

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

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

.date-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.range-field {
  grid-column: span 2;
}

.radio-row,
.check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  min-height: 30px;
  color: var(--text-2);
  font-size: 12px;
}

.radio-row label,
.check-row label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}

.radio-row input,
.check-row input {
  width: auto;
  height: auto;
}

.action-row,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.action-row {
  margin-top: 14px;
}

.toolbar {
  margin-top: 14px;
}

.action-left,
.action-right,
.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  color: var(--text-2);
  background: #fff;
  font-size: 12px;
  white-space: nowrap;
}

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

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

.btn.danger {
  color: var(--danger);
  border-color: rgba(245, 63, 63, 0.28);
  background: rgba(245, 63, 63, 0.06);
}

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

.hint {
  color: var(--text-3);
  font-size: 12px;
}

.table-shell {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line-1);
  border-radius: 8px;
}

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

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-1);
  color: var(--text-2);
  font-size: 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #fafbfc;
  font-weight: 600;
}

tbody tr:hover {
  background: #fafcff;
}

.quote-nested-row td {
  padding: 0 12px 12px 48px;
  background: #fbfcff;
}

.quote-nested-row:hover {
  background: #fbfcff;
}

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

.nested-table {
  width: 100%;
  min-width: 720px;
}

.nested-table th,
.nested-table td {
  padding: 8px 10px;
  white-space: nowrap;
}

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

.nested-empty {
  padding: 12px 14px;
  border: 1px dashed var(--line-2);
  border-radius: 6px;
  color: var(--text-3);
  background: #fff;
}

.cell-strong {
  color: var(--text-1);
  font-weight: 500;
}

.link {
  padding: 0;
  border: 0;
  color: var(--brand);
  background: transparent;
  font-size: 12px;
  text-align: left;
}

.required {
  margin-right: 3px;
  color: var(--danger);
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.tag-blue {
  color: var(--brand);
  background: rgba(22, 93, 255, 0.1);
}

.tag-green {
  color: var(--success);
  background: rgba(0, 168, 112, 0.1);
}

.tag-orange {
  color: var(--warning);
  background: rgba(255, 125, 0, 0.1);
}

.tag-red {
  color: var(--danger);
  background: rgba(245, 63, 63, 0.1);
}

.tag-gray {
  color: var(--text-2);
  background: #f2f3f5;
}

.tag-purple {
  color: var(--purple);
  background: rgba(123, 97, 255, 0.1);
}

.op-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-btn {
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  color: var(--text-2);
  background: #fff;
  font-size: 12px;
}

.table-btn.primary {
  color: var(--brand);
  border-color: rgba(22, 93, 255, 0.28);
  background: rgba(22, 93, 255, 0.05);
}

.table-btn.accent {
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(15, 118, 110, 0.06);
}

.table-btn.danger {
  color: var(--danger);
  border-color: rgba(245, 63, 63, 0.28);
  background: rgba(245, 63, 63, 0.05);
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--text-2);
  font-size: 12px;
}

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

.page-item {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: #fff;
}

.page-item.active {
  color: var(--brand);
  border-color: var(--brand);
}

.mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  background: rgba(29, 33, 41, 0.45);
}

.mask.show {
  display: block;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  width: 760px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 48px);
  display: none;
  flex-direction: column;
  transform: translate(-50%, -50%);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-layer);
}

.modal.wide {
  width: 1040px;
}

.modal.quote-form-modal {
  width: min(1880px, calc(100vw - 64px));
}

.modal.quote-form-modal .modal-body {
  max-height: calc(100vh - 168px);
}

.modal.quote-form-modal .modal-footer {
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-desc,
.drawer-sub {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 12px;
}

.modal-desc:empty,
.drawer-sub:empty {
  display: none;
}

.modal-body {
  overflow: auto;
  padding: 18px 20px;
}

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

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

.quote-step-tabs {
  display: flex;
  gap: 22px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--line-2);
}

.quote-step-tab {
  position: relative;
  height: 38px;
  padding: 0;
  border: 0;
  color: var(--text-1);
  background: transparent;
  font-size: 14px;
}

.quote-step-tab.active {
  color: var(--brand);
  font-weight: 600;
}

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

.quote-project-settings {
  display: grid;
  grid-template-columns: 520px 90px 320px 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 8px 0 44px;
  font-size: 12px;
}

.quote-project-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.quote-icon-btn {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--brand);
  border-radius: 50%;
  color: var(--brand);
  background: #fff;
  font-size: 18px;
  line-height: 1;
}

.quote-icon-btn.square {
  border-radius: 5px;
  font-size: 13px;
}

.quote-project-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-1);
}

.quote-project-table {
  width: 100%;
  min-width: 1760px;
  border-collapse: collapse;
}

.quote-project-table th,
.quote-project-table td {
  height: 44px;
  padding: 8px 10px;
  border-right: 1px solid var(--line-1);
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

.quote-project-table th:last-child,
.quote-project-table td:last-child {
  border-right: 0;
}

.quote-project-table .group-head th,
.quote-project-table .item-head th {
  background: #dceeff;
  color: var(--text-2);
  font-weight: 600;
}

.quote-project-table .group-row td {
  background: #fff;
}

.quote-project-table .detail-row:nth-child(even) td {
  background: #f5fbff;
}

.quote-project-table .check-col {
  width: 38px;
  text-align: center;
}

.quote-project-table .num,
.quote-project-table .money {
  text-align: right;
}

.quote-project-table .negative {
  color: #f00;
}

.quote-project-table .project-input {
  width: 78px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: #fff;
  text-align: center;
}

.quote-project-table .ghost-input {
  width: 100%;
  min-width: 72px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 12px;
}

.quote-attachment-row {
  display: grid;
  grid-template-columns: 42px auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 70px 0 22px;
  font-size: 12px;
}

.quote-attachment-box {
  height: 104px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: #fff;
}

.quote-total-box {
  width: 240px;
  margin: 8px 120px 0 auto;
  display: grid;
  gap: 12px;
  color: var(--text-2);
  font-size: 12px;
}

.quote-total-box div {
  display: flex;
  justify-content: space-between;
}

.modal-footer,
.drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 20px 18px;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: 1080px;
  max-width: calc(100vw - 48px);
  display: none;
  background: #f5f7fa;
  box-shadow: var(--shadow-layer);
}

.drawer.show {
  display: flex;
  flex-direction: column;
}

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

.drawer-title {
  color: var(--text-1);
  font-size: 18px;
  font-weight: 600;
}

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 18px 20px;
  background: #f5f7fa;
}

.drawer-section-card {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line-1);
  border-radius: 8px;
  background: #fff;
}

.section-title {
  margin: 0 0 12px;
  color: var(--text-1);
  font-size: 14px;
  font-weight: 600;
}

.section-title:first-child {
  margin-top: 0;
}

.info-grid {
  display: grid;
  gap: 10px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-item {
  min-height: 46px;
}

.info-label {
  color: var(--text-3);
  font-size: 12px;
}

.info-value {
  margin-top: 5px;
  color: var(--text-1);
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
}

.approval-flow {
  display: flex;
  align-items: flex-start;
  gap: 46px;
  margin-top: 18px;
  padding: 12px 0 2px;
}

.approval-node {
  min-width: 220px;
  text-align: center;
}

.approval-check {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 50%;
  color: #fff;
  background: #63c33b;
  font-size: 28px;
  font-weight: 700;
}

.approval-title {
  color: var(--text-1);
  font-size: 16px;
  font-weight: 600;
}

.approval-time {
  margin-top: 18px;
  color: var(--text-2);
  font-size: 15px;
}

.approval-line {
  width: 170px;
  height: 2px;
  margin-top: 20px;
  background: var(--line-2);
}

.mini-table {
  width: 100%;
  min-width: 0;
}

.mini-table th,
.mini-table td {
  white-space: normal;
}

.editable-table {
  width: 100%;
  min-width: 900px;
}

.editable-table input,
.editable-table select {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  font-size: 12px;
}

.table-note {
  margin-top: 8px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
}

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

.timeline-item {
  padding: 10px 12px;
  border: 1px solid var(--line-1);
  border-radius: 8px;
  background: var(--fill-2);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.7;
}

.placeholder {
  margin-top: 16px;
  padding: 28px;
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  color: var(--text-3);
  background: #fafbfc;
  font-size: 13px;
  line-height: 1.7;
}

.callout {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--text-2);
  background: var(--accent-soft);
  font-size: 12px;
  line-height: 1.7;
}

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: none;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(29, 33, 41, 0.92);
  font-size: 13px;
  box-shadow: var(--shadow-layer);
}

.toast.show {
  display: block;
}

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

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

  .sidebar {
    display: none;
  }

  .filter-grid,
  .modal-grid,
  .modal-grid.three,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .field.wide,
  .field.full,
  .range-field {
    grid-column: auto;
  }

  .global-search {
    display: none;
  }
}
