/* Two-column sidebar shared by all pages. */

:root {
    --col1-width: 120px;
    --col2-width: 244px;
    --sidebar-total-width: 364px;
    --col1-bg: #0f172a;
    --col2-bg: #1e293b;
    --col1-text: #b7c4d5;
    --col1-active: #2563eb;
    --col2-text: #d4deeb;
    --col2-muted: #8ca2bc;
    --col2-active-bg: #31435b;
}

.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    width: var(--sidebar-total-width);
    min-width: var(--sidebar-total-width);
    display: flex;
}

.sidebar-col1 {
    width: var(--col1-width);
    background: var(--col1-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    gap: 8px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-col1::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.sidebar-brand {
    width: 56px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-icons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.sidebar-icon {
    width: 96px;
    min-height: 62px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--col1-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.sidebar-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-icon.active {
    background: var(--col1-active);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .24);
}

.sidebar-icon.logout {
    margin-top: auto;
}

.sidebar-icon-mark {
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.sidebar-icon-label {
    max-width: 96px;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
    white-space: normal;
    word-break: keep-all;
}

.sidebar-col2 {
    width: var(--col2-width);
    background: var(--col2-bg);
    display: flex;
    flex-direction: column;
    padding: 16px 10px;
    gap: 5px;
    overflow-y: auto;
}

.col2-header {
    padding: 9px 10px 7px;
    color: var(--col2-muted);
    font-size: 13px;
    font-weight: 700;
}

.col2-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 10px 10px;
    border-radius: 9px;
    color: var(--col2-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background .18s ease, color .18s ease;
}

.col2-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.col2-item.active {
    background: var(--col2-active-bg);
    color: #ffffff;
}

.col2-title {
    flex: 1;
    min-width: 0;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.status-dot.active {
    background: #22c55e;
}

.status-dot.pending {
    background: #f59e0b;
}

.dev-badge {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(245, 158, 11, .18);
    color: #fbbf24;
    font-size: 11px;
    font-weight: 700;
}

.main-content {
    margin-left: var(--sidebar-total-width);
    flex: 1;
    width: calc(100% - var(--sidebar-total-width));
    min-width: 0;
    min-height: 100vh;
    background: #f5f8fb;
}

.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: #475569;
}

.content-area {
    padding: 24px;
}

.history-table {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.history-table th,
.history-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
}

.history-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

.history-table td {
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.history-table tr:hover td {
    background: #f8fafc;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-running {
    background: #dbeafe;
    color: #1e40af;
}

/* ===== 中等宽度：折叠二级导航，仅保留一级列 (104px) ===== */
@media (max-width: 1100px) {
    .sidebar-col2 {
        display: none;
    }
    .sidebar {
        width: var(--col1-width);
        min-width: var(--col1-width);
    }
    .main-content {
        margin-left: var(--col1-width);
        width: calc(100% - var(--col1-width));
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .28s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 40px rgba(0,0,0,.28);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    /* 汉堡按钮 */
    .hamburger-btn {
        display: flex;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1100;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 10px;
        background: #0f172a;
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        box-shadow: 0 4px 14px rgba(0,0,0,.18);
    }

    /* 遮罩层 */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(0,0,0,.4);
    }

    .sidebar-backdrop.show {
        display: block;
    }
}

@media (min-width: 769px) {
    .hamburger-btn { display: none; }
    .sidebar-backdrop { display: none; }
}

/* ========== 移动端字体/触控优化（≤768px） ========== */
@media (max-width: 768px) {
    html { font-size: 15px; }

    .main-content h2, .page-header h2 { font-size: 19px; }
    .main-content h3, .section-block h3 { font-size: 16px; }
    .main-content label, .form-group label { font-size: 13px; }
    .main-content .btn { font-size: 13px; min-height: 42px; padding: 0 14px; }
    .main-content input, .main-content select, .main-content textarea { font-size: 14px; }

    .pipeline-step .step-name { font-size: 11px; }
    .pipeline-step .step-state { font-size: 10px; }
    .pipeline-step .step-icon { font-size: 14px; }

    .history-table th, .history-table td { font-size: 12px; padding: 8px 10px; }
    .status-badge { font-size: 11px; padding: 3px 8px; }

    .section-kicker { font-size: 12px; }
    .workspace-header { font-size: 13px; }
}
