/* Pilot PocketDZ — layout and component styles on top of Bootstrap 5.3. */
:root {
    --pilot-sidebar-width: 240px;
    --pilot-surface: #ffffff;
    --pilot-background: #f4f6f9;
    --pilot-border: #e2e6ec;
    --pilot-accent: #1f3a5f;
}

[data-bs-theme="dark"] {
    --pilot-surface: #161b22;
    --pilot-background: #0d1117;
    --pilot-border: #2a313c;
    --pilot-accent: #9ec5fe;
}

body {
    background: var(--pilot-background);
    font-size: .925rem;
}

.icon {
    width: 1em;
    height: 1em;
    vertical-align: -.125em;
    flex-shrink: 0;
}

.icon-lg { width: 1.5rem; height: 1.5rem; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--pilot-sidebar-width);
    background: var(--pilot-surface);
    border-right: 1px solid var(--pilot-border);
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        flex-shrink: 0;
    }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    height: 58px;
    padding: 0 1rem;
    border-bottom: 1px solid var(--pilot-border);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--pilot-accent);
    color: var(--pilot-surface);
}

.brand-name { font-weight: 700; letter-spacing: -.01em; }

.sidebar-nav { flex: 1; padding: .75rem; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .75rem;
    border-radius: 6px;
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.sidebar-nav .nav-item:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.sidebar-nav .nav-item.active { background: var(--pilot-accent); color: var(--pilot-surface); }
.sidebar-nav .nav-item:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }

.sidebar-footer { padding: .75rem 1rem 1rem; border-top: 1px solid var(--pilot-border); }

.main-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    height: 58px;
    padding: 0 1.25rem;
    background: var(--pilot-surface);
    border-bottom: 1px solid var(--pilot-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title { font-size: 1.05rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content { padding: 1.25rem; max-width: 1400px; width: 100%; }

@media (max-width: 575.98px) {
    .content { padding: 1rem; }
    .topbar { padding: 0 1rem; }
}

.content-narrow { max-width: 720px; }

/* Auth */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 400px; }

/* Cards and stats */
.card { border-color: var(--pilot-border); background: var(--pilot-surface); }
.card-header { background: transparent; border-bottom-color: var(--pilot-border); font-weight: 600; }

.stat-card .stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }

.table { --bs-table-bg: transparent; }
.table > thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); font-weight: 600; }

.nav-tabs .nav-link { font-weight: 500; }

/* Definition lists */
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: .4rem 1rem; margin: 0; }
.kv dt { font-weight: 500; color: var(--bs-secondary-color); }
.kv dd { margin: 0; word-break: break-word; }

@media (max-width: 575.98px) {
    .kv { grid-template-columns: 1fr; }
    .kv dd { margin-bottom: .5rem; }
}

/* Logs and code */
.log-output {
    background: #0d1117;
    color: #d1d7e0;
    font-size: .8rem;
    border-radius: 6px;
    padding: .75rem;
    max-height: 360px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.code-view { max-height: none; }

.step-list .step { border-left: 3px solid var(--pilot-border); padding: .25rem 0 .75rem 1rem; }
.step-list .step.step-ok { border-left-color: var(--bs-success); }
.step-list .step.step-failed { border-left-color: var(--bs-danger); }
.step-list .step.step-other { border-left-color: var(--bs-warning); }

.progress-indicator { display: inline-flex; align-items: center; gap: .5rem; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--bs-secondary-color); }
.empty-state .icon { width: 2rem; height: 2rem; margin-bottom: .5rem; }

.form-section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); font-weight: 600; margin-bottom: .75rem; }
