/* ============================================================
   tool-timeline.css — 工具调用时间线 + 底部抽屉（9-24，三套皮共用；行为见 tool-timeline.js）

   🔴 几何只有一套：
     · 每行 = 20px 节点槽 + 12px 间距 + 正文（grid），节点槽里放 14px 图标 / 6px 思考点 / 完成勾；
     · 竖线由 .att-line::before 画**一次**：left 取节点槽中线，top/bottom 各 10px =
       第一个节点中心 → 最后一行（固定 20px 高的「完成 / 进行中」行）节点中心；
     · 节点槽底色 = 抽屉底色，盖住穿过它的那段线 ⇒ 看起来是一根线串起所有节点。
     不许再给单行画线段、不许用负 margin 把节点拖上线 —— 那正是以前「一截一截接不上」的来源。
   皮只改下面的 --att-* 变量（颜色 / 字体 / 圆角）。
   ============================================================ */

.att-drawer {
    --att-bg: var(--card-bg, #ffffff);
    --att-text: var(--text, #1f1f1f);
    --att-muted: color-mix(in srgb, var(--att-text) 55%, transparent);
    --att-rail: color-mix(in srgb, var(--att-text) 16%, transparent);
    --att-soft: color-mix(in srgb, var(--att-text) 5%, transparent);
    --att-chip: color-mix(in srgb, var(--att-text) 8%, transparent);
    --att-accent: var(--accent, #3f6fb0);
    --att-ok: #3f8f4a;
    --att-danger: #c62828;
    --att-font: inherit;
    --att-radius: 18px;

    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 11500;
    height: var(--att-h, 50dvh);
    min-height: 50dvh;
    max-height: 83.333dvh;
    display: flex;
    flex-direction: column;
    background: var(--att-bg);
    color: var(--att-text);
    font-family: var(--att-font);
    border-radius: var(--att-radius) var(--att-radius) 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.16);
    transform: translateY(100%);
    transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
    box-sizing: border-box;
}
.att-drawer.att-in { transform: translateY(0); }
.att-drawer.att-dragging { transition: none; }

.att-backdrop {
    position: fixed;
    inset: 0;
    z-index: 11499;
    background: rgba(0, 0, 0, 0.28);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.att-backdrop.att-in { opacity: 1; }

.att-grab {
    flex: 0 0 auto;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ns-resize;
    touch-action: none;
}
.att-grab span {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--att-rail);
}

.att-top {
    flex: 0 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 48px;
}
.att-title {
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.att-close {
    position: absolute;
    right: 12px;
    top: 2px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--att-muted);
    cursor: pointer;
}
.att-close svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}
/* 心声与思考抽屉批 2：思考 / 心声分段切换（只在传了 tabs 时出现） */
.att-tabs {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 2px auto 8px;
    padding: 3px;
    border-radius: 999px;
    background: var(--att-soft);
}
.att-tab {
    min-width: 72px;
    padding: 5px 14px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--att-muted);
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.att-tab.is-on {
    color: var(--att-text);
    background: var(--att-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    font-weight: 600;
}

.att-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 20px calc(18px + env(safe-area-inset-bottom, 0px));
}

/* ── 时间线几何 ─────────────────────────────────────────────── */
.att-line {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}
.att-line::before {
    content: '';
    position: absolute;
    left: 9.5px;          /* 20px 节点槽的中线（1px 线宽） */
    top: 10px;            /* 第一个节点中心 */
    bottom: 10px;         /* 最后一行（固定 20px 高）节点中心 */
    width: 1px;
    background: var(--att-rail);
}
.att-row {
    position: relative;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    column-gap: 12px;
    padding-bottom: 16px;
}
.att-mk {
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--att-bg);      /* 盖住穿过节点的那段线 */
    color: var(--att-muted);
}
.att-mk svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.att-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.att-body { min-width: 0; }

/* 主行：工具名 · 状态 · 耗时 · 展开箭头，行高 = 节点高，文字与节点中心对齐 */
.att-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 20px;
    line-height: 20px;
}
.att-has-detail > .att-body > .att-head { cursor: pointer; }
.att-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 600;
}
.att-chip {
    flex: 0 0 auto;
    font-size: 0.7rem;
    line-height: 18px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--att-chip);
    color: var(--att-muted);
}
.att-success .att-chip { color: var(--att-ok); background: color-mix(in srgb, var(--att-ok) 12%, transparent); }
.att-error .att-chip { color: var(--att-danger); background: color-mix(in srgb, var(--att-danger) 12%, transparent); }
.att-error .att-mk { color: var(--att-danger); }
.att-dur {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: var(--att-muted);
    font-variant-numeric: tabular-nums;
}
.att-caret {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    margin: 0 2px 3px 4px;
    border-right: 1.5px solid var(--att-muted);
    border-bottom: 1.5px solid var(--att-muted);
    transform: rotate(45deg);
    transition: transform 0.18s ease;
}
.att-name + .att-caret,
.att-chip + .att-caret { margin-left: auto; }
.att-open .att-caret { transform: rotate(-135deg); margin-bottom: -3px; }

.att-detail {
    display: none;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--att-soft);
    color: var(--att-muted);
    font-size: 0.8rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.att-detail > div + div { margin-top: 4px; }
.att-open .att-detail { display: block; }

/* 思考段：第一行与节点中心对齐 */
.att-reason-text {
    font-size: 0.84rem;
    line-height: 20px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    opacity: 0.85;
}

/* 搜索来源默认展示（链接不能藏死在点开区） */
.att-search { margin-top: 6px; }
.att-search-q { font-size: 0.8rem; color: var(--att-muted); margin-bottom: 4px; }
.att-src { padding: 6px 0; border-top: 1px solid var(--att-soft); }
.att-src:first-of-type { border-top: none; }
.att-src-head { font-size: 0.72rem; color: var(--att-muted); }
.att-src-title { display: block; font-size: 0.84rem; color: var(--att-accent); text-decoration: none; overflow-wrap: anywhere; }
.att-src-snip { font-size: 0.76rem; color: var(--att-muted); line-height: 1.5; margin-top: 2px; }
.att-muted { font-size: 0.72rem; color: var(--att-muted); margin-top: 4px; }

/* 终点行：固定 20px 高（竖线的终点就是它的节点中心） */
.att-end { padding-bottom: 0; height: 20px; }
.att-end .att-mk { color: var(--att-ok); }
.att-end-pending .att-mk { color: var(--att-muted); }
.att-end-text { font-size: 0.84rem; line-height: 20px; color: var(--att-muted); }
.att-spin {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--att-rail);
    border-top-color: var(--att-muted);
    animation: att-spin 0.9s linear infinite;
}
@keyframes att-spin { to { transform: rotate(360deg); } }

/* ── 皮：只改变量 ─────────────────────────────────────────────── */
.att-drawer[data-att-theme="chatgpt"] {
    --att-bg: #ffffff;
    --att-text: #0d0d0d;
    --att-accent: #0d0d0d;
    --att-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --att-radius: 16px;
}
html:is([data-theme="dark"], [data-theme="qirituan"], [data-theme="roots"], [data-theme="midnight"]) .att-drawer[data-att-theme="chatgpt"] {
    --att-bg: #2a2a2a;
    --att-text: #ececec;
    --att-accent: #ececec;
}
body.claude-skin-on .att-drawer[data-att-theme="claude"] {
    --att-bg: var(--cl-bg, #F8F8F6);
    --att-text: var(--cl-text, #1F1E1D);
    --att-accent: var(--cl-accent, #DA7756);
    --att-font: var(--cl-sans, inherit);
    --att-radius: 20px;
}
body.claude-skin-on .att-drawer[data-att-theme="claude"] .att-title {
    font-family: var(--cl-serif, inherit);
    font-weight: 500;
}
