* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, "Microsoft YaHei", sans-serif; color: #1f2937; background: #f4f6f8; }
a { color: inherit; text-decoration: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 220px; background: #111827; color: #e5e7eb; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { font-size: 18px; font-weight: 700; padding: 6px 8px 18px; border-bottom: 1px solid #374151; }
nav { display: grid; gap: 6px; }
nav a, .logout { padding: 10px 12px; border-radius: 6px; color: #cbd5e1; }
nav a.active, nav a:hover, .logout:hover { background: #243244; color: #fff; }
.logout { margin-top: auto; }
.content { margin-left: 220px; padding: 28px; }
header { margin-bottom: 18px; }
h1 { margin: 0 0 6px; font-size: 26px; }
h2 { margin: 0 0 14px; font-size: 18px; }
p { margin: 0 0 12px; color: #6b7280; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.node-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat, .panel, .login-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.group-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.group-card.copied { outline: 2px solid #16a34a; }
.group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.group-head strong { font-size: 22px; color: #111827; }
.group-head span { font-weight: 700; color: #374151; word-break: break-all; }
.node-counts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.node-counts span { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 8px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 13px; }
.hint { font-size: 13px; margin-bottom: 12px; }
.group-card form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-top: 10px; }
.address-list { display: grid; gap: 6px; min-height: 72px; padding: 10px; border: 1px solid #e5e7eb; border-radius: 6px; background: #f9fafb; margin-bottom: 10px; }
.address-title { font-size: 13px; color: #6b7280; }
.address-list code { display: block; padding: 5px 7px; border-radius: 4px; background: #fff; color: #111827; word-break: break-all; }
.address-list em { color: #9ca3af; font-style: normal; }
.stat { padding: 18px; }
.stat span { display: block; color: #6b7280; margin-bottom: 8px; }
.stat strong { font-size: 28px; }
.panel { padding: 18px; margin-bottom: 18px; }
.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.alert.error { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
button { border: 0; background: #15803d; color: #fff; border-radius: 6px; padding: 10px 14px; cursor: pointer; font-weight: 700; }
button:hover { background: #166534; }
input, select { border: 1px solid #d1d5db; border-radius: 6px; padding: 9px 10px; min-height: 38px; background: #fff; }
label { display: grid; gap: 6px; margin-bottom: 12px; color: #374151; }
.inline-form { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.inline-form.wrap { flex-wrap: wrap; }
.inline-form label { margin: 0; }
.checks { display: flex; gap: 16px; margin: 10px 0 14px; }
.checks label { display: flex; align-items: center; gap: 6px; margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { border-bottom: 1px solid #e5e7eb; text-align: left; padding: 10px; vertical-align: top; }
th { color: #374151; background: #f9fafb; white-space: nowrap; }
td { max-width: 420px; word-break: break-all; }
.empty { padding: 18px; background: #f9fafb; border-radius: 6px; }
.node-section { padding: 0; overflow: hidden; }
.node-section-head { min-height: 56px; padding: 0 18px; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; }
.node-section-head > div { display: flex; align-items: center; gap: 9px; }
.node-section-head h2 { margin: 0; text-transform: uppercase; }
.node-section-head > span { color: #6b7280; font-size: 14px; }
.protocol-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; }
.node-table { min-width: 760px; }
.node-table th { padding: 12px 18px; font-size: 13px; font-weight: 600; color: #64748b; }
.node-table td { padding: 14px 18px; vertical-align: middle; }
.node-table tbody tr { transition: background .15s ease; }
.node-table tbody tr:hover { background: #f8fafc; }
.node-table tbody tr.copied { background: #ecfdf5; }
.node-table th:nth-child(1) { width: 230px; }
.node-table th:nth-child(2) { width: 120px; }
.node-table th:nth-child(4) { width: 250px; text-align: right; }
.node-table td:last-child { text-align: right; }
.group-id { display: inline-block; min-width: 42px; color: #111827; font-size: 15px; }
.group-name { color: #64748b; }
.node-total { display: inline-flex; min-width: 34px; height: 26px; align-items: center; justify-content: center; border: 1px solid #dbe3ec; border-radius: 4px; color: #334155; background: #fff; font-weight: 700; }
.table-addresses { display: grid; gap: 5px; }
.table-addresses code { width: fit-content; max-width: 100%; color: #334155; background: #f1f5f9; border-radius: 4px; padding: 4px 7px; word-break: break-all; }
.muted { color: #94a3b8; }
.edit-button { padding: 7px 10px; background: transparent; color: #1677c8; font-weight: 600; }
.edit-button:hover { background: #eaf4fd; color: #0f5f9f; }
.node-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.node-actions form { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.row-icon-button { width: 34px; height: 34px; padding: 0; background: #fff; color: #475569; border: 1px solid #dbe3ec; font-size: 17px; }
.row-icon-button:hover { background: #f1f5f9; color: #111827; }
.row-icon-button:disabled { cursor: not-allowed; background: #f8fafc; color: #cbd5e1; }
.delete-button { padding: 7px 10px; background: transparent; color: #dc2626; }
.delete-button:hover { background: #fef2f2; color: #b91c1c; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .46); }
.modal[hidden] { display: none; }
.modal-panel { width: min(480px, 100%); background: #fff; border-radius: 8px; box-shadow: 0 24px 60px rgba(15, 23, 42, .22); }
.modal-head { padding: 18px 20px; border-bottom: 1px solid #e5e7eb; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-head h2 { margin-bottom: 4px; }
.modal-head p { margin: 0; font-size: 14px; }
.icon-button { width: 34px; height: 34px; padding: 0; flex: 0 0 auto; background: transparent; color: #64748b; font-size: 25px; line-height: 1; }
.icon-button:hover { background: #f1f5f9; color: #111827; }
.editor-form { padding: 18px 20px; }
.editor-form label { margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.editor-form input { width: 100%; }
.editor-form button { width: 100%; }
.clone-form { border-top: 1px solid #e5e7eb; }
.modal-open { overflow: hidden; }
.risk-groups { padding: 0; overflow: hidden; }
.risk-dot { background: #dc2626; }
.risk-table { min-width: 620px; }
.risk-table th { padding: 12px 18px; font-size: 13px; font-weight: 600; color: #64748b; }
.risk-table td { padding: 14px 18px; vertical-align: middle; }
.risk-table tbody tr:hover { background: #f8fafc; }
.risk-table tbody tr.selected { background: #eff6ff; }
.risk-table th:nth-child(1) { width: 55%; }
.risk-table th:nth-child(2) { width: 140px; }
.risk-table th:last-child, .risk-table td:last-child { text-align: right; }
.risk-actions { white-space: nowrap; }
.detail-button, .split-button { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 7px 10px; border-radius: 6px; font-size: 14px; font-weight: 600; }
.detail-button { color: #1677c8; }
.detail-button:hover { background: #eaf4fd; color: #0f5f9f; }
.split-button { margin-left: 4px; background: #15803d; }
.split-button:disabled { cursor: not-allowed; background: #cbd5e1; color: #64748b; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.detail-head h2 { margin-bottom: 4px; }
.detail-head p { margin: 0; }
.close-detail { color: #64748b; font-size: 14px; white-space: nowrap; }
.close-detail:hover { color: #111827; }
.split-preview { padding: 10px 12px; border-left: 3px solid #16a34a; background: #f0fdf4; color: #166534; font-size: 14px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.pagination a, .pagination span { min-height: 34px; padding: 7px 11px; border: 1px solid #dbe3ec; border-radius: 6px; color: #475569; background: #fff; }
.pagination a:hover { border-color: #93c5fd; background: #eff6ff; color: #1677c8; }
.pagination .disabled { color: #a1aab8; background: #f8fafc; }
.login-page { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(420px, calc(100vw - 32px)); padding: 28px; }
.login-card h1 { margin-bottom: 8px; }
.login-card button { width: 100%; margin-top: 4px; }
@media (max-width: 900px) {
  .sidebar { position: static; width: auto; }
  .content { margin-left: 0; padding: 18px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid, .card-grid.compact { grid-template-columns: 1fr; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .group-card form { grid-template-columns: 1fr; }
}
