/* =====================================================================
   鹰眼授权管理后台 · 自托管设计系统
   主色：克制的灰蓝；无外网 CDN；响应式
   ===================================================================== */
:root {
  --c-primary: #2563eb;
  --c-primary-dark: #1d4ed8;
  --c-primary-light: #eff4ff;
  --c-accent: #0ea5e9;
  --c-success: #10b981;
  --c-success-light: #ecfdf5;
  --c-warning: #f59e0b;
  --c-warning-light: #fffbeb;
  --c-danger: #ef4444;
  --c-danger-light: #fef2f2;
  --c-info: #6366f1; /* 仅小面积点缀，不做大面积紫色 */
  --c-bg: #f4f6fa;
  --c-surface: #ffffff;
  --c-sidebar: #0f1f3d;
  --c-sidebar-2: #13294f;
  --c-sidebar-active: #1d4ed8;
  --c-text: #1e293b;
  --c-text-2: #475569;
  --c-text-3: #94a3b8;
  --c-border: #e6eaf2;
  --c-border-2: #eef1f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 31, 61, 0.06), 0 4px 16px rgba(15, 31, 61, 0.05);
  --shadow-lg: 0 12px 40px rgba(15, 31, 61, 0.18);
  --sidebar-w: 232px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--c-text); }
.muted { color: var(--c-text-3); }
.small { font-size: 12px; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.hidden { display: none !important; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--c-sidebar) 0%, var(--c-sidebar-2) 100%);
  color: #cbd5e1;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform .25s ease;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 11px;
  height: var(--topbar-h);
  padding: 0 16px;
  color: #fff; font-weight: 700; font-size: 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  letter-spacing: .5px;
}
.sidebar .brand .brand-logo {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  background: rgba(255,255,255,.08); padding: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.sidebar .brand .brand-text { line-height: 1.18; min-width: 0; }
.sidebar .brand .brand-name { font-size: 15px; font-weight: 700; color: #fff; }
.sidebar .brand .brand-sub { font-size: 10px; font-weight: 500; letter-spacing: .4px; color: #8ea0bd; }
.sidebar .nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav .nav-group { font-size: 11px; color: #64748b; padding: 14px 12px 6px; letter-spacing: 1px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: 9px; color: #b6c2d6; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: var(--c-sidebar-active); color: #fff; box-shadow: 0 4px 12px rgba(29,78,216,.35); }
.sidebar .nav-foot { padding: 14px 18px; font-size: 11px; color: #5b6b85; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 17px; font-weight: 600; }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; color: var(--c-text-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--c-primary-light); color: var(--c-primary);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.content { padding: 24px; flex: 1; }
.menu-toggle { display: none; background: none; border: 0; cursor: pointer; color: var(--c-text); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15,31,61,.45); z-index: 35; }

/* ---------------- 卡片 / 统计 ---------------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--c-border-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-header h3 { font-size: 15px; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 14px; position: relative; overflow: hidden;
}
.stat-card .ico { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.stat-card .ico svg { width: 22px; height: 22px; }
.stat-card .val { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-card .lbl { color: var(--c-text-3); font-size: 13px; margin-top: 2px; }
.stat-card .sub { font-size: 12px; margin-top: 4px; color: var(--c-text-3); }
.ic-blue { background: var(--c-primary-light); color: var(--c-primary); }
.ic-green { background: var(--c-success-light); color: var(--c-success); }
.ic-amber { background: var(--c-warning-light); color: var(--c-warning); }
.ic-red { background: var(--c-danger-light); color: var(--c-danger); }
.ic-cyan { background: #ecfeff; color: #0891b2; }
.ic-indigo { background: #eef2ff; color: #4f46e5; }
.up { color: var(--c-success); } .down { color: var(--c-danger); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.chart { width: 100%; height: 300px; }
.chart-sm { width: 100%; height: 240px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 13px; font-weight: 500; cursor: pointer;
  background: #f1f5f9; color: var(--c-text-2); transition: all .15s;
  font-family: inherit; white-space: nowrap; line-height: 1.4;
}
.btn:hover { background: #e2e8f0; color: var(--c-text); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); color: #fff; }
.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-warning { background: var(--c-warning); color: #fff; }
.btn-outline { background: #fff; border-color: var(--c-border); color: var(--c-text-2); }
.btn-outline:hover { border-color: var(--c-primary); color: var(--c-primary); background: #fff; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: #eef2f7; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-link { background: none; padding: 0; border: 0; color: var(--c-primary); cursor: pointer; font-size: 13px; }
.btn-link.danger { color: var(--c-danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--c-text-2); margin-bottom: 6px; font-weight: 500; }
.field .hint { color: var(--c-text-3); font-size: 12px; margin-top: 4px; }
.input, .select, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
  background: #fff; color: var(--c-text); transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.input::placeholder { color: #b2bdcd; }
textarea.input { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { position: relative; }
.toolbar .search input { padding-left: 34px; min-width: 240px; }
.toolbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--c-text-3); }
.switch { position: relative; display: inline-block; width: 42px; height: 23px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 23px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 17px; width: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--c-primary); }
.switch input:checked + .slider::before { transform: translateX(19px); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 12px 16px; background: #f8fafc;
  color: var(--c-text-3); font-weight: 600; font-size: 12px;
  white-space: nowrap; border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0;
}
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--c-border-2); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #f9fbff; }
table.data .actions { display: flex; gap: 4px; flex-wrap: nowrap; }
table.data .actions .btn-link { padding: 2px 6px; }
.cell-main { font-weight: 600; color: var(--c-text); }
.cell-sub { font-size: 12px; color: var(--c-text-3); }

/* ---------------- 标签徽章 ---------------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; line-height: 1.7; white-space: nowrap; }
.tag-gray { background: #f1f5f9; color: #64748b; }
.tag-blue { background: var(--c-primary-light); color: var(--c-primary); }
.tag-green { background: var(--c-success-light); color: #059669; }
.tag-red { background: var(--c-danger-light); color: #dc2626; }
.tag-amber { background: var(--c-warning-light); color: #d97706; }
.tag-cyan { background: #ecfeff; color: #0891b2; }
.tag-violet { background: #f5f3ff; color: #7c3aed; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--c-success); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.dot-gray { background: #cbd5e1; }
.dot-red { background: var(--c-danger); }
.dot-amber { background: var(--c-warning); }

/* ---------------- 分页 ---------------- */
.pagination { display: flex; align-items: center; gap: 6px; justify-content: flex-end; padding: 14px 16px; flex-wrap: wrap; }
.pagination a, .pagination span.page {
  min-width: 32px; height: 32px; display: inline-grid; place-items: center;
  border: 1px solid var(--c-border); border-radius: 8px; padding: 0 8px;
  color: var(--c-text-2); background: #fff; font-size: 13px;
}
.pagination a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pagination .current { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.pagination .total { color: var(--c-text-3); margin-right: auto; font-size: 13px; }

/* ---------------- 模态框 ---------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: none; }
.modal.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(15,31,61,.5); backdrop-filter: blur(2px); }
.modal-dialog {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -48%);
  background: #fff; border-radius: 14px; width: 520px; max-width: calc(100vw - 32px);
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal-dialog.lg { width: 760px; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -45%) scale(.98); } to { opacity: 1; transform: translate(-50%, -48%) scale(1); } }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--c-border-2); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: 0; cursor: pointer; color: var(--c-text-3); font-size: 22px; line-height: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--c-border-2); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------- Toast ---------------- */
.toast-stack { position: fixed; top: 76px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border-radius: 10px; padding: 12px 16px; min-width: 240px;
  box-shadow: var(--shadow-lg); border-left: 4px solid var(--c-primary);
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  animation: slidein .2s ease;
}
.toast.success { border-left-color: var(--c-success); }
.toast.error { border-left-color: var(--c-danger); }
.toast.warning { border-left-color: var(--c-warning); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------------- 空状态 / 时间线 / 描述列表 ---------------- */
.empty { text-align: center; padding: 48px 20px; color: var(--c-text-3); }
.empty svg { width: 56px; height: 56px; opacity: .4; margin-bottom: 10px; }
.desc-list { display: grid; grid-template-columns: 130px 1fr; gap: 0; }
.desc-list dt { padding: 10px 0; color: var(--c-text-3); border-bottom: 1px dashed var(--c-border-2); }
.desc-list dd { margin: 0; padding: 10px 0; border-bottom: 1px dashed var(--c-border-2); word-break: break-all; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--c-border); }
.timeline .ti { position: relative; padding: 0 0 18px 0; }
.timeline .ti::before { content: ""; position: absolute; left: -21px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--c-primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--c-primary-light); }
.timeline .ti .t-time { font-size: 12px; color: var(--c-text-3); }
.timeline .ti .t-text { font-size: 13px; }

.seg { display: inline-flex; background: #eef1f6; border-radius: 9px; padding: 3px; gap: 2px; }
.seg a { padding: 6px 14px; border-radius: 7px; font-size: 13px; color: var(--c-text-2); }
.seg a.active { background: #fff; color: var(--c-primary); box-shadow: var(--shadow); font-weight: 600; }

/* ---------------- 登录页 ---------------- */
.login-wrap { position: relative; min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #0f1f3d 0%, #1d4ed8 120%); padding: 20px; overflow: hidden; }
.login-watermark {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(760px, 90vw); aspect-ratio: 1; pointer-events: none;
  background: url("/static/img/watermark.png") center/contain no-repeat;
  opacity: .07; z-index: 0;
}
.login-card { position: relative; z-index: 1; width: 400px; max-width: 100%; background: rgba(255,255,255,.98); border-radius: 16px; padding: 34px 34px 30px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 4px; }
.login-brand .login-logo-img { width: 92px; height: 92px; border-radius: 18px; filter: drop-shadow(0 6px 16px rgba(29,78,216,.25)); }
.login-brand h1 { font-size: 22px; letter-spacing: 1px; color: var(--c-text); }
.login-brand .login-brand-en { font-size: 11px; letter-spacing: 2px; color: var(--c-primary); font-weight: 700; }
.login-sub { text-align: center; color: var(--c-text-3); margin: 12px 0 24px; font-size: 13px; }
.alert { padding: 10px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 16px; display: flex; gap: 8px; align-items: center; }
.alert-error { background: var(--c-danger-light); color: #dc2626; border: 1px solid #fecaca; }
.alert-info { background: var(--c-primary-light); color: var(--c-primary); border: 1px solid #bfdbfe; }
.login-card .input { padding: 11px 13px; }
.login-foot { text-align: center; margin-top: 22px; font-size: 12px; color: var(--c-text-3); }

/* ---------------- 全站 Logo 水印（隐约可见，不遮挡正文） ---------------- */
.app-watermark {
  position: fixed; top: 50%; left: calc(50vw + 120px);
  width: min(520px, 46vw); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: url("/static/img/watermark.png") center/contain no-repeat;
  opacity: var(--wm-opacity, .045);
  pointer-events: none; z-index: 1;
}
@media (max-width: 960px) {
  .app-watermark { left: 50%; width: min(420px, 72vw); }
}
@media print { .app-watermark { display: none; } }

/* 大屏业务活跃分区标题 */
.biz-section-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--c-text); }
.biz-section-title .biz-bar { width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(180deg, var(--c-primary), var(--c-accent)); display: inline-block; }
.biz-section-title .btn-link { font-weight: 500; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1024px) {
  .grid-2, .grid-3, .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .sidebar.open ~ .sidebar-overlay { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}
