/* =========================================================
   律师搭子 1.2 — 公共样式
   配色沿用登录页深蓝 #0C447C 体系，浅色主题
   ========================================================= */

:root {
  --brand: #0C447C;
  --brand-hover: #185FA5;
  --brand-accent: #378ADD;
  --brand-light: #B5D4F4;
  --bg: #F2F5FA;
  --panel: #FFFFFF;
  --text: #1a1a2e;
  --text-soft: #5c6270;
  --text-muted: #9aa1af;
  --border: #E2E6EE;
  --border-soft: #EDF0F5;
  --danger: #e74c3c;
  --success: #22a06b;
  --warning: #e8a33d;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(12, 68, 124, 0.08);
  --shadow-lg: 0 24px 70px rgba(12, 68, 124, 0.16);
  --sidebar-w: 224px;
  --sidebar-collapsed-w: 64px;
  --content-max: 1680px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-hover); text-decoration: none; }
button { font-family: inherit; }

/* ===== 应用整体布局 ===== */
.app-layout { display: flex; min-height: 100dvh; }

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--brand);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-brand .logo-badge {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255,255,255,0.14);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.18); flex-shrink: 0;
}
.sidebar-brand .brand-cn { font-size: 17px; font-weight: 600; letter-spacing: 1.5px; }
.sidebar-brand .brand-en { font-size: 9.5px; letter-spacing: 2px; color: var(--brand-light); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; margin-bottom: 4px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.82);
  font-size: 14px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.10); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.16); color: #fff; font-weight: 600; }
.nav-item svg { flex-shrink: 0; }
.nav-item .nav-arrow { margin-left: auto; transition: transform 0.2s; opacity: 0.7; }
.nav-group .nav-sub { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; padding-left: 12px; }
.nav-group.expanded .nav-sub { max-height: 200px; }
.nav-group.expanded .nav-arrow { transform: rotate(180deg); }
.nav-sub-item {
  display: block; padding: 9px 14px 9px 36px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.72); font-size: 13px; margin-bottom: 3px;
  transition: background 0.15s, color 0.15s;
}
.nav-sub-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-sub-item.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 600; }

.sidebar-footer {
  padding: 12px; border-top: 1px solid rgba(255,255,255,0.12);
}
.logout-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border: none; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9);
  font-size: 14px; cursor: pointer; transition: background 0.15s;
}
.logout-btn:hover { background: rgba(231,76,60,0.85); color: #fff; }

/* 侧边栏底部：律师头像 + 退出 */
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-avatar {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; overflow: hidden;
  background: rgba(255,255,255,0.14); display: flex; align-items: center; justify-content: center;
}
.sidebar-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar-avatar-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
}
.sidebar-user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar-user-name {
  font-size: 14px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logout-link {
  align-self: flex-start; background: none; border: none; padding: 0; cursor: pointer;
  font-size: 12.5px; color: rgba(255,255,255,0.7); text-decoration: underline; text-underline-offset: 2px;
}
.logout-link:hover { color: #fff; }

/* ===== 主区域 ===== */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-width: 0;
}
.topbar {
  height: 60px; background: var(--panel);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 18px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-date { font-size: 13px; color: var(--text-muted); }
.bell {
  position: relative; cursor: pointer; color: var(--text-soft);
  display: flex; align-items: center;
}
.bell .dot {
  position: absolute; top: -3px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #fff; font-size: 10px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
}

/* ── 顶栏全局搜索 ── */
.gsearch { position: relative; width: 280px; }
.gsearch input {
  width: 100%; box-sizing: border-box; height: 34px;
  padding: 0 12px 0 32px; font-size: 13px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  outline: none; transition: border-color .15s;
}
.gsearch input:focus { border-color: var(--brand); }
.gsearch .gs-icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; display: flex;
}
.gsearch-panel {
  position: absolute; top: 42px; left: 0; right: 0; z-index: 300;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.12); max-height: 420px; overflow-y: auto;
  display: none;
}
.gsearch-panel.open { display: block; }
.gs-group-title {
  font-size: 11px; color: var(--text-muted); padding: 8px 12px 4px;
  font-weight: 600; letter-spacing: .05em;
}
.gs-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--text);
}
.gs-item:hover { background: var(--bg); }
.gs-item .gs-main { flex: 1; min-width: 0; }
.gs-item .gs-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item .gs-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-empty { padding: 18px 12px; text-align: center; font-size: 13px; color: var(--text-muted); }
@media (max-width: 768px) { .gsearch { width: 160px; } }
@media (max-width: 576px) { .gsearch { width: 120px; } }

.page-content { padding: 24px 28px 40px; flex: 1; width: 100%; }
@media (min-width: 1600px) {
  .page-content { max-width: var(--content-max); margin: 0 auto; }
}

/* ===== 卡片 ===== */
.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 16px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-title .accent-bar { width: 4px; height: 16px; background: var(--brand); border-radius: 2px; }
.card-sub { font-size: 12.5px; color: var(--text-muted); }

/* ===== 栅格 ===== */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ===== 统计小卡 ===== */
.stat-card {
  background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--brand); }
.stat-card .stat-value.small { font-size: 20px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background 0.15s, opacity 0.15s; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: #EEF3FA; color: var(--brand); }
.btn-ghost:hover { background: #E0EAF6; }
.btn-danger { background: #FDECEA; color: var(--danger); }
.btn-danger:hover { background: #f8d7d3; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* 图标按钮（非文字）用于 程序信息/强制措施/开庭安排/办案日志 添加 */
.btn-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px dashed var(--brand-accent); background: #F4F9FF;
  color: var(--brand); cursor: pointer; transition: background 0.15s;
}
.btn-icon:hover { background: #E6F1FD; }

/* ===== 徽标/标签 ===== */
.tag {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500; line-height: 1.7;
  white-space: nowrap; flex-shrink: 0;
}
.tag-blue { background: #E7F0FB; color: var(--brand); }
.tag-green { background: #E4F6EE; color: var(--success); }
.tag-orange { background: #FCF1E1; color: var(--warning); }
.tag-gray { background: #EDEFF3; color: var(--text-soft); }
.tag-red { background: #FDECEA; color: var(--danger); }
.tag-purple { background: #F1EAFB; color: #6B3FA0; }

/* ===== 通知中心（站内消息 + 系统公告合并）===== */
.notify-item {
  padding: 12px 14px; border-radius: var(--radius-sm); background: var(--panel);
  border: 1px solid var(--border-soft); margin-bottom: 10px; cursor: default;
}
.notify-item[data-type="msg"] { cursor: pointer; }
.notify-item[data-type="msg"]:hover { border-color: var(--brand); }
.notify-item.read { opacity: 0.6; }
.notify-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.notify-date { font-size: 12px; color: var(--text-muted); }
.notify-title { font-size: 14px; font-weight: 600; color: var(--text); }
.notify-content { font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.6; }

/* ===== 表格（长字段自动换行）===== */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td {
  padding: 12px 14px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border-soft);
  white-space: normal; word-break: break-word; overflow-wrap: anywhere;
}
.data-table th {
  background: #F7F9FC; color: var(--text-soft); font-weight: 600;
  font-size: 12.5px; white-space: nowrap;
}
.data-table td .case-no-link + .tag { margin-left: 6px; }
.data-table td .case-no-link { word-break: break-word; overflow-wrap: anywhere; }
.data-table tr:hover td { background: #FAFBFD; }
.data-table .col-actions { white-space: nowrap; width: 1%; }
.data-table td.num { font-variant-numeric: tabular-nums; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-soft); margin-bottom: 6px; }
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-control, .form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); background: #fff;
  outline: none; transition: border-color 0.15s; font-family: inherit;
}
.form-control:focus, .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--brand-accent);
}
.form-group textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0 16px; }
.form-row-5 { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 0 12px; }
.span-2 { grid-column: span 2; }
@media (max-width: 900px) { .form-row-5 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 640px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } .form-row-5 { grid-template-columns: 1fr; } }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,32,52,0.45);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 40px 16px; overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 560px; max-width: 100%; margin: auto 0;
  animation: modalIn 0.18s ease;
}
.modal.modal-lg { width: 760px; }
.modal.modal-sm { width: 420px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border-soft);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { border: none; background: none; font-size: 22px; color: var(--text-muted); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 22px; max-height: 66vh; overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--border-soft);
}

/* ===== 空状态 ===== */
.empty {
  text-align: center; color: var(--text-muted);
  padding: 40px 20px; font-size: 13.5px;
}
.empty svg { display: block; margin: 0 auto 12px; opacity: 0.5; }

/* ===== Toast ===== */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 999; }
.toast {
  background: #2b3548; color: #fff; padding: 11px 20px;
  border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2); animation: toastIn 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ===== 分段控件 / 模块切换 ===== */
.seg { display: inline-flex; background: #EEF2F8; border-radius: var(--radius-sm); padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: none; background: none; padding: 8px 16px; border-radius: 6px;
  font-size: 13.5px; color: var(--text-soft); cursor: pointer; white-space: nowrap;
}
.seg button.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 4px rgba(12,68,124,0.10); }

/* ===== 详情字段展示 ===== */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 24px; }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-item .dt { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.detail-item .dd { font-size: 14px; color: var(--text); white-space: normal; word-break: break-word; overflow-wrap: anywhere; }

/* ===== 待办列表（日期+内容同一行）===== */
.todo-list { list-style: none; }
.todo-line {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); margin-bottom: 8px; background: #FBFCFE;
}
.todo-line .todo-date { color: var(--brand); font-weight: 600; font-size: 13px; white-space: nowrap; flex-shrink: 0; }
.todo-line .todo-text { flex: 1; white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.todo-line.done .todo-text { text-decoration: line-through; color: var(--text-muted); }
.todo-line input[type=checkbox] { margin-top: 4px; }

/* ===== 时间线（程序信息/强制措施/开庭/日志）===== */
.timeline { list-style: none; position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 14px 14px; }
.timeline li::before { content: ''; position: absolute; left: -18px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand-accent); border: 2px solid #fff; }
.timeline .tl-date { font-size: 12px; color: var(--brand); font-weight: 600; }
.timeline .tl-body { font-size: 13.5px; color: var(--text); white-space: normal; word-break: break-word; overflow-wrap: anywhere; }

/* ===== 可点击行/卡片 ===== */
.clickable { cursor: pointer; }

/* ===== 加载态 ===== */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }

/* ===== 工具类 ===== */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-right { text-align: right; }
.text-brand { color: var(--brand); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-600 { font-weight: 600; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ===== 响应式断点 =====
   手机   < 576px
   平板   576px - 991px（侧边栏可收缩）
   电脑   >= 992px
   超宽  >= 1600px（内容区居中）
   ===================================================== */

/* 侧边栏收缩模式（平板/小屏电脑主动折叠图标） */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
  transition: width 0.2s;
}
.sidebar.collapsed .sidebar-brand .brand-cn,
.sidebar.collapsed .sidebar-brand .brand-en,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .logout-btn span,
.sidebar.collapsed .sidebar-user-meta { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 12px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 13px; }
.sidebar.collapsed .logout-btn { justify-content: center; padding: 13px; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 0; }
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .nav-sub { display: none; }
.sidebar.collapsed ~ .main-area { margin-left: var(--sidebar-collapsed-w); }

/* 菜单开关 */
.menu-toggle { display: none; border: none; background: none; cursor: pointer; color: var(--text-soft); margin-right: 4px; }

/* 平板：默认收缩侧边栏 */
@media (max-width: 991px) and (min-width: 576px) {
  .sidebar { width: var(--sidebar-collapsed-w); }
  .sidebar .sidebar-brand .brand-cn,
  .sidebar .sidebar-brand .brand-en,
  .sidebar .nav-item span,
  .sidebar .logout-btn span { display: none; }
  .sidebar .sidebar-brand { justify-content: center; padding: 20px 12px; }
  .sidebar .nav-item { justify-content: center; padding: 13px; }
  .sidebar .logout-btn { justify-content: center; padding: 13px; }
  .sidebar .sidebar-user-meta { display: none; }
  .sidebar .sidebar-user { justify-content: center; padding: 0; }
  .sidebar .nav-arrow,
  .sidebar .nav-sub { display: none; }
  .main-area { margin-left: var(--sidebar-collapsed-w); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* 手机：完全隐藏侧边栏，汉堡菜单滑出 */
@media (max-width: 575px) {
  .sidebar { position: fixed; transform: translateX(-100%); transition: transform 0.22s ease; width: var(--sidebar-w); }
  .sidebar.open { transform: none; }
  .sidebar .sidebar-brand .brand-cn,
  .sidebar .sidebar-brand .brand-en,
  .sidebar .nav-item span,
  .sidebar .logout-btn span { display: inline; }
  .main-area { margin-left: 0; width: 100%; max-width: 100%; }
  .menu-toggle { display: inline-flex !important; }
  /* 个人中心卡片撑满：清除左右内边距，由 card 自身撑满 */
  .page-content { padding: 12px 0 24px; }
  .topbar { padding: 0 16px; height: 56px; }
  .topbar .page-title { font-size: 16px; }
  .topbar-right { gap: 10px; }
  .topbar-date { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .card { padding: 16px 14px; margin-bottom: 12px; width: 100%; max-width: 100%; box-sizing: border-box; }
  .card-header { margin-bottom: 12px; }
  /* 模态框手机端适配 */
  .modal-overlay { padding: 12px 8px; }
  .modal { width: 100% !important; max-width: 100%; border-radius: 10px; }
  .modal-header { padding: 14px 16px; }
  .modal-header h3 { font-size: 15px; }
  .modal-body { padding: 16px; max-height: 70vh; }
  .modal-footer { padding: 12px 16px; flex-direction: column-reverse; gap: 8px; }
  .modal-footer .btn { width: 100%; }
  .form-group { margin-bottom: 12px; }
  .form-group label { font-size: 12.5px; margin-bottom: 4px; }
  .form-group input, .form-group select, .form-group textarea { font-size: 15px; }
  .form-control { font-size: 15px; }

  /* 个人中心卡片撑满屏幕 */
  .profile-layout { padding: 0 12px; gap: 12px; }
  .profile-content { width: 100%; min-width: 0; }
  .profile-nav.tab-nav { margin: 0 12px 12px; }
  .profile-content > section > .card { border-radius: 10px; }
}

/* 平板端表单适配 */
@media (max-width: 768px) and (min-width: 576px) {
  .modal-overlay { padding: 20px 12px; }
  .modal { width: 95% !important; }
  .modal-body { padding: 18px; }
}

/* 小电脑：4列变2列 */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); } }

/* ===== 移动端表格卡片化 ===== */
@media (max-width: 768px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    background: var(--panel); border-radius: var(--radius-sm);
    box-shadow: 0 1px 4px rgba(12,68,124,0.06); margin-bottom: 10px;
    padding: 12px 14px; border: 1px solid var(--border-soft);
  }
  .data-table td {
    display: flex; justify-content: flex-start; align-items: flex-start;
    flex-wrap: wrap;
    padding: 7px 6px 7px 0; border-bottom: 1px dashed var(--border-soft);
    font-size: 13px; gap: 4px 10px;
  }
  .data-table td > * { min-width: 0; }
  .data-table td .case-no-link { word-break: break-word; overflow-wrap: anywhere; }
  .data-table td .tag { margin-left: 8px; flex-shrink: 0; }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before {
    content: attr(data-label); flex: 0 0 72px; max-width: 72px;
    color: var(--text-muted); font-size: 12px; font-weight: 500; line-height: 1.5;
  }
  .data-table td > *:not(.case-no-link) { flex: 1 1 calc(100% - 82px); }
  .data-table td:first-child { align-items: center; }
  .data-table td.col-actions { justify-content: flex-start; gap: 8px; }
  .data-table td.col-actions::before { display: none; }
}

/* ===== 空状态（带图标） ===== */
.empty-box { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.empty-box svg { display: block; margin: 0 auto 14px; opacity: 0.5; }
.empty-box .btn { margin-top: 14px; }

/* ===== 设置项行（label + 右侧控件） ===== */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border-soft); gap: 12px;
}
.setting-row:last-child { border-bottom: none; }
.setting-row .s-label { font-weight: 500; color: var(--text); font-size: 14px; }
.setting-row .s-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.setting-row .s-control { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.setting-row select, .setting-row input[type="number"] {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; min-width: 90px;
}

/* ===== 开关 ===== */
.switch {
  position: relative; display: inline-block; width: 44px; height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0; background: #D1D8E2;
  border-radius: 24px; transition: 0.2s;
}
.switch .slider::before {
  content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ===== 标签页（左侧垂直导航） ===== */
.tab-nav {
  display: flex; flex-direction: column; gap: 4px; min-width: 170px;
}
.tab-nav .tab-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-size: 14px; cursor: pointer; white-space: nowrap;
}
.tab-nav .tab-item:hover { background: #F2F5FA; }
.tab-nav .tab-item.active { background: #E7F0FB; color: var(--brand); font-weight: 600; }
.tab-nav .tab-item svg { flex-shrink: 0; }
@media (max-width: 768px) {
  .tab-nav { flex-direction: row; overflow-x: auto; min-width: auto; padding-bottom: 4px; }
  .tab-nav .tab-item { padding: 9px 12px; font-size: 13px; }
}

/* ===== 文件上传区 ===== */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 28px 20px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s;
  color: var(--text-soft); font-size: 13.5px;
}
.upload-zone:hover { border-color: var(--brand-accent); background: #F7FAFE; }
.upload-zone input { display: none; }

/* ===== 危险区 ===== */
.danger-zone {
  border: 1px solid #F5C6CB; border-radius: var(--radius); background: #FDF2F2; padding: 18px;
}
.danger-zone .dz-title { color: var(--danger); font-weight: 600; font-size: 14px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.danger-zone .dz-desc { color: var(--text-soft); font-size: 13px; line-height: 1.7; }

/* ===== 徽标数字 ===== */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 600;
}

/* ===== 全局底部站点信息 ===== */
.site-footer {
  background: #F2F4F7;
  border-top: 1px solid #E4E7EC;
  color: #6B7280;
  font-size: 13px;
  line-height: 1.9;
  margin-top: auto;
}
.site-footer-inner {
  max-width: 1680px;
  margin: 0 auto;
  padding: 18px 32px 22px;
  text-align: center;
}
.site-footer .sf-loading { color: #9CA3AF; font-size: 13px; }
.sf-line { word-break: break-word; }
.sf-line-1 { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; }
.sf-line-2 { margin-top: 4px; color: #6B7280; }
.sf-line-3 { margin-top: 10px; color: #6B7280; }
.sf-beian { white-space: nowrap; }
.sf-link {
  color: #6B7280;
  text-decoration: none;
  transition: color 0.15s;
}
.sf-link:hover { color: #0C447C; }
.sf-sep { color: #C9CDD3; margin: 0 2px; user-select: none; }
.sf-svc-label { color: #6B7280; margin-right: 4px; }
.sf-svc-label:not(:first-child) { margin-left: 12px; }
.sf-svc-val { color: #4B5563; font-weight: 500; }
@media (max-width: 720px) {
  .site-footer-inner { padding: 14px 16px 18px; }
  .sf-line-1 { font-size: 12px; }
  .sf-line-3 { font-size: 12px; }
}

/* =========================================================
   主题系统（1.3 新增）
   - 配色族：[data-theme="..."] 仅覆盖品牌色组（含侧边栏）
   - 明暗模式：[data-mode="dark"] 覆盖底色/文字/边框/阴影组
   - 优先级：:root < [data-theme] < [data-mode] < 行内自定义(JS 注入)
   - 自定义主色由 theme.js 通过 html.style.setProperty 注入 --brand 等
   ========================================================= */

/* —— 预设配色族（品牌色组，与明暗模式正交叠加） —— */
html[data-theme="teal"] {
  --brand: #0E7C7B;
  --brand-hover: #149B99;
  --brand-accent: #34C0BD;
  --brand-light: #B2E3E2;
}
html[data-theme="green"] {
  --brand: #1F7A54;
  --brand-hover: #27916A;
  --brand-accent: #3FAE7E;
  --brand-light: #BFE9D6;
}
html[data-theme="amber"] {
  --brand: #B7791F;
  --brand-hover: #CF8F33;
  --brand-accent: #E6AB4D;
  --brand-light: #F6E2BD;
}
html[data-theme="purple"] {
  --brand: #5B3FA0;
  --brand-hover: #7458BD;
  --brand-accent: #9577D6;
  --brand-light: #D8CCF0;
}
html[data-theme="rose"] {
  --brand: #B3395F;
  --brand-hover: #C95679;
  --brand-accent: #E07A98;
  --brand-light: #F2CDD8;
}

/* —— 暗色模式（覆盖底色/文字/边框/阴影，品牌色跟随 theme） —— */
html[data-mode="dark"] {
  --bg: #0F1115;
  --panel: #181B21;
  --text: #E6E8EC;
  --text-soft: #A9AEB8;
  --text-muted: #6B7280;
  --border: #2A2F38;
  --border-soft: #22272F;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);
}

/* 暗色下对若干硬编码浅色块的修正 */
html[data-mode="dark"] .welcome-card {
  background: linear-gradient(120deg, var(--brand), var(--brand-hover));
}
html[data-mode="dark"] .warn-badge.court { background: rgba(55, 138, 221, 0.18); color: var(--brand-accent); }
html[data-mode="dark"] .warn-badge.pres { background: rgba(180, 71, 46, 0.18); color: #E08A6F; }
html[data-mode="dark"] .warn-badge.cons { background: rgba(31, 122, 84, 0.18); color: #5FCF9A; }
html[data-mode="dark"] .warn-badge.dl { background: rgba(183, 121, 31, 0.18); color: #E6AB4D; }
html[data-mode="dark"] .sf-link:hover { color: var(--brand-accent); }
html[data-mode="dark"] .stat-card .stat-value { color: var(--brand-accent); }
html[data-mode="dark"] .kpi-value { color: var(--text); }

/* 欢迎卡渐变跟随主题（覆盖 index.html 内联硬编码） */
.welcome-card { background: linear-gradient(120deg, var(--brand), var(--brand-hover)); }

/* —— 主题切换器 UI —— */
.theme-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-swatch {
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  border: 2px solid transparent; position: relative; transition: transform .12s, box-shadow .12s;
}
.theme-swatch:hover { transform: scale(1.08); }
.theme-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel) inset; }
.theme-swatch.custom {
  display: flex; align-items: center; justify-content: center;
  background: conic-gradient(#0C447C, #5B3FA0, #B3395F, #0E7C7B, #B7791F, #0C447C);
}
.theme-swatch.custom::after { content: '\270E'; color: #fff; font-size: 15px; }
.mode-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.mode-seg button {
  border: none; background: transparent; color: var(--text-soft);
  padding: 6px 14px; font-size: 13px; cursor: pointer; transition: background .12s, color .12s;
}
.mode-seg button.active { background: var(--brand); color: #fff; }
.theme-custom-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.theme-custom-row input[type="color"] {
  width: 40px; height: 32px; border: 1px solid var(--border); border-radius: 6px;
  background: none; cursor: pointer; padding: 2px;
}
.theme-custom-row label { font-size: 13px; color: var(--text-soft); }
.theme-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }

/* ============================================================
   界面自定义（列宽调整 / 分栏拖拽；V2.0 起移除卡片拖拽排序）
   ============================================================ */

/* 表格列宽调整手柄 */
.col-resizer {
  position: absolute; right: -3px; top: 0; height: 100%; width: 8px;
  cursor: col-resize; z-index: 3; touch-action: none;
}
.col-resizer::after {
  content: ''; position: absolute; right: 3px; top: 18%; height: 64%; width: 2px;
  background: transparent; border-radius: 2px; transition: background .12s;
}
.data-table thead th { position: relative; }
.data-table thead th:hover .col-resizer::after { background: var(--brand); }
.data-table.cols-locked { table-layout: fixed; }
.data-table.cols-locked td { word-break: break-word; }

/* 案件列表（首页在办 / 业务管理）：fixed 布局铺满卡片，内容换行，杜绝横向滚动条 */
#activeCaseTable,
#dataTable { table-layout: fixed; width: 100%; }
#activeCaseTable td,
#dataTable td { word-break: break-word; overflow-wrap: anywhere; }
/* 首页在办列表：无按钮列，溢出内容裁剪（编号 nowrap 超长不撑出滚动条）；容器兜底不横向滚动 */
#activeCaseTable td { overflow: hidden; }
#activeCaseWrap { overflow-x: hidden; }
/* 操作列：固定宽度且不裁剪，按钮完整显示（避免窄列溢出产生滚动条/遮挡） */
#dataTable .col-actions { width: 110px; min-width: 110px; white-space: nowrap; overflow: visible; }

/* 详情页左右栏分隔拖拽 */
.split-handle {
  position: absolute; top: 0; bottom: 0; width: 10px; margin-left: -5px;
  cursor: col-resize; z-index: 6; border-radius: 4px; touch-action: none;
  background: transparent; transition: background .15s; display: none;
}
.split-handle::after {
  content: ''; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 36px; border-radius: 2px; background: var(--border);
}
.split-handle.show { display: block; }
.split-handle:hover, .split-handle:hover::after { background: var(--brand); }
.cd-layout:hover .split-handle { display: block; }

@media (max-width: 720px) {
  .split-handle { display: none !important; }
}
