/* ============================================================
   电子价签 · 账户分发平台 — 管理端样式
   商务风：左侧深色导航 + 右侧浅色主内容
   ============================================================ */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-hover: #1e293b;
  --sidebar-active: rgba(59, 130, 246, 0.16);
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --border: #e2e8f0;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --violet: #7c3aed;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", Consolas, "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
::placeholder { color: var(--text-3); }

/* ---------------- 登录页 ---------------- */

.login-wrap { display: flex; min-height: 100vh; }

.login-hero {
  flex: 1.15;
  background: linear-gradient(160deg, #0f172a 0%, #1e3a8a 58%, #2563eb 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 72px;
  position: relative;
  overflow: hidden;
}
.login-hero::after {
  content: "";
  position: absolute;
  right: -140px; top: -140px;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .05);
}
.login-hero::before {
  content: "";
  position: absolute;
  left: -100px; bottom: -160px;
  width: 380px; height: 380px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
}
.hero-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 48px; }
.hero-logo {
  width: 44px; height: 44px; border-radius: 11px;
  background: rgba(255, 255, 255, .14);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.hero-logo svg { width: 24px; height: 24px; }
.hero-brand-title { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.hero-title { font-size: 34px; font-weight: 800; line-height: 1.3; margin: 0 0 14px; }
.hero-sub { font-size: 15px; color: rgba(255, 255, 255, .72); margin: 0 0 44px; max-width: 460px; }
.hero-features { display: flex; flex-direction: column; gap: 20px; position: relative; z-index: 1; }
.hero-feature { display: flex; align-items: flex-start; gap: 14px; }
.hero-feature-ico {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  background: rgba(255, 255, 255, .12);
  display: flex; align-items: center; justify-content: center;
}
.hero-feature-ico svg { width: 19px; height: 19px; }
.hero-feature b { display: block; font-size: 14.5px; margin-bottom: 2px; }
.hero-feature span { font-size: 13px; color: rgba(255, 255, 255, .62); }
.hero-foot { margin-top: 56px; font-size: 12.5px; color: rgba(255, 255, 255, .45); position: relative; z-index: 1; }

.login-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  padding: 40px;
}
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 24px; font-weight: 800; margin: 0 0 6px; }
.login-card .login-tip { color: var(--text-2); font-size: 13.5px; margin: 0 0 30px; }
.login-field { margin-bottom: 18px; }
.login-field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; color: var(--text-2); }
.login-input-wrap { position: relative; }
.login-input-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-3); pointer-events: none;
}
.login-input-wrap input { padding-left: 40px; }
.login-alert {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.login-alert.show { display: block; animation: shake .3s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.login-btn { width: 100%; height: 44px; font-size: 15px; margin-top: 6px; }
.login-foot { margin-top: 28px; text-align: center; font-size: 12px; color: var(--text-3); }

/* ---------------- 布局骨架 ---------------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: none;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sb-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 16px;
}
.sb-logo {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #2563eb, #4f8cff);
  display: flex; align-items: center; justify-content: center;
}
.sb-logo svg { width: 19px; height: 19px; }
.sb-brand b { color: #fff; font-size: 15px; display: block; line-height: 1.25; }
.sb-brand span { font-size: 11px; color: #64748b; }
.sb-nav { flex: 1; padding: 6px 12px; overflow-y: auto; }
.sb-section {
  font-size: 11px; letter-spacing: 1.5px; color: #475569;
  padding: 16px 10px 6px; text-transform: uppercase;
}
.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--sidebar-text); cursor: pointer;
  margin-bottom: 2px; font-size: 13.5px;
  transition: background .15s, color .15s;
  user-select: none;
}
.sb-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.sb-item:hover { background: var(--sidebar-hover); color: #fff; }
.sb-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sb-item.active svg { opacity: 1; color: #7dabff; }

.sb-user {
  margin: 10px 12px 14px;
  background: var(--sidebar-hover);
  border-radius: 10px;
  padding: 11px 12px;
  display: flex; align-items: center; gap: 10px;
}
.sb-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-info b {
  color: #fff; font-size: 13px; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-info span { font-size: 11px; color: #94a3b8; }
.sb-icon-btn {
  width: 30px; height: 30px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 7px; background: transparent;
  color: #94a3b8; cursor: pointer; transition: all .15s;
}
.sb-icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sb-icon-btn svg { width: 15px; height: 15px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px; flex: none;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 26px; gap: 14px;
}
.topbar h1 { font-size: 16.5px; font-weight: 700; margin: 0; }
.topbar .tb-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tb-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 600;
  border-radius: 999px; padding: 5px 12px;
}
.tb-chip svg { width: 13px; height: 13px; }

.content { padding: 24px 26px 40px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ---------------- 通用组件 ---------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.card-head .head-sub { font-size: 12px; color: var(--text-3); }
.card-head .head-right { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 15px;
  border: 1px solid transparent; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-secondary:hover:not(:disabled) { border-color: #cbd5e1; color: var(--text); background: #f8fafc; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-ghost-danger { background: transparent; color: var(--danger); }
.btn-ghost-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat-card { padding: 18px 20px; display: flex; align-items: center; gap: 15px; }
.stat-ico {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.stat-ico svg { width: 22px; height: 22px; }
.stat-ico.blue { background: var(--primary-soft); color: var(--primary); }
.stat-ico.green { background: var(--success-soft); color: var(--success); }
.stat-ico.violet { background: #f5f3ff; color: var(--violet); }
.stat-ico.amber { background: var(--warning-soft); color: var(--warning); }
.stat-val { font-size: 24px; font-weight: 800; line-height: 1.15; }
.stat-label { font-size: 12.5px; color: var(--text-3); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3);
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  background: #f8fafc; white-space: nowrap;
}
.tbl td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .cell-main { font-weight: 600; }
.tbl .cell-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.tbl .cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.tbl .mono { font-family: var(--mono); font-size: 13px; }
.tbl .port-num {
  font-family: var(--mono); font-weight: 700; font-size: 14px;
  color: var(--primary); background: var(--primary-soft);
  padding: 2px 9px; border-radius: 6px;
}
.tbl .url-cell { display: flex; align-items: center; gap: 6px; max-width: 300px; }
.tbl .url-cell code {
  font-family: var(--mono); font-size: 12px; color: var(--text-2);
  background: #f1f5f9; padding: 3px 8px; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.copy-btn {
  border: 0; background: transparent; color: var(--text-3);
  cursor: pointer; padding: 4px; border-radius: 6px; flex: none;
  display: inline-flex;
}
.copy-btn:hover { color: var(--primary); background: var(--primary-soft); }
.copy-btn svg { width: 14px; height: 14px; }

.empty {
  text-align: center; padding: 48px 20px; color: var(--text-3);
}
.empty svg { width: 40px; height: 40px; opacity: .4; margin-bottom: 10px; }
.empty p { margin: 0; font-size: 13px; }

/* 徽标 */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.gray { background: #f1f5f9; color: var(--text-3); }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.violet { background: #f5f3ff; color: var(--violet); }
.badge.slate { background: #f8fafc; color: var(--text-2); border: 1px solid var(--border); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }

/* 提示横幅 */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: 10px; padding: 13px 16px; margin-bottom: 18px;
  font-size: 13px;
}
.banner svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.banner.warn { background: var(--warning-soft); color: #92400e; border: 1px solid #fde68a; }
.banner.info { background: var(--primary-soft); color: #1e40af; border: 1px solid #bfdbfe; }
.banner b { font-weight: 700; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; color: var(--text-2); }
.field label .req { color: var(--danger); margin-left: 3px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; height: 38px;
  border: 1px solid #d5dde7; border-radius: 8px;
  padding: 0 12px; font-size: 13.5px; font-family: var(--font);
  color: var(--text); background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 72px; padding: 9px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}
input:disabled, select:disabled { background: #f8fafc; color: var(--text-3); }
.switch-row { display: flex; align-items: center; gap: 10px; }
.switch-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.switch-row label { margin: 0; cursor: pointer; }

/* 弹窗内错误横幅：保存失败/冲突原因直接显示在弹窗内 */
.modal-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.modal-error.show { display: flex; gap: 8px; align-items: flex-start; }
.modal-error svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }

/* 字段即时冲突检测结果 */
.check-msg { font-size: 12px; margin-top: 5px; display: none; }
.check-msg.ok { display: block; color: var(--success); }
.check-msg.bad { display: block; color: var(--danger); }

/* 弹窗 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .48);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 20px 20px;
  animation: fadeIn .15s;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 14px;
  width: 100%; max-width: 560px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
  animation: slideUp .18s ease-out;
}
@keyframes slideUp { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head {
  padding: 17px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.modal-close {
  margin-left: auto; border: 0; background: transparent; cursor: pointer;
  width: 30px; height: 30px; border-radius: 7px; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #f1f5f9; color: var(--text); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 22px; }
.modal-foot {
  padding: 15px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}
.modal-confirm-text { color: var(--text-2); font-size: 13.5px; margin: 0; }

/* 生成的密码展示 */
.gen-pw {
  background: #0f172a; color: #7dabff;
  font-family: var(--mono); font-size: 20px; font-weight: 700;
  border-radius: 10px; padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  letter-spacing: 1px;
}
.gen-pw .copy-btn { color: #94a3b8; }
.gen-pw .copy-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }

/* Toast */
.toast-wrap {
  position: fixed; top: 18px; right: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: #fff; border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
  padding: 12px 16px; font-size: 13.5px; min-width: 240px; max-width: 380px;
  display: flex; align-items: center; gap: 9px;
  animation: toastIn .22s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--primary); }
.toast svg { width: 16px; height: 16px; flex: none; }
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--danger); }
.toast.info svg { color: var(--primary); }
.toast.hide { animation: toastOut .25s forwards; }
@keyframes toastIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateX(30px); opacity: 0; } }

/* 加载中 */
.spinner {
  width: 15px; height: 15px; flex: none;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.spinner.dark { border-color: rgba(15, 23, 42, .2); border-top-color: var(--text-2); }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading { padding: 60px; text-align: center; color: var(--text-3); }

/* 工作台流程图卡片 */
.flow-card { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.flow-step { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.flow-num {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.flow-text { font-size: 13px; color: var(--text-2); }
.flow-text b { color: var(--text); }
.flow-arrow { color: var(--text-3); margin: 0 14px; font-size: 16px; }
.api-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: #0f172a; color: #7dabff;
  font-family: var(--mono); font-size: 12.5px;
  border-radius: 8px; padding: 8px 12px; margin-top: 12px;
}
.api-chip .copy-btn { color: #94a3b8; }
.api-chip .copy-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.method {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  background: var(--success-soft); color: var(--success);
  padding: 2px 7px; border-radius: 5px; margin-right: 8px;
}

@media (max-width: 900px) {
  .login-hero { display: none; }
  .sidebar { width: 200px; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
