/* ── Variables ───────────────────────────────────────────── */
:root {
    --sidebar-width: 250px;
    --sidebar-bg:    #15171c;
    --topbar-height: 3.25rem;
}

/* ── Portal layout ───────────────────────────────────────── */
html, body { height: 100%; }

.portal-body {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--bs-body-bg);
}

.portal-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.portal-sidebar::-webkit-scrollbar { display: none; }

.portal-main {
    flex: 1;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.portal-topbar {
    height: var(--topbar-height);
    flex-shrink: 0;
}

.portal-content {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(128,128,128,.2) transparent;
}
.portal-content::-webkit-scrollbar       { width: 5px; }
.portal-content::-webkit-scrollbar-thumb { background: rgba(128,128,128,.25); border-radius: 3px; }

/* ── Sidebar brand ───────────────────────────────────────── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}
.sidebar-brand-text .name { font-weight: 700; font-size: .875rem; color: #fff; line-height: 1.1; }
.sidebar-brand-text .sub  { font-size: .63rem; color: rgba(255,255,255,.38); }

/* ── Sidebar nav ─────────────────────────────────────────── */
.sidebar-nav { padding: .4rem 0; }

.sidebar-section {
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.22);
    padding: .85rem 1.1rem .2rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .48rem 1.1rem;
    color: rgba(255,255,255,.55);
    text-decoration: none;
    font-size: .855rem;
    border-left: 3px solid transparent;
    transition: background .12s, color .12s;
    white-space: nowrap;
}
.sidebar-link:hover  { background: rgba(255,255,255,.06); color: rgba(255,255,255,.88); }
.sidebar-link.active { background: rgba(255,255,255,.1);  color: #fff; border-left-color: var(--bs-primary); }
.sidebar-link i      { font-size: .95rem; width: 1rem; text-align: center; flex-shrink: 0; }

/* ── Sidebar footer ──────────────────────────────────────── */
.sidebar-footer {
    padding: .85rem;
    border-top: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

/* ── Job cards ───────────────────────────────────────────── */
.job-card { transition: box-shadow .15s, transform .15s; }
.job-card:hover {
    box-shadow: 0 .4rem 1.5rem rgba(0,0,0,.1) !important;
    transform: translateY(-1px);
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.status-dot.idle    { background: var(--bs-secondary-color); opacity:.35; }
.status-dot.running { background: var(--bs-warning); animation: blink 1.1s ease infinite; }
.status-dot.success { background: var(--bs-success); }
.status-dot.failed  { background: var(--bs-danger); }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.2} }

/* ── Log stream (dashboard) ──────────────────────────────── */
.log-stream {
    height: 440px;
    overflow-y: auto;
    font-size: .775rem;
    line-height: 1.65;
    scrollbar-width: thin;
    scrollbar-color: rgba(128,128,128,.2) transparent;
}
.log-stream::-webkit-scrollbar       { width: 4px; }
.log-stream::-webkit-scrollbar-thumb { background: rgba(128,128,128,.25); border-radius: 2px; }

.log-line {
    display: block;
    padding: .06rem .75rem;
    white-space: pre-wrap;
    word-break: break-word;
    border-left: 2px solid transparent;
}
.log-line:hover   { background: var(--bs-tertiary-bg); }
.log-line.error   { color: var(--bs-danger);  border-left-color: var(--bs-danger); }
.log-line.success { color: var(--bs-success); border-left-color: var(--bs-success); }
.log-line.info    { color: var(--bs-info); }

/* ── Push output modal ───────────────────────────────────── */
.push-output {
    max-height: 300px;
    overflow-y: auto;
    font-size: .775rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Log viewer (logs page) ──────────────────────────────── */
.log-viewer {
    height: calc(100vh - 230px);
    min-height: 300px;
    overflow-y: auto;
    font-size: .8rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 1rem 1.25rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;
    scrollbar-width: thin;
}
.log-viewer::-webkit-scrollbar       { width: 4px; }
.log-viewer::-webkit-scrollbar-thumb { background: rgba(128,128,128,.25); border-radius: 2px; }

/* ── Output modal ────────────────────────────────────────── */
#outputModalBody {
    font-size: .78rem;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .log-stream  { height: 280px; }
    .log-viewer  { height: 60vh; }
}
