/* ============================================================
   EX-12 预算管理驾驶舱 · Enterprise Budget Workspace
   ============================================================ */

.ex12-page {
    padding: clamp(12px, 1.5vw, 24px);
}

.ex12-page .container {
    max-width: 1760px;
}

/* —— Top bar —— */
.ex12-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--eh-space-4);
    padding: var(--eh-space-5);
    margin-bottom: var(--eh-space-4);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, rgba(37, 99, 235, 0.05) 100%);
    border: 1px solid var(--eh-border);
    border-radius: var(--eh-radius-xl);
    box-shadow: var(--eh-shadow-xs);
}

.ex12-topbar-main { flex: 1; min-width: 280px; }

.ex12-code {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--eh-font-mono);
    color: var(--eh-brand);
    background: var(--eh-brand-subtle);
    border: 1px solid var(--eh-border-brand);
    border-radius: var(--eh-radius-sm);
    padding: 3px 10px;
    margin-bottom: 8px;
}

.ex12-topbar .title {
    font-size: clamp(1.35rem, 2vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--eh-text-primary);
    line-height: 1.2;
}

.ex12-topbar .title .highlight { color: var(--eh-brand); }

.ex12-topbar .sub {
    margin-top: 6px;
    font-size: var(--eh-text-sm);
    color: var(--eh-text-secondary);
    line-height: 1.5;
}

.ex12-topbar .sub-en {
    font-size: var(--eh-text-xs);
    color: var(--eh-text-muted);
    margin-top: 4px;
    letter-spacing: 0.02em;
}

.ex12-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--eh-space-2);
}

.ex12-topbar-actions .spinning i {
    animation: ex12-spin 0.6s linear infinite;
}

@keyframes ex12-spin { to { transform: rotate(360deg); } }

.ex12-topbar-actions .btn-primary {
    background: var(--eh-brand);
    border-color: var(--eh-brand);
    color: #fff;
}

.ex12-topbar-actions .btn-primary:hover {
    background: var(--eh-brand-dark);
    color: #fff;
}

/* —— KPI row with rings —— */
.ex12-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--eh-space-3);
    margin-bottom: var(--eh-space-4);
}

.ex12-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--eh-surface-solid);
    border: 1px solid var(--eh-border);
    border-radius: var(--eh-radius-lg);
    box-shadow: var(--eh-shadow-xs);
    transition: box-shadow var(--eh-duration), border-color var(--eh-duration);
}

.ex12-kpi:hover {
    border-color: var(--eh-border-brand);
    box-shadow: var(--eh-shadow-sm);
}

.ex12-kpi-ring {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.ex12-kpi-ring svg {
    width: 52px;
    height: 52px;
    transform: rotate(-90deg);
}

.ex12-kpi-ring .ring-bg {
    fill: none;
    stroke: var(--eh-bg-muted);
    stroke-width: 4;
}

.ex12-kpi-ring .ring-fill {
    fill: none;
    stroke: var(--eh-brand);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.ex12-kpi-ring .ring-val {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--eh-font-mono);
    color: var(--eh-text-primary);
}

.ex12-kpi-body .kpi-num {
    font-size: clamp(1.15rem, 1.8vw, 1.5rem);
    font-weight: 800;
    font-family: var(--eh-font-mono);
    color: var(--eh-text-primary);
    line-height: 1.1;
}

.ex12-kpi-body .kpi-num.green { color: var(--eh-success); }
.ex12-kpi-body .kpi-num.yellow { color: var(--eh-warning); }

.ex12-kpi-body .kpi-label {
    font-size: var(--eh-text-xs);
    color: var(--eh-text-muted);
    font-weight: 600;
    margin-top: 2px;
}

.ex12-kpi-body .kpi-trend {
    font-size: 10px;
    font-weight: 600;
    color: var(--eh-success);
    margin-top: 2px;
}

.ex12-kpi-body .kpi-trend.down { color: var(--eh-danger); }

/* —— 三栏工作区 —— */
.ex12-workspace {
    display: grid;
    grid-template-columns: 220px 1fr 300px;
    gap: var(--eh-space-4);
    align-items: start;
}

.ex12-filter-panel {
    position: sticky;
    top: calc(var(--nav-height, 52px) + 12px);
    background: var(--eh-surface-solid);
    border: 1px solid var(--eh-border);
    border-radius: var(--eh-radius-lg);
    padding: var(--eh-space-4);
    box-shadow: var(--eh-shadow-xs);
}

.ex12-filter-panel .panel-head {
    font-size: var(--eh-text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--eh-text-muted);
    margin-bottom: var(--eh-space-3);
}

.ex12-filter-group {
    margin-bottom: var(--eh-space-4);
}

.ex12-filter-group label {
    display: block;
    font-size: var(--eh-text-xs);
    font-weight: 600;
    color: var(--eh-text-secondary);
    margin-bottom: 6px;
}

.ex12-filter-group select,
.ex12-filter-group input {
    width: 100%;
    background: var(--eh-bg-subtle);
    border: 1px solid var(--eh-border);
    border-radius: var(--eh-radius-md);
    padding: 8px 10px;
    font-size: var(--eh-text-sm);
    color: var(--eh-text-primary);
    font-family: inherit;
}

.ex12-filter-chips {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ex12-filter-chips button {
    text-align: left;
    padding: 7px 10px;
    font-size: var(--eh-text-xs);
    font-weight: 600;
    color: var(--eh-text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--eh-radius-md);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--eh-duration);
}

.ex12-filter-chips button:hover {
    background: var(--eh-brand-subtle);
    color: var(--eh-brand);
}

.ex12-filter-chips button.active {
    background: var(--eh-brand-muted);
    border-color: var(--eh-border-brand);
    color: var(--eh-brand);
}

/* —— 主内容区 —— */
.ex12-main .card { margin-bottom: var(--eh-space-4); }

.ex12-charts-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--eh-space-4);
    margin-bottom: var(--eh-space-4);
}

.ex12-page .chart-box {
    position: relative;
    height: 260px;
}

.ex12-page .chart-box.chart-sm { height: 220px; }

.ex12-page .chart-box canvas {
    max-height: none !important;
}

.ex12-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--eh-space-3);
    margin-bottom: var(--eh-space-3);
}

.ex12-table-toolbar input {
    flex: 1;
    min-width: 160px;
    background: var(--eh-bg-subtle);
    border: 1px solid var(--eh-border);
    border-radius: var(--eh-radius-md);
    padding: 9px 12px;
    font-size: var(--eh-text-sm);
    font-family: inherit;
}

.ex12-table-toolbar input:focus {
    outline: none;
    border-color: var(--eh-brand);
    box-shadow: 0 0 0 3px var(--eh-brand-subtle);
}

.ex12-table-meta {
    font-size: var(--eh-text-xs);
    color: var(--eh-text-muted);
    margin-left: auto;
}

.ex12-page table tbody tr {
    cursor: pointer;
    transition: background var(--eh-duration);
}

.ex12-page table tbody tr:hover,
.ex12-page table tbody tr.selected {
    background: var(--eh-brand-subtle);
}

.ex12-progress-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.ex12-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--eh-bg-muted);
    border-radius: var(--eh-radius-full);
    overflow: hidden;
}

.ex12-progress-bar .fill {
    height: 100%;
    border-radius: var(--eh-radius-full);
    background: var(--eh-brand);
    transition: width 0.4s ease;
}

.ex12-progress-bar .fill.warn { background: var(--eh-warning); }
.ex12-progress-bar .fill.danger { background: var(--eh-danger); }

.ex12-progress-pct {
    font-size: var(--eh-text-xs);
    font-family: var(--eh-font-mono);
    font-weight: 600;
    color: var(--eh-text-secondary);
    min-width: 38px;
    text-align: right;
}

/* —— 右侧栏 —— */
.ex12-rail {
    position: sticky;
    top: calc(var(--nav-height, 52px) + 12px);
    display: flex;
    flex-direction: column;
    gap: var(--eh-space-3);
}

.ex12-rail-card {
    background: var(--eh-surface-solid);
    border: 1px solid var(--eh-border);
    border-radius: var(--eh-radius-lg);
    padding: var(--eh-space-4);
    box-shadow: var(--eh-shadow-xs);
}

.ex12-rail-card .rail-title {
    font-size: var(--eh-text-sm);
    font-weight: 700;
    color: var(--eh-text-primary);
    margin-bottom: var(--eh-space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ex12-rail-card .rail-title i { color: var(--eh-brand); margin-right: 4px; }

.ex12-alert-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--eh-border);
    font-size: var(--eh-text-xs);
}

.ex12-alert-item:last-child { border-bottom: none; padding-bottom: 0; }

.ex12-alert-item .alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.ex12-alert-item.critical .alert-dot { background: var(--eh-danger); }
.ex12-alert-item.warning .alert-dot { background: var(--eh-warning); }
.ex12-alert-item.ok .alert-dot { background: var(--eh-success); }

.ex12-alert-item .alert-title {
    font-weight: 700;
    color: var(--eh-text-primary);
}

.ex12-alert-item .alert-desc {
    color: var(--eh-text-muted);
    margin-top: 2px;
    line-height: 1.45;
}

.ex12-timeline-item {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--eh-border);
    font-size: var(--eh-text-xs);
    align-items: start;
}

.ex12-timeline-item:last-child { border-bottom: none; }

.ex12-timeline-item .tl-date {
    color: var(--eh-text-faint);
    font-family: var(--eh-font-mono);
}

.ex12-timeline-item .tl-desc { color: var(--eh-text-secondary); }

.ex12-timeline-item .tl-status {
    font-weight: 600;
    white-space: nowrap;
}

.ex12-timeline-item .tl-status.approved { color: var(--eh-success); }
.ex12-timeline-item .tl-status.pending { color: var(--eh-warning); }
.ex12-timeline-item .tl-status.done { color: var(--eh-brand); }

.ex12-approval-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--eh-bg-subtle);
    border: 1px solid var(--eh-border);
    border-radius: var(--eh-radius-md);
    margin-bottom: 8px;
    font-size: var(--eh-text-xs);
    cursor: pointer;
    transition: border-color var(--eh-duration);
}

.ex12-approval-item:hover {
    border-color: var(--eh-border-brand);
}

.ex12-approval-item .ap-title { font-weight: 700; color: var(--eh-text-primary); }
.ex12-approval-item .ap-meta { color: var(--eh-text-muted); margin-top: 2px; }

.ex12-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    z-index: 100010;
    padding: 10px 20px;
    background: #111827;
    color: #f9fafb;
    font-size: var(--eh-text-sm);
    font-weight: 600;
    border-radius: var(--eh-radius-full);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s, opacity 0.3s;
}

.ex12-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.ex12-kpi.flash { animation: ex12-flash 0.4s ease; }

@keyframes ex12-flash {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.3); }
    100% { box-shadow: var(--eh-shadow-xs); }
}

@media (max-width: 1200px) {
    .ex12-workspace { grid-template-columns: 1fr; }
    .ex12-filter-panel, .ex12-rail { position: static; }
    .ex12-charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .ex12-kpi-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .ex12-kpi-row { grid-template-columns: 1fr; }
}
