/* ============================================================
   律师事务所管理系统 —— 专业深蓝主题
   设计原则：稳重、克制、清晰；白底 + 深蓝点缀 + 中性灰背景 + 柔和阴影
   ============================================================ */
:root {
    --topbar-h: 56px;
    --sidebar-w: 200px;
    --sidebar-collapsed: 64px;

    /* 主色：专业深蓝 */
    --primary: #1f4e79;
    --primary-color: #1f4e79;
    --primary-dark: #16395c;
    --primary-light: #2b6a9e;
    --primary-50: #f4f5f7;
    --primary-100: #eaedf0;
    --primary-200: #d6dce3;

    --accent: #5b7186;
    --accent-hover: #40586f;

    --sidebar-bg: #ffffff;
    --sidebar-hover: #f4f5f7;
    --sidebar-active: #e9ecf0;
    --content-bg: #f5f6f7;

    --text: #2b3a4d;
    --text-muted: #66788f;
    --text-light: #9aa9bc;
    --border: #e2e9f2;
    --border-light: #edf2f8;
    --card-bg: #ffffff;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 36px rgba(15, 23, 42, .14);

    --radius: 8px;
    --radius-sm: 6px;
    --transition: .18s ease;

    /* 同步覆盖 Bootstrap 主色变量，使 btn/bg/text/pagination 等组件统一 */
    --bs-primary: #1f4e79;
    --bs-primary-rgb: 31, 78, 121;
    --bs-link-color: #1f4e79;
    --bs-link-hover-color: #16395c;
    --bs-border-color: #e2e9f2;
    --bs-secondary-color: #66788f;
}

* { box-sizing: border-box; }

body {
    margin: 0; padding: 0;
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans CJK SC", "STHeiti", "WenQuanYi Micro Hei", sans-serif;
    background: var(--content-bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(31, 78, 121, .16); }

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 600; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== 顶部栏（深色导航） ===== */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1030;
    height: var(--topbar-h);
    background: #2d4566;
    display: flex; align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .18);
}
.topbar-brand {
    width: auto;
    min-width: var(--sidebar-w);
    height: 100%;
    display: flex; align-items: center; gap: 10px;
    padding: 0 14px;
    background: transparent;
    color: #f3f6fa;
    text-decoration: none; font-size: 16px; font-weight: 700;
    letter-spacing: .5px;
    transition: var(--transition);
}
.topbar-brand:hover { color: #ffffff; }
.topbar-brand .brand-logo,
.topbar-brand img {
    height: auto;
    width: auto;
    max-height: 34px;
    max-width: 168px;
    flex-shrink: 0;
    border-radius: 8px;
    object-fit: contain;
    display: block;
    background: transparent;
}
.sidebar-collapsed .topbar-brand .brand-logo,
.sidebar-collapsed .topbar-brand img {
    max-height: 34px;
    max-width: 48px;
}
.topbar-brand .brand-text {
    white-space: nowrap;
    font-size: 17px;
    line-height: 1.2;
    color: #f3f6fa;
    font-weight: 700;
}
.sidebar-collapsed .topbar-brand { width: var(--sidebar-collapsed); min-width: var(--sidebar-collapsed); justify-content: center; padding: 0 6px; }
.sidebar-collapsed .topbar-brand .brand-text { display: none; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topbar-right .btn {
    color: #e8eef5; border: none; background: transparent;
    padding: 7px 13px; font-size: 14px; border-radius: var(--radius-sm);
    transition: var(--transition);
}
.topbar-right .btn i { color: #d5deea; }
.topbar-right .btn:hover { color: #ffffff; background: rgba(255, 255, 255, .10); }
.topbar-right .btn:hover i { color: #ffffff; }
.topbar-right .btn .fa-crown { color: #f1c40f; }
.topbar-right .btn.show,
.topbar-right .btn:focus,
.topbar-right .btn:active {
    color: #ffffff;
    background: rgba(255, 255, 255, .12);
    box-shadow: none;
}
.topbar-user { color: #e8eef5; font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.topbar-user i { margin-right: 0; color: #d5deea; }
.topbar-avatar,
.user-avatar-preview,
.assistant-user-avatar img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  background: #d6e0ea;
}
.topbar-avatar { width: 26px; height: 26px; border: 1px solid rgba(255,255,255,.35); }
.user-avatar-field {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  max-width: 520px;
}
.user-avatar-field-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  width: 80px;
}
.user-avatar-field-caption {
  font-size: 12px;
  color: #64748b;
  line-height: 1.2;
  text-align: center;
}
.user-avatar-field-controls {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
}
.user-avatar-field-controls .form-control { max-width: 360px; }
.user-avatar-preview {
  width: 72px;
  height: 72px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #d6e0ea;
}
.user-avatar-fallback,
.assistant-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1f4e79;
  color: #fff;
  flex-shrink: 0;
  text-decoration: none;
}
.user-avatar-fallback {
  width: 72px;
  height: 72px;
  font-size: 1.5rem;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #d6e0ea;
}
.assistant-user-avatar:hover { color: #fff; opacity: .92; }
.assistant-user-avatar img { width: 32px; height: 32px; border: 0; }
@media (max-width: 575.98px) {
  .user-avatar-field { flex-direction: column; align-items: center; text-align: center; }
  .user-avatar-field-controls { width: 100%; align-items: stretch; }
  .user-avatar-field-controls .form-control { max-width: none; }
}
.topbar-divider { width: 1px; height: 22px; background: rgba(255, 255, 255, .18); margin: 0 6px; }
.mobile-menu-btn { color: #e8eef5 !important; }
.mobile-menu-btn:hover { color: #ffffff !important; background: rgba(255, 255, 255, .10) !important; }

/* ===== 侧边栏 ===== */
.sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
    width: var(--sidebar-w); z-index: 1020;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    overflow-y: auto; overflow-x: hidden;
    transition: var(--transition);
    padding: 5px 0;
}
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }

details.sidebar-uncommon { margin: 0; }
details.sidebar-uncommon > summary.sidebar-section {
    cursor: pointer;
    list-style: none;
}
details.sidebar-uncommon > summary.sidebar-section::-webkit-details-marker { display: none; }
details.sidebar-uncommon > summary.sidebar-section::after {
    content: ' ▸';
    font-size: .75em;
}
details.sidebar-uncommon[open] > summary.sidebar-section::after { content: ' ▾'; }
.sidebar-section {
    padding: 7px 22px 1px; font-size: 12px; font-weight: 600;
    color: #6b7c90; letter-spacing: .5px; white-space: nowrap;
}
.sidebar-collapsed .sidebar-section { display: none; }

.sidebar-nav { list-style: none; margin: 0; padding: 0 10px; }
.sidebar-nav li { margin: 0; }
.sidebar-nav a {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 7px 14px; border-radius: var(--radius-sm);
    color: #2f4054; text-decoration: none; font-size: 14px; font-weight: 500;
    transition: var(--transition); white-space: nowrap;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: var(--primary); }
.sidebar-nav a.active {
    background: var(--sidebar-active); color: var(--primary-dark); font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary);
}
.sidebar-nav a i { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; color: #4f647c; transition: var(--transition); }
.sidebar-nav a:hover i, .sidebar-nav a.active i { color: var(--primary); }
.sidebar-nav a .nav-label { transition: var(--transition); }
.sidebar-collapsed .sidebar-nav a { gap: 0; padding: 7px 0; justify-content: center; border-radius: var(--radius-sm); margin: 1px 8px; }
.sidebar-collapsed .sidebar-nav a.active { box-shadow: none; background: var(--sidebar-active); }
.sidebar-collapsed .sidebar-nav a .nav-label { display: none; }

.sidebar-toggle {
    position: absolute; bottom: 14px; left: 50%; transform: translateX(calc(-50% + 12px));
    background: #fff; border: 1px solid var(--border); color: var(--text-muted);
    width: 34px; height: 34px; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 13px; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.sidebar-toggle i { transform: translateX(1px); }
.sidebar-toggle:hover { background: var(--primary-50); color: var(--primary); border-color: var(--primary-200); }

/* ===== 主内容区 ===== */
.main-content {
    margin-left: var(--sidebar-w); margin-top: var(--topbar-h);
    padding: 22px 26px; min-height: calc(100vh - var(--topbar-h));
    transition: var(--transition);
}
.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed); }

/* ===== 卡片 ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease;
}
.card-header {
    background: #f8fafd;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    padding: 12px 16px;
    font-size: 14px;
    color: #33465c;
}
.card-body { padding: 16px 18px; }

.card-header.bg-primary {
    background: var(--primary) !important;
    border-bottom: none;
    color: #fff;
    font-weight: 600;
}
.card-header.bg-primary .text-white,
.card-header.bg-primary h5,
.card-header.bg-primary h6 { color: #fff !important; }

/* ===== 表格 ===== */
.table { margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .85rem; }
.table th { font-weight: 600; font-size: 13px; color: #5b6f86; border-bottom: 1px solid var(--border); background: #f7fafd; }
.table td { border-color: var(--border-light); color: #3a4c61; }
.table-light, .table-light > th { background: #f7fafd !important; }
/* 去除 Bootstrap 5.1 默认的深色粗分隔线（.table>:not(:first-child) 的 2px currentColor，
   在存在 colgroup 或多个表区段时会呈现黑色横线），统一改用上面的浅灰 1px 分隔 */
.table > :not(:first-child) { border-top: 0; }
.table-hover tbody tr { transition: background .15s; }
.table-hover tbody tr:hover { background: var(--primary-50); }

/* ===== 统计卡片 ===== */
.stats-card {
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease, transform .2s ease;
    border: 1px solid var(--border);
    background: #fff;
}
.stats-card:hover { box-shadow: var(--shadow-md); }
.stats-value { font-size: 1.8rem; font-weight: 700; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.stats-label { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }

/* ===== 按钮 ===== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
    letter-spacing: 0;
}
.btn:focus { box-shadow: 0 0 0 3px rgba(31, 78, 121, .15); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-light); border-color: var(--primary-light); box-shadow: 0 2px 8px rgba(31, 78, 121, .25); }
.btn-primary:active { background: var(--primary-dark) !important; border-color: var(--primary-dark) !important; }
.btn-ai {
    background: #f78b1e; border-color: #f78b1e; color: #fff;
}
.btn-ai:hover, .btn-ai:focus {
    background: #e57b12; border-color: #e57b12; color: #fff;
    box-shadow: 0 2px 8px rgba(247, 139, 30, .28);
}
.btn-ai:active { background: #d56f0c !important; border-color: #d56f0c !important; color: #fff !important; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary-200); background: #fff; }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-outline-secondary { color: #5b6f86; border-color: #d3deea; background: #fff; }
.btn-outline-secondary:hover { background: var(--primary-50); color: var(--primary); border-color: var(--primary-200); }
.btn-sm { border-radius: var(--radius-sm); }
.btn-link { color: var(--primary); text-decoration: none; }
.btn-link:hover { color: var(--primary-dark); }

/* ===== 表单 ===== */
.form-label { font-weight: 500; color: #44566c; }
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: #d7e0ec;
    font-size: 14px;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 78, 121, .13);
}
.form-control-lg { border-radius: var(--radius); }
.input-group-text { background: #f7fafd; border-color: #d7e0ec; color: var(--text-muted); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31, 78, 121, .13); }

/* ===== 徽章（实心底色 + 白字） ===== */
.badge { font-weight: 500; letter-spacing: 0; border-radius: 5px; padding: .35em .6em; }
.badge.bg-primary { background: #187cfc !important; color: #fff; }      /* 进行中 */
.badge.bg-success { background: #16824c !important; color: #fff; }      /* 已交 / 已开 */
.badge.bg-warning { background: #f0a202 !important; color: #fff; }
.badge.bg-danger  { background: #dc3545 !important; color: #fff; }
.badge.bg-info    { background: #1b6d9e !important; color: #fff; }
.badge.bg-secondary { background: #666e76 !important; color: #fff; }    /* 未开 / 未交 */
.badge.bg-dark { background: #33465c !important; color: #fff; }
/* 深色按钮内、白色顶栏上的计数徽章保持实心醒目 */
.btn .badge.bg-danger, .btn .badge.bg-warning,
.topbar-right .badge {
    background: #dc3545 !important; color: #fff !important;
}

/* ===== 分页 ===== */
.pagination .page-link {
    border-radius: var(--radius-sm); margin: 0 3px;
    border-color: var(--border); color: var(--primary);
    transition: var(--transition);
}
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .page-link:hover { background: var(--primary-50); color: var(--primary-dark); }
.pagination .disabled .page-link { color: var(--text-light); }

/* ===== 提示框 ===== */
.alert { border-radius: var(--radius); border: 1px solid transparent; box-shadow: var(--shadow-sm); }
.alert-success { background: #f0f8f3; border-color: #d6ebdd; color: #27683f; }
.alert-info    { background: #eef6fc; border-color: #d3e7f6; color: #1b618c; }
.alert-warning { background: #fdf7ea; border-color: #f5e3bb; color: #8a5e10; }
.alert-danger  { background: #fdf0ee; border-color: #f6d5d0; color: #b03326; }
.alert-primary { background: var(--primary-50); border-color: var(--primary-200); color: var(--primary-dark); }
.alert .btn-close { font-size: .75rem; }

/* ===== 下拉菜单 ===== */
.dropdown-menu {
    border-radius: var(--radius); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); padding: 6px;
}
.dropdown-item { border-radius: var(--radius-sm); padding: 8px 14px; font-size: 14px; color: #44566c; transition: var(--transition); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--primary-50); color: var(--primary-dark); }
.dropdown-divider { border-color: var(--border-light); }
.lead-import-menu {
    min-width: 16.5rem;
    padding: .85rem .9rem;
}
.lead-import-file {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 2.1rem;
    padding: .35rem .65rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--primary-50);
    color: var(--text-muted);
    font-size: .8125rem;
    cursor: pointer;
}
.lead-import-file:hover { border-color: var(--primary-200); color: var(--primary); }
.lead-import-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.lead-import-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 弹窗 ===== */
.modal-content { border-radius: 10px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border-light); }
.modal-footer { border-top: 1px solid var(--border-light); }

/* ===== 面包屑 ===== */
.breadcrumb { background: transparent; padding: 0; margin-bottom: 12px; font-size: 13px; }
.breadcrumb-item a { color: var(--text-muted); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--text); font-weight: 500; }

/* ===== 手风琴 / 选项卡 ===== */
.accordion-item { border: 1px solid var(--border); border-radius: var(--radius) !important; overflow: hidden; margin-bottom: 8px; }
.accordion-button { font-weight: 600; color: #33465c; background: #fff; }
.accordion-button:not(.collapsed) { background: var(--primary-50); color: var(--primary-dark); box-shadow: none; }
.accordion-button:focus { border-color: var(--primary-200); box-shadow: 0 0 0 3px rgba(31, 78, 121, .1); }
.accordion-body { color: #44566c; }

.nav-tabs { border-bottom: 1px solid var(--border); }
.nav-tabs .nav-link { color: var(--text-muted); border: none; border-bottom: 2px solid transparent; font-weight: 500; }
.nav-tabs .nav-link:hover { color: var(--primary); border-color: transparent; }
.nav-tabs .nav-link.active { color: var(--primary-dark); border: none; border-bottom: 2px solid var(--primary); background: transparent; font-weight: 600; }

/* ===== 页脚 ===== */
footer { padding: 16px 0; text-align: center; color: var(--text-light); font-size: 12px; }

/* ===== 轻淡入场动画 ===== */
.fade-in { animation: fadeUp .25s ease both; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== 无侧边栏页面 ===== */
body.no-sidebar .sidebar, body.no-sidebar .topbar { display: none; }
body.no-sidebar .main-content { margin-left: 0; margin-top: 0; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c9d6e4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a9bed6; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== 工具类 ===== */
.text-primary-color { color: var(--primary) !important; }

/* ============================================================
   Surface Kit：统一页面框架
   ============================================================ */
/* 统一页面内容宽度：铺满右侧可用区，仅在极宽屏(>1600px)居中上限，避免表格过散 */
.sf-page,
.sf-page-wide { width: 100%; max-width: 1600px; }

.sf-hero {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}
.sf-hero::before,
.sf-hero::after { display: none; }
.sf-hero-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.sf-hero h1,
.sf-hero .sf-hero-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 .25rem;
  color: var(--primary-dark);
  line-height: 1.3;
}
.sf-hero p,
.sf-hero .sf-hero-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: .875rem;
}
.sf-hero-icon { display: none; }
.sf-back {
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid #d3deea;
  color: var(--primary);
  font-size: .82rem;
  font-weight: 500;
  white-space: nowrap;
  padding: .3rem .75rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  transition: var(--transition);
}
.sf-back:hover {
  background: var(--primary-50);
  border-color: var(--primary-200);
  color: var(--primary-dark);
}

.sf-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1rem;
}
.sf-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  padding: .75rem 1rem;
  background: #f8fafd;
  border-bottom: 1px solid var(--border-light);
}
.sf-panel-head h2,
.sf-panel-head .sf-panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-dark);
}
.sf-panel-body { padding: 1rem; }
.sf-panel-body.p-0 { padding: 0; }

.sf-section-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0 0 .75rem;
}
.sf-section-title i { display: none; }

.sf-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .2rem;
  padding: .15rem;
  background: #edf3fa;
  border-radius: var(--radius-sm);
}
.sf-filters a,
.sf-filters .sf-filter {
  text-decoration: none;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 500;
  padding: .28rem .65rem;
  border-radius: 4px;
  white-space: nowrap;
  border: none;
  background: transparent;
  transition: background .15s, color .15s;
}
.sf-filters a:hover,
.sf-filters .sf-filter:hover {
  color: var(--primary);
  background: #fff;
}
.sf-filters a.active,
.sf-filters .sf-filter.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(31, 78, 121, .3);
}

.sf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}
.sf-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.sf-search-row .form-control,
.sf-search-row .form-select { border-radius: var(--radius-sm); }

.sf-empty {
  text-align: center;
  padding: 2.2rem 1.25rem;
  color: var(--text-light);
}
.sf-empty i {
  font-size: 1.6rem;
  color: #b9c8d9;
  display: block;
  margin-bottom: .5rem;
}

.sf-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.sf-stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  box-shadow: var(--shadow-sm);
}
.sf-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.sf-stat-label {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

.sf-badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 500;
  padding: .15rem .45rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #f7fafd;
  color: #5b6b7e;
}
.sf-badge-primary { background: #187cfc; color: #fff; border-color: #187cfc; }
.sf-badge-success { background: #16824c; color: #fff; border-color: #16824c; }
.sf-badge-warning { background: #f0a202; color: #fff; border-color: #f0a202; }
.sf-badge-danger { background: #dc3545; color: #fff; border-color: #dc3545; }
.sf-badge-muted { background: #666e76; color: #fff; border-color: #666e76; }

.sf-table thead th {
  background: #f7fafd;
  color: #5b6f86;
  font-weight: 600;
  font-size: .8rem;
  border-bottom: 1px solid #e6edf5;
  white-space: nowrap;
}
.sf-table tbody td {
  vertical-align: middle;
  border-color: #eff4f9;
}
.sf-table tbody tr:hover { background: var(--primary-50); }
.sf-table tbody tr.table-warning,
.sf-table tbody tr.table-warning:hover { background: #fff3cd; }
.sf-table tbody tr.table-danger,
.sf-table tbody tr.table-danger:hover { background: #f8d7da; }

.section-title h2,
.section-title .h4,
.dashboard-section > h1,
.dashboard-section > h2 {
  color: var(--primary-dark);
  font-weight: 600;
}
.section-title i { display: none; }

.main-content > .container > h1:first-child,
.main-content > .container-fluid > h1:first-child,
.main-content > .fade-in > h1:first-child,
.main-content > h1:first-child {
  color: var(--primary-dark);
  font-weight: 700;
}
.main-content h1 > .fas,
.main-content h1 > .far,
.main-content h2 > .fas,
.main-content h3 > .fas {
  display: none;
}

@media (max-width: 576px) {
  .sf-hero { padding: .9rem 1rem; }
  .sf-hero h1, .sf-hero .sf-hero-title { font-size: 1.15rem; }
}

/* ===== 智能助手 ===== */
.assistant-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e2a01e;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  font-weight: 700;
}
.assistant-badge.is-red { background: #c0392b; }
.assistant-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.assistant-col {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 16px;
  display: flex;
  flex-direction: column;
}
body.assistant-shell .topbar,
body.assistant-shell .sidebar,
body.assistant-shell .sidebar-nav a.active {
  box-shadow: none;
}
.assistant-col-chat {
  min-height: 420px;
}
.assistant-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.assistant-col-chat .assistant-chat-head h2 { margin: 0; }
.assistant-clear {
  border: 1px solid #f3d2a3;
  background: #fff6ea;
  color: #c47a12;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  box-shadow: none;
  cursor: pointer;
}
.assistant-clear:hover {
  background: #f78b1e;
  border-color: #e57b12;
  color: #fff;
}
.assistant-col h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 12px;
}
.assistant-remind {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 768px) {
  .assistant-remind { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .assistant-remind { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.assistant-card {
  display: block;
  border: 1px solid #e8ecf1;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  color: inherit;
  box-shadow: none;
  text-decoration: none;
}
.assistant-card:hover { color: inherit; text-decoration: none; }
button.assistant-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.assistant-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.assistant-card-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.assistant-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  background: #eaedf0;
  color: #1f4e79;
}
.assistant-card-count {
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: #eef1f5;
  color: #64748b;
}
.assistant-card-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  color: #16395c;
}
.assistant-card-body { font-size: 13px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.assistant-card.is-compact {
  padding: 9px 12px;
}
.assistant-card.is-compact .assistant-card-icon {
  width: 26px;
  height: 26px;
  font-size: 12px;
  border-radius: 6px;
}
.assistant-card.is-compact .assistant-card-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
}
.assistant-card.is-compact .assistant-card-body {
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.4;
}
.assistant-msg .assistant-card.is-compact { margin-top: 5px; }
.assistant-msg .assistant-card.is-compact:first-of-type { margin-top: 8px; }
.assistant-card.is-compact .assistant-confirm {
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 6px;
  flex-shrink: 0;
}
.assistant-card.is-compact .assistant-card-body:empty { display: none; }

.assistant-card.is-ai .assistant-card-icon { background: #fdf0dd; color: #d97a17; }
.assistant-card.is-ai .assistant-card-title { color: #d97a17; }
.assistant-card.is-ai .assistant-card-count { background: #fdf0dd; color: #d97a17; }
.assistant-card.is-ai:hover { background: #fffaf3; }

.assistant-card.is-cal .assistant-card-icon { background: #e2f3f1; color: #1d8a82; }
.assistant-card.is-cal .assistant-card-title { color: #1d8a82; }
.assistant-card.is-cal .assistant-card-count { background: #e2f3f1; color: #1d8a82; }
.assistant-card.is-cal:hover { background: #f4fbfa; }

.assistant-card.is-remind .assistant-card-icon { background: #fdf0dd; color: #c8821a; }
.assistant-card.is-remind .assistant-card-title { color: #a96f10; }
.assistant-card.is-remind .assistant-card-count { background: #fdf0dd; color: #c8821a; }
.assistant-card.is-remind:hover { background: #fffaf3; }

.assistant-card.is-advisor .assistant-card-icon { background: #eee9fa; color: #6d54c4; }
.assistant-card.is-advisor .assistant-card-title { color: #5a44b0; }
.assistant-card.is-advisor .assistant-card-count { background: #eee9fa; color: #6d54c4; }
.assistant-card.is-advisor:hover { background: #f8f6fd; }

.assistant-card.is-overdue .assistant-card-icon { background: #fde8e8; color: #b42318; }
.assistant-card.is-overdue .assistant-card-title { color: #b42318; }
.assistant-card.is-overdue .assistant-card-count { background: #fde8e8; color: #b42318; }
.assistant-card.is-overdue:hover { background: #fff8f8; }

.assistant-card.is-navy .assistant-card-icon { background: #eaedf0; color: #1f4e79; }
.assistant-card.is-navy .assistant-card-title { color: #1f4e79; }
.assistant-card.is-navy .assistant-card-count { background: #eaedf0; color: #1f4e79; }
.assistant-card.is-navy:hover { background: #f7f9fb; }
.assistant-card-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.assistant-confirm {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
}
.assistant-confirm:disabled { opacity: 0.7; }
.assistant-card.is-confirm:hover { background: #fff; }
.assistant-context {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--primary);
  background: #eef3f8;
  border-radius: 6px;
  padding: 8px 10px;
}
.assistant-empty { color: var(--text-muted); font-size: 13px; padding: 32px 8px; text-align: center; }
.assistant-chat { flex: 1; min-height: 280px; display: flex; flex-direction: column; gap: 10px; }
.assistant-messages { flex: 1; min-height: 180px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.assistant-msg.is-user { align-self: flex-end; max-width: 86%; }
.assistant-msg.is-bot { align-self: stretch; max-width: 100%; }
.assistant-skill { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.assistant-msg-text {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
  box-shadow: none;
}
.assistant-msg.is-user .assistant-msg-text {
  background: #1f4e79;
  color: #fff;
  border: 0;
}
.assistant-reply-card {
  background: #fff;
  border: 1px solid #d6e0ea;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: none;
}
.assistant-msg.is-bot .assistant-msg-text {
  background: transparent;
  color: #1f2d3d;
  border: 0;
  padding: 0;
  border-radius: 0;
  white-space: normal;
  line-height: 1.55;
}
.assistant-lead {
  margin: 0 0 .35em;
  line-height: 1.5;
}
.assistant-h {
  font-weight: 700;
  color: var(--primary-dark);
  margin: .55em 0 .12em;
  line-height: 1.35;
}
.assistant-h:first-child { margin-top: 0; }
.assistant-h.is-risk {
  margin-top: .75em;
  margin-bottom: .15em;
  color: #1f2d3d;
}
.assistant-sub {
  margin: .1em 0 .25em;
  padding-left: .2em;
  line-height: 1.5;
  color: #334155;
}
.assistant-gap {
  height: .2em;
}
.assistant-p {
  margin: 0 0 .5em;
  line-height: 1.55;
}
.assistant-li {
  margin: .05em 0;
  line-height: 1.45;
  padding-left: .1em;
}
.assistant-lead + .assistant-h { margin-top: .35em; }
.assistant-p + .assistant-h,
.assistant-li + .assistant-h { margin-top: .5em; }
.assistant-h + .assistant-li { margin-top: .08em; }
.assistant-h + .assistant-catalog-grid { margin-top: 2px; }
.assistant-catalog-grid + .assistant-h { margin-top: .55em; }
.assistant-li + .assistant-p { margin-top: .4em; }
.assistant-catalog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 0 0 6px;
}
@media (min-width: 768px) {
  .assistant-catalog-grid { grid-template-columns: 1fr 1fr; }
}
.assistant-skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid #e6edf5;
  background: #f8fafc;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: inherit;
}
.assistant-skill-row:hover {
  background: #eef4fb;
  border-color: #c9d9ea;
  color: inherit;
}
.assistant-skill-name {
  font-weight: 600;
  font-size: 13.5px;
  color: #16395c;
  line-height: 1.3;
}
.assistant-skill-ask {
  font-size: 12px;
  color: #6b7c90;
  flex-shrink: 0;
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.assistant-msg .assistant-card { margin-top: 8px; box-shadow: none; }
.assistant-msg.is-bot .assistant-card {
  background: #fff;
}
.assistant-sources {
  margin-top: 8px;
  font-size: 12px;
  color: #5b6d82;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.5;
}
.assistant-sources i { margin-top: 2px; color: #1f4e79; }
.assistant-related { margin-top: 10px; }
.assistant-related-label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 4px;
}
.assistant-related-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.assistant-related-chips button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  font-size: 12px;
  padding: 4px 10px;
  color: var(--primary);
}
.assistant-kb {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #d6e4f4;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  cursor: pointer;
  box-shadow: none;
}
.assistant-kb input { position: absolute; opacity: 0; pointer-events: none; }
.assistant-kb-switch {
  flex: 0 0 40px;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #cfd8e3;
  position: relative;
  margin-top: 2px;
}
.assistant-kb-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
}
.assistant-kb input:checked + .assistant-kb-switch { background: #1f4e79; }
.assistant-kb input:checked + .assistant-kb-switch::after { left: 20px; }
.assistant-kb-copy { min-width: 0; }
.assistant-kb-title { display: block; font-size: 13px; color: #1f2d3d; line-height: 1.45; }
.assistant-kb-state { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.assistant-hints { display: flex; flex-wrap: wrap; gap: 6px; }
.assistant-hint {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  font-size: 12px;
  padding: 4px 10px;
  color: var(--primary);
}
.assistant-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.assistant-chip {
  border: 1px solid #c9d9ea;
  background: #f4f8fc;
  color: #1f4e79;
  border-radius: 16px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
}
.assistant-chip:hover { background: #e8f1fa; }
.assistant-chip.is-active {
  background: #1f4e79;
  border-color: #1f4e79;
  color: #fff;
}
.assistant-composer { display: flex; flex-direction: column; gap: 8px; }
.assistant-composer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 0;
}
.assistant-stance-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.assistant-stance-label {
  font-size: 12px;
  color: #5b6d82;
  font-weight: 600;
}
.assistant-stance-btn {
  border: 1px solid #c9d9ea;
  background: #fff;
  color: #1f4e79;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  cursor: pointer;
}
.assistant-stance-btn:hover { background: #e8f1fa; }
.assistant-stance-btn.is-on {
  background: #1f4e79;
  border-color: #1f4e79;
  color: #fff;
}
.assistant-skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8f1fa;
  color: #1f4e79;
  border: 1px solid #b9cee4;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
}
.assistant-skill-tag button {
  border: 0;
  background: transparent;
  color: #5b6d82;
  padding: 0 0 0 2px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.assistant-attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.assistant-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 12px;
  padding: 3px 8px;
  color: #334155;
}
.assistant-attach-chip button {
  border: 0;
  background: transparent;
  color: #b03326;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
}
.assistant-composer-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.assistant-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d6e0ea;
  background: #fff;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  color: #1f4e79;
  cursor: pointer;
  margin: 0;
}
.assistant-upload-btn:hover { background: #f4f8fc; }
.assistant-desense {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
  margin: 0;
  cursor: pointer;
  user-select: none;
}
.assistant-desense input { margin: 0; }
.assistant-desense-panel {
  border: 1px solid #d6e0ea;
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.assistant-desense-panel[hidden] { display: none !important; }
.assistant-desense-label {
  font-size: 12px;
  font-weight: 600;
  color: #5b6d82;
}
.assistant-redact-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }
.assistant-redact-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 1.4;
  border-radius: 999px;
  padding: 2px 8px;
  background: #e8eef5;
  color: #334155;
}
.assistant-redact-tag.is-custom {
  background: #fff;
  border: 1px solid #cbd5e1;
}
.assistant-redact-tag button {
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: 0 0 0 2px;
  font-size: 13px;
  line-height: 1;
}
.assistant-desense-add { display: flex; gap: 6px; }
.assistant-desense-add input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d6e0ea;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}
.assistant-desense-add button {
  border: 1px solid #1f4e79;
  background: #1f4e79;
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}
.assistant-desense-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.assistant-desense-box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 52px;
  max-height: 320px;
  overflow: auto;
  color: #1e293b;
}
.assistant-desense-note { font-size: 12px; color: #64748b; }
mark.assistant-redact {
  background: #fde68a;
  color: #92400e;
  padding: 0 2px;
  border-radius: 2px;
}
@media (max-width: 720px) {
  .assistant-desense-cols { grid-template-columns: 1fr; }
}
.assistant-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.assistant-msg.is-user { flex-direction: row-reverse; }
.assistant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
}
.assistant-msg.is-bot .assistant-avatar {
  background: #e8f1fa;
  color: #1f4e79;
  border: 1px solid #c9d9ea;
}
.assistant-msg.is-user .assistant-avatar {
  background: #1f4e79;
  color: #fff;
  overflow: hidden;
  padding: 0;
}
.assistant-msg.is-user .assistant-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.assistant-msg-main { min-width: 0; flex: 1; }
.assistant-msg.is-user .assistant-msg-main { display: flex; flex-direction: column; align-items: flex-end; }
.assistant-msg.is-pending .assistant-msg-text { color: var(--text-muted); }
.assistant-form.is-busy input,
.assistant-form.is-busy button { opacity: .65; pointer-events: none; }
.assistant-form button:disabled { opacity: .65; }
.assistant-chat-empty { color: var(--text-muted); font-size: 13px; padding: 12px 4px 4px; }
.assistant-form { display: flex; gap: 8px; }
.assistant-form input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.assistant-form button {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 10px 16px;
}

/* ===== 已转案件详情 ===== */
.crm-banner {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: 1rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.crm-banner-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .95rem;
}
.crm-banner-title { font-weight: 650; color: var(--primary-dark); margin-bottom: .15rem; }
.crm-banner-body { flex: 1; min-width: 0; font-size: .86rem; color: var(--text-muted); }
.crm-banner-danger { background: #fdf5f5; border-color: #f0c8cc; }
.crm-banner-danger .crm-banner-mark { background: #f8d7da; color: #b02a37; }
.crm-banner-danger .crm-banner-title { color: #b02a37; }
.crm-banner-warning { background: #fff9ec; border-color: #ecd48a; }
.crm-banner-warning .crm-banner-mark { background: #ffe69c; color: #997404; }
.crm-banner-warning .crm-banner-title { color: #997404; }

.crm-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem 1rem;
  margin-bottom: 1rem;
}
.crm-meta-item label {
  display: block;
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .12rem;
}
.crm-meta-item span {
  color: var(--primary-dark);
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}
.crm-meta-wide { grid-column: 1 / -1; }
.crm-meta-dense { gap: .45rem .85rem; margin-bottom: 0; }
.crm-pre { white-space: pre-wrap; font-weight: 500 !important; color: var(--text) !important; }
.crm-subhead {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: .25rem 0 .65rem;
  letter-spacing: .02em;
}
.crm-stage {
  border: 1px solid var(--border);
  background: #f8fafd;
  border-radius: var(--radius-sm);
  padding: .75rem .9rem;
  margin-bottom: .65rem;
}
.crm-stage-title { font-size: .88rem; font-weight: 650; color: var(--primary-dark); margin-bottom: .45rem; }

.crm-tl {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.05rem;
  position: relative;
}
.crm-tl::before {
  content: '';
  position: absolute;
  left: .28rem;
  top: .35rem;
  bottom: .35rem;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary-200), #edf2f8);
}
.crm-tl-item {
  position: relative;
  padding: 0 0 .95rem .35rem;
}
.crm-tl-item:last-child { padding-bottom: 0; }
.crm-tl-item::before {
  content: '';
  position: absolute;
  left: -1.05rem;
  top: .42rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--primary-200);
}
.crm-tl-item.is-alert::before { background: #dc3545; box-shadow: 0 0 0 3px #fff, 0 0 0 4px #f1c0c4; }
.crm-tl-item.is-done::before { background: #16824c; box-shadow: 0 0 0 3px #fff, 0 0 0 4px #c8e6d4; }
.crm-tl-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem .45rem;
  margin-bottom: .2rem;
}
.crm-tl-time { margin-left: auto; color: var(--text-light); font-size: .78rem; white-space: nowrap; }
.crm-tl-text { font-size: .86rem; color: var(--text); line-height: 1.5; }

.crm-feed { display: flex; flex-direction: column; gap: .7rem; }
.crm-feed-item {
  border: 1px solid var(--border-light);
  background: #fbfcfe;
  border-radius: var(--radius-sm);
  padding: .8rem .9rem;
}
.crm-feed-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
  margin-bottom: .4rem;
}
.crm-feed-text { font-size: .9rem; line-height: 1.55; white-space: pre-wrap; }
.crm-feed-meta { margin-top: .35rem; font-size: .78rem; color: var(--text-muted); }
.crm-form-note { font-size: .78rem; color: var(--text-muted); margin-top: .7rem; }

@media (min-width: 992px) {
  .crm-write { position: sticky; top: calc(var(--topbar-h) + 12px); }
}
@media (max-width: 767.98px) {
  .crm-meta { grid-template-columns: 1fr; }
  .crm-banner { flex-wrap: wrap; }
}

#sfConfirmModal { z-index: 2000; }
.sf-confirm-dialog {
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(22, 57, 92, .24);
}
.sf-confirm-dialog .modal-body { padding: 1.7rem 1.6rem .35rem; text-align: center; }
.sf-confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto .8rem;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}
.sf-confirm-icon.is-primary { background: #e8f1fb; color: #1f4e79; }
.sf-confirm-icon.is-warning { background: #fdf0dd; color: #c8821a; }
.sf-confirm-icon.is-danger { background: #fde8e8; color: #b42318; }
.sf-confirm-dialog h3 {
  margin: 0 0 .55rem;
  color: #16395c;
  font-size: 1.15rem;
  font-weight: 700;
}
.sf-confirm-message {
  margin: 0;
  color: #475569;
  font-size: .92rem;
  line-height: 1.6;
  white-space: pre-wrap;
}
.sf-confirm-dialog .modal-footer {
  border: 0;
  justify-content: center;
  gap: .65rem;
  padding: 1rem 1.6rem 1.4rem;
}
.sf-confirm-dialog .btn-primary { background: #1f4e79; border-color: #1f4e79; }
.sf-confirm-dialog .btn-primary:hover { background: #16395c; border-color: #16395c; }
