/* ============================================================
   律师办案管理系统 · 前端样式
   设计语言：Ant Design 5（GitHub ant-design/ant-design，~99k★）
   企业级配色 / 卡片式布局 / 8px 间距体系 / 圆角与阴影规范
   ============================================================ */

/* ---------- 设计变量（Ant Design 5 tokens） ---------- */
:root {
  --primary: #1677ff;
  --primary-hover: #4096ff;
  --primary-active: #0958d9;
  --primary-bg: #e6f4ff;
  --success: #52c41a;
  --success-bg: #f6ffed;
  --warning: #faad14;
  --danger: #ff4d4f;
  --danger-bg: #fff1f0;
  --purple: #722ed1;
  --purple-bg: #f9f0ff;

  --bg: #f5f5f5;
  --card: #ffffff;
  --border: #f0f0f0;
  --border-strong: #d9d9d9;
  --text: rgba(0, 0, 0, .88);
  --text-2: rgba(0, 0, 0, .65);
  --text-3: rgba(0, 0, 0, .45);
  --text-disable: rgba(0, 0, 0, .25);

  --sider-bg: #001529;
  --sider-text: rgba(255, 255, 255, .65);
  --sider-text-active: rgba(255, 255, 255, .88);

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px 0 rgba(0, 0, 0, .03), 0 1px 6px -1px rgba(0, 0, 0, .02), 0 2px 4px 0 rgba(0, 0, 0, .02);
  --shadow-modal: 0 6px 16px 0 rgba(0, 0, 0, .08), 0 3px 6px -4px rgba(0, 0, 0, .12), 0 9px 28px 8px rgba(0, 0, 0, .05);
}

/* ---------- 重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5715;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--text-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============================================================
   登录页
   ============================================================ */
body.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
  background:
    radial-gradient(1200px 600px at 15% 10%, rgba(22, 119, 255, .35), transparent 60%),
    radial-gradient(1000px 500px at 85% 90%, rgba(22, 119, 255, .28), transparent 55%),
    linear-gradient(135deg, #001529 0%, #0b1f3f 55%, #123 100%);
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card {
  background: #fff; border-radius: 12px; padding: 40px 40px 30px;
  box-shadow: var(--shadow-modal);
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo .logo-badge {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #0e5fe0 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(22, 119, 255, .35);
}
.login-logo h1 { font-size: 20px; font-weight: 600; letter-spacing: .5px; }
.login-logo p { color: var(--text-3); font-size: 13px; margin-top: 6px; }
.login-form .field { margin-bottom: 18px; }
.login-form .field input {
  height: 40px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: all .2s;
}
.login-form .field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, .12);
}
.login-form .btn { height: 42px; font-size: 15px; margin-top: 4px; }
.login-footer {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 22px; font-size: 13px;
}
.login-footer .sep { color: var(--border-strong); }

/* ============================================================
   应用框架：深色侧边栏 + 顶栏 + 内容区
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px; flex-shrink: 0;
  background: var(--sider-bg); color: var(--sider-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  height: 64px; padding: 0 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar .brand .logo-badge {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, #0e5fe0 100%);
  display: flex; align-items: center; justify-content: center;
}
.sidebar .brand .brand-text { line-height: 1.3; }
.sidebar .brand .brand-title { display: block; color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .3px; }
.sidebar .brand .brand-sub { display: block; font-size: 11px; color: rgba(255, 255, 255, .45); }

.sidebar .nav { flex: 1; padding: 12px 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px; margin-bottom: 4px;
  border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--sider-text);
  font-size: 14px; text-align: left; cursor: pointer;
  transition: all .2s;
}
.nav-item:hover { color: var(--sider-text-active); background: rgba(255, 255, 255, .06); }
.nav-item.active { color: #fff; background: var(--primary); font-weight: 500; }
.nav-item .nav-ico { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }

.sidebar .sidebar-foot {
  padding: 16px; border-top: 1px solid rgba(255, 255, 255, .08);
}
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.user-chip .user-name { color: #fff; font-size: 14px; line-height: 1.2; }
.user-chip .user-role { display: block; font-size: 12px; color: rgba(255, 255, 255, .45); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; padding: 0 24px; flex-shrink: 0;
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 16px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 24px; }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 6px 15px; font-size: 14px; line-height: 1.5715;
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--primary-active); }

.btn-default, .btn-ghost {
  background: #fff; border-color: var(--border-strong); color: var(--text);
}
.btn-default:hover:not(:disabled), .btn-ghost:hover:not(:disabled) { color: var(--primary); border-color: var(--primary); }
.btn-danger { background: #fff; border-color: var(--border-strong); color: var(--danger); }
.btn-danger:hover:not(:disabled) { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 1px 8px; font-size: 12px; border-radius: 4px; }
.btn-block { width: 100%; }

.link-btn {
  background: none; border: none; padding: 0 4px;
  color: var(--primary); font-size: 13px; cursor: pointer;
}
.link-btn:hover { color: var(--primary-hover); text-decoration: underline; }

/* ============================================================
   表单
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--text); }
.field label i { color: var(--danger); font-style: normal; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px 12px; background: #fff; color: var(--text);
  outline: none; transition: all .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, .12);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-disable); }
.field textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row .field { margin-bottom: 16px; }
@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; } }
.hint { font-size: 12px; color: var(--text-3); margin: 2px 0 12px; }
.form-error {
  background: var(--danger-bg); color: var(--danger);
  border-radius: var(--radius-sm); padding: 7px 12px;
  font-size: 13px; margin-bottom: 12px;
}

/* 开关（Ant Design switch） */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 22px;
  background: rgba(0, 0, 0, .25); cursor: pointer; transition: all .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
  transition: all .2s;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ============================================================
   卡片与网格
   ============================================================ */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow-card);
}
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

.section-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.section-title .sub { margin-left: 8px; font-size: 12px; font-weight: 400; color: var(--text-3); }

/* 统计指标卡 */
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-card); }
.stat-label { font-size: 13px; color: var(--text-2); }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; }
.stat-delta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ============================================================
   工具栏 / 标签页 / 搜索
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: inline-flex; gap: 2px; background: rgba(0, 0, 0, .04); padding: 3px; border-radius: var(--radius-sm); }
.tabs button {
  border: none; background: none; padding: 5px 16px;
  border-radius: 5px; cursor: pointer; font-size: 13px; color: var(--text-2);
  transition: all .2s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: #fff; color: var(--primary); font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.search-input {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px 12px; width: 260px; outline: none; transition: all .2s;
  background: #fff; color: var(--text);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22, 119, 255, .12); }

/* ============================================================
   表格
   ============================================================ */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff; }
table.data th, table.data td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
table.data th {
  background: #fafafa; color: var(--text); font-weight: 600; font-size: 13px;
  white-space: nowrap;
}
table.data tbody tr:hover td { background: #fafafa; }
table.data tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.pager { display: flex; align-items: center; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.pager button {
  min-width: 28px; height: 28px; padding: 0 10px;
  border: 1px solid var(--border-strong); background: #fff; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; color: var(--text); transition: all .2s;
}
.pager button:hover:not(:disabled) { color: var(--primary); border-color: var(--primary); }
.pager button:disabled { color: var(--text-disable); cursor: not-allowed; }
.pager .page-info { font-size: 13px; color: var(--text-2); }

/* ============================================================
   标签
   ============================================================ */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  font-size: 12px; line-height: 1.6; border: 1px solid transparent;
}
.tag-blue { color: var(--primary); background: var(--primary-bg); border-color: #91caff; }
.tag-green { color: var(--success); background: var(--success-bg); border-color: #b7eb8f; }
.tag-red { color: var(--danger); background: var(--danger-bg); border-color: #ffa39e; }
.tag-gray { color: var(--text-2); background: rgba(0, 0, 0, .04); border-color: var(--border); }
.tag-purple { color: var(--purple); background: var(--purple-bg); border-color: #d3adf7; }

/* ============================================================
   模态框
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
/* hidden 属性优先于 display:flex，未打开时弹窗必须隐藏 */
.modal-mask[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 12px; width: 520px; max-width: 96vw;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: modalIn .2s ease-out;
}
@keyframes modalIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-lg { width: 880px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.modal-head h2 { font-size: 16px; font-weight: 600; }
.modal-close {
  border: none; background: none; font-size: 18px; line-height: 1;
  color: var(--text-3); cursor: pointer; padding: 4px;
  border-radius: 4px; transition: all .2s;
}
.modal-close:hover { color: var(--text); background: rgba(0, 0, 0, .04); }
.modal-body { padding: 20px 24px; }
.modal-body .field { margin-bottom: 14px; }
.modal-foot {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: #fff;
}

/* ============================================================
   详情区块
   ============================================================ */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 28px; font-size: 13.5px; }
.detail-grid .item { display: flex; gap: 10px; min-width: 0; }
.detail-grid .item b { min-width: 84px; color: var(--text-3); font-weight: 500; flex-shrink: 0; }
.detail-grid .item span { color: var(--text); word-break: break-all; }
.sub-block { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--border); }
.sub-block h3 { font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }

/* ============================================================
   日历
   ============================================================ */
.calendar { user-select: none; }
.cal-head { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; }
.cal-title { font-size: 14px; font-weight: 600; min-width: 130px; text-align: center; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-week span { text-align: center; font-size: 12px; color: var(--text-3); padding: 4px 0; }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-days button {
  aspect-ratio: 1; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font-size: 13px; cursor: pointer;
  position: relative; transition: all .15s;
}
.cal-days button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.cal-days button.today { border-color: var(--primary); background: var(--primary-bg); color: var(--primary-active); font-weight: 600; }
.cal-days button.dim { border-color: transparent; background: transparent; cursor: default; }
.cal-days .dot {
  position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--primary);
}

/* ============================================================
   今日待办列表
   ============================================================ */
.todo-list { list-style: none; }
.todo-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.todo-list li:last-child { border-bottom: none; }
.todo-list .time { color: var(--text-2); font-size: 12.5px; width: 76px; flex-shrink: 0; }
.todo-list .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

/* ============================================================
   Toast 轻提示
   ============================================================ */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; padding: 8px 16px; border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font-size: 13px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border);
}
.toast.ok { border-color: #b7eb8f; color: var(--success); }
.toast.err { border-color: #ffa39e; color: var(--danger); }

/* ============================================================
   空状态 / 加载
   ============================================================ */
.empty { text-align: center; color: var(--text-3); padding: 48px 0; font-size: 13px; }
.loading { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 13px; }

/* ============================================================
   纯 CSS 柱状图（替代 echarts，零外部依赖）
   ============================================================ */
.barchart {
  display: flex; gap: 10px; width: 100%;
  padding: 26px 4px 0; box-sizing: border-box;
}
.bc-series { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.bc-pair {
  flex: 1; display: flex; align-items: stretch; justify-content: center; gap: 8px;
  min-height: 120px;
}
.bc-bar-wrap {
  flex: 1; max-width: 64px; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: 6px;
}
.bc-bar {
  width: 100%; max-width: 48px; min-height: 2px;
  border-radius: 4px 4px 0 0; position: relative;
  display: flex; align-items: flex-start; justify-content: center;
  transition: height .3s ease;
}
.bc-val {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--text-2); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.bc-axis { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.bc-legend {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 12px; color: var(--text-2); white-space: nowrap;
}
.bc-legend i { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* ============================================================
   兼容：旧类名 .layout（若引用）
   ============================================================ */
.layout { display: flex; min-height: 100vh; }
.sidebar .foot { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar .brand { height: 52px; }
  .sidebar .nav { display: flex; overflow-x: auto; padding: 6px 12px; }
  .nav-item { width: auto; white-space: nowrap; margin: 0 4px; }
  .sidebar .sidebar-foot { border-top: none; padding: 10px 16px; flex-direction: row; align-items: center; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .search-input { width: 100%; }
  .toolbar .search-input { width: 100%; }
  table.data { min-width: 720px; }
}
