:root {
  --ink: #162028;
  --muted: #667480;
  --line: #d9e2e7;
  --paper: #f3f6f8;
  --panel: #ffffff;
  --accent: #155e75;
  --accent-dark: #0f3f4f;
  --accent-soft: #e8f5f7;
  --accent-2: #a15c13;
  --danger: #b42318;
  --good: #16794c;
  --nav: #111a21;
  --nav-2: #17242d;
  --shadow: 0 22px 60px rgba(20, 35, 48, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(21, 94, 117, 0.11), transparent 34%),
    linear-gradient(180deg, #fbfcfd 0%, var(--paper) 46%);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(15, 24, 32, 0.94), rgba(21, 94, 117, 0.75)),
    linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 22px),
    #101820;
}

.login-panel {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
    rgba(14, 22, 29, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-panel::after {
  content: "请使用管理员分配的云端账号和密码登录";
  display: block;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.brand-mark,
.side-brand span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: #08201e;
  background: #fff;
  font-weight: 800;
}

.logo-mark {
  overflow: hidden;
  background: #fff;
}

.logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-panel .logo-mark {
  width: 92px;
  height: 36px;
  padding: 5px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-copy {
  display: grid;
  gap: 2px;
  line-height: 1.2;
}

.brand-copy strong {
  color: #fff;
  font-size: 17px;
}

.brand-copy em {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-style: normal;
}

.login-panel h1 {
  margin: 22px 0 8px;
  font-size: 29px;
  line-height: 1.22;
  letter-spacing: 0;
}

.login-panel p {
  margin: 0 0 26px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label,
.search-box {
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.76);
}

.login-form input,
.search-box input,
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.login-form input {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.login-form button,
.primary-btn {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.22);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  color: #dbe7ea;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 36%),
    linear-gradient(180deg, var(--nav-2), var(--nav));
  box-shadow: 12px 0 34px rgba(15, 24, 32, 0.12);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 28px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.side-brand strong {
  display: grid;
  gap: 3px;
  max-width: 132px;
  font-size: 13px;
  line-height: 1.22;
}

.side-brand strong span {
  display: block;
  width: auto;
  height: auto;
  border-radius: 0;
  color: #fff;
  background: transparent;
  font-weight: 800;
}

.side-brand strong em {
  color: #91b8bd;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.side-brand .logo-mark {
  width: 62px;
  height: 30px;
  flex: 0 0 62px;
  padding: 4px;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  padding: 11px 12px;
  color: #b9c7ce;
  background: transparent;
  text-align: left;
  font-weight: 750;
}

.nav button::before {
  content: attr(data-icon);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #a9c5cb;
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
  font-weight: 900;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.nav button.active::before,
.nav button:hover::before {
  color: #0f3f4f;
  background: #fff;
}

.nav button.active::after {
  content: "";
  position: absolute;
  inset: 9px auto 9px -16px;
  width: 3px;
  border-radius: 0 8px 8px 0;
  background: #d6a13a;
}

.nav button.locked {
  opacity: 0.42;
}

.workspace {
  min-width: 0;
  background: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(249, 252, 253, 0.9);
  backdrop-filter: blur(18px);
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-box {
  min-width: 300px;
  color: var(--muted);
}

.search-box input:focus,
.login-form input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus,
.filter-bar select:focus {
  border-color: rgba(21, 94, 117, 0.55);
  box-shadow: 0 0 0 3px rgba(21, 94, 117, 0.12);
}

.ghost-btn {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  font-weight: 750;
}

.ghost-btn:hover,
.row-actions button:hover,
.toolbar button:hover {
  border-color: #b8d5d0;
  color: var(--accent-dark);
}

.user-pill {
  align-self: end;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #cfe0df;
  border-radius: 8px;
  padding: 0 12px;
  color: #0a4f4b;
  background: #edf8f5;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.content {
  padding: 24px 26px 96px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.7fr);
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(196, 211, 218, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(21, 94, 117, 0.1), transparent 52%),
    linear-gradient(180deg, #ffffff, #f8fbfc);
  box-shadow: var(--shadow);
}

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

.hero-logo {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  display: grid;
  place-items: center;
  border: 1px solid #d8e4e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(17, 31, 44, 0.11);
}

.hero-logo img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.hero-main h3 {
  margin: 5px 0 12px;
  font-size: 24px;
  line-height: 1.25;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-tags span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #dbe7eb;
  border-radius: 8px;
  padding: 0 10px;
  color: #40505a;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.hero-metrics,
.hero-workflow {
  display: grid;
  gap: 10px;
}

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

.hero-workflow {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-metrics button,
.hero-workflow button {
  border: 1px solid #dbe7eb;
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  text-align: left;
}

.hero-metrics button:hover,
.hero-workflow button:hover {
  border-color: #9dc8d0;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(17, 31, 44, 0.09);
}

.hero-metrics span,
.hero-workflow span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.hero-metrics strong,
.hero-workflow strong {
  display: block;
  margin-top: 7px;
  font-size: 23px;
}

.kpi-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi,
.card,
.table-wrap,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(17, 31, 44, 0.065);
}

.kpi {
  position: relative;
  padding: 18px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #d5a13a);
}

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

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.card {
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(21, 94, 117, 0.05), transparent 44%),
    #fff;
}

.clickable-card,
.clickable-row,
.timeline-item {
  cursor: pointer;
}

.clickable-card:hover,
.timeline-item:hover {
  transform: translateY(-1px);
  border-color: #b8d5d0;
  box-shadow: 0 16px 36px rgba(17, 31, 44, 0.11);
}

.card h3,
.detail-panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.card p {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.section-title h3 {
  margin: 0;
  font-size: 18px;
}

.section-title h3::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  margin-right: 8px;
  border-radius: 4px;
  vertical-align: -2px;
  background: var(--accent);
}

.table-wrap {
  overflow: auto;
  border-radius: 8px;
}

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

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

th {
  position: sticky;
  top: 0;
  color: #2c3940;
  background: #eef4f6;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1;
}

tbody tr:nth-child(even) td {
  background: #fbfdfe;
}

tr:hover td {
  background: #f2f8f9;
}

.row-actions {
  min-width: 116px;
  white-space: nowrap;
}

.row-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  margin-right: 6px;
  color: #31414a;
  background: #fff;
  font-size: 12px;
}

.row-actions button:last-child {
  color: var(--danger);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 4px 9px;
  color: #2f3c45;
  background: #edf1f3;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status.good {
  color: var(--good);
  background: #e8f6ef;
}

.status.warn {
  color: var(--accent-2);
  background: #fff3d8;
}

.status.danger {
  color: var(--danger);
  background: #fdebea;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 16px;
}

.detail-panel {
  padding: 18px;
  align-self: start;
}

.detail-list {
  display: grid;
  gap: 11px;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf1f3;
  padding-bottom: 9px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  text-align: right;
  font-weight: 650;
}

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

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

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

.reminder-toolbar {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(17, 31, 44, 0.06);
}

.toolbar-primary {
  margin-left: auto;
  height: 40px;
  padding: 0 16px;
}

.toolbar .primary-btn,
.toolbar-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 10px 22px rgba(21, 94, 117, 0.2);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.vertical-list {
  display: grid;
  gap: 10px;
}

.tree-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(17, 31, 44, 0.06);
}

.tree-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: var(--ink);
  background: linear-gradient(180deg, #f4f8f9, #edf4f5);
  cursor: pointer;
}

.tree-group summary span {
  color: var(--muted);
  font-size: 13px;
}

.tree-list {
  display: grid;
  gap: 1px;
  background: #edf1f3;
}

.tree-item {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 0;
  padding: 13px 14px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.tree-item:hover {
  background: #f3f9fa;
}

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

.tree-item em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.tree-item b {
  color: var(--accent-dark);
  white-space: nowrap;
}

.rank {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

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

.filter-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.filter-bar select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

.field-manager {
  display: grid;
  gap: 10px;
}

.field-tools {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}

.field-list {
  display: grid;
  gap: 1px;
  background: #edf1f3;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: #fff;
}

.field-row.disabled {
  opacity: 0.58;
}

.field-row strong,
.field-row em {
  display: block;
}

.field-row em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(17, 31, 44, 0.055);
}

.timeline-date {
  font-weight: 800;
}

.reminder-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.reminder-actions button {
  border: 1px solid #b8d5d0;
  border-radius: 8px;
  padding: 8px 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  font-size: 12px;
  font-weight: 800;
}

.reminder-actions button:disabled {
  opacity: 0.62;
}

.wechat-permission-panel {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.wechat-control {
  min-height: 126px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(17, 31, 44, 0.055);
}

.wechat-control > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.wechat-control small {
  color: var(--muted);
  line-height: 1.5;
}

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

.check-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.supplier-category-list {
  display: grid;
  gap: 12px;
}

.supplier-category {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 30px rgba(17, 31, 44, 0.055);
}

.supplier-category-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 16px;
  color: #fff;
  background: linear-gradient(145deg, var(--accent-dark), var(--accent));
}

.supplier-category-head span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.supplier-category-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.supplier-category-item {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 15px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.supplier-category-item:hover {
  background: #f3f9fa;
}

.supplier-category-item.pending {
  color: var(--muted);
  background: #fafcfd;
}

.supplier-category-item strong,
.supplier-category-item em {
  display: block;
}

.supplier-category-item em {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.supplier-category-item b {
  color: var(--accent-dark);
  white-space: nowrap;
}

.supplier-other .vertical-list {
  padding: 10px;
}

.channel-groups,
.order-customer-groups {
  display: grid;
  gap: 10px;
  padding: 10px;
  background: #f5f8f9;
}

.channel-group,
.deal-status-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.channel-group > summary,
.deal-status-group > summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

.channel-group > summary {
  color: #fff;
  background: var(--accent);
}

.deal-status-group {
  margin: 8px;
}

.deal-status-group > summary {
  color: var(--ink);
  background: #edf4f5;
}

.channel-group summary span,
.deal-status-group summary span {
  font-size: 12px;
  opacity: 0.76;
}

.order-customer-group > .table-wrap {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.line-items-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.line-item-rows {
  display: grid;
  gap: 8px;
}

.line-item-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) repeat(3, minmax(110px, 0.8fr)) 40px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.line-item-contractItems {
  grid-template-columns: minmax(150px, 1.4fr) repeat(4, minmax(105px, 0.8fr)) 40px;
}

.line-item-row label {
  display: grid;
  gap: 5px;
}

.line-item-row label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.line-item-row input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
}

.line-add-btn {
  justify-self: start;
}

.line-remove-btn {
  width: 38px;
  height: 38px;
}

.line-summary {
  display: block;
  margin-bottom: 5px;
  white-space: nowrap;
}

.line-summary:last-child {
  margin-bottom: 0;
}

.inline-link {
  border: 0;
  padding: 0;
  color: var(--accent);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
}

.empty {
  padding: 42px;
  border: 1px dashed #c6d0d7;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #fff;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 32, 0.46);
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(780px, 92vh);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  padding: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-head,
.modal-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.modal-actions {
  grid-template-columns: auto 1fr auto auto;
  margin-top: 18px;
}

.modal-head h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 24px;
  line-height: 1;
}

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

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

.pricing-field textarea {
  min-height: 154px;
  font-family: inherit;
  line-height: 1.9;
}

.field textarea {
  resize: vertical;
}

.field small {
  color: var(--muted);
  line-height: 1.45;
}

.danger-btn {
  height: 42px;
  border: 1px solid #f0b6b1;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--danger);
  background: #fff6f5;
  font-weight: 700;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    height: auto;
    padding: 8px;
  }

  .side-brand {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(10, minmax(58px, 1fr));
    gap: 4px;
    overflow-x: auto;
  }

  .nav button {
    padding: 10px 4px;
    text-align: center;
    font-size: 12px;
  }

  .topbar,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .user-pill {
    align-self: stretch;
    justify-content: center;
  }

  .search-box {
    min-width: 0;
  }

  .kpi-grid,
  .card-grid,
  .split,
  .dashboard-hero,
  .hero-workflow {
    grid-template-columns: 1fr;
  }

  .hero-main {
    align-items: flex-start;
  }

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

  .toolbar-primary {
    width: 100%;
    margin-left: 0;
  }

  .content {
    padding: 18px 14px 92px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .wechat-permission-panel,
  .supplier-category {
    grid-template-columns: 1fr;
  }

  .supplier-category-items {
    grid-template-columns: 1fr;
  }

  .supplier-category-item {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .line-item-row,
  .line-item-contractItems {
    grid-template-columns: 1fr 1fr;
  }

  .line-remove-btn {
    grid-column: 2;
    justify-self: end;
  }

  .modal-fields,
  .modal-actions,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .tree-item {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .tree-item b {
    grid-column: 2;
  }
}

@media (max-width: 560px) {
  .login-panel {
    padding: 24px;
  }

  .nav {
    overflow-x: auto;
    grid-template-columns: repeat(10, minmax(62px, 1fr));
  }

  .topbar h2 {
    font-size: 21px;
  }
}
