/* ==========================================================================
   法法联盟·律师办 — 旗舰律所级设计系统 (Law Theme v4.0 · v2.1.0)
   设计理念：克制、权威、精密、高信任感（深墨蓝 + 香槟金 + 冷瓷白）
   原则：只做全局美学与交互升维，绝不覆盖业务语义色（红/橙/绿/状态标签）
   ========================================================================== */

:root {
  /* 品牌核心色系 */
  --law-ink: #0F1B29;
  --law-ink-2: #132234;
  --law-navy: #1B3A5C;
  --law-navy-hover: #142D48;
  --law-navy-soft: rgba(27, 58, 92, 0.08);
  --law-gold: #D4A853;
  --law-gold-light: #E6C47B;
  --law-gold-soft: rgba(212, 168, 83, 0.14);

  /* 中性表面与层次 */
  --law-canvas: #F4F6FA;
  --law-surface: #FFFFFF;
  --law-surface-muted: #F8FAFC;
  --law-border: rgba(15, 23, 42, 0.08);
  --law-border-strong: #CBD5E1;

  /* 文本层级 */
  --law-text-1: #0F172A;
  --law-text-2: #334155;
  --law-text-3: #64748B;
  --law-text-4: #94A3B8;

  /* 精致多层投影 */
  --law-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --law-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --law-shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.07), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --law-shadow-lg: 0 18px 42px -10px rgba(15, 23, 42, 0.16), 0 6px 16px -6px rgba(15, 23, 42, 0.08);

  /* 统一圆角尺度（商务利落感） */
  --law-r-sm: 6px;
  --law-r-md: 8px;
  --law-r-lg: 12px;

  /* 动效曲线 */
  --law-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* 覆盖旧版变量（瑞士精密紧凑尺度） */
  --primary-color: #1B3A5C;
  --bg-color: #F4F6FA;
  --text-color: #0F172A;
  --sidebar-width: 224px;
  --header-height: 52px;
}

/* ---------- 全局基础排版与渲染优化 ---------- */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  background-color: var(--law-canvas);
  color: var(--law-text-1);
  letter-spacing: 0.004em;
}

/* 优雅极简滚动条 */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.24);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.42); }

/* ---------- 左侧旗舰深墨蓝导航栏 ---------- */
.sidebar {
  background: linear-gradient(180deg, #111F30 0%, #0D1826 55%, #0A131E 100%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 2px 0 18px rgba(10, 19, 30, 0.14);
  z-index: 30;
}

.sidebar-logo {
  height: var(--header-height);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0) 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
  padding: 0 16px;
}

.sidebar-logo .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: #F8FAFC;
  width: 100%;
  transition: opacity 0.2s var(--law-ease);
}
.sidebar-logo .brand:hover { opacity: 0.94; }

.sidebar-logo .brand-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(212, 168, 83, 0.22) 0%, rgba(212, 168, 83, 0.07) 100%);
  border: 1px solid rgba(227, 185, 107, 0.36);
  color: var(--law-gold-light);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}
.sidebar-logo .brand-mark { width: 17px; height: 17px; }

.sidebar-logo .brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.sidebar-logo .brand-text b {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #FFFFFF;
}
.sidebar-logo .brand-text i {
  font-style: normal;
  font-size: 10px;
  color: rgba(227, 185, 107, 0.78);
  letter-spacing: 0.3px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .brand-text { display: none; }
.sidebar.collapsed .sidebar-logo { padding: 0; justify-content: center; }
.sidebar.collapsed .sidebar-logo .brand { justify-content: center; }
.sidebar.collapsed .sidebar-footer { display: none; }

.nav-menu {
  padding: 12px 0 16px !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.nav-menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); }
.nav-menu::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.26); }

/* 侧栏分组标题 */
.sidebar .section-title,
.sidebar .nav-group-label {
  margin: 16px 16px 6px 20px !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  color: rgba(148, 163, 184, 0.68) !important;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  user-select: none;
}
.sidebar .nav-group-label:first-child { margin-top: 4px !important; }
.sidebar.collapsed .nav-group-label { display: none; }

/* 侧栏导航项 */
.sidebar .nav-item {
  position: relative;
  display: flex;
  align-items: center;
  padding: 7.5px 12px !important;
  margin: 1.5px 9px !important;
  border-radius: 7px !important;
  font-size: 13px !important;
  font-weight: 500;
  color: rgba(213, 224, 236, 0.84) !important;
  transition: background-color 0.18s var(--law-ease), color 0.18s var(--law-ease), transform 0.18s var(--law-ease);
}

.sidebar .nav-item .nav-icon {
  margin-right: 10px !important;
  width: 18px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.78;
  transition: opacity 0.18s ease, color 0.18s ease;
}

.sidebar .nav-item:hover {
  background: rgba(255, 255, 255, 0.065) !important;
  color: #FFFFFF !important;
}
.sidebar .nav-item:hover .nav-icon { opacity: 1; }

.sidebar .nav-item.active {
  background: linear-gradient(90deg, rgba(212, 168, 83, 0.17) 0%, rgba(27, 58, 92, 0.58) 100%) !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  box-shadow: inset 0 0 0 1px rgba(227, 185, 107, 0.22), 0 2px 8px rgba(0, 0, 0, 0.18) !important;
}
.sidebar .nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--law-gold-light), var(--law-gold));
}
.sidebar .nav-item.active .nav-icon {
  opacity: 1;
  color: var(--law-gold-light);
}

.sidebar.collapsed .nav-item {
  padding: 10px 0 !important;
  margin: 3px 10px !important;
  justify-content: center;
}
.sidebar.collapsed .nav-item .nav-icon { margin-right: 0 !important; }
.sidebar.collapsed .nav-item.active::before { display: none; }

/* 侧栏底部状态与版本徽标 */
.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.78);
  background: rgba(0, 0, 0, 0.16);
  user-select: none;
}
.sidebar-footer .sf-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer .sf-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.65);
  flex-shrink: 0;
}
.sidebar-footer .sf-ver {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(212, 168, 83, 0.14);
  border: 1px solid rgba(212, 168, 83, 0.28);
  color: var(--law-gold-light);
  font-weight: 600;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ---------- 顶部毛玻璃导航栏 ---------- */
.top-header {
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--law-border) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03) !important;
  padding: 6px 20px !important;
}

.header-left {
  font-size: 14.5px !important;
  font-weight: 700 !important;
  color: var(--law-text-1) !important;
  letter-spacing: -0.01em;
}

.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--law-text-2);
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.sidebar-toggle-btn:hover {
  background: var(--law-surface-muted);
  border-color: var(--law-border);
  color: var(--law-navy);
}
.sidebar-toggle-btn:active { transform: scale(0.96); }

/* 消息铃铛图标按钮 */
.top-header .notif-bell {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--law-text-2);
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  margin-right: 2px !important;
}
.top-header .notif-bell:hover {
  background: var(--law-surface-muted);
  border-color: var(--law-border);
  color: var(--law-navy);
}
#notif-badge {
  top: 2px !important;
  right: 2px !important;
  box-shadow: 0 0 0 2px #fff;
  font-variant-numeric: tabular-nums;
}

/* 右上角用户胶囊与下拉菜单 */
.user-profile {
  background: var(--law-surface) !important;
  border: 1px solid var(--law-border-strong) !important;
  border-radius: 999px !important;
  padding: 3px 10px 3px 5px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  color: var(--law-text-1) !important;
  box-shadow: var(--law-shadow-xs);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease !important;
}
.user-profile:hover {
  border-color: rgba(27, 58, 92, 0.38) !important;
  box-shadow: 0 3px 10px rgba(27, 58, 92, 0.08);
  background: #FAFBFD !important;
}
.user-avatar-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1B3A5C 0%, #0F243D 100%);
  color: var(--law-gold-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  flex-shrink: 0;
}

.user-dropdown {
  border-radius: 12px !important;
  border: 1px solid rgba(15, 23, 42, 0.09) !important;
  box-shadow: var(--law-shadow-lg) !important;
  padding: 8px !important;
  min-width: 232px !important;
}
.user-dropdown .ud-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--law-text-2);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.user-dropdown .ud-link:hover {
  background: #F1F5F9;
  color: var(--law-navy);
}
.user-dropdown .ud-sep {
  height: 1px;
  background: #EEF2F6;
  margin: 6px 4px;
}

/* ---------- 内容主画布 ---------- */
.content-area {
  background: var(--law-canvas);
  padding: 16px 20px 28px;
}
@media (max-width: 768px) {
  .content-area { padding: 14px 12px 28px; }
  .top-header { padding: 8px 12px !important; }
}

/* ---------- 全局卡片与容器质感 ---------- */
.card, .panel, .section-card, .hw-card {
  background: var(--law-surface);
  border: 1px solid var(--law-border);
  border-radius: var(--law-r-lg);
  box-shadow: var(--law-shadow-sm);
}

/* ---------- 全局按钮交互规范（克制高质感） ---------- */
.btn, button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--law-r-md);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background-color 0.16s var(--law-ease),
              border-color 0.16s var(--law-ease),
              color 0.16s var(--law-ease),
              box-shadow 0.16s var(--law-ease),
              transform 0.14s var(--law-ease);
}

.btn:hover:not(:disabled),
a.btn:hover {
  transform: translateY(-1px);
}
.btn:active:not(:disabled),
a.btn:active {
  transform: translateY(0);
}
.btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.16);
}

.btn-primary, a.btn-primary {
  background: linear-gradient(180deg, #21456C 0%, #1B3A5C 100%);
  border: 1px solid #16314E;
  color: #FFFFFF;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-primary:hover:not(:disabled), a.btn-primary:hover {
  background: linear-gradient(180deg, #1B3A5C 0%, #142D48 100%);
  border-color: #10253B;
  box-shadow: 0 6px 16px -4px rgba(27, 58, 92, 0.36);
}

/* ---------- 全局表单控件精修 ---------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
select,
textarea {
  border-color: var(--law-border-strong);
  border-radius: var(--law-r-sm);
  color: var(--law-text-1);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}
input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
input[type="tel"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
input[type="datetime-local"]:hover,
input[type="search"]:hover,
select:hover,
textarea:hover {
  border-color: #94A3B8;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: var(--law-navy) !important;
  box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.12) !important;
  outline: none;
}

/* ---------- 全局数据表格精修 ---------- */
table {
  font-variant-numeric: tabular-nums;
}
table thead th {
  background: #F8FAFC;
  color: #475569;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #E2E8F0;
}
table tbody tr {
  transition: background-color 0.12s ease;
}
table tbody tr:hover {
  background-color: rgba(27, 58, 92, 0.025);
}

/* ---------- 全局 Flash 浮动提示（支持关闭与丝滑入场） ---------- */
.law-toast-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(560px, 92vw);
  width: max-content;
}
.law-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.55;
  box-shadow: var(--law-shadow-lg);
  backdrop-filter: blur(8px);
  animation: lawToastIn 0.24s var(--law-ease);
}
.law-toast--info {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(27, 58, 92, 0.18);
  border-left: 4px solid var(--law-navy);
  color: var(--law-navy);
}
.law-toast--error {
  background: rgba(255, 250, 250, 0.98);
  border: 1px solid #FECACA;
  border-left: 4px solid #DC2626;
  color: #991B1B;
}
.law-toast__close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}
.law-toast__close:hover { opacity: 1; background: rgba(15, 23, 42, 0.06); }

@keyframes lawToastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 桌面端嵌入模式（body.embed）完全兼容保护 ---------- */
body.embed .content-area {
  padding: 14px 16px 24px;
}

/* ---------- 平板与阔折叠展开屏自适应（601px - 1024px） ---------- */
@media (max-width: 1024px) and (min-width: 769px) {
  :root {
    --sidebar-width: 200px;
  }
  .sidebar-logo { padding: 0 12px; }
  .sidebar-logo .brand-text b { font-size: 14px; }
  .sidebar-logo .brand-text i { display: none; }
  .sidebar .nav-item { padding: 8px 11px !important; margin: 2px 8px !important; font-size: 13px !important; }
  .content-area { padding: 14px 14px 28px; overflow-x: hidden; }
  .top-header { padding: 8px 14px !important; }
}

/* ---------- 手机与窄折叠屏自适应（<= 768px：抽屉导航 + 零横向滚动 + 紧致高密度） ---------- */
@media (max-width: 768px) {
  html, body, .main-wrapper {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  .sidebar {
    position: fixed !important;
    left: 0; top: 0; bottom: 0;
    width: 248px !important;
    transform: translateX(-100%);
    z-index: 10001 !important;
    transition: transform 0.26s var(--law-ease);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 33, 0.52);
    backdrop-filter: blur(2px);
    z-index: 10000;
  }
  .sidebar-mask.show { display: block; }
  .top-header {
    padding: 6px 10px !important;
    min-height: 48px !important;
    gap: 6px !important;
  }
  .header-left { font-size: 14.5px !important; gap: 6px !important; }
  .user-profile { padding: 3px 8px 3px 4px !important; font-size: 12px !important; }
  .user-avatar-dot { width: 22px; height: 22px; font-size: 11px; }
  .content-area {
    padding: 10px 10px 24px !important;
    overflow-x: hidden !important;
  }
}

/* 超紧凑标准手机（<= 480px）：进一步压缩留白，让首屏装下更多核心内容 */
@media (max-width: 480px) {
  .content-area { padding: 8px 8px 20px !important; }
}


/* ============================================================
   v2.1.2 精密双层微雕图标体系（LawPrecision Duotone v2）与第一梯队表面质感
   ============================================================ */
svg.nvi .ic-duotone,
svg.lp-ic .ic-duotone {
  fill: var(--ic-fill, currentColor);
  fill-opacity: var(--ic-fill-op, 0.14);
  stroke: none;
}
.sidebar .nav-item .nav-icon svg.nvi {
  width: 17px;
  height: 17px;
  transition: transform 0.16s ease, color 0.16s ease;
}
.sidebar .nav-item:hover .nav-icon svg.nvi {
  transform: translateY(-0.5px);
}
.sidebar .nav-item.active .nav-icon svg.nvi {
  color: #E6C47B !important;
  --ic-fill: #E6C47B;
  --ic-fill-op: 0.24;
}
.lp-ic {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: -0.2em;
  flex-shrink: 0;
}
.lp-ic--sm { width: 14px; height: 14px; }
.lp-ic--md { width: 18px; height: 18px; }
.lp-ic--lg { width: 20px; height: 20px; }

/* 玻璃浮雕微图标徽章（第一梯队面板标题/KPI 专用） */
.lp-ic-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #F5F8FC 0%, #EAF0F8 100%);
  border: 1px solid #D9E4F0;
  color: #163250;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 1px 2px rgba(15, 27, 41, 0.04);
  flex-shrink: 0;
}
.lp-ic-badge--gold {
  background: linear-gradient(145deg, rgba(230, 196, 123, 0.22) 0%, rgba(212, 168, 83, 0.12) 100%);
  border-color: rgba(230, 196, 123, 0.42);
  color: #F2D694;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.lp-ic-badge--red {
  background: linear-gradient(145deg, #FFF5F5 0%, #FEE2E2 100%);
  border-color: #FECACA;
  color: #B91C1C;
}
.lp-ic-badge--violet {
  background: linear-gradient(145deg, #F8F5FF 0%, #EDE9FE 100%);
  border-color: #DDD6FE;
  color: #5B21B6;
}
.lp-ic-badge--emerald {
  background: linear-gradient(145deg, #F2FDF8 0%, #D1FAE5 100%);
  border-color: #A7F3D0;
  color: #047857;
}
