:root {
  --ink: #1f2823;
  --muted: #66716b;
  --line: #d8dfda;
  --paper: #ffffff;
  --surface: #f4f7f5;
  --green: #244739;
  --green-2: #39735c;
  --amber: #9b6200;
  --amber-bg: #fff4dc;
  --red: #a23b32;
  --red-bg: #fff0ee;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

.topbar {
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #fff;
  background: var(--green);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .45);
  font-size: 18px;
  font-weight: 700;
}
.brand div { display: grid; gap: 2px; }
.brand strong { font-size: 18px; }
.brand span { font-size: 12px; color: #dce8e1; }
.environment { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #7fdb9d; }

main { width: min(1180px, calc(100% - 32px)); margin: 24px auto 48px; }
.toolbar {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.toolbar label { font-size: 13px; color: var(--muted); }
select, input, button {
  height: 36px;
  border: 1px solid #aeb9b2;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
select { min-width: 180px; padding: 0 32px 0 10px; }
input { width: 100%; min-width: 220px; padding: 0 10px; }
button { padding: 0 15px; background: var(--green-2); color: #fff; border-color: var(--green-2); cursor: pointer; }
button.secondary { background: #fff; color: var(--green); }
button:disabled { opacity: .55; cursor: not-allowed; }
.connection { margin-left: auto; font-size: 13px; color: var(--muted); }
.role-mode { margin: 14px 0 0; padding: 10px 12px; border-left: 3px solid var(--green-2); background: #eef5f0; color: var(--green); font-size: 13px; }
.role-mode.read-only { border-left-color: var(--amber); background: var(--amber-bg); color: #694600; }

.notice { margin: 16px 0; padding: 12px 14px; border: 1px solid #e7c786; background: var(--amber-bg); color: #694600; font-size: 13px; }
.notice.error { border-color: #e6aaa4; background: var(--red-bg); color: var(--red); }

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: var(--paper);
  margin: 20px 0;
}
.summary div { min-height: 92px; padding: 18px; border-right: 1px solid var(--line); display: grid; align-content: center; gap: 6px; }
.summary div:last-child { border-right: 0; }
.summary span { font-size: 12px; color: var(--muted); }
.summary strong { font-size: 26px; color: var(--green); }

.action-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(260px, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8faf9;
}
.action-bar label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.action-bar input { min-width: 0; width: 100%; }
.action-help { margin: 0; align-self: end; min-height: 36px; display: flex; align-items: center; color: var(--muted); font-size: 12px; line-height: 1.5; }
.account-row-action { width: 64px; padding: 0 10px; }
.account-row-action.freeze { background: var(--red); border-color: var(--red); }
.account-row-action.unfreeze { background: var(--green-2); border-color: var(--green-2); }
.account-table td strong, .account-table td small { display: block; }
.account-table td small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.status-label { display: inline-block; padding: 3px 7px; border: 1px solid; font-size: 12px; }
.status-label.active { color: var(--green); border-color: #9bb6a7; background: #eef5f0; }
.status-label.frozen { color: var(--red); border-color: #e0aaa4; background: var(--red-bg); }

.staff-list { display: grid; border-top: 1px solid var(--line); }
.staff-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(140px, .9fr) 90px 100px; gap: 14px; align-items: center; min-height: 62px; border-bottom: 1px solid var(--line); font-size: 13px; }
.staff-row div { display: grid; gap: 3px; }
.staff-row div span, .read-only { color: var(--muted); font-size: 11px; }
.role-label { color: var(--green); font-weight: 600; }
.staff-role-control { display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.staff-role-select { width: 100%; min-width: 140px; }

.status-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); }
.status-strip div { min-height: 74px; display: grid; align-content: center; gap: 6px; padding: 14px; border-right: 1px solid var(--line); }
.status-strip div:last-child { border-right: 0; }
.status-strip span { color: var(--muted); font-size: 11px; }
.status-strip strong { color: var(--green); font-size: 13px; }
.cloud-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.prior-stage { margin-top: 20px; border: 1px solid var(--line); background: var(--paper); }
.prior-stage summary { padding: 15px 18px; color: var(--green); cursor: pointer; font-weight: 600; }
.prior-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.prior-grid div { display: grid; gap: 6px; padding: 16px; background: var(--paper); }
.prior-grid span { color: var(--muted); font-size: 12px; line-height: 1.5; }

.workspace { margin-top: 20px; padding: 22px; border: 1px solid var(--line); background: var(--paper); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
h1, h2 { margin: 0; font-size: 18px; line-height: 1.4; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.demo-badge { padding: 4px 8px; border: 1px solid #d6b26a; color: var(--amber); background: var(--amber-bg); font-size: 12px; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 600; background: #f8faf9; }
td:last-child { font-weight: 600; }

.integration-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.integration-item { min-height: 110px; padding: 14px; border: 1px solid var(--line); }
.integration-item strong, .integration-item span { display: block; }
.integration-item strong { font-size: 14px; margin-bottom: 8px; }
.integration-item span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.integration-item b { display: inline-block; margin-top: 9px; color: var(--amber); font-size: 12px; }

.audit-list { display: grid; gap: 8px; }
.audit-item { display: grid; grid-template-columns: minmax(160px, 1fr) 80px minmax(210px, 1fr) minmax(260px, 1.4fr); gap: 12px; align-items: center; padding: 10px 12px; border-left: 3px solid var(--green-2); background: #f8faf9; font-size: 12px; line-height: 1.6; }
.audit-item.denied { border-left-color: var(--red); }
.audit-item small, .audit-item code { color: var(--muted); }
.empty { color: var(--muted); font-size: 13px; }

.catalog-tabs { display: flex; gap: 6px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.catalog-tab { height: 32px; padding: 0 12px; color: var(--green); background: var(--paper); border: 0; border-bottom: 2px solid transparent; border-radius: 0; }
.catalog-tab.active { color: var(--green); border-bottom-color: var(--green-2); }
.catalog-panel { display: grid; gap: 16px; }
.catalog-group { border: 1px solid var(--line); background: #fbfcfb; }
.catalog-group h3 { margin: 0; padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--line); }
.catalog-group h3 small { margin-left: 6px; color: var(--muted); font-size: 11px; font-weight: 400; }
.field-grid { overflow-x: auto; }
.field-row { min-width: 680px; display: grid; grid-template-columns: minmax(190px, 1.5fr) 120px 70px minmax(180px, 1fr); gap: 12px; padding: 10px 14px; border-bottom: 1px solid #e5ebe7; align-items: center; font-size: 12px; }
.field-row:last-child { border-bottom: 0; }
.field-head { color: var(--muted); background: #f3f7f4; font-size: 11px; }
.field-row code { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.interface-list { display: grid; gap: 8px; }
.interface-row { display: grid; grid-template-columns: 54px minmax(230px, 1fr) minmax(180px, 1.2fr) 150px; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); align-items: center; font-size: 12px; }
.interface-row b { color: var(--green-2); }
.interface-row code { color: var(--ink); }
.interface-row small { color: var(--muted); }
.state-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; }
.state-chip { padding: 5px 8px; border: 1px solid #cdd9d1; background: #eef5f0; color: var(--green); font-size: 12px; }

@media (max-width: 820px) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary div:nth-child(2) { border-right: 0; }
  .summary div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .integration-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connection { width: 100%; margin-left: 0; }
  .action-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reason-field { grid-column: 1 / -1; }
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-strip div:nth-child(2) { border-right: 0; }
  .status-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .prior-grid { grid-template-columns: 1fr; }
  .audit-item { grid-template-columns: 1fr 70px; }
  .audit-item small, .audit-item code { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .topbar { align-items: flex-start; }
  .environment { white-space: normal; }
  main { width: min(100% - 20px, 1180px); margin-top: 12px; }
  .toolbar { align-items: stretch; }
  .toolbar label { width: 100%; }
  select, input, button { width: 100%; }
  .summary { grid-template-columns: 1fr; }
  .summary div { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary div:last-child { border-bottom: 0; }
  .integration-list { grid-template-columns: 1fr; }
  .interface-row { grid-template-columns: 54px 1fr; }
  .interface-row span, .interface-row small { grid-column: 2; }
  .workspace { padding: 15px; }
  .action-bar { grid-template-columns: 1fr; }
  .reason-field { grid-column: auto; }
  .status-strip { grid-template-columns: 1fr; }
  .status-strip div { border-right: 0; border-bottom: 1px solid var(--line); }
  .status-strip div:last-child { border-bottom: 0; }
  .staff-row { grid-template-columns: 1fr auto; padding: 12px 0; }
  .staff-role-control { grid-column: 1 / -1; }
  .staff-role-select { min-width: 0; }
  .staff-row > span:nth-of-type(2), .staff-row > button, .staff-row > .read-only { grid-column: 2; }
  .account-table, .account-table tbody, .account-table tr, .account-table td { display: block; min-width: 0; width: 100%; }
  .account-table thead { display: none; }
  .account-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .account-table td { display: grid; grid-template-columns: 92px 1fr; gap: 10px; border: 0; padding: 6px 0; }
  .account-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; }
}
