/* ============================================================
 * 暗房工坊 · Darkroom Tools - 主样式表
 * 设计方向：暗房终端风格 · 深黑底 + 霓虹青绿强调
 * 创建日期：2026-09-15
 * ============================================================ */

/* ----- CSS 变量定义 ----- */
:root {
    /* 主色调 */
    --bg-base: #0a0a0a;
    --bg-elevated: #111111;
    --bg-card: #161616;
    --bg-hover: #1d1d1d;
    --bg-input: #0d0d0d;

    /* 边框 */
    --border: #232323;
    --border-strong: #2e2e2e;
    --border-accent: #00ff9d33;

    /* 文字 */
    --text-primary: #e8e8e8;
    --text-secondary: #8a8a8a;
    --text-tertiary: #5a5a5a;
    --text-accent: #00ff9d;

    /* 强调色 */
    --accent: #00ff9d;
    --accent-dim: #00ff9d22;
    --accent-glow: rgba(0, 255, 157, 0.35);
    --warn: #ff6b35;
    --warn-dim: #ff6b3522;

    /* 字体 */
    --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, Monaco, monospace;
    --font-display: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    /* 尺寸 */
    --topbar-h: 56px;
    --statusbar-h: 32px;
    --rail-w: 240px;
    --panel-w: 320px;

    /* 过渡 */
    --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-med: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ----- 全局重置 ----- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    user-select: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, button {
    font-family: inherit;
}

::selection {
    background: var(--accent);
    color: var(--bg-base);
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ----- 背景纹理层 ----- */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0) 0px,
        rgba(0, 0, 0, 0) 2px,
        rgba(0, 255, 157, 0.015) 3px,
        rgba(0, 0, 0, 0) 4px
    );
    mix-blend-mode: screen;
}

.grid-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image:
        linear-gradient(rgba(0, 255, 157, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 157, 0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 90%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 90%);
}

/* ----- 顶部导航栏 ----- */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.topbar::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent) 70%, transparent);
    opacity: 0.4;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    color: var(--accent);
    display: flex;
    align-items: center;
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.brand-accent {
    color: var(--accent);
    margin: 0 2px;
}

.brand-sub {
    font-size: 10px;
    color: var(--text-tertiary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

/* ----- 主体布局 ----- */
.workspace {
    flex: 1;
    display: grid;
    grid-template-columns: var(--rail-w) 1fr var(--panel-w);
    min-height: 0;
    position: relative;
    z-index: 5;
}

/* ----- 左侧工具导航 ----- */
.tool-rail {
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.rail-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rail-title {
    font-size: 10px;
    color: var(--text-tertiary);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 8px 8px;
    border-bottom: 1px dashed var(--border);
    margin-bottom: 4px;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 4px;
    color: var(--text-secondary);
    text-align: left;
    transition: all var(--t-fast);
    position: relative;
    border: 1px solid transparent;
}

.tool-btn:hover:not(.disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tool-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--border-accent);
}

.tool-btn.active::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    border-radius: 2px;
}

.tool-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.tool-icon {
    display: flex;
    align-items: center;
    color: inherit;
    flex-shrink: 0;
}

.tool-label {
    flex: 1;
    font-size: 13px;
}

.tool-key {
    font-size: 10px;
    color: var(--text-tertiary);
    background: var(--bg-base);
    padding: 2px 6px;
    border-radius: 2px;
    border: 1px solid var(--border);
}

.tool-btn.active .tool-key {
    color: var(--accent);
    border-color: var(--border-accent);
    background: var(--bg-base);
}

.rail-footer {
    margin-top: auto;
    padding: 12px 8px;
    border-top: 1px dashed var(--border);
}

.footer-line {
    font-size: 10px;
    color: var(--text-tertiary);
    line-height: 1.8;
    letter-spacing: 0.3px;
}

/* ----- 中央工作区 ----- */
.canvas-area {
    background:
        radial-gradient(ellipse at center, #141414 0%, var(--bg-base) 80%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 24px;
}

/* 上传/拖拽区 */
.dropzone {
    width: 100%;
    max-width: 560px;
    border: 2px dashed var(--border-strong);
    border-radius: 8px;
    padding: 48px 24px;
    text-align: center;
    transition: all var(--t-med);
    cursor: pointer;
    background: rgba(20, 20, 20, 0.4);
    backdrop-filter: blur(4px);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: scale(1.01);
}

.dropzone.dragover {
    box-shadow: 0 0 30px var(--accent-glow);
}

.dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.dropzone-icon {
    color: var(--accent);
    opacity: 0.7;
    margin-bottom: 4px;
    filter: drop-shadow(0 0 12px var(--accent-glow));
}

.dropzone-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.dropzone-sub {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.dropzone-formats {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.format-tag {
    font-size: 10px;
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.format-tag.tag-pdf {
    background: rgba(255, 107, 53, 0.08);
    border-color: var(--warn);
    color: var(--warn);
    font-weight: 700;
}

/* 全局：hidden 属性强制隐藏，覆盖任何 display 声明（2026-09-15） */
[hidden] {
    display: none !important;
}

/* PDF 处理进度条（2026-09-15） */
.panel-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 4px 0 10px;
}
.panel-progress .progress-track {
    height: 6px;
    border-radius: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    overflow: hidden;
}
.panel-progress .progress-fill {
    height: 100%;
    width: 0;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-glow));
    box-shadow: 0 0 8px var(--accent-glow);
    transition: width 0.18s ease;
}
.panel-progress .progress-text {
    font-size: 11px;
    line-height: 1;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 预览区 */
.preview-stage {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    flex-shrink: 0;
}

.preview-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.info-label {
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
}

.info-value {
    color: var(--text-primary);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-ghost {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-secondary);
    font-size: 11px;
    transition: all var(--t-fast);
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-ghost.full {
    width: 100%;
    justify-content: center;
    padding: 10px;
    font-size: 12px;
}

.preview-canvas-wrap {
    flex: 1;
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkerboard {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
        linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
        linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    opacity: 0.5;
}

#mainCanvas {
    max-width: 100%;
    max-height: 100%;
    position: relative;
    z-index: 2;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* 裁剪覆盖层 */
.crop-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    cursor: crosshair;
}

.crop-box {
    position: absolute;
    border: 1px dashed var(--accent);
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.6),
        0 0 12px var(--accent-glow);
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border: 1px solid var(--bg-base);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent-glow);
}

.h-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.h-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.h-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.h-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.h-n { top: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.h-s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.h-w { top: 50%; left: -6px; transform: translateY(-50%); cursor: ew-resize; }
.h-e { top: 50%; right: -6px; transform: translateY(-50%); cursor: ew-resize; }

/* ----- 右侧参数面板 ----- */
.control-panel {
    background: var(--bg-elevated);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 20px;
}

.panel-section {
    display: none;
    flex-direction: column;
    gap: 18px;
}

.panel-section.active {
    display: flex;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.panel-num {
    font-size: 11px;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 2px 6px;
    border-radius: 2px;
    border: 1px solid var(--border-accent);
}

.panel-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.panel-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 8px 10px;
    background: var(--bg-card);
    border-left: 2px solid var(--accent);
    border-radius: 2px;
}

/* 参数组 */
.param-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.param-value {
    color: var(--accent);
    font-weight: 600;
    text-transform: none;
}

/* 滑块 */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 2px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: 2px solid var(--bg-base);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px var(--accent-glow);
    transition: transform var(--t-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: 2px solid var(--bg-base);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px var(--accent-glow);
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-tertiary);
    padding: 0 2px;
}

/* 格式选择 */
.format-select {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.radio-card {
    cursor: pointer;
    position: relative;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all var(--t-fast);
    text-align: center;
}

.radio-card input:checked + .radio-card-body {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.radio-card:hover .radio-card-body {
    border-color: var(--border-strong);
}

.rc-title {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 600;
}

.rc-sub {
    font-size: 9px;
    color: var(--text-tertiary);
}

.radio-card input:checked + .radio-card-body .rc-title {
    color: var(--accent);
}

/* 复选框行 */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 0;
}

.checkbox-row input {
    appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    background: var(--bg-input);
    cursor: pointer;
    position: relative;
    transition: all var(--t-fast);
}

.checkbox-row input:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-row input:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0;
    width: 4px;
    height: 8px;
    border: solid var(--bg-base);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* 输出信息块 */
.panel-output {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
}

.output-row {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

.output-row.highlight {
    color: var(--accent);
    font-weight: 600;
    border-top: 1px dashed var(--border);
    padding-top: 6px;
    margin-top: 2px;
}

.crop-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    margin-top: 8px;
}

/* 主按钮 */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--accent);
    color: var(--bg-base);
    border: 1px solid var(--accent);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all var(--t-fast);
    margin-top: auto;
}

.btn-primary:hover:not(:disabled) {
    background: transparent;
    color: var(--accent);
    box-shadow: 0 0 16px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* 分段控制 */
.seg-control {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px;
    gap: 2px;
}

.seg-btn {
    padding: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    border-radius: 2px;
    transition: all var(--t-fast);
    letter-spacing: 0.3px;
}

.seg-btn:hover {
    color: var(--text-primary);
}

.seg-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--border-accent);
}

/* 尺寸输入 */
.dim-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.dim-field {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.dim-row label {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.dim-x {
    font-size: 14px;
    color: var(--text-tertiary);
    padding-bottom: 8px;
    flex-shrink: 0;
    user-select: none;
}

.text-input,
.dim-row input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 12px;
    transition: border-color var(--t-fast);
}

.text-input:focus,
.dim-row input:focus {
    outline: none;
    border-color: var(--accent);
}

/* 按钮网格 */
.btn-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.btn-tile {
    aspect-ratio: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-fast);
}

.btn-tile:hover:not(.disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.btn-tile.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* 颜色选择 */
.color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-row input[type="color"] {
    width: 40px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg-input);
    cursor: pointer;
    padding: 2px;
}

.color-value {
    font-size: 11px;
    color: var(--text-secondary);
}

/* 位置网格 */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    aspect-ratio: 3;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px;
}

.pos-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 2px;
    transition: all var(--t-fast);
    position: relative;
}

.pos-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: all var(--t-fast);
}

.pos-btn:hover {
    border-color: var(--border-strong);
}

.pos-btn:hover::after {
    background: var(--text-secondary);
}

.pos-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.pos-btn.active::after {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
}

/* ----- 底部状态栏 ----- */
.statusbar {
    height: var(--statusbar-h);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 10px;
    color: var(--text-tertiary);
    letter-spacing: 0.3px;
    position: relative;
    z-index: 10;
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sb-item {
    color: var(--text-secondary);
}

.sb-sep {
    color: var(--text-tertiary);
    opacity: 0.5;
}

.sb-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--accent-dim);
    border: 1px solid var(--border-accent);
    border-radius: 2px;
    color: var(--accent);
    font-size: 10px;
    transition: all var(--t-fast);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sb-action:hover:not(:disabled) {
    background: var(--accent);
    color: var(--bg-base);
}

.sb-action:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ----- Toast 通知 ----- */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-h) + 16px);
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 300px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-left-width: 3px;
    padding: 10px 16px;
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    animation: toast-in 220ms ease-out;
    max-width: 100%;
    word-break: break-all;
}

/* success — 青绿 */
.toast-success {
    border-color: var(--accent);
    border-left-color: var(--accent);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 8px var(--accent-glow);
}

/* warn — 琥珀橙 */
.toast-warn {
    border-color: #ffb020;
    border-left-color: #ffb020;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 8px rgba(255, 176, 32, 0.3);
    color: #ffd080;
}

/* error — 警告红 */
.toast-error {
    border-color: var(--warn);
    border-left-color: var(--warn);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 8px rgba(255, 107, 53, 0.35);
}

/* info — 蓝色 */
.toast-info {
    border-color: #5bb0ff;
    border-left-color: #5bb0ff;
    color: #c0dcff;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.out {
    animation: toast-out 200ms ease-in forwards;
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* ===== PDF 工具专属样式 ===== */

/* PDF 文件列表（合并用） */
.pdf-file-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
}

.pdf-file-list .empty-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 12px;
    color: var(--text-tertiary);
    font-size: 11px;
}

.pdf-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    cursor: move;
    transition: background var(--t-fast);
}

.pdf-file-item:last-child { border-bottom: none; }

.pdf-file-item:hover { background: var(--bg-hover); }

.pdf-file-item.dragging {
    opacity: 0.5;
    background: var(--accent-dim);
}

.pdf-file-item.drag-over {
    border-top: 2px solid var(--accent);
}

.pdf-item-icon {
    width: 28px;
    height: 36px;
    background: var(--warn-dim);
    border: 1px solid var(--warn);
    border-radius: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--warn);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.pdf-item-info {
    flex: 1;
    min-width: 0;
}

.pdf-item-name {
    color: var(--text-primary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-item-meta {
    color: var(--text-tertiary);
    font-size: 10px;
    margin-top: 2px;
}

.pdf-item-del {
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 2px;
    transition: all var(--t-fast);
}

.pdf-item-del:hover {
    color: var(--warn);
    background: var(--warn-dim);
}

/* 页码快捷按钮 */
.split-quick {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.quick-chip {
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-secondary);
    font-size: 10px;
    cursor: pointer;
    transition: all var(--t-fast);
    letter-spacing: 0.5px;
}

.quick-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

/* PDF 处理进度条 */
.pdf-progress {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 11px;
    color: var(--text-secondary);
    display: none;
}

.pdf-progress.active { display: block; }

.pdf-progress-bar {
    height: 3px;
    background: var(--bg-input);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.pdf-progress-fill {
    height: 100%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
    transition: width 200ms ease-out;
    width: 0;
}

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
    :root {
        --rail-w: 200px;
        --panel-w: 280px;
    }
}

@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 1fr;
    }
    .tool-rail,
    .control-panel {
        display: none;
    }
}
