:root {
  --primary: #1f6feb;
  --primary-d: #1450b8;
  --bg: #0f172a;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --ok: #16a34a;
  --err: #dc2626;
}
* { box-sizing: border-box; }
[hidden], #admin-app[hidden] { display: none !important; }
body {
  margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text); background: linear-gradient(135deg, #1e3a8a, #0ea5e9);
  min-height: 100vh;
}
.portal-wrap { max-width: 420px; margin: 0 auto; padding: 48px 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px; background: #fff; color: var(--primary); font-weight: 800;
}
.card {
  background: var(--card); border-radius: 16px; padding: 24px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.welcome { text-align: center; font-size: 16px; color: var(--muted); margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tab {
  flex: 1; padding: 9px 0; border: none; background: #eef2f7; color: var(--muted);
  border-radius: 9px; font-size: 13px; cursor: pointer; transition: .15s;
}
.tab.active { background: var(--primary); color: #fff; }
.tab-pane { display: none; flex-direction: column; gap: 12px; }
.tab-pane.active { display: flex; }
.tab-pane input {
  padding: 12px 14px; border: 1px solid #d8dee9; border-radius: 10px; font-size: 15px; outline: none;
}
.tab-pane input:focus { border-color: var(--primary); }
.tab-pane button, #sms-send, #wx-get, #wx-mock {
  padding: 12px 14px; border: none; border-radius: 10px; background: var(--primary); color: #fff;
  font-size: 15px; cursor: pointer;
}
.tab-pane button:hover { background: var(--primary-d); }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.row button { white-space: nowrap; background: #eef2f7; color: var(--primary); }
.qr { background: #f1f5f9; border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); font-size: 13px; word-break: break-all; }
.msg { margin-top: 14px; min-height: 20px; text-align: center; font-size: 14px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }
.footer { text-align: center; color: rgba(255,255,255,.8); font-size: 12px; margin-top: 18px; }

.admin-login {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  max-width: none; margin: 0; padding: 24px 16px;
  background: linear-gradient(135deg, #1e3a8a, #0ea5e9);
}
.admin-login .card { padding: 24px; width: 100%; max-width: 420px; }
.admin-login form { display: flex; flex-direction: column; gap: 12px; }
.admin-login input {
  padding: 12px 14px; border: 1px solid #d8dee9; border-radius: 10px; font-size: 15px;
}
.admin-login button {
  padding: 12px 14px; border: none; border-radius: 10px; background: var(--primary); color: #fff; font-size: 15px; cursor: pointer;
}
.hint { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

/* ---- 管理后台：左侧竖向菜单布局 ---- */
.admin-layout {
  display: flex; min-height: 100vh; max-width: 1400px; margin: 0 auto;
  background: rgba(255,255,255,.95); border-radius: 0;
}
.admin-sidebar {
  width: 220px; min-width: 220px; flex-shrink: 0;
  background: #1e293b; color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.admin-sidebar-head { padding: 20px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-sidebar-head h1 { margin: 0; font-size: 18px; color: #fff; font-weight: 700; }
.admin-sidebar-sub { font-size: 12px; color: #64748b; }
.admin-menu { flex: 1; display: flex; flex-direction: column; padding: 8px 0; overflow-y: auto; }
.admin-menu-item {
  display: block; padding: 11px 20px; color: #94a3b8; text-decoration: none;
  font-size: 14px; cursor: pointer; transition: .15s; border-left: 3px solid transparent;
}
.admin-menu-item:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.admin-menu-item.active { background: rgba(31,111,235,.15); color: #fff; border-left-color: var(--primary); }
.admin-sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-sidebar-foot button { padding: 6px 14px; border: none; border-radius: 8px; background: #334155; color: #e2e8f0; cursor: pointer; font-size: 13px; }
.admin-sidebar-foot button:hover { background: #475569; }

.admin-content { flex: 1; padding: 24px; min-width: 0; }
.admin-pane { display: none; }
.admin-pane.active { display: block; }
.admin-pane h2 { font-size: 18px; margin: 0 0 16px; }
.admin-content section { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eee; }
th { color: var(--muted); font-weight: 600; }
.form-inline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.form-inline input { padding: 8px 10px; border: 1px solid #d8dee9; border-radius: 8px; }
.form-inline button { padding: 8px 14px; border: none; border-radius: 8px; background: var(--primary); color: #fff; cursor: pointer; }
.logs { background: #0f172a; color: #9ca3af; padding: 12px; border-radius: 8px; max-height: 280px; overflow: auto; font-size: 12px; }
button.danger { background: var(--err); color: #fff; border: none; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.btn-sm { padding: 4px 10px; border: 1px solid #d8dee9; border-radius: 6px; background: #fff; color: var(--text); font-size: 12px; cursor: pointer; transition: .15s; }
.btn-sm:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm.btn-warn { border-color: #f59e0b; color: #f59e0b; }
.btn-sm.btn-warn:hover { background: #f59e0b; color: #fff; }
.btn-sm.danger { border-color: var(--err); }
.btn-sm.danger:hover { background: var(--err); color: #fff; }

.sessions-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager .info { color: var(--muted); font-size: 13px; margin-right: 8px; }
.pager button {
  padding: 5px 12px; border: 1px solid #d8dee9; border-radius: 6px; background: #fff; color: var(--text);
  font-size: 13px; cursor: pointer; transition: .15s;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

.modal { position: fixed; inset: 0; z-index: 999; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-box { position: relative; background: #fff; border-radius: 12px; padding: 24px; width: 460px; max-width: 90vw; box-shadow: 0 16px 48px rgba(0,0,0,.2); }
.modal-box h3 { margin: 0 0 16px; font-size: 16px; }
.modal-box .btn-cancel { padding: 8px 18px; border: 1px solid #d8dee9; border-radius: 8px; background: #fff; color: var(--text); cursor: pointer; font-size: 14px; }
.modal-box .btn-cancel:hover { background: #f1f5f9; }

.sms-config-form { display: flex; flex-direction: column; gap: 8px; }
.sms-config-form .form-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sms-config-form .form-label { min-width: 140px; color: var(--muted); font-size: 13px; }
.sms-config-form select { padding: 8px 10px; border: 1px solid #d8dee9; border-radius: 8px; font-size: 14px; }
.sms-config-form input { padding: 8px 10px; border: 1px solid #d8dee9; border-radius: 8px; font-size: 14px; width: 100%; }
.sms-config-form input[type="password"] { width: 100%; }
.sms-config-form textarea { padding: 8px 10px; border: 1px solid #d8dee9; border-radius: 8px; font-size: 13px; width: 100%; font-family: monospace; resize: vertical; }
.sms-provider-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding: 12px; background: #f8fafc; border-radius: 8px; }
.sms-provider-fields h4 { margin: 0 0 4px; font-size: 14px; }
#sms-config-save { padding: 8px 18px; border: none; border-radius: 8px; background: var(--primary); color: #fff; cursor: pointer; font-size: 14px; }
#sms-config-save:hover { background: var(--primary-d); }
#sms-test-send { padding: 8px 16px; border: 1px solid var(--primary); border-radius: 8px; background: #fff; color: var(--primary); cursor: pointer; font-size: 14px; }
#sms-test-send:hover { background: var(--primary); color: #fff; }
#sms-test-send:disabled { opacity: .5; cursor: not-allowed; }
.admin-wrap h3 { font-size: 14px; margin: 16px 0 8px; color: #334155; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); margin-right: 12px; }
.chk input { width: auto !important; }
#settings-save, #adm-pass-save, #nic-apply { padding: 8px 18px; border: none; border-radius: 8px; background: var(--primary); color: #fff; cursor: pointer; font-size: 14px; }
.btn-outline, #nic-preset, #nic-refresh, #nic-enforce {
  padding: 8px 16px; border: 1px solid var(--primary); border-radius: 8px; background: #fff; color: var(--primary); cursor: pointer; font-size: 14px;
}
.nic-status { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.nic-chip { background: #f1f5f9; color: #334155; border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.nic-table-wrap { overflow-x: auto; margin: 8px 0 20px; }
.nic-table { width: 100%; min-width: 1080px; border-collapse: collapse; font-size: 13px; }
.nic-table th { white-space: nowrap; background: #f8fafc; }
.nic-table td { vertical-align: middle; }
.nic-table .nic-name { font-weight: 700; color: #0f172a; }
.nic-table .nic-meta { display: block; margin-top: 2px; font-size: 12px; color: #64748b; font-weight: 400; }
.nic-table tr.role-portal { background: #f0fdf4; }
.nic-table tr.role-mgmt { background: #eff6ff; }
.nic-table tr.role-unused { background: #fff; }
.nic-table input, .nic-table select {
  width: 100%; min-width: 108px; padding: 6px 8px; border: 1px solid #d8dee9; border-radius: 6px; font-size: 13px; background: #fff;
}
.nic-table .nic-ip, .nic-table .nic-mask, .nic-table .nic-gw { min-width: 128px; }
.nic-table input:disabled, .nic-table select:disabled { background: #f1f5f9; color: #94a3b8; }
.nic-table .nic-live { font-size: 12px; color: #64748b; white-space: nowrap; }
