:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #fbfcfe;
  --table-head: #f3f6fb;
  --table-soft: #f8fbff;
  --text: #1f2937;
  --text-soft: #4b5563;
  --text-muted: #6b7280;
  --label: #374151;
  --border: #dce3ec;
  --border-soft: #edf1f6;
  --border-control: #cfd8e4;
  --hover-bg: #eef5ff;
  --hover-border: #c7d6ea;
  --selected-bg: #e9f2ff;
  --active-blue: #2563eb;
  --active-blue-soft: #60a5fa;
  --focus-border: #9fb7d8;
  --focus-ring: rgba(96, 165, 250, 0.12);
  --danger-bg: #fff7f7;
  --danger-border: #fecaca;
  --danger-text: #991b1b;
  --warning-bg: #fffaf0;
  --warning-border: #fde4b2;
  --warning-text: #92400e;
  --overlay: rgba(15, 23, 42, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.admin-wrap {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 16px 16px 0;
  overflow: hidden;
}

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.admin-side {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 16px;
}

.admin-side h1 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
}

.admin-nav {
  min-height: 0;
  overflow: auto;
}

.admin-nav button {
  width: 100%;
  display: flex;
  align-items: center;
  margin: 4px 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  line-height: 1.25;
  text-align: left;
}

.admin-nav button:hover {
  background: var(--hover-bg);
  color: var(--active-blue);
}

.admin-nav button.active {
  background: var(--hover-bg);
  color: var(--active-blue-soft);
}

.admin-side-user {
  margin-top: auto;
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.admin-side-user span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-main {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.admin-head {
  padding: 2px 2px 0;
}

.admin-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 23px;
  font-weight: 800;
  line-height: 1.1;
}

.admin-head p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.admin-work-panel {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.hub-view {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.admin-summary div {
  padding: 10px 12px;
  border-right: 1px solid var(--border-soft);
}

.admin-summary div:last-child {
  border-right: 0;
}

.admin-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.admin-summary strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 12px 14px;
}

.admin-toolbar-left,
.admin-toolbar-right,
.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.admin-toolbar-left {
  overflow: auto;
}

.admin-input {
  height: 36px;
  border: 1px solid var(--border-control);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
  padding: 0 10px;
}

.admin-input:focus {
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.admin-search {
  width: 260px;
  min-width: 240px;
}

.admin-select {
  width: 144px;
  min-width: 128px;
}

.admin-btn {
  display: inline-flex;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px;
  text-decoration: none;
  white-space: nowrap;
}

.admin-btn:hover {
  border-color: var(--hover-border);
  background: var(--hover-bg);
}

.admin-btn-primary {
  border-color: #b9ccea;
  background: #e9f2ff;
  color: var(--active-blue);
}

.admin-btn-danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.admin-btn-small {
  height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.admin-table-wrap {
  min-height: 0;
  flex: 1;
  overflow: scroll;
  scrollbar-gutter: stable both-edges;
  background: var(--surface);
}

.admin-table-wrap::-webkit-scrollbar,
.hub-scroll::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.admin-table-wrap::-webkit-scrollbar-track,
.hub-scroll::-webkit-scrollbar-track {
  background: #eef2f7;
}

.admin-table-wrap::-webkit-scrollbar-thumb,
.hub-scroll::-webkit-scrollbar-thumb {
  border: 2px solid #eef2f7;
  border-radius: 10px;
  background: #b8c1ce;
}

.admin-dense-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
  text-align: left;
}

.admin-dense-table th,
.admin-dense-table td {
  max-width: 280px;
  overflow: hidden;
  border-right: 0.8px solid var(--border);
  border-bottom: 0.8px solid var(--border);
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-dense-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--table-head);
  color: var(--label);
  font-weight: 700;
  padding-bottom: 8px;
  padding-top: 8px;
  box-shadow: 0 1px 0 var(--border);
}

.admin-dense-table tbody tr:hover {
  background: var(--hover-bg);
}

.admin-mono {
  font-family: Consolas, Monaco, monospace;
}

.admin-badge {
  display: inline-flex;
  height: 24px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  padding: 0 8px;
}

.admin-badge-error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.admin-badge-warning {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.admin-badge-muted {
  color: var(--text-muted);
}

.hub-dashboard {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 0;
  overflow: hidden;
}

.hub-left,
.hub-right {
  min-width: 0;
  overflow: auto;
  padding: 14px;
}

.hub-left {
  border-right: 1px solid var(--border);
}

.hub-section {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.hub-section h3 {
  margin: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  padding: 11px 13px;
}

.hub-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hub-module {
  min-height: 88px;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding: 12px;
}

.hub-module strong {
  display: block;
  font-size: 14px;
}

.hub-module span {
  display: block;
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.hub-health {
  display: grid;
}

.hub-health-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 80px;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 12px;
  font-size: 12px;
}

.hub-health-row:last-child {
  border-bottom: 0;
}

.hub-io-table,
.hub-api-table {
  min-width: 1120px;
}

.hub-io-table th,
.hub-io-table td,
.hub-api-table th,
.hub-api-table td {
  max-width: none;
  white-space: normal;
  vertical-align: top;
}

.hub-io-table th:nth-child(1) {
  width: 190px;
}

.hub-io-table th:nth-child(2) {
  width: 260px;
}

.hub-io-table th:nth-child(3),
.hub-io-table th:nth-child(4),
.hub-io-table th:nth-child(5) {
  width: 210px;
}

.hub-io-table th:nth-child(6) {
  width: 220px;
}

.hub-api-table th:nth-child(1) {
  width: 210px;
}

.hub-api-table th:nth-child(2) {
  width: 260px;
}

.hub-api-table th:nth-child(3),
.hub-api-table th:nth-child(4) {
  width: 210px;
}

.hub-api-table th:nth-child(5) {
  width: 180px;
}

.hub-api-table th:nth-child(6) {
  width: 220px;
}

.hub-system-cell,
.hub-stack-cell,
.hub-status-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.hub-system-cell strong,
.hub-stack-cell strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.hub-system-cell span,
.hub-stack-cell span,
.hub-status-cell span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.hub-flow-block {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px;
}

.hub-flow-block + .hub-flow-block {
  margin-top: 8px;
}

.hub-flow-block span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.hub-flow-block strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.hub-subdomain-layout {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: 280px minmax(0, 1fr);
  overflow: hidden;
}

.hub-subdomain-list {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.hub-subdomain-detail {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.hub-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 16px 18px;
}

.hub-detail-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

.hub-detail-head p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.hub-detail-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.hub-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.hub-detail-summary div {
  min-height: 82px;
  border-right: 1px solid var(--border-soft);
  padding: 12px;
}

.hub-detail-summary div:last-child {
  border-right: 0;
}

.hub-detail-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.hub-detail-summary strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.hub-flow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.hub-flow-grid .hub-flow-block {
  min-height: 94px;
  border-color: var(--border);
  background: var(--surface);
}

.hub-detail-bottom {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.hub-action-panel {
  padding: 12px;
}

.hub-action-panel .admin-row-actions {
  align-items: stretch;
  flex-direction: column;
}

.hub-action-panel .admin-btn {
  width: 100%;
}

.hub-permission-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.hub-permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.hub-permission-table-wrap {
  max-height: none;
  border-top: 0;
}

.hub-permission-table {
  min-width: 980px;
}

.hub-permission-table th,
.hub-permission-table td {
  max-width: none;
  vertical-align: middle;
  white-space: normal;
}

.hub-permission-table th:nth-child(1) {
  width: 160px;
}

.hub-permission-table th:nth-child(2),
.hub-permission-table th:nth-child(3),
.hub-permission-table th:nth-child(4) {
  width: 180px;
}

.hub-permission-table th:nth-child(5) {
  width: 90px;
}

.hub-permission-table th:nth-child(6) {
  width: 260px;
}

.hub-permission-table .admin-input {
  width: 100%;
}

.hub-permission-template-layout {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: 260px minmax(0, 1fr);
  overflow: hidden;
}

.hub-permission-all {
  display: grid;
  gap: 12px;
  padding: 14px;
  overflow: auto;
}

.hub-permission-group {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px;
}

.hub-permission-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.hub-permission-group-head h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 16px;
}

.hub-permission-group-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.hub-permission-group-head label,
.hub-permission-field {
  display: grid;
  gap: 8px;
}

.hub-permission-group-head label span,
.hub-permission-field span {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.hub-permission-field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.hub-permission-field {
  min-height: 86px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px;
}

.hub-permission-field em {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-permission-field small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.hub-permission-detail {
  display: grid;
}

.hub-detail-summary-compact {
  border-bottom: 0;
}

.hub-permission-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.hub-permission-options label {
  display: grid;
  gap: 7px;
  min-height: 118px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 12px;
}

.hub-permission-options label.active {
  border-color: #b9ccea;
  background: #e9f2ff;
}

.hub-permission-options span {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.hub-permission-options strong {
  color: var(--active-blue);
  font-size: 12px;
  line-height: 1.35;
}

.hub-permission-options em {
  color: var(--text-muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.hub-permission-card {
  display: grid;
  min-height: 102px;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px;
}

.hub-permission-card span {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.hub-permission-card em {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-origin-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.hub-origin-list span {
  display: block;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 12px;
  padding: 8px 10px;
}

.hub-expiry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 160px;
  gap: 10px;
  padding: 12px;
}

.hub-expiry-grid label {
  display: flex;
  height: 36px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
}

.hub-permission-layout {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: 220px 240px minmax(0, 1fr);
  overflow: hidden;
}

.hub-column {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--border);
}

.hub-column:last-child {
  border-right: 0;
}

.hub-column-head {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 11px 13px;
}

.hub-column-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.hub-list-button {
  width: calc(100% - 16px);
  margin: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.hub-list-button:hover,
.hub-list-button.active {
  border-color: var(--hover-border);
  background: var(--hover-bg);
}

.hub-list-button strong,
.hub-field-row strong {
  display: block;
  font-size: 13px;
}

.hub-list-button span,
.hub-field-row span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.hub-fields {
  padding: 10px;
}

.hub-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  padding: 9px 2px;
}

.hub-field-row select {
  width: 150px;
}

.hub-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 18px;
}

.hub-empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 14px;
}

.hub-empty span {
  display: block;
  max-width: 760px;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .admin-wrap {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .admin-side {
    min-height: auto;
  }

  .admin-nav {
    display: flex;
    gap: 4px;
    overflow: auto;
  }

  .admin-nav button {
    flex: 0 0 auto;
    width: auto;
  }

  .admin-side-user {
    display: none;
  }

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

  .admin-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-toolbar-left,
  .admin-toolbar-right {
    width: 100%;
  }

  .hub-dashboard,
  .hub-permission-layout,
  .hub-permission-template-layout,
  .hub-subdomain-layout,
  .hub-detail-bottom,
  .hub-flow-grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .hub-subdomain-list {
    max-height: 260px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .hub-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hub-permission-grid,
  .hub-permission-options,
  .hub-expiry-grid {
    grid-template-columns: 1fr;
  }

  .hub-left {
    border-right: 0;
  }

  .hub-module-grid {
    grid-template-columns: 1fr;
  }
}
