@charset "utf-8";
/* ==========================================================================
   全站表格样式（全局，不依赖 class）  global-table.css
   位置：网站根目录（public/global-table.css）—— 多站点、城市分站共用同一份
   引入：由多网站系统插件（dayrui/App/Sites/Config/Hooks.php）自动注入 <link>，
         不需要改主题模板。

   【判定：哪些表格要美化】命中任一即可，不需要任何 class：
     · 常见正文容器里的 table（.geo-article-body / .article-content / article …）
     · table:has(> thead)                —— 带表头的表格（编辑器输出的基本都是这种）
     · table:has(tbody tr > th)          —— 表头写在 tbody 里的
     · table[border]:not([border="0"])   —— 老编辑器给的 border 属性
   【排除：哪些表格不动它】
     · 表格加 class="gt-off"             —— 手动关闭
     · .timeline / [class*="layui"] / [role="presentation"] —— 组件或排版表格
     · border="0" 的表格（主题常用作排版）不会命中判定，保持原样

   【实现提示】
   · 正文表格是编辑器输出的，带大量内联样式，优先级很高 → 所有属性都用 !important
   · 排除条件写在**表格层级**（table:not(.gt-off):has(...)），
     这样表头/单元格规则会跟着一起排除，不会出现"表格没美化、里面的 th 却被改了"
   · :where() 是宽容选择器列表：老浏览器不认 :has 时只忽略那一条，规则不会整体失效
   ========================================================================== */

:root {
    --gt-border: #e5e9f0;       /* 外框线 */
    --gt-line: #eef1f6;         /* 行/列分隔线 */
    --gt-head-bg: #f4f7fb;      /* 表头背景 */
    --gt-strip-bg: #fafbfd;     /* 斑马纹 */
    --gt-hover-bg: #f4f8ff;     /* 悬停行 */
    --gt-head-text: #1f2d3d;    /* 表头文字 */
    --gt-text: #3d4a5c;         /* 单元格文字 */
}

/* ==========================================================================
   一、表格本体
   ========================================================================== */
:where(
    .geo-article-body table:not(.gt-off), .about-content table:not(.gt-off),
    .article-content table:not(.gt-off), .article_body table:not(.gt-off),
    .detail-content table:not(.gt-off), .news-content table:not(.gt-off),
    .cms-content table:not(.gt-off), .editor-content table:not(.gt-off),
    .editor table:not(.gt-off), .content-body table:not(.gt-off),
    .text-content table:not(.gt-off), article table:not(.gt-off),
    table:not(.gt-off):has(> thead),
    table:not(.gt-off):has(tbody tr > th),
    table[border]:not([border="0"]):not(.gt-off)
):not(.timeline):not([class*="layui"]):not([role="presentation"]) {
    width: 100% !important;
    max-width: 100% !important;
    margin: 18px 0 !important;
    border: 1px solid var(--gt-border) !important;
    border-radius: 10px !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
    table-layout: auto !important;
    font-size: 14px !important;
    line-height: 1.75 !important;
    color: var(--gt-text) !important;
    box-shadow: 0 1px 2px rgba(16, 32, 64, .04) !important;
}

/* ==========================================================================
   二、表头
   ========================================================================== */
:where(
    .geo-article-body table:not(.gt-off) th, .about-content table:not(.gt-off) th,
    .article-content table:not(.gt-off) th, .article_body table:not(.gt-off) th,
    .detail-content table:not(.gt-off) th, .news-content table:not(.gt-off) th,
    .cms-content table:not(.gt-off) th, .editor-content table:not(.gt-off) th,
    .editor table:not(.gt-off) th, .content-body table:not(.gt-off) th,
    .text-content table:not(.gt-off) th, article table:not(.gt-off) th,
    table:not(.gt-off):has(> thead) thead th,
    table:not(.gt-off):has(tbody tr > th) tbody th,
    table[border]:not([border="0"]):not(.gt-off) th
) {
    background: var(--gt-head-bg) !important;
    color: var(--gt-head-text) !important;
    font-weight: 600 !important;
    text-align: left !important;
    padding: 12px 15px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--gt-border) !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
}

/* ==========================================================================
   三、单元格
   ========================================================================== */
:where(
    .geo-article-body table:not(.gt-off) td, .about-content table:not(.gt-off) td,
    .article-content table:not(.gt-off) td, .article_body table:not(.gt-off) td,
    .detail-content table:not(.gt-off) td, .news-content table:not(.gt-off) td,
    .cms-content table:not(.gt-off) td, .editor-content table:not(.gt-off) td,
    .editor table:not(.gt-off) td, .content-body table:not(.gt-off) td,
    .text-content table:not(.gt-off) td, article table:not(.gt-off) td,
    table:not(.gt-off):has(> thead) td,
    table:not(.gt-off):has(tbody tr > th) td,
    table[border]:not([border="0"]):not(.gt-off) td
) {
    padding: 12px 15px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--gt-line) !important;
    color: var(--gt-text) !important;
    vertical-align: top !important;
    text-align: left !important;
    word-break: break-word !important;
}

/* ==========================================================================
   四、单元格之间的竖线
   ========================================================================== */
:where(
    .geo-article-body table:not(.gt-off) tr > * + *,
    .article-content table:not(.gt-off) tr > * + *,
    .article_body table:not(.gt-off) tr > * + *,
    .detail-content table:not(.gt-off) tr > * + *,
    .news-content table:not(.gt-off) tr > * + *,
    .editor-content table:not(.gt-off) tr > * + *,
    article table:not(.gt-off) tr > * + *,
    table:not(.gt-off):has(> thead) tr > * + *,
    table:not(.gt-off):has(tbody tr > th) tr > * + *,
    table[border]:not([border="0"]):not(.gt-off) tr > * + *
) {
    border-left: 1px solid var(--gt-line) !important;
}

/* ==========================================================================
   五、斑马纹
   ========================================================================== */
:where(
    .geo-article-body table:not(.gt-off) tbody tr:nth-child(even) td,
    .article-content table:not(.gt-off) tbody tr:nth-child(even) td,
    .article_body table:not(.gt-off) tbody tr:nth-child(even) td,
    .detail-content table:not(.gt-off) tbody tr:nth-child(even) td,
    .news-content table:not(.gt-off) tbody tr:nth-child(even) td,
    .editor-content table:not(.gt-off) tbody tr:nth-child(even) td,
    article table:not(.gt-off) tbody tr:nth-child(even) td,
    table:not(.gt-off):has(> thead) tbody tr:nth-child(even) td,
    table:not(.gt-off):has(tbody tr > th) tbody tr:nth-child(even) td,
    table[border]:not([border="0"]):not(.gt-off) tbody tr:nth-child(even) td
) {
    background: var(--gt-strip-bg) !important;
}

/* ==========================================================================
   六、悬停整行
   ========================================================================== */
:where(
    .geo-article-body table:not(.gt-off) tbody tr:hover td,
    .article-content table:not(.gt-off) tbody tr:hover td,
    .article_body table:not(.gt-off) tbody tr:hover td,
    .detail-content table:not(.gt-off) tbody tr:hover td,
    .news-content table:not(.gt-off) tbody tr:hover td,
    .editor-content table:not(.gt-off) tbody tr:hover td,
    article table:not(.gt-off) tbody tr:hover td,
    table:not(.gt-off):has(> thead) tbody tr:hover td,
    table:not(.gt-off):has(tbody tr > th) tbody tr:hover td,
    table[border]:not([border="0"]):not(.gt-off) tbody tr:hover td
) {
    background: var(--gt-hover-bg) !important;
}

/* ==========================================================================
   七、最后一行去掉多余下边线
   ========================================================================== */
:where(
    .geo-article-body table:not(.gt-off) tbody tr:last-child td,
    .article-content table:not(.gt-off) tbody tr:last-child td,
    .article_body table:not(.gt-off) tbody tr:last-child td,
    .detail-content table:not(.gt-off) tbody tr:last-child td,
    .news-content table:not(.gt-off) tbody tr:last-child td,
    .editor-content table:not(.gt-off) tbody tr:last-child td,
    article table:not(.gt-off) tbody tr:last-child td,
    table:not(.gt-off):has(> thead) tbody tr:last-child td,
    table:not(.gt-off):has(tbody tr > th) tbody tr:last-child td,
    table[border]:not([border="0"]):not(.gt-off) tbody tr:last-child td
) {
    border-bottom: 0 !important;
}

/* ==========================================================================
   八、第一列：名称列，不换行并加深
   ========================================================================== */
:where(
    .geo-article-body table:not(.gt-off) tbody td:first-child,
    .article-content table:not(.gt-off) tbody td:first-child,
    .article_body table:not(.gt-off) tbody td:first-child,
    .detail-content table:not(.gt-off) tbody td:first-child,
    article table:not(.gt-off) tbody td:first-child,
    table:not(.gt-off):has(> thead) tbody td:first-child,
    table:not(.gt-off):has(tbody tr > th) tbody td:first-child,
    table[border]:not([border="0"]):not(.gt-off) tbody td:first-child
) {
    white-space: nowrap !important;
    color: #1f2d3d !important;
    font-weight: 500 !important;
}

/* ==========================================================================
   九、表格里的链接
   ========================================================================== */
:where(
    .geo-article-body table:not(.gt-off) a,
    .article-content table:not(.gt-off) a,
    .article_body table:not(.gt-off) a,
    article table:not(.gt-off) a,
    table:not(.gt-off):has(> thead) a,
    table[border]:not([border="0"]):not(.gt-off) a
) {
    color: #2f7bf6 !important;
    text-decoration: none !important;
}
:where(
    .geo-article-body table:not(.gt-off) a:hover,
    .article-content table:not(.gt-off) a:hover,
    .article_body table:not(.gt-off) a:hover,
    article table:not(.gt-off) a:hover,
    table:not(.gt-off):has(> thead) a:hover,
    table[border]:not([border="0"]):not(.gt-off) a:hover
) {
    text-decoration: underline !important;
}

/* ==========================================================================
   十、表格后面的说明小字
   ========================================================================== */
:where(
    .geo-article-body table:not(.gt-off) + p,
    .article-content table:not(.gt-off) + p,
    .article_body table:not(.gt-off) + p,
    table:not(.gt-off):has(> thead) + p,
    table[border]:not([border="0"]):not(.gt-off) + p
) {
    margin-top: 8px !important;
    color: #8a97a8 !important;
    font-size: 13px !important;
}

/* ==========================================================================
   十一、兜底：其它位置的表格至少不歪（只合并边框，不动布局）
   ========================================================================== */
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* ==========================================================================
   十二、移动端
   ========================================================================== */
@media (max-width: 768px) {
    :where(
        .geo-article-body table:not(.gt-off), .article-content table:not(.gt-off),
        .article_body table:not(.gt-off), .detail-content table:not(.gt-off),
        .news-content table:not(.gt-off), .cms-content table:not(.gt-off),
        .editor-content table:not(.gt-off), .content-body table:not(.gt-off),
        .text-content table:not(.gt-off), article table:not(.gt-off),
        table:not(.gt-off):has(> thead),
        table[border]:not([border="0"]):not(.gt-off)
    ) {
        font-size: 13px !important;
        border-radius: 8px !important;
        margin: 14px 0 !important;
    }
    :where(
        .geo-article-body table:not(.gt-off) th, .geo-article-body table:not(.gt-off) td,
        .article-content table:not(.gt-off) th, .article-content table:not(.gt-off) td,
        .article_body table:not(.gt-off) th, .article_body table:not(.gt-off) td,
        article table:not(.gt-off) th, article table:not(.gt-off) td,
        table:not(.gt-off):has(> thead) th, table:not(.gt-off):has(> thead) td,
        table[border]:not([border="0"]):not(.gt-off) th,
        table[border]:not([border="0"]):not(.gt-off) td
    ) {
        padding: 9px 10px !important;
    }
    :where(
        .geo-article-body table:not(.gt-off) th,
        article table:not(.gt-off) th,
        table:not(.gt-off):has(> thead) th,
        .geo-article-body table:not(.gt-off) tbody td:first-child,
        article table:not(.gt-off) tbody td:first-child,
        table:not(.gt-off):has(> thead) tbody td:first-child
    ) {
        white-space: normal !important;
    }
}

/* ==========================================================================
   十三、打印
   ========================================================================== */
@media print {
    :where(
        .geo-article-body table:not(.gt-off),
        .article-content table:not(.gt-off),
        .article_body table:not(.gt-off),
        article table:not(.gt-off),
        table:not(.gt-off):has(> thead)
    ) {
        box-shadow: none !important;
        font-size: 12px !important;
    }
}
