/* ============================================================
 * Next - Design tokens & global styles
 * ============================================================ */

:root {
  /* Brand — matches MokaHR core product (#0068FF base) */
  --brand:         #0068FF;
  --brand-hover:   #0047B3;
  --brand-active:  #00388C;
  --brand-disabled:#81ABFF;
  --brand-soft:    #F4F6FB;   /* used for hover backgrounds */
  --brand-soft-2:  #E6EEFF;   /* used for active sidebar pill */

  /* Neutrals — MokaHR cool slate scale */
  --gray-50:  #F7F8FA;
  --gray-100: #F4F4F4;        /* hover row, disabled bg */
  --gray-200: #DDDFE3;        /* darker divider */
  --gray-300: #D8D8D8;        /* card / table border */
  --gray-400: #B8BBCC;        /* disabled text */
  --gray-500: #989CB2;        /* muted / placeholder */
  --gray-600: #474C66;        /* secondary text */
  --gray-700: #374151;
  --gray-800: #141933;        /* primary text */
  --gray-900: #03040D;        /* shadow base */

  /* Semantic */
  --success: #00B42A;
  --warning: #FF7D00;
  --danger:  #F53F3F;
  --info:    #0068FF;

  /* Status colors (badges) — closer to MokaHR's flat semantic palette */
  --status-pending-bg:  #FFF4E5;
  --status-pending-fg:  #D46B08;
  --status-approved-bg: #E6F4EA;
  --status-approved-fg: #00873C;
  --status-rejected-bg: #FFECEC;
  --status-rejected-fg: #C03030;
  --status-draft-bg:    #F4F4F4;
  --status-draft-fg:    #595959;

  /* Layout — MokaHR sidebar is wider, topbar shorter */
  --topbar-h:   52px;
  --sidebar-w:  220px;
  --content-max: 1440px;
  --radius-sm:  4px;
  --radius:     8px;          /* MokaHR's primary radius */
  --radius-lg:  12px;

  /* Shadows — MokaHR uses a single soft elevation */
  --shadow-1: 0 1px 2px rgba(3, 4, 13, 0.04);
  --shadow-2: 0 2px 10px rgba(3, 4, 13, 0.08);
  --shadow-3: 0 8px 24px rgba(3, 4, 13, 0.12);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 320ms;
}

/* Element Plus token override — propagate brand to el-button etc. */
:root {
  --el-color-primary:               var(--brand);
  --el-color-primary-light-3:       var(--brand-disabled);
  --el-color-primary-light-5:       #99B9FF;
  --el-color-primary-light-7:       #CCDCFF;
  --el-color-primary-light-8:       var(--brand-soft-2);
  --el-color-primary-light-9:       var(--brand-soft);
  --el-color-primary-dark-2:        var(--brand-hover);
  --el-border-radius-base:          var(--radius-sm);
  --el-border-radius-small:         var(--radius-sm);
  --el-text-color-primary:          var(--gray-800);
  --el-text-color-regular:          var(--gray-600);
  --el-text-color-secondary:        var(--gray-500);
  --el-text-color-placeholder:      var(--gray-400);
  --el-border-color:                var(--gray-300);
  --el-border-color-light:          var(--gray-200);
  --el-border-color-lighter:        var(--gray-200);
  --el-fill-color-blank:            #FFFFFF;
  --el-bg-color:                    #FFFFFF;
}

/* ============================================================
 * Dark theme — override all design tokens
 * ============================================================ */
[data-theme="dark"] {
  --brand:         #4D94FF;
  --brand-hover:   #6AABFF;
  --brand-active:  #80BBFF;
  --brand-disabled:#3366AA;
  --brand-soft:    #1A2340;
  --brand-soft-2:  #1E2A4A;

  --gray-50:  #0D1117;
  --gray-100: #161B22;
  --gray-200: #21262D;
  --gray-300: #30363D;
  --gray-400: #484F58;
  --gray-500: #8B949E;
  --gray-600: #C9D1D9;
  --gray-700: #D2D8E0;
  --gray-800: #E6EDF3;
  --gray-900: #F0F6FC;

  --success: #3FB950;
  --warning: #D29922;
  --danger:  #F85149;
  --info:    #4D94FF;

  --status-pending-bg:  #2D2200;
  --status-pending-fg:  #D29922;
  --status-approved-bg: #0D2818;
  --status-approved-fg: #3FB950;
  --status-rejected-bg: #2D0E0E;
  --status-rejected-fg: #F85149;
  --status-draft-bg:    #21262D;
  --status-draft-fg:    #8B949E;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-3: 0 8px 24px rgba(0, 0, 0, 0.5);

  /* Element Plus dark overrides */
  --el-color-primary:               var(--brand);
  --el-color-primary-light-3:       #3366AA;
  --el-color-primary-light-5:       #2A4A80;
  --el-color-primary-light-7:       #1E3460;
  --el-color-primary-light-8:       #1A2A4A;
  --el-color-primary-light-9:       #151F36;
  --el-color-primary-dark-2:        var(--brand-hover);
  --el-text-color-primary:          var(--gray-800);
  --el-text-color-regular:          var(--gray-600);
  --el-text-color-secondary:        var(--gray-500);
  --el-text-color-placeholder:      var(--gray-400);
  --el-border-color:                var(--gray-300);
  --el-border-color-light:          var(--gray-200);
  --el-border-color-lighter:        var(--gray-200);
  --el-fill-color-blank:            #161B22;
  --el-bg-color:                    #0D1117;
  --el-bg-color-overlay:            #161B22;
  --el-mask-color:                  rgba(0, 0, 0, 0.6);
  --el-fill-color:                  #21262D;
  --el-fill-color-light:            #161B22;
  --el-fill-color-lighter:          #0D1117;
}

/* Dark-specific overrides for components that use hardcoded #fff */
[data-theme="dark"] .topbar,
[data-theme="dark"] .sidebar,
[data-theme="dark"] .agent-dock,
[data-theme="dark"] .agent-dock-footer {
  background: #161B22;
}
[data-theme="dark"] .card,
[data-theme="dark"] .el-card,
[data-theme="dark"] .el-dialog,
[data-theme="dark"] .el-table,
[data-theme="dark"] .el-input__wrapper,
[data-theme="dark"] .el-textarea__inner {
  background: #161B22;
}
[data-theme="dark"] .el-table tr,
[data-theme="dark"] .el-table th.el-table__cell {
  background: #161B22;
}
[data-theme="dark"] .el-table--enable-row-hover .el-table__body tr:hover > td {
  background: #21262D;
}
[data-theme="dark"] .agent-msg-bubble {
  background: #21262D;
}
[data-theme="dark"] .agent-msg-user .agent-msg-bubble {
  background: var(--brand-soft-2);
}
[data-theme="dark"] .cv-grid-item {
  background: #161B22;
}
[data-theme="dark"] .cv-sandbox-frame {
  background: #161B22;
}
[data-theme="dark"] .cv-rail-section {
  background: #161B22;
  border-color: var(--gray-200);
}
[data-theme="dark"] .cv-rail-emoji {
  background: #21262D;
}
[data-theme="dark"] .el-dropdown__popper,
[data-theme="dark"] .el-select-dropdown {
  background: #161B22 !important;
}
[data-theme="dark"] .cv-config-panel { background: #161B22; }
[data-theme="dark"] .cv-config-agent { background: linear-gradient(135deg, #161B22 0%, #1A1528 100%); }
/* dark: config toggle now in action bar, styled via .cv-widget-act */
[data-theme="dark"] .cv-config-prompt-ta { background: #0D1117; border-color: #30363D; color: #C9D1D9; }
[data-theme="dark"] .cv-config-note { background: rgba(31, 111, 235, 0.08); }
[data-theme="dark"] .cv-agent-md pre { background: #0D1117; }
[data-theme="dark"] .cv-agent-md code { background: #21262D; border-color: #30363D; }
[data-theme="dark"] .cv-agent-md blockquote { background: rgba(31, 111, 235, 0.05); }
[data-theme="dark"] .cv-agent-result th { background: linear-gradient(135deg, #161B22, #1C2128); }
[data-theme="dark"] .cv-widget-act {
  background: rgba(22, 27, 34, 0.95);
  border-color: #30363D;
  color: #8B949E;
}
[data-theme="dark"] .cv-widget-act:hover:not(:disabled) { background: #21262D; color: #C9D1D9; }
[data-theme="dark"] .cv-widget-editing-badge {
  background: linear-gradient(135deg, #1F6FEB 0%, #388BFD 100%);
}
[data-theme="dark"] .agent-dock-context.is-editing {
  background: linear-gradient(90deg, rgba(31, 111, 235, 0.2), rgba(56, 139, 253, 0.15));
  border-bottom-color: rgba(31, 111, 235, 0.3);
}
[data-theme="dark"] .agent-dock-context-cancel {
  border-color: rgba(31, 111, 235, 0.3);
  color: #8B949E;
}
[data-theme="dark"] .agent-dock-context-cancel:hover {
  background: rgba(31, 111, 235, 0.15);
  color: #58A6FF;
  border-color: #58A6FF;
}

/* Theme dropdown active item */
.is-active-theme {
  color: var(--brand) !important;
  font-weight: 500;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue",
               "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ============================================================
 * App shell
 * ============================================================ */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ---------- Top bar ---------- */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  color: var(--brand);
  letter-spacing: 0.3px;
}

.brand-mark {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand) 0%, #4F8EFF 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 104, 255, 0.30);
}

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
  height: 100%;
  align-items: stretch;
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 14px;
  color: var(--gray-600);
  transition: color var(--t-base) var(--ease);
  border-bottom: 2px solid transparent;
}

.nav a:hover { color: var(--brand); }

.nav a.router-link-active {
  color: var(--brand);
  font-weight: 500;
  border-bottom-color: var(--brand);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  font-size: 16px;
}
.icon-btn:hover {
  background: var(--gray-50);
  color: var(--brand);
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--gray-100);
  padding: 16px 12px;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section-title {
  font-size: 12px;
  color: var(--gray-400);
  padding: 8px 12px;
  margin-top: 8px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-600);
  cursor: pointer;
  margin-bottom: 2px;
  transition: all var(--t-fast) var(--ease);
  position: relative;
}

.sidebar-item:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}

.sidebar-item.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 500;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

.sidebar-item .si-icon {
  width: 16px; text-align: center; flex-shrink: 0;
}

/* ---------- Content area ---------- */
.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  min-width: 0;
}

.content-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header .actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.page-container {
  min-height: 300px;
}
.page-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--gray-800);
}
.page-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ============================================================
 * Cards
 * ============================================================ */
.card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--t-base) var(--ease),
              transform var(--t-base) var(--ease);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
}
.card-body { padding: 20px; }

.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.muted { color: var(--gray-500); }
.small { font-size: 12px; }

/* ============================================================
 * Hero (greeting)
 * ============================================================ */
.hero {
  background: linear-gradient(135deg, #2D5BFF 0%, #5B7CFF 60%, #7E9AFF 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(45, 91, 255, 0.18);
}
.hero::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.hero::after {
  content: '';
  position: absolute;
  right: 80px; bottom: -80px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 20px;
}
.hero-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600;
  backdrop-filter: blur(10px);
}
.hero-greet { font-size: 22px; font-weight: 600; margin: 0 0 6px; }
.hero-meta { opacity: 0.85; font-size: 13px; }
.hero-stats {
  display: flex;
  gap: 36px;
  margin-left: auto;
  position: relative;
  z-index: 1;
}
.hero-stat-num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.hero-stat-label { font-size: 12px; opacity: 0.85; margin-top: 2px; }

/* ============================================================
 * Quick action grid (dashboard self-service)
 * ============================================================ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) { .action-grid { grid-template-columns: repeat(3, 1fr); } }

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--gray-700);
  border: 1px solid transparent;
  transition: all var(--t-base) var(--ease);
  cursor: pointer;
}
.action-card:hover {
  background: var(--brand-soft);
  border-color: var(--brand-soft-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.action-card:hover .action-icon { transform: scale(1.08); }

.action-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: #fff;
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-1);
  transition: transform var(--t-base) var(--ease);
}
.action-label { font-size: 13px; font-weight: 500; }

/* ============================================================
 * Lists (todos, announcements)
 * ============================================================ */
.row-list { padding: 4px 0; }
.row-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--t-fast) var(--ease);
  cursor: pointer;
}
.row-item:last-child { border-bottom: none; }
.row-item:hover { background: var(--gray-50); }

.row-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 500; color: var(--gray-800); margin-bottom: 4px; }
.row-meta { font-size: 12px; color: var(--gray-500); }
.row-action { flex-shrink: 0; }

/* ============================================================
 * Status badges
 * ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
}
.badge-pending  { background: var(--status-pending-bg);  color: var(--status-pending-fg); }
.badge-approved { background: var(--status-approved-bg); color: var(--status-approved-fg); }
.badge-rejected { background: var(--status-rejected-bg); color: var(--status-rejected-fg); }
.badge-draft    { background: var(--status-draft-bg);    color: var(--status-draft-fg); }

/* ============================================================
 * Element Plus overrides
 * ============================================================ */
.el-card {
  border-radius: var(--radius) !important;
  border-color: var(--gray-100) !important;
  box-shadow: var(--shadow-1) !important;
  transition: box-shadow var(--t-base) var(--ease) !important;
}
.el-card:hover { box-shadow: var(--shadow-2) !important; }
.el-card__header {
  padding: 16px 20px !important;
  border-bottom-color: var(--gray-100) !important;
  font-weight: 600;
  font-size: 15px;
}
.el-card__body { padding: 20px !important; }

/* Filled primary button (default) */
.el-button--primary:not(.is-link):not(.is-plain):not(.is-text):not(.is-dashed) {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
  transition: all var(--t-fast) var(--ease) !important;
}
.el-button--primary:not(.is-link):not(.is-plain):not(.is-text):not(.is-dashed):hover {
  background: var(--brand-hover) !important;
  border-color: var(--brand-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45, 91, 255, 0.3);
}

/* Plain primary button (light bg, dark text) */
.el-button--primary.is-plain {
  background: var(--brand-soft) !important;
  border-color: var(--brand-soft-2) !important;
  color: var(--brand) !important;
  transition: all var(--t-fast) var(--ease) !important;
}
.el-button--primary.is-plain:hover {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}

/* Link primary button (text only, no background) */
.el-button--primary.is-link {
  color: var(--brand) !important;
  background: transparent !important;
  border-color: transparent !important;
  padding: 0 4px !important;
  height: auto !important;
  font-weight: normal;
}
.el-button--primary.is-link:hover {
  color: var(--brand-hover) !important;
  background: transparent !important;
}

/* Danger link */
.el-button--danger.is-link {
  color: var(--danger) !important;
  background: transparent !important;
  border-color: transparent !important;
  padding: 0 4px !important;
  height: auto !important;
}

.el-input__wrapper {
  border-radius: var(--radius-sm) !important;
  transition: all var(--t-fast) var(--ease) !important;
}
.el-input__wrapper:hover { border-color: var(--brand) !important; }

.el-table th { background: var(--gray-50) !important; font-weight: 600 !important; }
.el-table td, .el-table th { padding: 12px 0 !important; }

/* ============================================================
 * Tabs (profile)
 * ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 20px;
}
.tab {
  padding: 12px 20px;
  font-size: 14px;
  color: var(--gray-600);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--t-fast) var(--ease);
}
.tab:hover { color: var(--brand); }
.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 500;
}

/* ============================================================
 * Field display (profile read-only fields)
 * ============================================================ */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}
.field {
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  gap: 16px;
  align-items: baseline;
}
.field-label {
  width: 110px;
  flex-shrink: 0;
  color: var(--gray-500);
  font-size: 13px;
}
.field-value {
  flex: 1;
  color: var(--gray-800);
  font-size: 14px;
}

/* ============================================================
 * Form
 * ============================================================ */
.form-card {
  max-width: 720px;
  margin: 0 auto;
}

.duration-display {
  background: var(--brand-soft);
  border: 1px dashed var(--brand-soft-2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--brand);
  font-weight: 500;
  font-size: 14px;
}

/* ============================================================
 * Page transitions
 * ============================================================ */
.fade-enter-active, .fade-leave-active {
  transition: opacity var(--t-base) var(--ease),
              transform var(--t-base) var(--ease);
}
.fade-enter-from { opacity: 0; transform: translateY(6px); }
.fade-leave-to   { opacity: 0; transform: translateY(-6px); }

/* ============================================================
 * Stat cards (reports / dashboards)
 * ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-100);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--t-base) var(--ease);
  cursor: pointer;
}
.stat-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.stat-card .stat-label { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
.stat-card .stat-delta { font-size: 12px; margin-top: 6px; }
.stat-card .stat-delta.up    { color: var(--success); }
.stat-card .stat-delta.down  { color: var(--danger); }
.stat-card .stat-glyph {
  position: absolute;
  right: 16px; top: 18px;
  font-size: 28px;
  opacity: 0.4;
}

/* ============================================================
 * Leave balance cards
 * ============================================================ */
.balance-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.balance-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-100);
  padding: 20px;
  transition: all var(--t-base) var(--ease);
}
.balance-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.balance-type {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 8px;
}
.balance-remain {
  font-size: 32px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.2;
}
.balance-unit { font-size: 14px; color: var(--gray-500); margin-left: 4px; font-weight: normal; }
.balance-meta { font-size: 12px; color: var(--gray-500); margin-top: 8px; }
.balance-bar {
  margin-top: 12px;
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
}
.balance-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, #6E8BFF 100%);
  border-radius: 3px;
  transition: width var(--t-slow) var(--ease);
}

/* ============================================================
 * Attendance calendar
 * ============================================================ */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-head {
  text-align: center;
  font-size: 12px;
  color: var(--gray-500);
  padding: 8px 0;
  font-weight: 500;
}
.calendar-cell {
  aspect-ratio: 1.4;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  border: 1px solid transparent;
}
.calendar-cell:hover {
  background: var(--brand-soft);
  border-color: var(--brand-soft-2);
}
.calendar-cell.empty { background: transparent; cursor: default; }
.calendar-cell.empty:hover { background: transparent; border-color: transparent; }
.calendar-cell.today { background: var(--brand); color: #fff; }
.calendar-cell.today .cal-status { color: rgba(255,255,255,0.85); }
.calendar-cell .cal-day { font-size: 14px; font-weight: 600; }
.calendar-cell .cal-status { font-size: 11px; }
.calendar-cell.weekend { background: #FFF7E6; }
.calendar-cell.weekend .cal-status { color: var(--warning); }
.calendar-cell.exception { background: #FFECEC; }
.calendar-cell.exception .cal-status { color: var(--danger); }
.calendar-cell.leave { background: #E6F4FF; }
.calendar-cell.leave .cal-status { color: var(--info); }

/* ============================================================
 * OKR / Performance cards
 * ============================================================ */
.okr-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-100);
  padding: 20px;
  margin-bottom: 12px;
  transition: all var(--t-base) var(--ease);
}
.okr-card:hover { box-shadow: var(--shadow-2); }
.okr-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.okr-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}
.okr-bar {
  flex: 1;
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}
.okr-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, #6E8BFF 100%);
  border-radius: 4px;
}
.okr-pct { font-size: 13px; font-weight: 600; color: var(--brand); width: 40px; text-align: right; }
.okr-krs { padding-left: 8px; border-left: 2px solid var(--gray-100); margin-top: 12px; }
.okr-kr {
  font-size: 13px;
  color: var(--gray-600);
  padding: 6px 0;
  display: flex;
  justify-content: space-between;
}

/* ============================================================
 * Empty state
 * ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state .es-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .es-title { font-size: 16px; font-weight: 500; margin-bottom: 6px; color: var(--gray-700); }
.empty-state .es-desc { font-size: 13px; color: var(--gray-500); }

/* ============================================================
 * Avatar dropdown trigger
 * ============================================================ */
.avatar-trigger {
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  border: 2px solid transparent;
  border-radius: 50%;
}
.avatar-trigger:hover {
  border-color: var(--brand-soft-2);
  transform: scale(1.05);
}

.el-dropdown-menu__item {
  font-size: 13px !important;
  padding: 8px 16px !important;
}

/* ============================================================
 * Scrollbar polish
 * ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* ============================================================
 * Tables: ensure full container width + clickable rows
 * ============================================================ */
.el-table .el-table__inner-wrapper::before { display: none; } /* hide bottom line */
.el-table .cell { line-height: 1.5; }
.row-clickable .el-table__row { cursor: pointer; transition: background var(--t-fast) var(--ease); }
.row-clickable .el-table__row:hover > td { background: var(--brand-soft) !important; }

/* ============================================================
 * Balance preview (real-time deduction)
 * ============================================================ */
.balance-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-soft-2);
  border-radius: var(--radius);
}
.balance-preview.warn {
  background: #FFECEC;
  border-color: #FFD0D0;
}
.balance-preview .bp-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.balance-preview .bp-label {
  font-size: 11px;
  color: var(--gray-500);
}
.balance-preview .bp-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
}
.balance-preview .bp-arrow {
  font-size: 18px;
  color: var(--gray-400);
  font-weight: 600;
}

/* ============================================================
 * Attachment zone
 * ============================================================ */
.attachment-zone {
  width: 100%;
}
.attachment-empty {
  border: 1.5px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.attachment-empty:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
  transition: background var(--t-fast) var(--ease);
}
.attachment-item:hover {
  background: var(--brand-soft);
}

/* ============================================================
 * Approval timeline (vertical, on application detail)
 * ============================================================ */
.approval-timeline {
  position: relative;
  padding-left: 8px;
}
.approval-step {
  position: relative;
  padding-left: 36px;
  padding-bottom: 24px;
}
.approval-step:last-child { padding-bottom: 0; }
.approval-step::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}
.approval-step:last-child::before { display: none; }
.approval-step.done::before { background: var(--success); }

.approval-node {
  position: absolute;
  left: 0;
  top: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--gray-300);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  color: var(--gray-500);
  z-index: 1;
}
.approval-step.done .approval-node {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.approval-step.current .approval-node {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  animation: pulseBrand 1.6s ease-in-out infinite;
}
@keyframes pulseBrand {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 91, 255, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(45, 91, 255, 0); }
}
.approval-body { padding-top: 4px; }
.approval-title { font-weight: 500; font-size: 14px; margin-bottom: 2px; }
.approval-comment {
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--gray-600);
}

/* ============================================================
 * Performance activity stage row
 * ============================================================ */
.stage-row {
  display: flex;
  gap: 0;
  align-items: stretch;
  position: relative;
}
.stage-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  padding: 0 8px;
}
.stage-item::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--gray-200);
  z-index: 0;
}
.stage-item:last-child::after { display: none; }
.stage-item.done::after { background: var(--success); }
.stage-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--gray-300);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  color: var(--gray-500);
  z-index: 1;
  position: relative;
  margin-bottom: 8px;
}
.stage-item.done .stage-dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.stage-item.current .stage-dot {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.stage-name { font-weight: 500; font-size: 13px; margin-bottom: 2px; }

/* ============================================================
 * Payslip
 * ============================================================ */
.payslip-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 14px;
  border-bottom: 1px dashed var(--gray-100);
}
.payslip-row.total {
  font-weight: 600;
  border-bottom: 2px solid var(--gray-200);
  margin-top: 4px;
}
.payslip-net {
  margin-top: 24px;
  padding: 20px;
  background: var(--brand-soft);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
}

/* ============================================================
 * Recruiting funnel
 * ============================================================ */
.funnel-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.funnel-label {
  width: 90px;
  font-size: 13px;
  color: var(--gray-700);
  text-align: right;
  flex-shrink: 0;
}
.funnel-bar {
  flex: 1;
  height: 28px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.funnel-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, #6E8BFF 100%);
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: width var(--t-slow) var(--ease);
  min-width: 40px;
}
.funnel-pct {
  width: 50px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  flex-shrink: 0;
}

/* ============================================================
 * Tabs polish (used on EmployeeDetail)
 * ============================================================ */
.el-tabs__nav-wrap::after { background: var(--gray-100) !important; }
.el-tabs__item.is-active { color: var(--brand) !important; }
.el-tabs__active-bar { background: var(--brand) !important; }

/* ============================================================
 * Dialog polish
 * ============================================================ */
.el-dialog__header { border-bottom: 1px solid var(--gray-100); padding: 16px 20px !important; margin: 0 !important; }
.el-dialog__title { font-weight: 600 !important; font-size: 15px !important; }
.el-dialog__body { padding: 20px !important; }
.create-event-dialog .el-dialog__body { max-height: 60vh; overflow-y: auto; }
.el-dialog__footer { border-top: 1px solid var(--gray-100); padding: 12px 20px !important; }

/* ============================================================
 * Settings → Employee detail header
 * ============================================================ */
.emp-header-card {
  overflow: hidden;
  position: relative;
}
.emp-header-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(45, 91, 255, 0.07), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(45, 91, 255, 0.04), transparent 40%);
  pointer-events: none;
}
.emp-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px !important;
}
.emp-avatar {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5C7DFF 0%, #2D5BFF 100%);
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(45, 91, 255, 0.25);
}
.emp-identity {
  flex: 1;
  min-width: 0;
}
.emp-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.emp-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1.2;
}
.emp-sub {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 6px;
}
.emp-meta {
  font-size: 12px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.emp-meta b { color: var(--gray-700); font-weight: 600; }
.emp-meta .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.emp-quick-meta {
  display: flex;
  gap: 24px;
  flex: none;
  padding-left: 24px;
  border-left: 1px solid var(--gray-100);
}
.emp-quick-item {
  min-width: 0;
  max-width: 180px;
}
.emp-quick-label {
  font-size: 11px;
  color: var(--gray-500);
  margin-bottom: 4px;
}
.emp-quick-value {
  font-size: 13px;
  color: var(--gray-800);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 1100px) {
  .emp-quick-meta { display: none; }
}

/* ============================================================
 * Settings → Org page (master / detail)
 * ============================================================ */
.org-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.org-split {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}
/* Grid items default to min-width:auto, which lets a wide el-table push the
 * column wider every time you toggle a column on. The minmax(0, 1fr) above
 * + min-width:0 here lock the column width to the grid track. */
.org-split > .org-tree-card,
.org-split > .org-detail-card {
  min-width: 0;
}
.org-tree-card {
  display: flex;
  flex-direction: column;
  /* Always tall enough to actually navigate. The page can scroll if the
     viewport is short — that's better than a 250px tree stub. */
  height: 640px;
}
.org-tree-scroll {
  flex: 1;
  overflow: auto;
  padding: 4px 8px 12px;
  min-height: 0;
}
.org-tree-node {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding-right: 6px;
  font-size: 13.5px;
}
.org-tree-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--gray-800);
}
.org-tree-count {
  flex: none;
  min-width: 22px;
  padding: 0 8px;
  height: 18px;
  line-height: 18px;
  border-radius: 10px;
  background: var(--gray-100);
  color: var(--gray-500);
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.el-tree-node.is-current > .el-tree-node__content .org-tree-count {
  background: var(--brand);
  color: #fff;
}
.org-tree-card .el-tree-node__content { height: 30px; }
.org-tree-card .el-tree-node__content:hover { background: var(--gray-50); }
.org-tree-card .el-tree-node.is-current > .el-tree-node__content {
  background: rgba(64, 96, 255, 0.08);
}
.org-tree-card .el-tree-node.is-current > .el-tree-node__content .org-tree-name {
  color: var(--brand);
  font-weight: 600;
}

.org-detail-card {
  min-height: 640px;
  display: flex;
  flex-direction: column;
}
.org-detail-card > .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
/* Force el-table to honor its parent width and not expand the grid column. */
.org-detail-card .el-table {
  width: 100% !important;
  max-width: 100%;
}
.org-detail-card .el-descriptions {
  width: 100%;
}
.org-emp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.org-emp-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.org-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.org-detail-heading { min-width: 0; flex: 1; }
.org-breadcrumb {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.org-detail-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-800);
  margin: 0;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 10px;
}
.org-level-tag {
  flex: none;
  font-weight: 500 !important;
}
.org-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.org-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.org-chip {
  cursor: pointer;
  padding: 4px 6px 4px 10px !important;
  height: auto !important;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}
.org-chip:hover {
  background: rgba(64, 96, 255, 0.08) !important;
  border-color: var(--brand) !important;
  color: var(--brand) !important;
}
.org-chip-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  height: 16px;
  line-height: 16px;
  border-radius: 8px;
  background: var(--gray-100);
  color: var(--gray-500);
  font-size: 10px;
  text-align: center;
}
.org-chip:hover .org-chip-count {
  background: var(--brand);
  color: #fff;
}

@media (max-width: 860px) {
  .org-split { grid-template-columns: 1fr; }
  .org-tree-card { max-height: 420px; }
  .org-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------------------------
 * Attendance Rule detail panel (Settings → 考勤组 expandable rows)
 * ------------------------------------------------------------------------- */
.rule-detail {
  padding: 16px 20px 20px;
  background: var(--brand-soft, #F4F6FB);
  border-radius: var(--radius, 8px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.rule-detail-section {
  background: #fff;
  border: 1px solid var(--gray-200, #ECEEF5);
  border-radius: var(--radius, 8px);
  padding: 14px 18px 16px;
  box-shadow: var(--shadow-2, 0 2px 10px rgba(3, 4, 13, 0.06));
}
.rule-detail-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800, #141933);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--gray-200, #ECEEF5);
  display: flex;
  align-items: center;
  gap: 6px;
}
.rule-detail-title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--brand, #0068FF);
  border-radius: 2px;
}
.rule-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 24px;
}
.rule-detail-grid > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  line-height: 1.6;
}
.rule-detail-grid label {
  color: var(--gray-500, #989CB2);
  flex: 0 0 auto;
  min-width: 84px;
}
.rule-detail-grid span {
  color: var(--gray-800, #141933);
  font-weight: 500;
  word-break: break-all;
}
.rule-detail-shifts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rule-shift-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--brand-soft-2, #E6EEFF);
  color: var(--brand, #0068FF);
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
  border: 1px solid rgba(0, 104, 255, 0.16);
}
.rule-detail-list {
  background: #FAFBFD;
  border: 1px solid var(--gray-200, #ECEEF5);
  border-radius: 6px;
  padding: 10px 12px;
  max-height: 220px;
  overflow: auto;
}
.rule-detail-list pre {
  margin: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  color: var(--gray-600, #474C66);
  white-space: pre-wrap;
  word-break: break-all;
}
.rule-detail-empty {
  padding: 8px 0;
  font-size: 12px;
  color: var(--gray-500, #989CB2);
}

/* ---------------------------------------------------------------------------
 * Admin analytics — KPI cards, dashboards, distribution bars, trend bars
 * ------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--gray-200, #ECEEF5);
  border-radius: var(--radius, 8px);
  box-shadow: var(--shadow-2, 0 2px 10px rgba(3, 4, 13, 0.06));
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card-action {
  cursor: pointer;
}
.kpi-card-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(3, 4, 13, 0.1);
}
.kpi-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.kpi-icon-blue   { background: #E6EEFF; color: #0068FF; }
.kpi-icon-green  { background: #E8F8EF; color: #10B981; }
.kpi-icon-orange { background: #FEF3C7; color: #D97706; }
.kpi-icon-red    { background: #FEE2E2; color: #DC2626; }
.kpi-body { min-width: 0; }
.kpi-num {
  font-size: 26px;
  font-weight: 600;
  color: var(--gray-800, #141933);
  line-height: 1.15;
}
.kpi-num-sub {
  font-size: 14px;
  color: var(--gray-500, #989CB2);
  font-weight: 400;
  margin-left: 4px;
}
.kpi-label {
  font-size: 12px;
  color: var(--gray-500, #989CB2);
  margin-top: 4px;
}

/* Action pending list (dashboard right side) */
.action-pending-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-pending-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #FAFBFD;
  border: 1px solid var(--gray-200, #ECEEF5);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.action-pending-item:hover {
  background: #F4F6FB;
  border-color: var(--brand, #0068FF);
}
.ap-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.ap-text {
  flex: 1;
  font-size: 13px;
  color: var(--gray-800, #141933);
}
.ap-num {
  font-size: 18px;
  font-weight: 600;
  color: var(--brand, #0068FF);
}

/* Recent activity list */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px dashed var(--gray-200, #ECEEF5);
}
.recent-item:last-child { border-bottom: none; }
.recent-name {
  font-weight: 500;
  color: var(--gray-800, #141933);
  flex: 0 0 auto;
}
.recent-meta {
  flex: 1;
  color: var(--gray-500, #989CB2);
}
.recent-date {
  flex: 0 0 auto;
  color: var(--gray-500, #989CB2);
  font-size: 11px;
}

/* Distribution bars (leave type, overtime kind, dept ranking) */
.dist-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dist-bar-row {
  display: grid;
  grid-template-columns: 80px 1fr 140px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.dist-bar-label {
  color: var(--gray-800, #141933);
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dist-bar-track {
  background: #F4F6FB;
  border-radius: 4px;
  height: 18px;
  overflow: hidden;
}
.dist-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0068FF, #4A8DFF);
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.dist-bar-fill.orange {
  background: linear-gradient(90deg, #D97706, #FBBF24);
}
.dist-bar-val {
  color: var(--gray-500, #989CB2);
  text-align: left;
}

/* Trend bars (monthly exception trend) */
.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  padding: 20px 10px 0;
  height: 240px;
}
.trend-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.trend-bar-track {
  flex: 1;
  width: 60%;
  max-width: 60px;
  background: #F4F6FB;
  border-radius: 4px 4px 0 0;
  position: relative;
  display: flex;
  align-items: flex-end;
}
.trend-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #4A8DFF, #0068FF);
  border-radius: 4px 4px 0 0;
  position: relative;
  display: flex;
  justify-content: center;
  transition: height 0.5s ease;
  min-height: 4px;
}
.trend-bar-pct {
  position: absolute;
  top: -20px;
  font-size: 11px;
  color: var(--gray-800, #141933);
  font-weight: 600;
  white-space: nowrap;
}
.trend-bar-label {
  font-size: 12px;
  color: var(--gray-800, #141933);
  font-weight: 500;
}
.trend-bar-meta {
  font-size: 10px;
}

/* Inline status badge color variants used by dashboard / inbox tables */
.badge.bg-red    { background: #FEE2E2; color: #DC2626; }
.badge.bg-orange { background: #FEF3C7; color: #D97706; }
.badge.bg-yellow { background: #FEF9C3; color: #A16207; }
.badge.bg-green  { background: #DCFCE7; color: #16A34A; }

/* page-tools (top-right of page-header) */
.page-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Inbox tabs spacing */
.inbox-tabs .el-tabs__header {
  padding: 0 20px;
  margin-bottom: 0;
}
.inbox-tabs .el-tabs__content {
  padding: 12px 0;
}
.inbox-tabs .el-badge__content {
  margin-left: 6px;
  transform: translate(0, 0);
  position: relative;
  top: -1px;
}

/* Margin utilities used by analytics templates */
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.mb-8  { margin-bottom: 8px; }

/* ---------------------------------------------------------------------------
 * Reports — unified HR data center page (tabs + nested sub-tabs)
 * ------------------------------------------------------------------------- */
.reports-page {
  width: 100%;
}
.reports-tabs {
  margin-top: 8px;
}
.reports-tabs.el-tabs--border-card {
  border: 1px solid var(--gray-200, #ECEEF5);
  border-radius: var(--radius, 8px);
  box-shadow: var(--shadow-2, 0 2px 10px rgba(3, 4, 13, 0.06));
  background: #fff;
}
.reports-tabs.el-tabs--border-card > .el-tabs__header {
  background: #FAFBFD;
  border-bottom: 1px solid var(--gray-200, #ECEEF5);
  padding: 0 8px;
}
.reports-tabs.el-tabs--border-card > .el-tabs__header .el-tabs__item {
  height: 48px;
  line-height: 48px;
  font-size: 14px;
  color: var(--gray-600, #474C66);
  border: none !important;
  padding: 0 18px !important;
}
.reports-tabs.el-tabs--border-card > .el-tabs__header .el-tabs__item:hover {
  color: var(--brand, #0068FF);
}
.reports-tabs.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active {
  color: var(--brand, #0068FF);
  background: #fff;
  font-weight: 600;
  position: relative;
}
.reports-tabs.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 2px;
  background: var(--brand, #0068FF);
  border-radius: 1px;
}
.reports-tabs.el-tabs--border-card > .el-tabs__content {
  padding: 24px;
  background: #FAFBFD;
}
.rt-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* When admin pages are embedded inside reports tabs, demote their inner
 * page-header so it doesn't compete with the outer "HR 数据中心" title */
.reports-tabs .el-tab-pane .page-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--gray-200, #ECEEF5);
}
.reports-tabs .el-tab-pane .page-header .page-title {
  font-size: 17px;
}
.reports-tabs .el-tab-pane .page-header .page-subtitle {
  font-size: 12px;
}

/* ---------- Sub-tabs inside the 原始数据 pane ----------
 * Styled as a compact segmented control (think iOS/Linear) so they read
 * clearly as a *secondary* level under the big "原始数据" tab and don't
 * compete visually with the outer border-card tabs above. */
.reports-subtabs {
  margin-bottom: 4px;
}
.reports-subtabs .el-tabs__header {
  margin: 0 0 18px 0;
  border-bottom: none;
}
.reports-subtabs .el-tabs__nav-wrap {
  overflow: visible;
}
.reports-subtabs .el-tabs__nav-wrap::after {
  display: none;     /* kill the default 1px underline */
}
.reports-subtabs .el-tabs__nav {
  display: inline-flex;
  background: #EEF1F7;
  border-radius: 10px;
  padding: 4px;
  border: none;
  gap: 2px;
  height: auto !important;
}
.reports-subtabs .el-tabs__item {
  height: 32px !important;
  line-height: 32px !important;
  padding: 0 16px !important;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600, #474C66);
  border: none !important;
  border-radius: 7px;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.reports-subtabs .el-tabs__item:hover {
  color: var(--brand, #0068FF);
}
.reports-subtabs .el-tabs__active-bar {
  display: none !important;
}
.reports-subtabs .el-tabs__item.is-active {
  background: #fff;
  color: var(--brand, #0068FF);
  font-weight: 600;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 1px 3px rgba(15, 23, 42, 0.08);
}

/* When a records page lives inside the 原始数据 sub-tab, its own
 * "加班记录 (HR)" page-header is redundant with the active sub-tab pill
 * right above it. Compact + de-emphasize it so the table breathes. */
.reports-tabs .reports-subtabs .el-tab-pane .page-header {
  margin-bottom: 14px;
  padding-bottom: 0;
  border-bottom: none;
}
.reports-tabs .reports-subtabs .el-tab-pane .page-header .page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700, #2A2F45);
}
.reports-tabs .reports-subtabs .el-tab-pane .page-header .page-subtitle {
  font-size: 12px;
  color: var(--gray-500, #94A3B8);
  margin-top: 2px;
}

/* ============================================================
 * AI Agent dock — global floating chat widget
 * ============================================================ */
.agent-dock-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9000;
  font-size: 13px;
}

/* Floating action button — slim round icon */
.agent-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #5B7BFF 0%, #8A5CF6 60%, #C04DF9 100%);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(91, 123, 255, 0.32), 0 1px 4px rgba(91, 123, 255, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  opacity: 0.85;
}
.agent-fab:hover {
  opacity: 1;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 24px rgba(91, 123, 255, 0.42), 0 3px 8px rgba(91, 123, 255, 0.22);
}
.agent-fab:active { transform: translateY(0) scale(1); }
.agent-fab-icon { line-height: 1; font-size: 18px; }

/* Panel */
.agent-dock {
  /* width/height come from inline :style binding (resizable) */
  min-width: 340px;
  min-height: 420px;
  max-width:  calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--gray-200, #ECEEF5);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18), 0 8px 24px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.agent-dock.is-resizing {
  user-select: none;
  transition: none;
}

/* Resize handles */
.agent-resize-edge {
  position: absolute;
  z-index: 5;
}
.agent-resize-edge.top {
  top: 0; left: 14px; right: 14px; height: 6px;
  cursor: ns-resize;
}
.agent-resize-edge.left {
  top: 14px; bottom: 14px; left: 0; width: 6px;
  cursor: ew-resize;
}
.agent-resize-corner {
  position: absolute;
  top: 0; left: 0;
  width: 16px; height: 16px;
  cursor: nwse-resize;
  z-index: 6;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 3px 0 0 3px;
  color: rgba(255, 255, 255, 0.7);
}
.agent-resize-corner:hover { color: #fff; }

/* Header */
.agent-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #5B7BFF 0%, #8A5CF6 60%, #C04DF9 100%);
  color: #fff;
}
.agent-dock-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.agent-dock-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 18px;
  flex-shrink: 0;
}
.agent-dock-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}
.agent-dock-status {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.agent-dock-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.3);
}
.agent-dock-actions {
  display: flex;
  gap: 4px;
}
.agent-dock-iconbtn {
  width: 26px;
  height: 26px;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.agent-dock-iconbtn:hover { background: rgba(255, 255, 255, 0.28); }

/* Body / messages */
.agent-dock-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.agent-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.agent-msg-user { flex-direction: row-reverse; }
.agent-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #5B7BFF, #8A5CF6);
  color: #fff;
}
.agent-msg-user .agent-msg-avatar {
  background: var(--brand, #0068FF);
}
.agent-msg-bubble-wrap {
  max-width: calc(100% - 44px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.agent-msg-user .agent-msg-bubble-wrap { align-items: flex-end; }
.agent-msg-bubble {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--gray-200, #ECEEF5);
  color: var(--gray-800, #1F2937);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.agent-msg-agent .agent-msg-bubble {
  border-top-left-radius: 4px;
}
.agent-msg-user .agent-msg-bubble {
  background: var(--brand, #0068FF);
  color: #fff;
  border-color: transparent;
  border-top-right-radius: 4px;
}
.agent-msg-time {
  font-size: 10px;
  color: var(--gray-500, #94A3B8);
  margin-top: 4px;
  padding: 0 4px;
}

/* Markdown rendered content inside agent bubbles */
.agent-md {
  white-space: normal !important;
}
.agent-md p {
  margin: 0 0 8px 0;
}
.agent-md p:last-child {
  margin-bottom: 0;
}
.agent-md h1, .agent-md h2, .agent-md h3, .agent-md h4 {
  margin: 8px 0 4px 0;
  font-weight: 600;
  line-height: 1.4;
}
.agent-md h1 { font-size: 16px; }
.agent-md h2 { font-size: 15px; }
.agent-md h3 { font-size: 14px; }
.agent-md h4 { font-size: 13px; }
.agent-md ul, .agent-md ol {
  margin: 4px 0 8px 0;
  padding-left: 20px;
}
.agent-md li {
  margin-bottom: 2px;
}
.agent-md code {
  background: #F1F5F9;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 12px;
  font-family: 'SF Mono', Monaco, monospace;
  color: #E11D48;
}
.agent-md pre {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 6px 0;
}
.agent-md pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}
.agent-md table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
  font-size: 12px;
}
.agent-md table th, .agent-md table td {
  border: 1px solid #E2E8F0;
  padding: 4px 8px;
  text-align: left;
}
.agent-md table th {
  background: #F8FAFC;
  font-weight: 600;
}
.agent-md strong {
  font-weight: 600;
}
.agent-md blockquote {
  border-left: 3px solid #5B7BFF;
  margin: 6px 0;
  padding: 4px 12px;
  color: #64748B;
  background: #F8FAFC;
  border-radius: 0 4px 4px 0;
}
.agent-md hr {
  border: none;
  border-top: 1px solid #E2E8F0;
  margin: 8px 0;
}

/* Typing indicator */
.agent-msg-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 14px 14px;
}
.agent-msg-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-400, #B0B6C2);
  animation: agent-typing 1.2s infinite ease-in-out;
}
.agent-msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.agent-msg-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes agent-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* Collapsible long messages */
.agent-msg-bubble.is-collapsed {
  max-height: 320px;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to bottom, #000 260px, transparent 320px);
  -webkit-mask-image: linear-gradient(to bottom, #000 260px, transparent 320px);
}
.agent-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  background: #fff;
  color: #5B7BFF;
  font-size: 12px;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s, border-color 0.15s;
}
.agent-expand-btn:hover {
  background: #F8FAFC;
  border-color: #5B7BFF;
}

/* Widget iframe — auto-height */
.agent-widget-wrap {
  margin-top: 8px;
  width: 100%;
  position: relative;
}
.agent-add-canvas-btn {
  display: block;
  margin: 6px 0 0;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--brand, #5B7BFF);
  background: var(--brand-soft-2, #F1F5FF);
  border: 1px solid rgba(91, 123, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.agent-add-canvas-btn:hover {
  background: rgba(91, 123, 255, 0.15);
  border-color: rgba(91, 123, 255, 0.4);
}
.agent-added-canvas-hint {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #10B981;
}
.agent-canvas-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #F1F5FF, #EFF6FF);
  border: 1px dashed rgba(91, 123, 255, 0.3);
  border-radius: 8px;
}
.agent-confirm-canvas-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #5B7BFF, #8B5CF6);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
}
.agent-confirm-canvas-btn:hover { opacity: .85; }
.agent-confirm-canvas-hint {
  font-size: 11px;
  color: #64748B;
}
.agent-widget-iframe {
  width: 100%;
  min-height: 100px;
  height: 300px;    /* fallback before onload auto-sizes */
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;  /* no scrollbars — height matches content */
}

/* Tool steps (shown during streaming) */
.agent-tool-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.agent-tool-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748B;
  padding: 4px 10px;
  background: #F8FAFC;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
  animation: agent-step-in 0.3s ease-out;
}
.agent-tool-step-icon {
  font-size: 13px;
  flex-shrink: 0;
}
@keyframes agent-step-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Streaming cursor blink */
.agent-streaming::after {
  content: '▍';
  color: #5B7BFF;
  animation: agent-cursor-blink 0.8s step-end infinite;
  font-weight: 300;
}
@keyframes agent-cursor-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* Suggestion chips (welcome state) */
.agent-suggest {
  margin-top: 4px;
  padding: 12px;
  background: #fff;
  border: 1px dashed var(--gray-300, #D9DEE9);
  border-radius: 12px;
}
.agent-data-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.agent-data-hint {
  font-size: 11px;
  color: var(--primary, #5B7BFF);
  background: rgba(91, 123, 255, 0.08);
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.agent-suggest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.agent-suggest-title {
  font-size: 12px;
  color: var(--gray-600, #64748B);
}
.agent-suggest-refresh {
  font-size: 11px;
  color: var(--brand, #0068FF);
  background: none;
  border: 1px solid var(--gray-200, #ECEEF5);
  border-radius: 12px;
  padding: 2px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.agent-suggest-refresh:hover {
  background: var(--brand-soft, #F4F6FB);
  border-color: var(--brand, #0068FF);
}
.agent-suggest-refresh:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.agent-msg-count {
  font-size: 11px;
  color: var(--gray-500, #989CB2);
  margin-left: 6px;
}
.agent-suggest-chip {
  display: block;
  padding: 8px 10px;
  margin-top: 6px;
  background: var(--brand-soft-2, #F1F5FF);
  color: var(--brand, #0068FF);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  border: 1px solid transparent;
}
.agent-suggest-chip:hover {
  background: #E6EEFF;
  border-color: #C7D7FF;
  transform: translateX(2px);
}

/* Stagger reveal animation */
.agent-suggest-chip.chip-enter {
  animation: chipSlideIn 0.25s ease-out;
}
@keyframes chipSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Refresh icon spin */
.agent-refresh-icon {
  display: inline-block;
  transition: transform 0.2s;
}
.agent-suggest-refresh.is-loading .agent-refresh-icon,
.agent-suggest-loading .agent-refresh-icon {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Inline loading hint below suggestions */
.agent-suggest-loading {
  font-size: 11px;
  color: var(--gray-500, #989CB2);
  margin-top: 10px;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Footer / input */
.agent-dock-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--gray-200, #ECEEF5);
  background: #fff;
}
.agent-dock-input {
  width: 100%;
  border: 1px solid var(--gray-200, #ECEEF5);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  color: var(--gray-800, #1F2937);
  background: #F8FAFC;
  transition: border-color 0.15s, background 0.15s;
}
.agent-dock-input:focus {
  border-color: var(--brand, #0068FF);
  background: #fff;
}
.agent-dock-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.agent-dock-tools { display: flex; gap: 4px; }
.agent-dock-tool {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--gray-500, #94A3B8);
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.agent-dock-tool:hover {
  background: var(--gray-100, #F1F5F9);
  color: var(--gray-700, #475569);
}
.agent-dock-send {
  padding: 6px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #5B7BFF 0%, #8A5CF6 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.agent-dock-send:hover:not(:disabled) { transform: translateY(-1px); }
.agent-dock-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.agent-dock-stop {
  padding: 6px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  animation: agent-stop-pulse 1.5s ease-in-out infinite;
}
.agent-dock-stop:hover { transform: translateY(-1px); opacity: 0.9; }
@keyframes agent-stop-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

/* Fade transition (kept simple to avoid transform-stuck states) */
.agent-dock-enter-from,
.agent-dock-leave-to {
  opacity: 0;
}
.agent-dock-enter-active,
.agent-dock-leave-active {
  transition: opacity 0.18s ease;
}

/* Mobile-ish: shrink panel on small viewports */
@media (max-width: 540px) {
  .agent-dock {
    width:  calc(100vw - 32px) !important;
    height: calc(100vh - 100px) !important;
  }
  .agent-resize-edge, .agent-resize-corner { display: none; }
  .agent-dock-root { right: 16px; bottom: 16px; }
}

/* ---------- Records-table UX helpers ---------- */
/* Clickable name cell that drills into a single employee */
.cell-link {
  color: #5B7BFF;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.15s, border-color 0.15s;
}
.cell-link:hover {
  color: #3B5BDB;
  border-bottom-color: #5B7BFF;
}

/* Banner shown above table when an employee filter is active */
.active-filter-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 8px 14px;
  background: linear-gradient(90deg, rgba(91, 123, 255, 0.08), rgba(138, 92, 246, 0.06));
  border: 1px solid rgba(91, 123, 255, 0.25);
  border-radius: 10px;
  font-size: 13px;
  color: var(--gray-700, #475569);
}
.active-filter-banner .afb-label {
  color: var(--gray-500, #94A3B8);
  font-weight: 500;
}
.active-filter-banner .afb-value {
  color: #3B5BDB;
  font-weight: 600;
}
.active-filter-banner .afb-clear {
  margin-left: auto;
  padding: 2px 10px;
  border: 1px solid rgba(91, 123, 255, 0.4);
  background: #fff;
  color: #5B7BFF;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.active-filter-banner .afb-clear:hover {
  background: #5B7BFF;
  color: #fff;
}

/* ============================================================
 * 我的画布 (AI-generated personal pages)
 * ============================================================ */
.nav-beta {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(90deg, #5B7BFF, #8A5CF6);
  border-radius: 4px;
  vertical-align: middle;
  line-height: 1.4;
}
.cv-beta {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(90deg, #5B7BFF, #8A5CF6);
  border-radius: 6px;
  vertical-align: middle;
}

.canvas-page { }

.cv-self-pick {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}

/* ---------- Left rail ---------- */
.cv-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}
.cv-rail-section {
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-1);
}
.cv-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  margin-bottom: 10px;
  padding: 0 4px;
}
.cv-icon-btn {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid var(--gray-100);
  background: #fff;
  color: #5B7BFF;
  font-size: 14px;
  line-height: 18px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cv-icon-btn:hover { background: #5B7BFF; color: #fff; border-color: #5B7BFF; }

.cv-rail-empty {
  font-size: 12px;
  color: var(--gray-500);
  padding: 12px 6px;
  text-align: center;
  line-height: 1.6;
}

.cv-rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-size: 13px;
  position: relative;
  border: 1px solid transparent;
}
.cv-rail-item:hover {
  background: var(--brand-soft);
  border-color: var(--gray-200);
  transform: translateX(2px);
}
.cv-rail-item.active {
  background: var(--brand-soft-2);
  border-color: rgba(0, 104, 255, 0.25);
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(0, 104, 255, 0.1);
}
.cv-rail-item.active .cv-rail-title { font-weight: 600; }
.cv-rail-item.active .cv-rail-meta { color: var(--brand); opacity: 0.7; }

.cv-rail-emoji {
  font-size: 18px;
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-50);
  border-radius: 8px;
  transition: background 0.2s;
}
.cv-rail-item:hover .cv-rail-emoji { background: var(--brand-soft-2); }
.cv-rail-item.active .cv-rail-emoji { background: rgba(0, 104, 255, 0.12); }

.cv-rail-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cv-rail-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  line-height: 1.3;
}
.cv-rail-meta {
  font-size: 11px;
  color: var(--gray-500);
  line-height: 1.3;
}

.cv-rail-del {
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  color: var(--gray-400);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  opacity: 0;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s var(--ease);
}
.cv-rail-item:hover .cv-rail-del { opacity: 1; }
.cv-rail-del:hover { background: #FEE2E2; color: #DC2626; }

.cv-rail-tpl {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px dashed var(--gray-200);
  transition: all 0.2s var(--ease);
}
.cv-rail-tpl:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  border-style: solid;
  transform: translateX(2px);
}
.cv-rail-tpl .cv-rail-emoji {
  background: var(--gray-50);
}
.cv-rail-tpl:hover .cv-rail-emoji {
  background: var(--brand-soft-2);
}
.cv-rail-tpl-body { flex: 1; min-width: 0; }
.cv-rail-tpl-title { font-size: 13px; font-weight: 500; }
.cv-rail-tpl-meta { margin-top: 2px; }

/* ---------- Main canvas area ---------- */
.cv-main {
  background: transparent;
}
.cv-blank, .cv-empty-canvas {
  background: #fff;
  border: 1px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 80px 20px;
  text-align: center;
}
.cv-blank-icon { font-size: 48px; margin-bottom: 12px; }
.cv-blank-title { font-size: 16px; font-weight: 500; margin-bottom: 6px; }
.cv-blank-desc { font-size: 13px; }

.cv-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  margin-bottom: 20px;
}
.cv-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.cv-toolbar-emoji { font-size: 22px; }
.cv-toolbar-title {
  font-size: 16px;
  font-weight: 600;
  border: none;
  background: transparent;
  outline: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
  min-width: 80px;
  max-width: 320px;
}
.cv-toolbar-title:hover, .cv-toolbar-title:focus {
  background: rgba(91, 123, 255, 0.06);
}
.cv-toolbar-right {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- Widget grid ---------- */
.cv-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  padding-top: 6px;  /* room for the badge that sits above the card edge */
}
.cv-grid-item {
  position: relative;
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: visible;
  transition: box-shadow 0.18s;
}
.cv-grid-item:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06); }
.cv-span-4  { grid-column: span 4; }
.cv-span-6  { grid-column: span 6; }
.cv-span-8  { grid-column: span 8; }
.cv-span-12 { grid-column: span 12; }
@media (max-width: 1100px) {
  .cv-span-4 { grid-column: span 6; }
  .cv-span-8 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .canvas-layout { grid-template-columns: 1fr; }
  .cv-rail { position: static; }
  .cv-span-4, .cv-span-6, .cv-span-8 { grid-column: span 12; }
}

/* Widget index badge (top-left pill on grid item) */
.cv-widget-index-badge {
  position: absolute;
  top: -9px;
  left: 14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #5B7BFF, #8B5CF6);
  padding: 0 6px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 4px rgba(91, 123, 255, 0.2);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* Agent type badge (next to index badge) */
.cv-agent-badge {
  position: absolute;
  top: -9px;
  left: 44px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  z-index: 4;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(124, 58, 237, 0.3);
}

/* per-widget action bar (top-right, above card border) */
.cv-widget-actions {
  position: absolute;
  top: -13px;
  right: 8px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.18s;
  z-index: 5;
}
.cv-grid-item:hover .cv-widget-actions { opacity: 1; }
.cv-widget-act {
  width: 26px; height: 26px;
  border: 1px solid var(--gray-100);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  color: var(--gray-500);
  font-size: 14px;
  line-height: 1;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cv-widget-act:hover:not(:disabled) { background: #F1F5F9; color: var(--gray-800); }
.cv-widget-act:disabled { opacity: 0.35; cursor: not-allowed; }
.cv-widget-act-danger { font-size: 16px; }
.cv-widget-act-danger:hover:not(:disabled) { background: #FEE2E2; color: #DC2626; border-color: #FECACA; }
.cv-widget-act-cfg { font-size: 12px; }
.cv-widget-act-cfg:hover:not(:disabled) { background: #F0F0FF; color: #6B4FD8; border-color: #C4B5FD; }
.cv-widget-act-cfg.active { background: #7C5CFF; color: #fff; border-color: #7C5CFF; }
.cv-widget-act-edit { font-size: 12px; }
.cv-widget-act-edit:hover:not(:disabled) { background: #E6EEFF; color: var(--brand); border-color: #B3D1FF; }
.cv-widget-act-edit.is-editing { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Editing badge shown on the widget being edited */
.cv-widget-editing-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--brand) 0%, #3B82F6 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 14px;
  border-radius: 12px;
  z-index: 4;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 104, 255, 0.25);
  animation: cv-editing-pulse 2s ease-in-out infinite;
}
.cv-editing-cancel {
  font-size: 11px;
  opacity: 0.7;
  margin-left: 4px;
}
.cv-editing-cancel:hover { opacity: 1; }
@keyframes cv-editing-pulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 104, 255, 0.25); }
  50% { box-shadow: 0 2px 16px rgba(0, 104, 255, 0.45); }
}

/* Editing highlight border on grid item */
.cv-grid-item:has(.cv-widget-editing-badge) {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 2px rgba(0, 104, 255, 0.15);
}

.cv-empty {
  text-align: center;
  padding: 30px 10px;
  color: var(--gray-400);
  font-size: 13px;
}

/* ---------- Sandbox widget ---------- */
.cv-sandbox {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 320px;
  overflow: hidden;
  border-radius: inherit;
}
/* (sandbox-title removed — title info now lives in index badge + config panel) */
.cv-sandbox-frame {
  width: 100%;
  min-height: 280px;
  border: none;
  background: #fff;
  display: block;
}
.cv-sandbox-toggle {
  display: block;
  width: 100%;
  padding: 6px 0;
  font-size: 12px;
  color: var(--brand);
  background: var(--gray-50);
  border: none;
  border-top: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.15s;
}
.cv-sandbox-toggle:hover {
  background: var(--brand-soft);
}

/* ============================================================
 * Agent Widget — AI-driven canvas component
 * ============================================================ */
/* ---- Widget config panel (shared by sandbox + agent) ---- */
.cv-config-panel {
  padding: 12px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-size: 12px;
  animation: cv-config-slide 0.2s ease;
}
.cv-config-agent { background: linear-gradient(135deg, #FAFAFF 0%, #F8F5FF 100%); }
@keyframes cv-config-slide { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 400px; } }
.cv-config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.cv-config-row-top { align-items: flex-start; }
.cv-config-label {
  width: 64px;
  flex-shrink: 0;
  color: var(--gray-500);
  font-size: 11px;
}
.cv-config-val { color: var(--gray-800); font-weight: 500; }
.cv-config-divider { border-top: 1px dashed var(--gray-200); margin: 6px 0; }
.cv-config-note {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(0, 104, 255, 0.04);
  border-radius: 4px;
}
.cv-config-prompt-view {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.cv-config-prompt-view .cv-config-val {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cv-config-edit-btn {
  font-size: 11px;
  color: var(--brand);
  background: none;
  border: 1px solid rgba(0, 104, 255, 0.2);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.cv-config-edit-btn:hover { background: rgba(0, 104, 255, 0.06); border-color: var(--brand); }
.cv-config-prompt-edit { flex: 1; }
.cv-config-prompt-ta {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.5;
  color: var(--gray-800);
  background: #fff;
}
.cv-config-prompt-ta:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(0,104,255,0.1); }
.cv-config-prompt-actions { display: flex; gap: 6px; margin-top: 6px; }
.cv-config-prompt-save {
  font-size: 11px;
  padding: 4px 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.cv-config-prompt-save:hover { background: var(--brand-hover); }
.cv-config-prompt-cancel {
  font-size: 11px;
  padding: 4px 14px;
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  color: var(--gray-600);
  cursor: pointer;
}
.cv-config-prompt-cancel:hover { background: var(--gray-50); }

/* ---- Agent widget ---- */
.cv-agent-widget {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
}
.cv-agent-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #F0F4FF 0%, #F8F0FF 100%);
  border-bottom: 1px solid var(--gray-200);
}
[data-theme="dark"] .cv-agent-header {
  background: linear-gradient(135deg, #1A2340 0%, #201A30 100%);
}
.cv-agent-icon { font-size: 18px; }
.cv-agent-title { font-weight: 600; font-size: 14px; color: var(--gray-800); flex: 1; }
.cv-agent-body { padding: 16px; }
.cv-agent-base { margin-bottom: 12px; }
.cv-agent-base-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.cv-agent-base-preview {
  max-height: 220px;
  overflow: auto;
  border-radius: 8px;
  background: var(--gray-50);
  padding: 8px;
  border: 1px solid var(--gray-200);
}
.cv-agent-base-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.cv-agent-base-table th {
  padding: 5px 8px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-weight: 600;
  font-size: 11px;
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.cv-agent-base-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--gray-100);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  color: var(--gray-700);
  font-size: 12px;
}
.cv-agent-base-table tbody tr:hover td {
  background: rgba(99,102,241,.04);
}
.cv-agent-more {
  font-size: 11px;
  color: var(--gray-500);
  text-align: center;
  padding: 4px;
}
.cv-agent-action { text-align: center; padding: 12px 0; }
.cv-agent-run-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, #7C5CFF 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--t-base) var(--ease);
  box-shadow: 0 2px 8px rgba(0, 104, 255, 0.3);
}
.cv-agent-run-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 104, 255, 0.4);
}
.cv-agent-hint {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 8px;
}
.cv-agent-stop-btn {
  display: block;
  margin: 12px auto 4px;
  padding: 6px 20px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  animation: agent-stop-pulse 1.5s ease-in-out infinite;
}
.cv-agent-stop-btn:hover { transform: translateY(-1px); opacity: 0.9; }
.cv-agent-loading { padding: 8px 0; }
.cv-agent-steps { margin-bottom: 8px; }
.cv-agent-step {
  font-size: 12px;
  color: var(--gray-600);
  padding: 3px 0;
}
.cv-agent-thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-500);
  font-size: 13px;
}
.cv-agent-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.cv-agent-result {
  font-size: 13px;
  line-height: 1.8;
  color: var(--gray-800);
}
/* ---- Agent MD rich formatting ---- */
.cv-agent-md h1, .cv-agent-md h2, .cv-agent-md h3 {
  margin: 16px 0 8px;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.4;
}
.cv-agent-md h1 { font-size: 16px; padding-bottom: 6px; border-bottom: 2px solid var(--brand-soft-2); }
.cv-agent-md h2 { font-size: 15px; }
.cv-agent-md h3 { font-size: 14px; color: var(--gray-700); }
.cv-agent-md p { margin: 6px 0; }
.cv-agent-md ul, .cv-agent-md ol {
  padding-left: 20px;
  margin: 6px 0;
}
.cv-agent-md li { margin: 4px 0; }
.cv-agent-md li::marker { color: var(--brand); }
.cv-agent-md strong { color: var(--gray-800); font-weight: 600; }
.cv-agent-md em { color: var(--gray-600); }
.cv-agent-md code {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 12px;
  font-family: "SF Mono", "Menlo", monospace;
}
.cv-agent-md pre {
  background: #1E293B;
  color: #E2E8F0;
  border-radius: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.5;
}
.cv-agent-md pre code { background: none; border: none; padding: 0; color: inherit; }
.cv-agent-md blockquote {
  border-left: 3px solid var(--brand);
  padding: 4px 12px;
  margin: 8px 0;
  color: var(--gray-600);
  background: rgba(0, 104, 255, 0.03);
  border-radius: 0 6px 6px 0;
}
.cv-agent-md hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 12px 0;
}
.cv-agent-result table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.cv-agent-result th {
  background: linear-gradient(135deg, #F8FAFC, #F1F5F9);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
  color: var(--gray-700);
}
.cv-agent-result td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 12px;
}
.cv-agent-result tr:hover td { background: rgba(0, 104, 255, 0.02); }
.cv-agent-result tr:last-child td { border-bottom: none; }
.cv-agent-rerun-btn {
  margin-top: 12px;
  padding: 6px 16px;
  font-size: 12px;
  color: var(--brand);
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.cv-agent-rerun-btn:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
}
.cv-agent-error {
  color: var(--danger);
  font-size: 13px;
  padding: 8px 0;
}
.cv-agent-done { padding: 4px 0; }

/* Hint card pointing to the global AI dock */
.cv-rail-hint {
  margin-top: 8px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(91,123,255,0.08), rgba(138,92,246,0.06));
  border: 1px dashed rgba(91, 123, 255, 0.35);
  border-radius: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.cv-rail-hint-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.cv-rail-hint-title {
  font-size: 13px;
  font-weight: 600;
  color: #3B5BDB;
  margin-bottom: 4px;
}
.cv-rail-hint-desc {
  line-height: 1.55;
}

/* ============================================================
 * AI Dock — context badge, compose mode, warn-state messages
 * ============================================================ */
.agent-dock-iconbtn.is-active {
  background: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.agent-dock-context {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(90deg, rgba(91,123,255,0.10), rgba(138,92,246,0.08));
  border-bottom: 1px solid rgba(91, 123, 255, 0.18);
  font-size: 12px;
  color: #475569;
}
.agent-dock-context-icon { font-size: 14px; }
.agent-dock-context-label { color: var(--gray-500, #94A3B8); }
.agent-dock-context-value {
  font-weight: 600;
  color: #3B5BDB;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-dock-context.is-editing {
  background: linear-gradient(90deg, rgba(0, 104, 255, 0.15), rgba(59, 130, 246, 0.12));
  border-bottom-color: rgba(0, 104, 255, 0.25);
}
.agent-dock-context-cancel {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(0, 104, 255, 0.25);
  color: var(--gray-500);
  font-size: 11px;
  cursor: pointer;
  border-radius: 4px;
  width: 20px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.agent-dock-context-cancel:hover {
  background: rgba(0, 104, 255, 0.1);
  color: var(--brand);
  border-color: var(--brand);
}

.agent-msg.is-warn .agent-msg-bubble {
  background: #FEF3C7;
  border-color: #FCD34D;
  color: #92400E;
}
.agent-msg.is-loading .agent-msg-bubble {
  background: linear-gradient(135deg, #EFF6FF, #F0EBFF);
  border-color: #C7D2FE;
  color: #4338CA;
  animation: agent-pulse 1.5s ease-in-out infinite;
}
@keyframes agent-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

/* Compose mode — input takes most of the panel, body shrinks */
.agent-dock.is-compose .agent-dock-body {
  flex: 0 0 auto;
  max-height: 140px;
  padding: 10px 14px;
  gap: 10px;
}
.agent-dock.is-compose .agent-dock-body .agent-msg-bubble {
  font-size: 12px;
  padding: 8px 10px;
}
.agent-dock.is-compose .agent-dock-footer {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 14px;
}
.agent-dock.is-compose .agent-dock-input {
  flex: 1;
  min-height: 0;
  font-size: 14px;
  line-height: 1.55;
  padding: 12px 14px;
  background: #fff;
  border-color: var(--brand, #0068FF);
  box-shadow: 0 0 0 3px rgba(91, 123, 255, 0.08);
}
.agent-dock.is-compose .agent-suggest {
  display: none;
}

/* ============================================================
 * Moka Debug Page
 * ============================================================ */
.moka-debug-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  overflow: hidden;
}
.moka-debug-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #F9FAFB;
  border-bottom: 1px solid #E5E7EB;
  user-select: none;
}
.moka-debug-card-header:hover {
  background: #F3F4F6;
}
.moka-debug-card-body {
  padding: 16px 20px;
}
.moka-debug-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.moka-debug-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.moka-debug-info-label {
  font-size: 11px;
  font-weight: 600;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.moka-debug-info-item code {
  font-size: 12px;
  background: #F3F4F6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, 'Fira Code', monospace;
  color: #1F2937;
}
.moka-debug-json {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 12px;
  font-family: 'SF Mono', Monaco, 'Fira Code', monospace;
  line-height: 1.5;
  overflow: auto;
  max-height: 360px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1F2937;
  margin: 0;
}

/* ---- Request form ---- */
.moka-debug-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px 16px;
  padding: 16px;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
}
.moka-debug-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.moka-debug-form-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
}
.moka-debug-form-label code {
  font-size: 10px;
  color: #6366F1;
  background: #EEF2FF;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'SF Mono', Monaco, 'Fira Code', monospace;
  font-weight: 500;
}

/* ---- Response bar ---- */
.moka-debug-response-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* ---- Pagination bar ---- */
.moka-debug-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  border-radius: 8px;
  margin: 8px 0;
}
.moka-debug-pager-info {
  font-size: 13px;
  color: #374151;
  white-space: nowrap;
}

/* ---- Data row cards ---- */
.moka-debug-row-card {
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.moka-debug-row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #F9FAFB;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}
.moka-debug-row-header:hover { background: #F3F4F6; }
.moka-debug-row-arrow {
  width: 16px;
  text-align: center;
  color: #6B7280;
  font-size: 14px;
  flex-shrink: 0;
}
.moka-debug-row-num {
  font-size: 11px;
  color: #9CA3AF;
  font-family: 'SF Mono', Monaco, monospace;
  min-width: 24px;
}

/* ---- Tree view (DevTools style) ---- */
.moka-tree {
  font-family: 'SF Mono', Monaco, 'Fira Code', Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  max-height: 600px;
  overflow: auto;
  background: #fff;
}
.moka-tree-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 1px 12px 1px 0;
  white-space: nowrap;
  min-height: 22px;
}
.moka-tree-row:hover { background: #F5F5F5; }
.moka-tree-row-top {
  background: #F8FAFC;
  font-weight: 600;
  border-top: 1px solid #E5E7EB;
  padding-top: 6px;
  padding-bottom: 6px;
}
.moka-tree-row-top:first-child { border-top: none; }
.moka-tree-arrow {
  width: 16px;
  text-align: center;
  cursor: pointer;
  color: #6B7280;
  flex-shrink: 0;
  user-select: none;
  font-size: 11px;
}
.moka-tree-arrow:hover { color: #111827; }
.moka-tree-leaf {
  width: 16px;
  flex-shrink: 0;
}
.moka-tree-key {
  color: #881798;
  flex-shrink: 0;
}
.moka-tree-colon {
  color: #6B7280;
  margin: 0 2px;
}
.moka-tree-desc {
  color: #9CA3AF;
  font-size: 11px;
  font-style: italic;
  margin-left: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  flex-shrink: 1;
}
.moka-tree-badge {
  color: #6B7280;
  font-size: 11px;
  margin-left: 4px;
}
.moka-tree-val {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}
.moka-tree-val-string { color: #A31515; }
.moka-tree-val-number { color: #098658; }
.moka-tree-val-boolean { color: #0000FF; }
.moka-tree-val-null { color: #9CA3AF; font-style: italic; }

/* === Meituan center — simple bar/trend charts (no chart lib) === */
.mt-bar-list { display: flex; flex-direction: column; gap: 6px; }
.mt-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 80px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.mt-bar-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary, #555);
}
.mt-bar-track {
  background: var(--card-bg, #f3f4f6);
  border-radius: 4px;
  height: 14px;
  overflow: hidden;
}
.mt-bar-fill {
  background: linear-gradient(90deg, #ffd03b, #ff8a3d);
  height: 100%;
  border-radius: 4px;
  transition: width .25s ease;
}
.mt-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #222);
}

.mt-trend {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  padding: 8px 0;
  overflow-x: auto;
}
.mt-trend-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 22px;
  flex: 1 0 auto;
  height: 100%;
}
.mt-trend-fill {
  width: 100%;
  background: linear-gradient(180deg, #ff8a3d, #ffd03b);
  border-radius: 3px 3px 0 0;
  min-height: 1px;
  transition: height .3s ease;
}
.mt-trend-fill-alt {
  background: linear-gradient(180deg, #5b9bff, #94c1ff);
}
.mt-trend-x {
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-secondary, #999);
  white-space: nowrap;
}

/* 月度环比卡片 */
.mt-monthly {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 4px 0;
  overflow: hidden;
  width: 100%;
}
.mt-monthly-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mt-monthly-amt,
.mt-monthly-mom,
.mt-monthly-x,
.mt-monthly-meta {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mt-monthly-bar-wrap {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.mt-monthly-bar {
  width: 60%;
  min-height: 2px;
  background: linear-gradient(180deg, #409eff, #a0cfff);
  border-radius: 4px 4px 0 0;
  transition: height .3s ease;
}
.mt-monthly-amt {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #222);
  font-variant-numeric: tabular-nums;
}
.mt-monthly-mom {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mt-monthly-x {
  font-size: 12px;
  color: var(--text-secondary, #666);
  margin-top: 2px;
}
.mt-monthly-meta {
  font-size: 11px;
  text-align: center;
  line-height: 1.5;
  max-width: 100%;
}
.mt-monthly-meta > div {
  white-space: nowrap;
}
.mt-monthly-amt { font-size: 12px; }

/* ========================================================================== */
/* 趋势数据表 · 首行/首列/末列 冻结 (横向+纵向滚动时保持可见)                    */
/* ========================================================================== */
.sticky-table-wrap {
  position: relative;
}
.sticky-table-wrap table { isolation: isolate; }
/* 所有单元格: 统一的 border-bottom (因为 border-collapse:separate 会失去默认的相邻合并) */
.sticky-table-wrap td,
.sticky-table-wrap th {
  border-bottom: 1px solid var(--gray-100);
}
/* 表头: 纵向冻结在顶部 */
.sticky-table-wrap thead th.col-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}
/* 首列 (部门/项目名) */
.sticky-table-wrap td.col-first {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.04);
}
.sticky-table-wrap tbody tr:hover td.col-first { background: var(--gray-50); }
/* 末列 (最新月) */
.sticky-table-wrap td.col-last {
  position: sticky;
  right: 0;
  z-index: 1;
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.04);
}
/* 末列背景要不透明, 否则横向滚动时下面的 data 列会透过来 */
.dept-trend-table td.col-last-dept { background: #f2faec; }
.project-trend-table td.col-last-project { background: #eef6ff; }
/* 左上角 (首列 × 首行) — 必须在两种 sticky 之上 */
.sticky-table-wrap thead th.col-first.col-head {
  left: 0;
  z-index: 3;
  background: var(--gray-50);
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.04);
}
/* 右上角 (末列 × 首行) */
.sticky-table-wrap thead th.col-last.col-head {
  right: 0;
  z-index: 3;
  background: var(--gray-100);
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.04);
}
/* 普通行 hover (非 sticky 列) */
.sticky-table-wrap tbody tr { transition: background 0.15s; }
.sticky-table-wrap tbody tr:hover td:not(.col-first):not(.col-last) {
  background-color: rgba(0, 0, 0, 0.02);
}
/* 数据单元格可点击下钻 — hover 时加手型 + 高亮提示 */
.sticky-table-wrap td.cell-drill {
  cursor: pointer;
  transition: box-shadow 0.12s, filter 0.12s;
}
.sticky-table-wrap td.cell-drill:hover {
  filter: brightness(0.94);
  box-shadow: inset 0 0 0 1.5px rgba(64, 158, 255, 0.45);
}
.mt-monthly-x { font-size: 11px; }

/* ========================================================================== */
/* 下钻抽屉 · drill-table 行分隔 + 分摊占比可视化横条                          */
/* ========================================================================== */
.drill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.drill-table thead th {
  background: var(--gray-50, #f8f9fb);
  padding: 8px 10px;
  border-bottom: 1px solid var(--gray-200, #e4e7ed);
  font-weight: 600;
  color: var(--gray-700, #4a5164);
  text-align: left;
}
.drill-table tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--gray-100, #ebeef5);
  vertical-align: top;
}
.drill-table tbody tr:hover td {
  background: rgba(64, 158, 255, 0.04);
}
/* 分摊列: 每个项目一行, 横向条形图 + 名称 + 百分比 */
.drill-table td.alloc-cell { padding: 8px 10px; }
.drill-table .alloc-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 90px 36px;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  line-height: 1.4;
}
.drill-table .alloc-row + .alloc-row {
  border-top: 1px dashed var(--gray-100, #ebeef5);
}
.drill-table .alloc-name {
  font-size: 12.5px;
  color: var(--gray-800, #303133);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drill-table .alloc-bar {
  position: relative;
  display: block;
  height: 8px;
  background: var(--gray-100, #ebeef5);
  border-radius: 4px;
  overflow: hidden;
}
.drill-table .alloc-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #409eff 0%, #66b1ff 100%);
  border-radius: 4px;
  transition: width 0.2s ease;
}
.drill-table .alloc-pct {
  font-size: 12px;
  color: var(--gray-600, #6b7280);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* 紧凑型员工行: 圆形姓名首字头像 */
.drill-table .emp-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drill-table .emp-cell-text {
  min-width: 0;
}
.emp-avatar-sm {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  user-select: none;
}
img.emp-avatar-img {
  object-fit: cover;
  background: #f0f2f5;
}
