/* ============================================================
   CRM 通用样式库 - P0 提取版
   基于 3,794 处内联样式高频模式提取
   ============================================================ */

/* ===== CSS 变量：设计系统 ===== */
:root {
  /* 主色 */
  --color-primary: #1a6984;
  --color-primary-light: #e8f4fc;
  --color-primary-hover: #155e75;

  /* 文本色 */
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  --text-light: #999;
  --text-white: #fff;

  /* 背景色 */
  --bg-white: #fff;
  --bg-page: #f8fafc;
  --bg-gray: #f1f5f9;
  --bg-light: #f5f5f5;
  --bg-primary: #f0f7fa;
  --bg-primary-light: #f0f9ff;

  /* 状态色 */
  --color-success: #16a34a;
  --bg-success: #f0fdf4;
  --color-danger: #dc2626;
  --bg-danger: #fef2f2;
  --color-warning: #e89130;
  --bg-warning: #fffbeb;
  --color-info: #2563eb;
  --bg-info: #eff6ff;

  /* 边框 */
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  /* 圆角 */
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;

  /* 字号 */
  --fs-xs: 10px;
  --fs-sm: 11px;
  --fs-base: 12px;
  --fs-md: 13px;
  --fs-lg: 14px;
  --fs-xl: 16px;
  --fs-2xl: 18px;

  /* 间距 */
  --gap-1: 2px;
  --gap-2: 4px;
  --gap-3: 6px;
  --gap-4: 8px;
  --gap-5: 10px;
  --gap-6: 12px;
  --gap-7: 14px;
  --gap-8: 16px;
}

/* ===== 工具类：字号 ===== */
.fs-xs { font-size: 10px; }
.fs-sm { font-size: 11px; }
.fs-base { font-size: 12px; }
.fs-md { font-size: 13px; }
.fs-lg { font-size: 14px; }
.fs-xl { font-size: 16px; }

/* ===== 工具类：字重 ===== */
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ===== 工具类：文字颜色 ===== */
.text-primary { color: var(--color-primary); }
.text-white { color: #fff; }
.text-main { color: var(--text-primary); }
.text-body { color: #555; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }

/* ===== 工具类：背景色 ===== */
.bg-white { background: #fff; }
.bg-page { background: var(--bg-page); }
.bg-gray { background: var(--bg-gray); }
.bg-light { background: var(--bg-light); }
.bg-primary { background: var(--bg-primary); }
.bg-primary-light { background: var(--bg-primary-light); }
.bg-success { background: var(--bg-success); }
.bg-danger { background: var(--bg-danger); }
.bg-warning { background: var(--bg-warning); }
.bg-info { background: var(--bg-info); }
.bg-none { background: none; }

/* ===== 工具类：圆角 ===== */
.rounded-sm { border-radius: 3px; }
.rounded-md { border-radius: 4px; }
.rounded { border-radius: 6px; }
.rounded-lg { border-radius: 8px; }
.rounded-xl { border-radius: 10px; }

/* ===== 工具类：边框 ===== */
.border { border: 1px solid var(--border-color); }
.border-0 { border: none; }

/* ===== 工具类：display ===== */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-grid { display: grid; }

/* ===== 工具类：flex ===== */
.flex-1 { flex: 1; }
.flex-1-0 { flex: 1; min-width: 0; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 2px; }
.gap-2 { gap: 4px; }
.gap-3 { gap: 6px; }
.gap-4 { gap: 8px; }
.gap-5 { gap: 10px; }
.gap-6 { gap: 12px; }

/* ===== 工具类：margin ===== */
.m-0 { margin: 0; }
.mb-1 { margin-bottom: 2px; }
.mb-2 { margin-bottom: 4px; }
.mb-3 { margin-bottom: 6px; }
.mb-4 { margin-bottom: 8px; }
.mb-5 { margin-bottom: 10px; }
.mb-6 { margin-bottom: 12px; }
.mb-7 { margin-bottom: 14px; }
.mb-8 { margin-bottom: 16px; }
.mt-1 { margin-top: 2px; }
.mt-2 { margin-top: 4px; }
.mt-3 { margin-top: 6px; }
.mt-4 { margin-top: 8px; }
.mt-5 { margin-top: 10px; }
.mt-6 { margin-top: 12px; }
.mr-1 { margin-right: 2px; }
.mr-2 { margin-right: 4px; }
.mr-3 { margin-right: 6px; }
.mr-4 { margin-right: 8px; }
.ml-1 { margin-left: 2px; }
.ml-2 { margin-left: 4px; }
.ml-3 { margin-left: 6px; }
.ml-4 { margin-left: 8px; }

/* ===== 工具类：padding ===== */
.p-0 { padding: 0; }
.p-2 { padding: 4px; }
.p-3 { padding: 6px; }
.p-4 { padding: 8px; }
.p-5 { padding: 10px; }
.p-6 { padding: 12px; }
.px-4 { padding-left: 8px; padding-right: 8px; }
.px-6 { padding-left: 12px; padding-right: 12px; }
.px-7 { padding-left: 14px; padding-right: 14px; }
.py-2 { padding-top: 4px; padding-bottom: 4px; }
.py-3 { padding-top: 6px; padding-bottom: 6px; }
.py-4 { padding-top: 8px; padding-bottom: 8px; }

/* ===== 工具类：文本 ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.leading-15 { line-height: 1.5; }
.leading-17 { line-height: 1.7; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== 工具类：宽度 ===== */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* ===== 组件：按钮 ===== */
.btn {
  display: inline-block;
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
}
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
.btn-lg {
  padding: 8px 20px;
  font-size: 14px;
}

/* ===== 组件：卡片 ===== */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border-light);
}
.card-primary {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

/* ===== 组件：标签 / Tag ===== */
.tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 500;
}
.tag-primary {
  background: var(--bg-primary-light);
  color: var(--color-primary);
}
.tag-success {
  background: var(--bg-success);
  color: var(--color-success);
}
.tag-danger {
  background: var(--bg-danger);
  color: var(--color-danger);
}
.tag-warning {
  background: var(--bg-warning);
  color: var(--color-warning);
}
.tag-info {
  background: var(--bg-info);
  color: var(--color-info);
}
.tag-gray {
  background: var(--bg-gray);
  color: var(--text-tertiary);
}
.tag-light {
  background: var(--bg-light);
  color: var(--text-muted);
}

/* ===== 组件：输入框 ===== */
.input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}
.input:focus {
  border-color: var(--color-primary);
}
.input-sm {
  padding: 5px 8px;
  font-size: 12px;
}

/* ===== 组件：表格 ===== */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.tbl th, .tbl td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
}
.tbl th {
  background: var(--bg-page);
  font-weight: 600;
  color: var(--text-secondary);
}

/* ===== 组件：label / form ===== */
.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.form-label-strong {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 4px;
}

/* ===== 组件：section 标题 ===== */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 6px;
}
.section-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
}

/* ===== 组件：浮层 / tooltip ===== */
.tip-text {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== 组件：空状态 ===== */
.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ============================================================
   两栏布局：大月历 + 当日详情
   ============================================================ */
.two-pane-container {
  display: flex;
  gap: 12px;
  height: 560px;
  align-items: stretch;
}

.two-pane {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(26, 105, 132, .06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.two-pane-left {
  flex: 0 0 60%;
  min-width: 0;
}

.two-pane-right {
  flex: 1 1 auto;
  min-width: 0;
}

.two-pane-header {
  padding: 14px 18px;
  border-bottom: 1px solid #eef2f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
  font-size: 14px;
}

/* ---- 左栏：大月历 ---- */
.pane-month-cal-large {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 4px;
  padding: 12px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.pane-mhdr {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pane-mday {
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s ease;
  position: relative;
  background: #fafbfc;
  border: 1px solid transparent;
}

.pane-mday:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.pane-mday.today .pane-md-num {
  background: var(--color-primary);
  color: #fff;
  width: 30px;
  height: 30px;
  line-height: 30px;
  border-radius: 50%;
  text-align: center;
  font-weight: 700;
}

.pane-mday.selected {
  background: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.pane-mday.selected .pane-md-num {
  background: var(--color-primary);
  color: #fff;
  width: 30px;
  height: 30px;
  line-height: 30px;
  border-radius: 50%;
  text-align: center;
  font-weight: 700;
}

.pane-mday.other-month {
  visibility: hidden;
}

.pane-md-num {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1;
  font-weight: 500;
}

.pane-md-count {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--color-primary);
  padding: 1px 7px;
  border-radius: 10px;
  line-height: 1.5;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(26, 105, 132, .2);
}

.pane-mday.today .pane-md-count {
  background: #dc2626;
}

.pane-mday.selected .pane-md-count {
  background: var(--color-primary);
}

.pane-month-nav,
.pane-week-nav {
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 20px;
  padding: 2px 10px;
  border-radius: 6px;
  transition: all .15s;
  user-select: none;
  font-weight: 400;
}

.pane-month-nav:hover,
.pane-week-nav:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.pane-month-title {
  font-size: 15px;
  font-weight: 700;
}

/* ---- 右栏：当日详情 ---- */
.pane-day-detail {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pane-day-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-day-date {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.pane-day-weekday {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.pane-day-today-tag {
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.pane-day-stats {
  font-size: 12px;
  color: var(--text-tertiary);
}

.pane-day-stats strong {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 14px;
}

.pane-day-stat-sep {
  margin: 0 6px;
  color: #cbd5e1;
}

.pane-day-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pane-day-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eef2f7;
}

.pane-day-group-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 10px;
}

.pane-day-group-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pane-day-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  transition: all .15s ease;
}

.pane-day-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
}

.pane-day-card.completed {
  opacity: 0.6;
}

.pane-day-card.completed .pane-day-card-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.pane-day-card-hd {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.pane-day-card-check {
  flex-shrink: 0;
  cursor: pointer;
}

.pane-day-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.pane-day-card-empty .pane-day-card-empty-text {
  color: var(--text-tertiary);
  font-style: italic;
  opacity: .75;
}

.pane-day-card-pri {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.pane-card-level {
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 3px;
  border: 1px solid;
  background: #fff;
  flex-shrink: 0;
}

.pane-day-card-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}

.pane-day-card:hover .pane-day-card-actions {
  opacity: 1;
}

.pane-day-card-action {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 3px;
}

.pane-day-card-action:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.pane-day-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.pane-card-wx {
  color: #075985;
}

.pane-card-time {
  color: var(--text-secondary);
}

.pane-day-card-label {
  font-weight: 600;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.pane-day-card-comp,
.pane-day-card-reason,
.pane-day-card-action-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 4px;
}

.pane-day-card-reason {
  color: #64748b;
  font-style: italic;
}

.pane-day-card-action-text {
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 4px 8px;
  border-radius: 5px;
  margin-top: 4px;
}

.pane-day-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.pane-day-empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.pane-day-empty-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.pane-day-empty-tip {
  font-size: 12px;
  color: var(--text-muted);
}

.pane-day-add-wrap {
  margin-top: auto;
  padding-top: 8px;
  flex-shrink: 0;
}

.pane-day-add-btn {
  width: 100%;
  padding: 8px 12px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid #c8e0ed;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.pane-day-add-btn:hover {
  background: var(--color-primary);
  color: #fff;
}

/* ---- 响应式 ---- */
@media (max-width: 1200px) {
  .three-pane-container {
    height: auto;
    flex-wrap: wrap;
  }
  .three-pane-left {
    flex: 0 0 200px;
  }
  .three-pane-mid {
    flex: 1 1 300px;
  }
  .three-pane-right {
    flex: 1 1 100%;
    max-height: 400px;
  }
}
