:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --surface: #ffffff;
  --line: #d9e2e4;
  --text: #182327;
  --muted: #627074;
  --teal: #0f8f83;
  --teal-dark: #086a61;
  --blue: #2864b4;
  --amber: #b7791f;
  --amber-bg: #fff3cf;
  --red: #c2413b;
  --red-bg: #ffe2df;
  --green: #217a4b;
  --green-bg: #dff4e8;
  --shadow: 0 18px 50px rgba(27, 43, 48, 0.11);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  max-width: 1180px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px;
  border-radius: 8px;
  background: var(--text);
}

.brand-mark span {
  display: block;
  border-radius: 999px;
  background: var(--teal);
}

.brand-mark span:nth-child(2) {
  background: #d99a2b;
}

.brand-mark span:nth-child(3) {
  background: #6da7d9;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

.brand p,
.panel-heading span,
.metric span,
.info-strip span,
.contact-list dt,
.sync-badge {
  color: var(--muted);
  font-size: 13px;
}

.sync-badge {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.query-panel {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(180px, 260px) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 78px);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4f5;
}

.segment {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segment.active {
  background: var(--surface);
  color: var(--teal-dark);
  font-weight: 700;
  box-shadow: 0 1px 8px rgba(17, 43, 47, 0.12);
}

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

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

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #fbfdfd;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 143, 131, 0.14);
}

.primary-btn {
  min-height: 48px;
  min-width: 96px;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn:hover {
  background: var(--teal-dark);
}

.shortcut-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.shortcut-title {
  display: grid;
  gap: 4px;
  min-width: 92px;
}

.shortcut-title strong {
  font-size: 15px;
}

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

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

.shortcut {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.shortcut:hover,
.shortcut.active {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: rgba(15, 143, 131, 0.08);
}

.leader-apply-panel {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.apply-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
}

.apply-copy {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}

.apply-copy strong {
  color: var(--teal-dark);
  font-size: 16px;
}

.apply-copy ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.apply-form {
  display: grid;
  gap: 12px;
}

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

.file-field {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

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

.file-field input {
  width: 100%;
}

.file-field em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.5;
}

.check-row {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--teal);
  flex: 0 0 auto;
}

.apply-status {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.apply-status.ok {
  color: var(--green);
}

.apply-status.error {
  color: var(--red);
}

.empty-state {
  margin-top: 16px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.result-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

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

.metric,
.info-strip,
.table-panel,
.side-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  min-height: 96px;
  padding: 16px;
  display: grid;
  gap: 10px;
  align-content: center;
}

.metric strong {
  font-size: 24px;
  line-height: 1.1;
}

.risk-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 14px;
}

.risk-green {
  color: var(--green);
  background: var(--green-bg);
}

.risk-yellow {
  color: var(--amber);
  background: var(--amber-bg);
}

.risk-red {
  color: var(--red);
  background: var(--red-bg);
}

.info-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.notice-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf6;
  color: var(--text);
}

.notice-band strong {
  color: var(--amber);
  white-space: nowrap;
}

.notice-band span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.info-strip div {
  min-height: 70px;
  padding: 14px;
  display: grid;
  gap: 6px;
  background: #fbfdfd;
}

.info-strip strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}

.table-panel,
.side-panel {
  overflow: hidden;
}

.panel-heading {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  font-size: 16px;
}

.icon-action {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--teal-dark);
  font-size: 13px;
  cursor: pointer;
}

.icon-action:hover {
  border-color: var(--teal);
  background: rgba(15, 143, 131, 0.08);
}

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

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

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

th {
  color: var(--muted);
  font-weight: 600;
  background: #f7fafb;
}

td {
  color: var(--text);
}

.status-ok,
.status-warn,
.status-stop {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 13px;
}

.status-ok {
  color: var(--green);
  background: var(--green-bg);
}

.status-warn {
  color: var(--amber);
  background: var(--amber-bg);
}

.status-stop {
  color: var(--red);
  background: var(--red-bg);
}

.side-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.risk-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.risk-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fbfb;
  border: 1px solid var(--line);
}

.risk-item strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

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

.contact-list {
  margin: 0;
  padding: 4px 14px 14px;
}

.contact-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.contact-list div:last-child {
  border-bottom: 0;
}

.contact-list dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.ref-box {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.ref-box strong {
  color: var(--blue);
  font-size: 22px;
}

.ref-box span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.ref-box em {
  min-height: 18px;
  color: var(--green);
  font-size: 12px;
  font-style: normal;
}

@media (max-width: 900px) {
  .shell {
    padding: 14px;
  }

  .query-panel,
  .shortcut-panel,
  .apply-layout,
  .form-grid,
  .summary-band,
  .info-strip,
  .content-layout {
    grid-template-columns: 1fr;
  }

  .notice-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .content-layout {
    gap: 12px;
  }
}

@media (max-width: 640px) {
  .table-wrap {
    overflow-x: visible;
  }

  table {
    min-width: 0;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: #f7fafb;
  }

  tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  td {
    display: grid;
    gap: 4px;
    padding: 0;
    border-bottom: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
  }

  td:first-child {
    grid-column: 1 / -1;
    font-weight: 700;
  }
}
