/* ==========================================================================
   AI 中转站 - 科技感视觉层（在 app.css 之上叠加）
   设计取向：白底精确排版 + 发丝线结构 + 克制的动态，避免千篇一律的模板感。
   手法：栅格底纹、等宽数据、hairline 分隔、tabular 数字、微动效、状态脉冲。
   加载顺序：app.css → tech.css（本文件），因此可直接覆盖既有声明。
   ========================================================================== */

:root {
    /* —— 精确的中性墨阶（不用纯黑，层次更细腻） —— */
    --ink-900: #0b1220;
    --ink-800: #151d2e;
    --ink-700: #2b3648;
    --hairline: rgba(11, 18, 32, .09);
    --hairline-strong: rgba(11, 18, 32, .16);
    --grid-line: rgba(11, 18, 32, .045);

    /* —— 唯一强调色（比默认更沉稳，配一枚数据青作为点缀） —— */
    --accent: #1a56db;
    --accent-hover: #1543b0;
    --accent-soft: #eef3ff;
    --accent-line: rgba(26, 86, 219, .28);
    --tech: #0891b2;

    --bg: #fbfbfd;
    --card: #ffffff;

    /* —— 动效令牌：统一曲线与时长，动效才不会“各弹各的” —— */
    --ease: cubic-bezier(.22, .61, .36, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --dur: .26s;
    --dur-slow: .5s;

    /* —— 阴影只用于抬升，不用于装饰 —— */
    --sh-1: 0 1px 2px rgba(11, 18, 32, .04), 0 1px 3px rgba(11, 18, 32, .03);
    --sh-2: 0 4px 14px rgba(11, 18, 32, .06), 0 1px 3px rgba(11, 18, 32, .04);
    --sh-3: 0 12px 32px rgba(11, 18, 32, .10), 0 2px 6px rgba(11, 18, 32, .05);

    --radius: 12px;
    --radius-sm: 8px;
}

/* ==========================================================================
   1. 基底
   ========================================================================== */

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    /* 极淡的工程栅格底纹：只提供质感，不抢内容 */
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 56px 56px, 56px 56px;
    background-position: -1px -1px;
    font-feature-settings: "tnum" 0;
}

/* 有自定义背景图时（body.has-bg），栅格让位给图片 */
body.has-bg { background-image: none; }

::selection { background: rgba(26, 86, 219, .16); }

/* 细滚动条（桌面） */
@media (hover: hover) {
    * { scrollbar-width: thin; scrollbar-color: var(--hairline-strong) transparent; }
    *::-webkit-scrollbar { width: 10px; height: 10px; }
    *::-webkit-scrollbar-thumb {
        background: var(--hairline-strong);
        border: 3px solid transparent;
        background-clip: content-box;
        border-radius: 99px;
    }
    *::-webkit-scrollbar-thumb:hover { background: rgba(11, 18, 32, .28); background-clip: content-box; }
}

/* 键盘可达性与精致感兼顾的聚焦环 */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* 标题：收紧字距让排版显“设计感” */
h1, h2, h3 { letter-spacing: -.015em; }
h1 { letter-spacing: -.028em; }

/* 数字统一等宽，表格/统计对齐更专业 */
.tnum, .hero-stats .n, table.data td.right, .mono { font-variant-numeric: tabular-nums; }

/* 小标签统一为“技术标注”风格 */
.eyebrow, .card-head .head-note, .section-title p, .group-title {
    letter-spacing: .01em;
}

/* ==========================================================================
   2. 顶栏 / 侧栏
   ========================================================================== */

.topbar {
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--hairline);
    transition: box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.topbar.scrolled {
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 0 var(--hairline), 0 6px 24px rgba(11, 18, 32, .05);
}

.brand .logo {
    background: var(--ink-900);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

/* 品牌旁的运行状态点：脉冲代表“服务在线” */
.live-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #16a34a;
    display: inline-block;
    margin-left: 7px;
    position: relative;
    vertical-align: 1px;
}
.live-dot::after {
    content: ""; position: absolute; inset: -4px;
    border-radius: 50%;
    border: 1px solid rgba(22, 163, 74, .5);
    animation: pulse-ring 2.4s var(--ease-out) infinite;
}
@keyframes pulse-ring {
    0%   { transform: scale(.6); opacity: .9; }
    70%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

.nav-links a { font-size: 13.5px; }
.nav-links a::after { height: 1.5px; bottom: -4px; }

/* 侧栏：发丝分隔 + 悬停位移 + 当前项指示条 */
.sidebar {
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--hairline);
}
.sidebar a.item {
    border-radius: var(--radius-sm);
    margin: 1px 8px;
    padding-left: 12px;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.sidebar a.item:hover { transform: translateX(1px); }
.sidebar a.item::before { left: -8px; top: 10px; bottom: 10px; width: 2px; }
.sidebar .group-title {
    font-size: 11px; font-weight: 600; letter-spacing: .08em;
    text-transform: uppercase; color: var(--text-3);
}
.side-foot { border-top: 1px solid var(--hairline); }
.main-head { border-bottom: 1px solid var(--hairline); }

/* ==========================================================================
   3. 公开页 Hero：左对齐 + 蓝图底纹 + 缓慢光扫
   ========================================================================== */

.hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--hairline);
    background:
        radial-gradient(120% 100% at 12% 0%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
        linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
}
.hero::before {
    /* 蓝图栅格：比 body 更密，形成“工作面”的观感 */
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(11, 18, 32, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(11, 18, 32, .05) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(120% 90% at 20% 10%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(120% 90% at 20% 10%, #000 20%, transparent 78%);
    pointer-events: none;
}
.hero::after {
    /* 缓慢横移的光扫：唯一的“发光”元素，低对比不刺眼 */
    content: "";
    position: absolute; top: 0; bottom: 0; width: 42%;
    background: linear-gradient(100deg, transparent, rgba(26, 86, 219, .055), transparent);
    animation: hero-sweep 11s linear infinite;
    pointer-events: none;
}
@keyframes hero-sweep {
    0%   { transform: translateX(-60%); opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { transform: translateX(240%); opacity: 0; }
}
.hero .container { position: relative; z-index: 1; }
.hero .eyebrow {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-700);
    background: #fff;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    padding: 5px 12px;
    box-shadow: var(--sh-1);
}
.hero h1 {
    font-size: clamp(28px, 4.4vw, 46px);
    line-height: 1.18;
    margin: 18px 0 14px;
    max-width: 18em;
}
.hero .sub { color: var(--text-2); font-size: 15px; line-height: 1.8; }
.hero .btns { margin-top: 22px; }

/* 统计条：保留既有居中排布，只强化数字与标注的技术标注感 */
.hero-stats { margin-top: 40px; }
.hero-stats > div { padding: 0 30px; }
.hero-stats .n {
    font-size: 26px; font-weight: 700; letter-spacing: -.02em;
    line-height: 1.2; color: var(--ink-900);
}
.hero-stats .n::after {
    content: ""; display: inline-block; width: 6px; height: 6px;
    margin-left: 6px; border-radius: 50%;
    background: var(--accent); vertical-align: 6px; opacity: .85;
}
.hero-stats .l {
    font-size: 11px; color: var(--text-3);
    letter-spacing: .08em; text-transform: uppercase; margin-top: 4px;
}
@media (max-width: 560px) {
    .hero-stats > div { padding: 0 14px; }
}

/* ==========================================================================
   4. 卡片 / 区块
   ========================================================================== */

.card {
    background: var(--card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: none;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (hover: hover) {
    .card:hover { border-color: var(--hairline-strong); box-shadow: var(--sh-1); }
}
.card-head {
    border-bottom: 1px solid var(--hairline);
    background: linear-gradient(180deg, #fff, #fdfdfe);
}
.card-head h3 { font-size: 14.5px; letter-spacing: -.01em; }
.card-head .head-note { color: var(--text-3); }

.section-title h2 {
    font-size: clamp(19px, 2.4vw, 26px);
    letter-spacing: -.02em;
}
.section-title h2::before {
    height: 2px; width: 34px; background: var(--accent);
}
.section-title p { color: var(--text-2); }

/* 功能格：发丝边框 + 悬停点亮图标底色 */
.feature {
    border: 1px solid var(--hairline);
    background: var(--card);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (hover: hover) {
    .feature:hover { border-color: var(--accent-line); box-shadow: var(--sh-2); transform: translateY(-2px); }
}
.feature .fi {
    background: var(--ink-900);
    color: #fff;
    transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (hover: hover) {
    .feature:hover .fi { background: var(--accent); }
}
.feature h3 { font-size: 14.5px; }
.feature p { color: var(--text-2); }

.step-num {
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}

/* 底部行动条 */
.cta-band {
    border-top: 1px solid var(--hairline);
    background:
        linear-gradient(180deg, #ffffff, #f7f9ff);
}

/* 模型胶囊 */
.model-chip {
    border: 1px solid var(--hairline);
    background: #fff;
    transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
@media (hover: hover) {
    .model-chip:hover {
        border-color: var(--accent-line);
        color: var(--accent);
        transform: translateY(-1px);
        box-shadow: var(--sh-1);
    }
}

/* ==========================================================================
   5. 按钮 / 表单
   ========================================================================== */

.btn {
    font-weight: 600;
    letter-spacing: .01em;
    border-radius: 9px;
    background: linear-gradient(180deg, #2764e8, #1a56db);
    border: 1px solid #1a4fd0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(11, 18, 32, .06);
    transition: filter var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
                transform .12s var(--ease), border-color var(--dur) var(--ease);
}
.btn:hover:not(:disabled) { filter: brightness(1.06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), var(--sh-2); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: saturate(.7); }

.btn-ghost, .btn-outline {
    background: #fff;
    border: 1px solid var(--hairline-strong);
    box-shadow: var(--sh-1);
}
.btn-ghost:hover:not(:disabled), .btn-outline:hover:not(:disabled) {
    background: #fff;
    border-color: var(--accent-line);
    color: var(--accent);
    filter: none;
    box-shadow: var(--sh-2);
}

.btn-link {
    border-bottom: 1px solid transparent;
    transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn-link:hover { border-bottom-color: currentColor; }
.btn-link.danger:hover { color: var(--danger); }

input, select, textarea {
    border: 1px solid var(--hairline-strong);
    border-radius: 9px;
    background: #fff;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: rgba(11, 18, 32, .28); }
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, .12);
    outline: none;
}
label { font-weight: 600; color: var(--text-2); font-size: 12.5px; letter-spacing: .01em; }
.hint { color: var(--text-3); }

.checkbox input { accent-color: var(--accent); }
.switch .track { background: rgba(11, 18, 32, .22); }

.chip { border-radius: 999px; }
.chip.is-active { box-shadow: 0 0 0 3px rgba(26, 86, 219, .10); }

/* 分组选择卡：选中时出现左侧强调条 */
.group-card { border-radius: var(--radius-sm); }
.group-card.is-active { box-shadow: inset 3px 0 0 var(--accent); }

/* ==========================================================================
   6. 表格：hairline + 悬停强调条 + 粘性表头 + 骨架屏
   ========================================================================== */

.table-wrap { position: relative; }
table.data thead th {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-3);
    background: rgba(251, 251, 253, .92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--hairline);
    position: sticky; top: 0; z-index: 2;
}
table.data tbody td { border-bottom: 1px solid var(--hairline); }
table.data tbody tr {
    transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
@media (hover: hover) {
    table.data tbody tr:hover {
        background: #fafbff;
        box-shadow: inset 2px 0 0 var(--accent);
    }
}
table.data tbody tr:last-child td { border-bottom: none; }

/* AJAX 进行中：表体轻微降低对比并叠加流动高光 */
.table-wrap.is-loading::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
    background-size: 40% 100%;
    background-repeat: no-repeat;
    animation: table-sheen 1.1s linear infinite;
    pointer-events: none;
}
.table-wrap.is-loading { opacity: .75; }
@keyframes table-sheen {
    0%   { background-position: -40% 0; }
    100% { background-position: 140% 0; }
}

/* 通用骨架屏（页面数据加载占位） */
.skeleton {
    position: relative; overflow: hidden;
    background: rgba(11, 18, 32, .06);
    border-radius: 6px;
    color: transparent !important;
}
.skeleton::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent);
    transform: translateX(-100%);
    animation: skeleton-shimmer 1.4s var(--ease) infinite;
}
@keyframes skeleton-shimmer { to { transform: translateX(100%); } }

/* ==========================================================================
   7. 徽标 / 状态 / 进度
   ========================================================================== */

.badge {
    border: 1px solid var(--hairline);
    font-weight: 600;
    letter-spacing: .01em;
}
.badge-green { background: #f2fdf5; border-color: rgba(21, 128, 61, .22); color: #15803d; }
.badge-red   { background: #fff5f5; border-color: rgba(185, 28, 28, .2); color: #b91c1c; }
.badge-blue  { background: #f4f7ff; border-color: var(--accent-line); color: var(--accent); }
.badge-gray  { background: #f7f8fa; border-color: var(--hairline); color: var(--text-2); }
.badge-yellow{ background: #fffbf0; border-color: rgba(180, 83, 9, .22); color: #b45309; }

/* 状态点：给关键徽标加一枚脉冲点，体现“在线/运行”语义 */
.badge-green::before {
    content: ""; width: 5px; height: 5px; border-radius: 50%;
    background: currentColor; display: inline-block;
    margin-right: 5px; vertical-align: 1px;
    animation: dot-breathe 2.6s var(--ease) infinite;
}
@keyframes dot-breathe {
    0%, 100% { opacity: .35; transform: scale(.9); }
    50%      { opacity: 1; transform: scale(1.1); }
}

.progress { background: rgba(11, 18, 32, .07); border-radius: 99px; overflow: hidden; }
.progress > i {
    display: block; height: 100%; border-radius: 99px;
    background: linear-gradient(90deg, var(--accent), #4f8bff);
    transition: width var(--dur-slow) var(--ease-out);
}

/* 顶栏加载进度线（AJAX / 跳转时出现） */
#top-progress {
    position: fixed; top: 0; left: 0; height: 2px; width: 0;
    background: linear-gradient(90deg, var(--accent), var(--tech));
    box-shadow: 0 0 8px rgba(26, 86, 219, .5);
    z-index: 999;
    transition: width .22s var(--ease-out), opacity .3s linear;
    opacity: 0;
}
#top-progress.on { opacity: 1; }

/* ==========================================================================
   8. 代码 / 终端（深色块作为唯一“重色”，很“工程”）
   ========================================================================== */

pre.code, .code {
    background: var(--ink-900);
    color: #dbe4f4;
    border: 1px solid #1c2740;
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
    padding: 16px 18px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.75;
    position: relative;
    overflow-x: auto;
    background-image:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 26px);
}
pre.code::before {
    content: "";
    position: absolute; top: 12px; right: 14px;
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    box-shadow: -13px 0 0 rgba(255, 255, 255, .10), -26px 0 0 rgba(255, 255, 255, .07);
}
code.inline {
    background: #f4f6fa;
    border: 1px solid var(--hairline);
    border-radius: 6px;
    padding: 1px 6px;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--ink-700);
}

/* ==========================================================================
   9. 弹窗 / 提示
   ========================================================================== */

.modal-mask {
    background: rgba(11, 18, 32, .42);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: fade-in .2s var(--ease) both;
}
.modal {
    border: 1px solid var(--hairline);
    border-radius: 14px;
    box-shadow: var(--sh-3);
    animation: modal-in .28s var(--ease-out) both;
}
@keyframes modal-in {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to   { opacity: 1; transform: none; }
}
.modal-head { border-bottom: 1px solid var(--hairline); }
.modal-foot { border-top: 1px solid var(--hairline); background: #fcfcfe; }
@media (max-width: 640px) {
    .modal { animation: sheet-up .3s var(--ease-out) both; }
    @keyframes sheet-up {
        from { opacity: 0; transform: translateY(28px); }
        to   { opacity: 1; transform: none; }
    }
}

/*
   注意：.toast-wrap / .toast 已在 app.css 定义，这里只做质感统一与
   图标标记，不重复声明布局，避免样式互相覆盖。
*/
.toast {
    background: var(--ink-900);
    border: 1px solid #1c2740;
    box-shadow: var(--sh-3);
    position: relative;
    padding-left: 16px;
    overflow: hidden;
}
.toast::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--tech);
}
.toast-success::before { background: #22c55e; }
.toast-error::before { background: #ef4444; }

.alert {
    border: 1px solid var(--hairline);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    background: #fff;
}
.alert-success { border-left-color: #16a34a; background: #f7fef9; }
.alert-error   { border-left-color: #dc2626; background: #fff7f7; }
.alert-warning { border-left-color: #d97706; background: #fffcf3; }
.alert-info    { border-left-color: var(--tech); background: #f6fcfe; }

.key-display {
    font-family: var(--mono);
    background: var(--ink-900);
    color: #d7e3f7;
    border-radius: var(--radius-sm);
    border: 1px solid #1c2740;
}

/* ==========================================================================
   10. 认证页 / 空状态
   ========================================================================== */

.auth-card {
    border: 1px solid var(--hairline);
    border-radius: 14px;
    box-shadow: var(--sh-2);
}
.auth-head .mark {
    background: var(--ink-900);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.empty { color: var(--text-3); }
.empty .ico { color: var(--text-3); }

/* ==========================================================================
   11. 图表（后台仪表盘）
   ========================================================================== */

.chart .bar {
    transition: filter var(--dur) var(--ease), transform var(--dur) var(--ease);
    transform-origin: bottom center;
    animation: bar-rise .6s var(--ease-out) both;
}
@media (hover: hover) {
    .chart .bar:hover { filter: saturate(1.2) brightness(1.05); transform: scaleY(1.02); }
}
@keyframes bar-rise { from { transform: scaleY(.02); opacity: .3; } to { transform: scaleY(1); opacity: 1; } }

/* 统计卡：数字用等宽 + 悬停轻微抬升 */
.stat { border: 1px solid var(--hairline); }
@media (hover: hover) {
    .stat:hover { border-color: var(--accent-line); box-shadow: var(--sh-2); }
}
.stat .n, .stat .v { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ==========================================================================
   12. 无障碍：尊重系统“减少动效”
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .hero::after, .live-dot::after, .badge-green::before { animation: none; }
    #top-progress { transition: none; }
}
