/* ==================== 模态框 ==================== */
.modal-lg { max-width: 800px; }
.modal-body { max-height: 70vh; overflow-y: auto; }
.modal-title { font-weight: 700; }
.modal { z-index: 9999; }
.modal-backdrop { z-index: 9998; }
.modal-dialog { z-index: 10000; }
.modal-content { border-radius: var(--radius); border: none; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--gray-100); padding: 16px 20px; }
.modal-footer { border-top: 1px solid var(--gray-100); padding: 12px 20px; }

/* 模态框基础显示/隐藏规则（独立于 bootstrap CDN）：内网无 CDN 时弹窗仍能正常弹出与关闭，
   与 bootstrap 原生 .modal 行为保持一致，避免双份样式冲突 */
.modal { display: none; position: fixed; top: 0; left: 0; z-index: 9999; width: 100%; height: 100%; overflow-x: hidden; overflow-y: auto; outline: 0; }
.modal.show { display: block; }
.modal.fade:not(.show) { opacity: 0; }
.modal.fade.show { opacity: 1; }
.modal-dialog { position: relative; width: auto; margin: 1.75rem auto; max-width: 500px; pointer-events: none; }
.modal.show .modal-dialog { pointer-events: auto; }
.modal-dialog.modal-lg, .modal-lg .modal-dialog { max-width: 800px; }
.modal-content { position: relative; display: flex; flex-direction: column; width: 100%; pointer-events: auto; background-color: #fff; background-clip: padding-box; outline: 0; }
.modal-backdrop { position: fixed; top: 0; left: 0; z-index: 9998; width: 100%; height: 100%; background: rgba(15,23,42,.45); }
.modal-backdrop.show { opacity: 1; }

/* 自定义居中弹窗（用于定向推荐等轻量弹窗） */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .2s ease;
}
.modal-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px;
    animation: slideUp .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ==================== 工具类 ==================== */
.text-muted-2 { color: var(--gray-500) !important; }
.cursor-pointer { cursor: pointer; }
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; color: var(--gray-300); }
.empty-state p { font-size: 15px; }

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .5s ease;
}

.badge-round {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ==================== 组织架构 ==================== */
.org-node .card {
    transition: box-shadow .2s, border-color .2s;
}
.org-node .card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.org-member-tag {
    transition: background .2s;
}
.org-member-tag:hover {
    background: var(--gray-100) !important;
}
.org-unassigned-tag:hover {
    background: var(--primary-light) !important;
    border-color: var(--primary) !important;
}
.org-children {
    position: relative;
    margin-left: 14px;
    padding-left: 26px;
    border-left: 2px solid var(--gray-200);
    transition: all .2s;
}
.org-children > .org-node {
    position: relative;
}
/* 树形结构图：子节点到主干的横向连接线 */
.org-children > .org-node::before {
    content: '';
    position: absolute;
    top: 19px;
    left: -26px;
    width: 26px;
    height: 2px;
    background: var(--gray-200);
}
/* 树形结构图：公司名根节点 */
.org-company-root {
    position: relative;
}
.org-root-card {
    border: 2px solid var(--primary) !important;
    background: var(--gray-50);
}
.org-root-card .card-body {
    background: transparent;
}
.org-root-card strong {
    color: var(--primary);
}
/* 节点标题可点击编辑 */
.org-node-head {
    border-radius: 6px;
    padding: 2px 4px;
    transition: background .15s;
}
.org-editable { cursor: pointer; }
.org-editable:hover {
    background: var(--gray-50);
}
.org-editable:hover strong {
    text-decoration: underline;
}
.org-toggle {
    transition: transform .2s;
}
#orgAssignDropdown {
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    border-radius: 8px;
}

/* ==================== 龙头企业卡片 ==================== */
.enterprise-card:hover {
    border-color: var(--primary, #2563eb) !important;
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

/* ==================== 详情字段 ==================== */
.detail-field {
    margin-bottom: 12px;
}
.detail-label {
    display: block;
    font-size: 12px;
    color: var(--gray-400, #9ca3af);
    margin-bottom: 4px;
    font-weight: 600;
}
.detail-value {
    font-size: 14px;
    color: var(--gray-700, #374151);
}

/* 科纪广场城市详情：下级区县快捷入口 */
.gov-children-block { border-top: 1px dashed #e5e7eb; padding-top: 12px; margin-top: 12px; }
.gov-children-title { font-size: 13px; font-weight: 600; color: #6b7280; margin-bottom: 8px; }
.gov-children-list { display: flex; flex-wrap: wrap; gap: 8px; }
.gov-child-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: 999px;
    background: #f3f4f6; color: #0d9488;
    font-size: 13px; cursor: pointer; border: 1px solid transparent;
    transition: all .15s ease;
}
.gov-child-chip:hover { background: #ccfbf1; border-color: #99f6e4; }

/* ==================== 政府城市卡片 ==================== */
/* .gov-city-card 视觉统一规则已迁移至 theme.css（19.2 节，单一可信源），此处不再重复定义避免双源冲突 */

/* 政府资源视图切换（热门城市 / 按省份） */
.gov-view-tabs .btn-tab {
    border: 1px solid #e5e7eb;
    background: #fff;
    color: var(--gray-600, #6b7280);
    border-radius: 8px;
    padding: 6px 14px;
    font-weight: 500;
}
.gov-view-tabs .btn-tab:hover {
    background: #f8fafc;
}
.gov-view-tabs .btn-tab.active {
    background: var(--primary, #2563eb);
    border-color: var(--primary, #2563eb);
    color: #fff;
}

/* 区县列表 */
.gov-district-list {
    border-top: 1px dashed #e5e7eb;
    padding-top: 8px;
}
.gov-district-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin: 2px 4px 2px 0;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.gov-district-item:hover {
    background: #e9ecef;
    border-color: #2563eb;
}
.gov-district-card:hover {
    border-color: #2563eb !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

/* 龙头企业行业分组 */
.ent-industry-group {
    border-radius: 8px;
    overflow: hidden;
}
.ent-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f0f4ff;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.ent-group-header:hover {
    background: #e0e7ff;
}
.ent-group-arrow {
    font-size: 12px;
    color: #6b7280;
    transition: transform .15s;
}
.ent-group-body {
    padding: 6px 0 0 0;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .3s; }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
}

/* ==================== 登录页 ==================== */
.login-page {
    /* 登录/注册覆盖层独立滚动：body 的 overflow:hidden 是给主工作台的，
       这里 fixed+inset 撑满视口并自行 overflow-y:auto，内容超一屏时可滚，
       修复注册卡（套餐卡+复选框+注册按钮）在小视口下被截断的问题。 */
    position: fixed;
    inset: 0;
    overflow-y: auto;
    display: flex;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #1e40af 100%);
    padding: 20px;
}
/* 居中交给 margin:auto 而非 align-items:center：
   子元素高于视口时前者可从顶部滚起，后者顶部会被裁掉滚不到。 */
.login-container { width: 100%; max-width: 420px; margin: auto; }
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}
.login-logo h2 {
    font-size: var(--brand-name);
    font-weight: var(--brand-name-weight);
    color: var(--gray-800);
    margin-bottom: 4px;
}
.login-logo p {
    font-size: var(--brand-sub);
    color: var(--gray-500);
    margin: 0;
}
.login-form .form-control {
    padding: 12px 14px;
    font-size: 15px;
}
.login-form .btn-primary {
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
}

/* SaaS 套餐选择 */
.plan-options {
    display: flex;
    gap: 8px;
}
.plan-option {
    flex: 1;
    cursor: pointer;
    position: relative;
}
.plan-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.plan-card {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    transition: all .2s;
    background: #f8fafc;
}
.plan-option input[type="radio"]:checked + .plan-card {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.plan-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-800);
}
.plan-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin: 4px 0;
}
.plan-desc {
    font-size: 11px;
    color: var(--gray-500);
}
.plan-price small {
    font-size: 11px;
    font-weight: 400;
    color: var(--gray-500);
}
.trial-hero {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 12px 14px;
    text-align: center;
    margin-bottom: 14px;
}
.trial-hero-days {
    font-size: 20px;
    font-weight: 700;
    color: #15803d;
    line-height: 1.3;
}
.trial-hero-sub {
    font-size: 12px;
    color: #16a34a;
    margin-top: 4px;
}
.trial-note {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 10px;
    text-align: center;
    line-height: 1.6;
}

/* ==================== AI 聊天组件 ==================== */
.chat-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 1050;
    pointer-events: none;
}
/* 展开式浮钮菜单 */
.fab-menu {
    position: fixed;
    bottom: 92px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: auto;
    z-index: 1051;
}
.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 8px 14px 8px 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
}
.fab-menu-item:hover {
    background: #f3f4f6;
}
/* 脚印轨迹：竖排菜单项按奇偶左右交错，似小狗行走落点（非半圆弧排布，适配 1~8 个动态项） */
.fab-menu-item:nth-child(even) {
    margin-right: 16px;
}
.fab-menu-item i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-size: 17px;
    flex-shrink: 0;
}
/* 狗爪徽章：柯基橙渐变圆底 + 白色爪印 */
.fab-menu-item .paw-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f6a13c, #e07b2a);
    box-shadow: 0 2px 6px rgba(224, 123, 42, 0.35);
    flex-shrink: 0;
}
.fab-menu-item .paw-svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}
.fab-menu-item .fab-menu-label {
    white-space: nowrap;
}
/* 自定义菜单项（齿轮）：中性灰虚线边，区别于狗爪动作项 */
.fab-menu-item.fab-menu-settings i {
    background: #f3f4f6;
    color: #6b7280;
    box-shadow: none;
    font-size: 16px;
}
.fab-menu-item.fab-menu-settings {
    border-style: dashed;
    border-color: #d1d5db;
}

/* 自定义快捷菜单设置面板 */
.fab-settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.fab-set-panel {
    background: #fff;
    border-radius: 16px;
    width: 360px;
    max-width: 92vw;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
.fab-set-head {
    padding: 16px 18px;
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    border-bottom: 1px solid #eef0f3;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.fab-set-head span {
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
}
.fab-set-body {
    padding: 8px 6px;
    overflow: auto;
}
.fab-set-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
}
.fab-set-row.on {
    background: #fff7ed;
}
.fab-set-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}
.fab-set-order {
    width: 20px;
    text-align: center;
    color: #f59e0b;
    font-weight: 700;
    font-size: 13px;
}
.fab-set-move button {
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 6px;
    width: 26px;
    height: 24px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
}
.fab-set-move button:disabled {
    opacity: .35;
    cursor: not-allowed;
}
/* 拖拽排序视觉：手柄 + 放置高亮（已选项置顶连续，可拖拽重排） */
.fab-set-row.draggable { cursor: grab; }
.fab-set-row.draggable:active { cursor: grabbing; }
.fab-set-handle { color: #9ca3af; margin-right: 2px; cursor: grab; user-select: none; font-size: 15px; }
.fab-set-group-title { font-size: 12px; color: #6b7280; font-weight: 600; margin: 14px 2px 6px; }
.fab-set-empty { font-size: 12px; color: #9ca3af; padding: 2px 2px 10px; }
.fab-set-row.drag-over { outline: 2px dashed #f6a13c; outline-offset: 2px; background: #fff7ed; }
.fab-set-foot {
    display: flex;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid #eef0f3;
}
.fab-set-cancel, .fab-set-save {
    flex: 1;
    padding: 9px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}
.fab-set-cancel {
    background: #f3f4f6;
    color: #374151;
}
.fab-set-save {
    background: #f59e0b;
    color: #fff;
}
/* 柯基形象：菜单项用 3D 全身图（圆形铺满+蓝紫渐变外环），面板标题/头像用扁平 SVG */
.fab-menu-item .fab-corgi-3d {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    padding: 3px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    position: relative;
}
.fab-menu-item .fab-corgi-3d::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #f3eee5;
    background-image: url('/static/img/corgi-3d.png');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
}
.chat-title img.corgi-flat {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px;
}
.chat-msg-avatar img.corgi-avatar-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: contain;
}
/* 菜单弹出动画 */
.fab-menu[style*="display: flex"] {
    animation: fabMenuIn 0.18s ease;
}
@keyframes fabMenuIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
    pointer-events: auto;
    z-index: 1051;
    animation: fabFloaty 3.2s ease-in-out infinite;
    /* 去底柯基本体，无外环无裁圆，背景完全透明 */
    background: transparent;
    perspective: 600px;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}
.chat-fab-corgi {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}
/* 跟随鼠标的高光层 */
.chat-fab-glare {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.15) 35%, transparent 70%);
    opacity: 0;
    transition: opacity 0.25s ease, background-position 0.08s linear;
    z-index: 3;
}
/* 菜单展开时柯基保持原样：原「蓝块+叉」关闭遮罩彻底隐形，仅占位避免 JS 报错 */
.chat-fab-overlay {
    display: none;
}
/* 菜单展开（#fabMenu 的 display 非 none）时，柯基本体亮起暖橙光晕作为激活提示。
   用兄弟选择器纯 CSS 判定，无需 JS 增删 class；drop-shadow 跟随柯基轮廓，不显方块 */
#fabMenu:not([style*="display: none"]):not([style*="display:none"]) ~ #chatFab .chat-fab-corgi {
    filter: drop-shadow(0 0 7px rgba(245, 158, 11, 0.95)) drop-shadow(0 0 2px rgba(245, 158, 11, 0.8));
}
@keyframes fabFloaty {
    0%, 100% { transform: translateY(0); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15)); }
    50% { transform: translateY(-5px); filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.2)); }
}
.chat-fab:hover {
    transform: scale(1.08);
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.22));
}
.chat-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #fff;
}

