:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --sidebar: #101a2e;
  --sidebar-2: #172440;
  --primary: #2f6bff;
  --primary-soft: #e8efff;
  --success: #12a670;
  --success-soft: #e4f7f0;
  --warn: #e08a00;
  --warn-soft: #fdf3e0;
  --danger: #e03b3b;
  --danger-soft: #fdeaea;
  --text: #1d2433;
  --muted: #6b7688;
  --line: #e6eaf2;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(19, 34, 66, 0.08);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

a { color: inherit; text-decoration: none; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #cdd6e6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 22px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #4c8dff, #7a5cff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
}
.brand-title { font-size: 15px; font-weight: 600; color: #fff; line-height: 1.2; }
.brand-sub { font-size: 11px; color: #7f8ca6; }

.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 11px; color: #647191; padding: 12px 12px 6px; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 2px;
  color: #b9c4d8; cursor: pointer; font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(47, 107, 255, 0.9), rgba(47, 107, 255, 0.55)); color: #fff; }
.nav-icon { width: 18px; text-align: center; font-size: 14px; }

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

.topbar {
  height: 62px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 16px; font-weight: 600; }
.page-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.content { padding: 22px 24px 40px; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 16px 18px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 120;
    transform: translateX(-100%); transition: transform 0.2s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 12px 40px rgba(16, 26, 46, 0.35); }
  .nav-mask { position: fixed; inset: 0; background: rgba(16, 26, 46, 0.35); z-index: 110; }
}
.nav-toggle { display: none; }

.kpi { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.kpi-label { font-size: 12.5px; color: var(--muted); }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.kpi-value.small { font-size: 20px; }
.kpi-foot { font-size: 12px; color: var(--muted); }
.kpi-accent { width: 34px; height: 4px; border-radius: 4px; background: var(--primary); }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 13px;
  transition: all 0.15s; font-family: inherit; white-space: nowrap;
}
.btn:hover { border-color: #c9d4ea; background: #f7f9ff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #245bdd; border-color: #245bdd; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
}
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: #eef1f6; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
input, select {
  font-family: inherit; font-size: 13px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
  outline: none; transition: border 0.15s;
  width: 100%;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.toolbar .field { min-width: 140px; }
.spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600;
  font-size: 12px; background: #f9fafd; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
tbody tr:hover { background: #f8faff; }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.empty { padding: 34px; text-align: center; color: var(--muted); font-size: 13px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 4px 0; color: var(--muted); font-size: 12.5px; }

/* ---------- 图表 ---------- */
.bars { display: flex; align-items: flex-end; gap: 18px; height: 190px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-stack { width: 100%; display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; }
.bar { width: 62%; border-radius: 6px 6px 3px 3px; transition: height 0.4s; min-height: 2px; }
.bar-in { background: linear-gradient(180deg, #4c8dff, #2f6bff); }
.bar-out { background: linear-gradient(180deg, #ffb454, #f2941f); }
.bar-tax { background: linear-gradient(180deg, #8a7bff, #6d5bff); }
.bar-label { font-size: 11.5px; color: var(--muted); }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(16, 26, 46, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px;
}
.modal {
  background: #fff; border-radius: 16px; width: min(880px, 100%);
  max-height: 86vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(16, 26, 46, 0.3);
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px 20px; overflow: auto; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
pre {
  background: #0f172a; color: #cbd5e1; padding: 14px; border-radius: 10px;
  font-size: 12px; overflow: auto; max-height: 320px; margin: 0;
}

.loading { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,0.45); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  background: var(--sidebar); color: #fff; padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16, 26, 46, 0.35); font-size: 13px; max-width: 420px;
}
.toast.error { background: #8f1f1f; }
.toast.success { background: #0d6a4a; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.status-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }

/* ---------- 税务一键申报 ---------- */
.hint { font-size: 12px; color: var(--muted); line-height: 1.8; }

.apply-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; margin-bottom: 18px; border-radius: var(--radius);
  background: linear-gradient(90deg, #17305e 0%, #2f6bff 65%, #7a5cff 100%);
  color: #fff; box-shadow: var(--shadow);
}
.apply-banner-title { font-size: 16px; font-weight: 700; }
.apply-banner-desc { font-size: 12.5px; color: #d7e3ff; margin-top: 4px; max-width: 900px; line-height: 1.6; }

.apply-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.apply-login { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.apply-login .field { min-width: 220px; }

.apply-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; font-size: 13px; }
.apply-kv > div { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbff; }
.apply-kv span { font-size: 12px; color: var(--muted); }
.apply-kv b { font-size: 14px; }

.apply-section-title { margin: 18px 0 8px; font-size: 13.5px; font-weight: 600; padding-left: 10px; border-left: 3px solid var(--primary); }

.apply-alert { margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: #8a5a00; font-size: 13px; }
.apply-alert.danger { background: var(--danger-soft); color: #9c2020; }

.apply-taxes { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 13px; }
.apply-taxes label { display: flex; align-items: center; gap: 6px; }
.apply-taxes input { width: auto; }

@media (max-width: 860px) {
  .apply-kv { grid-template-columns: 1fr; }
  .apply-banner { flex-direction: column; align-items: flex-start; }
}

/* ---------- 登录态与登录浮层 ---------- */
.user-line { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.user-name { font-weight: 600; color: var(--text); }
.logout-link { color: var(--primary); text-decoration: none; }
.logout-link:hover { text-decoration: underline; }

.login-modal { width: min(420px, 100%); padding: 26px 26px 22px; }
.login-title { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.login-tip { margin: 0 0 18px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.login-tabs { display: flex; gap: 8px; margin: 14px 0 4px; }
.login-tab {
  flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: transparent; font-size: 12.5px; font-family: inherit; color: var(--muted); cursor: pointer;
}
.login-tab.active { border-color: var(--primary); color: var(--primary); background: rgba(37, 99, 235, 0.06); font-weight: 600; }
.code-row { display: flex; gap: 8px; align-items: center; }
.code-row input { flex: 1; }
.trial-chip {
  padding: 3px 9px; border-radius: 999px; background: rgba(37, 99, 235, 0.1);
  color: var(--primary); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.login-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.login-field input {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 13px; font-family: inherit; outline: none;
}
.login-field input:focus { border-color: var(--primary); }
.login-actions { display: flex; justify-content: flex-end; margin-top: 6px; }

/* ---------- 图表与分页增强（R-13） ---------- */
.echart { width: 100%; height: 230px; }
.pager-jump {
  width: 64px; padding: 4px 8px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 12px; font-family: inherit;
}

