/* ============================================================
 * goport 共享设计系统（浅色主题 + 深蓝侧栏）
 * 三端通用：管理后台 / 用户面板 / 代理中心
 * ============================================================ */
:root {
  /* 背景层级 */
  --bg-primary:   #f4f6fb;
  --bg-secondary: #ffffff;
  --bg-card:      #ffffff;
  --bg-hover:     #f2f5fb;
  --bg-input:     #ffffff;

  /* 边框 */
  --border:       #e6e9f2;
  --border-light: #d7dce8;

  /* 文字 */
  --text-primary:   #1e2430;
  --text-secondary: #5c6579;
  --text-muted:     #9098ab;

  /* 主色与语义色 */
  --accent:       #3b6df6;
  --accent-hover: #2f5ee6;
  --accent-light: rgba(59, 109, 246, 0.10);
  --success:      #16a34a;
  --success-bg:   rgba(22, 163, 74, 0.10);
  --warning:      #d97706;
  --warning-bg:   rgba(217, 119, 6, 0.12);
  --danger:       #dc2626;
  --danger-bg:    rgba(220, 38, 38, 0.10);
  --purple:       #7c3aed;
  --purple-bg:    rgba(124, 58, 237, 0.10);
  --cyan:         #0891b2;
  --cyan-bg:      rgba(8, 145, 178, 0.10);

  --radius:    12px;
  --radius-sm: 9px;
  --radius-xs: 7px;
  --shadow:    0 16px 40px rgba(23, 35, 64, 0.14);
  --shadow-sm: 0 1px 3px rgba(23, 35, 64, 0.06), 0 1px 2px rgba(23, 35, 64, 0.04);

  --sidebar-width: 224px;
  --topbar-height: 58px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 13px; line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
/* 启动过渡：恢复会话期间先显示加载层，避免登录页闪现 */
.boot-view {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--bg-primary);
}
.boot-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(99, 132, 255, .18);
  border-top-color: var(--accent, #3b82f6);
  animation: boot-spin .75s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }
.boot-text { font-size: 13px; color: var(--text-secondary, #64748b); letter-spacing: .5px; }
a { color: var(--accent); text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
b, strong { font-weight: 600; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cdd4e2; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b6bfd2; background-clip: padding-box; }

.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }
.text-info    { color: var(--accent) !important; }
.text-muted, .dim { color: var(--text-muted) !important; }
.flex { display: flex; } .flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  background: #fff; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s, opacity .15s;
  white-space: nowrap; user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #4d7bfa, var(--accent)); color: #fff; box-shadow: 0 2px 8px rgba(59,109,246,.28); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, var(--accent), var(--accent-hover)); }
.btn-secondary { background: #fff; border-color: var(--border-light); color: var(--text-secondary); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: #c6cddc; color: var(--text-primary); }
.btn-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: rgba(220,38,38,.2); }
.btn-danger:hover:not(:disabled)  { background: rgba(220,38,38,.16); }
.btn-success { background: var(--success-bg); color: var(--success); border-color: rgba(22,163,74,.2); }
.btn-success:hover:not(:disabled) { background: rgba(22,163,74,.16); }
.btn-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(217,119,6,.2); }
.btn-warning:hover:not(:disabled) { background: rgba(217,119,6,.16); }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-block { width: 100%; height: 40px; font-size: 14px; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea,
input[type=text], input[type=password], input[type=number], select, textarea {
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px;
  padding: 9px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint, .hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ===== 卡片 / 面板 ===== */
.card, .panel {
  background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card-header, .panel .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.card-title, .panel .head .t { font-size: 15px; font-weight: 600; }
.card-body, .panel-body { position: relative; }

/* ===== 统计卡片 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.stat-card:hover { box-shadow: 0 6px 20px rgba(23,35,64,.08); transform: translateY(-1px); border-color: var(--border-light); }
.stat-card .stat-icon, .stat-card .icon {
  width: 42px; height: 42px; flex: none; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; background: var(--accent-light);
}
.stat-card .stat-info { display: flex; flex-direction: column; min-width: 0; }
.stat-card .stat-label, .stat-card .label, .stat-card .k { font-size: 12px; color: var(--text-secondary); margin: 0 0 3px; }
.stat-card .stat-value, .stat-card .value, .stat-card .v { font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: .2px; }
.stat-card .sub, .stat-card .d { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.stat-card .value.primary { color: var(--accent); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.danger  { color: var(--danger); }
.stat-card .value.purple  { color: var(--purple); }

/* ===== 表格 ===== */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
table.data-table, table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data-table thead th, table.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  background: #f7f9fc; color: var(--text-secondary);
  font-weight: 600; font-size: 12px;
  text-align: left; padding: 11px 14px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
table.data-table td, table.tbl td { padding: 11px 14px; border-bottom: 1px solid #eef1f7; color: var(--text-primary); white-space: nowrap; }
table.data-table tbody tr:last-child td, table.tbl tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover td, table.tbl tbody tr:hover td { background: var(--bg-hover); }
.actions { display: flex; gap: 6px; white-space: nowrap; flex-wrap: wrap; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; font-size: 12px; color: var(--text-secondary); }

/* ===== 标签 / 徽标 ===== */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.tag::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .85; }
.tag-success { background: var(--success-bg); color: #15803d; }
.tag-warning { background: var(--warning-bg); color: #b45309; }
.tag-danger  { background: var(--danger-bg);  color: #b91c1c; }
.tag-info    { background: var(--accent-light); color: #2f5ee6; }
.tag-purple  { background: var(--purple-bg);  color: #6d28d9; }
.tag-cyan    { background: var(--cyan-bg);    color: #0e7490; }
.tag-gray    { background: #eef1f7; color: var(--text-secondary); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.status-dot.online { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.status-dot.offline { background: var(--text-muted); }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; gap: 10px; }
.pagination .pages { display: flex; gap: 4px; }
.pagination .page-btn {
  min-width: 30px; height: 30px; padding: 0 9px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  cursor: pointer; transition: all .15s; background: #fff; color: var(--text-secondary);
}
.pagination .page-btn:hover:not([disabled]) { background: var(--bg-hover); border-color: var(--border-light); color: var(--text-primary); }
.pagination .page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ===== 筛选栏 ===== */
.filter-bar, .toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select, .toolbar input, .toolbar select { height: 32px; padding: 0 12px; }
.toolbar input[type=number] { width: 150px; }
.filter-bar .spacer, .toolbar .spacer { flex: 1; }

/* ===== 仪表盘 ===== */
.dash-section-title { font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: .5px; margin: 0 0 10px 2px; }
.dash-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
@media (max-width: 1100px) { .dash-cols { grid-template-columns: 1fr; } }

/* 待办提醒 */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius-sm); background: var(--bg-card); cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.alert-item:hover { background: var(--bg-hover); transform: translateX(2px); }
.alert-item .t { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.alert-item .n { font-weight: 700; font-size: 15px; }
.alert-item .go { font-size: 12px; color: var(--text-muted); }
.alert-item.info   { border-left-color: var(--accent); }
.alert-item.warn   { border-left-color: var(--warning); }
.alert-item.danger { border-left-color: var(--danger); }
.alert-item.ok     { border-left-color: var(--success); cursor: default; }
.alert-item.ok:hover { background: var(--bg-card); transform: none; }

/* 快捷入口 */
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-actions .btn { justify-content: center; }

/* 系统状态列表 */
.status-list { display: flex; flex-direction: column; }
.status-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.status-row:last-child { border-bottom: none; }
.status-row .k { color: var(--text-secondary); }

/* ===== 平台设置 ===== */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.settings-block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: var(--bg-card); }
.settings-block .sb-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.settings-block .sb-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.6; }
.settings-block .form-group:last-child { margin-bottom: 0; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.5; }

/* 开关 */
.switch { position: relative; display: inline-flex; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { display: none; }
.switch .slider { position: absolute; inset: 0; background: #d7dce8; border-radius: 24px; transition: .2s; cursor: pointer; }
.switch .slider::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(23,35,64,.25); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.switch-row:last-child { border-bottom: none; }
.switch-row .t { font-size: 13px; }
.switch-row .d { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== 弹窗 ===== */
.modal-overlay, .modal-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(23, 35, 64, 0.42); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center;
}
.modal-overlay { display: flex; animation: overlayIn .16s ease; }
.modal-mask.show { display: flex; animation: overlayIn .16s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 480px; max-width: 94vw; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff;
  border: 1px solid var(--border); border-radius: 16px; padding: 22px 22px 18px;
  box-shadow: var(--shadow); animation: modalIn .18s cubic-bezier(.2,.9,.3,1.2);
}
.modal.large { width: 720px; }
.modal.xlarge { width: 980px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal h3 { font-size: 15px; margin-bottom: 12px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-xs); cursor: pointer; color: var(--text-muted); font-size: 18px; line-height: 1; }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-footer, .modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex: 0 0 auto; }

/* 详情信息网格（用户详情/节点详情等弹窗头部信息区） */
.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px 20px; padding: 14px 16px;
  background: var(--bg-hover); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.detail-grid > div { min-width: 0; }
.detail-grid .k { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.detail-grid .v { font-size: 13px; font-weight: 600; word-break: break-all; }

/* 详情弹窗内的分区标题 */
.detail-section { margin-top: 18px; }
.detail-section-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.detail-section-title .count { color: var(--text-muted); font-weight: 400; font-size: 12px; }

/* ===== Toast ===== */
#toast-container { position: fixed; top: 18px; right: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 200px; max-width: 380px; padding: 11px 16px 11px 14px;
  background: #fff; color: var(--text-primary);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); font-size: 13px;
  box-shadow: 0 10px 30px rgba(23,35,64,.14);
  animation: toastIn .2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info    { border-left-color: var(--accent); }
@keyframes toastIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== 空状态 / 加载 ===== */
.empty-state, .empty { text-align: center; padding: 42px 20px; color: var(--text-muted); font-size: 13px; line-height: 2; }
.empty-state .icon { font-size: 38px; margin-bottom: 10px; opacity: .5; }
.loading-wrap { padding: 40px; text-align: center; color: var(--text-secondary); }

/* ===== 图表 / 进度条 ===== */
.chart-container, .chart-area { width: 100%; height: 300px; }
.chart-container.small { height: 240px; }
.progress-bar { width: 100%; height: 8px; background: #eef1f7; border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--purple)); transition: width .35s ease; }

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ===== 徽标（面板 / 代理中心） ===== */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.on  { background: var(--success-bg); color: #15803d; }
.badge.off { background: var(--warning-bg); color: #b45309; }
.badge.dis { background: #eef1f7; color: var(--text-secondary); }

/* ===== 登录页通用 ===== */
.login-foot { margin-top: 22px; text-align: center; font-size: 11px; color: var(--text-muted); }
.login-foot a { cursor: pointer; color: var(--accent); }
.login-divider { height: 1px; margin: 20px 0; background: var(--border); }

/* ===== 公告条 ===== */
.notice {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; margin-bottom: 16px;
  background: #eef4ff; border: 1px solid #d6e4ff; border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); font-size: 13px; color: #2f4a8f; line-height: 1.7;
}
.notice::before { content: '📢'; flex: none; }

/* ===== 复选框行 ===== */
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-secondary); cursor: pointer; user-select: none; }
.chk input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

/* 侧栏分组分隔（保留类名，实际不再使用间隔，避免菜单被切断） */
.nav-sep { display: none; }
