:root {
  --bg: #f4f6f9;
  --card: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --menu-bg: #111827;
  --menu-text: #f9fafb;
  --menu-muted: #9ca3af;
  --menu-active: #2563eb;
  --danger: #dc2626;
  --ok: #059669;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.hub-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.hub-topbar {
  background: var(--menu-bg);
  color: var(--menu-text);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 52px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.hub-brand {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  margin-right: 8px;
}

.hub-menu {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  padding: 8px 0;
  scrollbar-width: thin;
}

.hub-menu::-webkit-scrollbar { height: 6px; }
.hub-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 999px; }

.hub-menu-item {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--menu-text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: .15s ease;
}

.hub-menu-item:hover {
  background: rgba(255,255,255,.12);
}

.hub-menu-item.active {
  background: var(--menu-active);
  border-color: var(--menu-active);
}

.hub-menu-item.is-link {
  border-style: dashed;
}

.hub-menu-item.is-blank::after {
  content: ' ↗';
  font-size: 11px;
  opacity: 0.75;
}

.hub-top-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.hub-top-actions a,
.hub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--menu-text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}

.hub-btn:hover,
.hub-top-actions a:hover {
  background: rgba(255,255,255,.14);
  text-decoration: none;
}

.hub-frame-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #fff;
  overflow: hidden;
}

.hub-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}

.hub-frame[hidden] {
  display: none !important;
}

.hub-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 15px;
  background: #fff;
  z-index: 1;
}

.hub-empty[hidden] {
  display: none !important;
}

.hub-page {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px 40px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.card h1, .card h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.card h2 { font-size: 17px; }

.muted { color: var(--muted); font-size: 13px; }

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.status-ok { color: var(--ok); }
.status-bad { color: var(--danger); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

th { background: #f9fafb; }

.tool-table input[type="text"],
.tool-table input[type="number"],
.tool-table select {
  width: 100%;
}

.link-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.link-add-form input[type="text"] {
  flex: 1 1 140px;
  min-width: 120px;
}

.link-add-form input[type="number"] {
  width: 90px;
}

.link-add-form select {
  width: 130px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2ff;
  color: #3730a3;
}

.badge-off {
  background: #fef2f2;
  color: #991b1b;
}

.msg {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

.msg-ok { background: #ecfdf5; color: #065f46; }
.msg-err { background: #fef2f2; color: #991b1b; }

@media (max-width: 768px) {
  .hub-brand { display: none; }
  .hub-topbar { padding: 0 10px; }
  .admin-nav { overflow-x: auto; flex-wrap: nowrap; }
}

.admin-header {
  padding-bottom: 0;
}

.admin-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.admin-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin: 0 -20px;
  padding: 12px 20px 0;
}

.admin-nav-item {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  border: 1px solid transparent;
  border-bottom: none;
  text-decoration: none;
}

.admin-nav-item:hover {
  color: var(--accent);
  background: #f9fafb;
  text-decoration: none;
}

.admin-nav-item.active {
  color: var(--accent);
  background: #fff;
  border-color: var(--line);
  font-weight: 600;
}

input[type="file"] {
  font: inherit;
  font-size: 14px;
}
