.control-body {
    background:
        radial-gradient(circle at top left, rgba(34, 211, 238, 0.12), transparent 28%),
        radial-gradient(circle at right bottom, rgba(167, 139, 250, 0.12), transparent 34%),
        linear-gradient(180deg, #06101d 0%, #081221 40%, #0a1425 100%);
}

.control-shell {
    width: min(1500px, calc(100vw - 32px));
    margin: 18px auto 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.control-hero {
    padding: 26px 28px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.control-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.control-summary-card,
.control-nav-item {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(8, 16, 31, 0.82);
    padding: 16px;
}

.control-summary-card strong,
.control-nav-item strong {
    display: block;
    font-family: var(--font-display);
    margin-bottom: 6px;
}

.control-summary-card span,
.control-nav-item p {
    color: var(--text-soft);
    line-height: 1.6;
    margin: 0;
    font-size: 13px;
}

.control-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.control-nav-panel,
.control-frame-panel { padding: 22px; }

.control-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-nav-item {
    cursor: pointer;
    transition: border-color .16s ease, transform .16s ease, background .16s ease;
}

.control-nav-item:hover,
.control-nav-item.active {
    transform: translateY(-1px);
    border-color: rgba(34, 211, 238, 0.32);
    background: rgba(10, 21, 41, 0.92);
}

.control-section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0 16px;
}

.control-module-root {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-module-placeholder,
.crew-board,
.crew-card,
.crew-report-card,
.crew-report-empty,
.crew-boss-box,
.crew-guest-strip {
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(7, 16, 31, 0.82);
}

.control-module-placeholder {
    padding: 18px;
}

.control-module-placeholder strong {
    display: block;
    margin-bottom: 8px;
    font-family: var(--font-display);
}

.control-module-placeholder p,
.control-module-placeholder span {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.7;
}

.crew-board {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.crew-board-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.crew-board-head h3 {
    margin: 4px 0 0;
    font-family: var(--font-display);
}

.crew-live-chip {
    align-self: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(34, 211, 238, 0.24);
    color: #67e8f9;
    background: rgba(10, 21, 41, 0.92);
    font-size: 12px;
}

.crew-stage {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 14px;
}

.crew-boss-box,
.crew-report-card,
.crew-report-empty {
    padding: 16px;
}

.crew-boss-box,
.crew-report-card {
    display: flex;
    gap: 14px;
    align-items: center;
}

.crew-boss-box strong,
.crew-report-card strong,
.crew-card strong {
    display: block;
    font-family: var(--font-display);
}

.crew-boss-box p,
.crew-report-card p,
.crew-card p {
    margin: 6px 0 0;
    color: var(--text-soft);
    line-height: 1.6;
}

.crew-report-lane {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.crew-report-card span,
.crew-card span {
    color: #67e8f9;
    font-size: 12px;
}

.crew-report-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-soft);
    min-height: 122px;
}

.crew-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.crew-card {
    padding: 16px;
}

.crew-card-head {
    display: flex;
    gap: 12px;
    align-items: center;
}

.crew-card-meta {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.crew-card-meta span,
.crew-guest-pill {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(10, 21, 41, 0.82);
}

.crew-card.online,
.crew-guest-pill.online {
    border-color: rgba(34, 211, 238, 0.28);
}

.crew-card.blocked,
.crew-report-card.blocked {
    border-color: rgba(248, 113, 113, 0.32);
    background: rgba(34, 10, 18, 0.62);
}

.crew-guest-strip {
    padding: 14px 16px;
}

.crew-guest-strip strong {
    display: block;
    margin-bottom: 10px;
    font-family: var(--font-display);
}

.crew-guest-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.crew-avatar {
    position: relative;
    width: 30px;
    height: 46px;
    flex: 0 0 30px;
    image-rendering: pixelated;
    animation: crew-avatar-bob 1.2s steps(2, end) infinite;
}

.crew-shadow,
.crew-head,
.crew-face,
.crew-eye,
.crew-hair,
.crew-body,
.crew-body-shade,
.crew-collar,
.crew-badge,
.crew-arm,
.crew-leg,
.crew-foot {
    position: absolute;
    display: block;
    border-radius: 0;
}

.crew-shadow {
    left: 4px;
    bottom: 2px;
    width: 22px;
    height: 4px;
    background: rgba(15, 23, 42, 0.26);
}

.crew-head {
    left: 9px;
    top: 5px;
    width: 12px;
    height: 9px;
    background: var(--skin);
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.55),
        inset 0 -1px 0 rgba(0, 0, 0, 0.10);
}

.crew-head::before,
.crew-head::after {
    content: '';
    position: absolute;
    top: -2px;
    width: 4px;
    height: 4px;
    background: var(--hair);
}

.crew-head::before { left: -1px; }
.crew-head::after { right: -1px; }

.crew-face {
    left: 10px;
    top: 8px;
    width: 10px;
    height: 3px;
    background: rgba(255, 246, 236, 0.18);
}

.crew-eye {
    top: 9px;
    width: 2px;
    height: 2px;
    background: #0f172a;
}

.crew-eye.left { left: 12px; }
.crew-eye.right { left: 17px; }

.crew-hair {
    left: 8px;
    top: 3px;
    width: 14px;
    height: 3px;
    background: var(--hair);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.45);
}

.crew-body {
    left: 8px;
    top: 16px;
    width: 14px;
    height: 12px;
    background: var(--coat);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.45);
}

.crew-body-shade {
    left: 15px;
    top: 16px;
    width: 7px;
    height: 12px;
    background: rgba(0, 0, 0, 0.12);
}

.crew-collar {
    left: 12px;
    top: 16px;
    width: 6px;
    height: 2px;
    background: rgba(255, 255, 255, 0.60);
}

.crew-badge {
    left: 18px;
    top: 21px;
    width: 3px;
    height: 3px;
    background: var(--accent);
}

.crew-arm {
    top: 18px;
    width: 2px;
    height: 8px;
    background: var(--coat);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.30);
}

.crew-arm.left { left: 5px; }
.crew-arm.right { right: 5px; }

.crew-leg {
    top: 28px;
    width: 4px;
    height: 9px;
    background: var(--pants);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.30);
}

.crew-leg.left { left: 9px; }
.crew-leg.right { right: 9px; }

.crew-foot {
    top: 37px;
    width: 5px;
    height: 3px;
    background: #111827;
}

.crew-foot.left { left: 8px; }
.crew-foot.right { right: 8px; }

.control-frame-shell {
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(7, 16, 31, 0.76);
    margin-top: 14px;
}

#control-legacy-frame {
    width: 100%;
    min-height: 1180px;
    border: 0;
    display: block;
    background: #050b16;
}

.control-frame-shell[hidden] {
    display: none;
}

.office-scene-card,
.command-panel,
.department-card {
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(7, 16, 31, 0.82);
}

.office-scene-card,
.command-panel {
    padding: 18px;
}

.office-scene-head,
.command-grid,
.control-field-grid,
.button-grid,
.auth-inline,
.model-kpis,
.status-grid,
.department-metrics {
    display: flex;
    gap: 12px;
}

.office-scene-head,
.auth-inline {
    justify-content: space-between;
    align-items: center;
}

.command-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.command-grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.control-field-grid,
.button-grid,
.model-kpis,
.status-grid {
    flex-wrap: wrap;
}

.control-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 14px 0;
}

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-soft);
    font-size: 13px;
}

.field-stack input,
.field-stack select,
.field-stack textarea,
.auth-inline input {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(10, 21, 41, 0.92);
    color: #e2e8f0;
    padding: 10px 12px;
    font: inherit;
}

.field-stack textarea {
    min-height: 120px;
    resize: vertical;
}

.auth-inline input {
    flex: 1;
}

.toggle-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 14px 0;
    color: var(--text-soft);
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 12px;
}

.history-panel,
.event-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
}

.event-row,
.history-item,
.model-kpi,
.status-grid > div {
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(10, 21, 41, 0.78);
    padding: 12px;
}

.event-row strong,
.history-item strong,
.model-kpi strong,
.department-card strong,
.status-grid strong {
    display: block;
    font-family: var(--font-display);
    margin-bottom: 6px;
}

.event-row span,
.history-item div,
.model-kpi span,
.department-card p,
.status-grid span,
.scene-footer-note,
.status-note,
.control-copy-block {
    color: var(--text-soft);
    line-height: 1.6;
}

.status-note {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(10, 21, 41, 0.72);
}

.status-note[data-kind="ok"] {
    border-color: rgba(34, 197, 94, 0.28);
    color: #bbf7d0;
}

.status-note[data-kind="warn"] {
    border-color: rgba(250, 204, 21, 0.28);
    color: #fde68a;
}

.status-note[data-kind="bad"] {
    border-color: rgba(248, 113, 113, 0.30);
    color: #fecaca;
}

.office-scene {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background:
        linear-gradient(180deg, rgba(6, 10, 18, 0.58), rgba(8, 16, 31, 0.64)),
        radial-gradient(circle at 20% 12%, rgba(56, 189, 248, 0.12), transparent 26%),
        radial-gradient(circle at 80% 20%, rgba(250, 204, 21, 0.10), transparent 26%),
        radial-gradient(circle at 52% 58%, rgba(15, 118, 110, 0.12), transparent 30%),
        url('/static/office_bg.webp') center/cover no-repeat;
}

.office-scene::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}

.office-zone,
.office-queue-guide,
.office-person-marker {
    position: absolute;
}

.office-zone {
    border-radius: 18px;
    border: 1px dashed rgba(148, 163, 184, 0.24);
    background: rgba(5, 10, 18, 0.18);
}

.office-zone span {
    position: absolute;
    top: -10px;
    left: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(8, 15, 28, 0.78);
    color: #dbeafe;
    font-size: 11px;
}

.zone-boss { left: 37%; top: 6%; width: 22%; height: 24%; }
.zone-product { left: 7%; top: 12%; width: 24%; height: 28%; }
.zone-rd { left: 36%; top: 48%; width: 42%; height: 30%; }
.zone-qa { left: 7%; top: 50%; width: 22%; height: 28%; }
.zone-review { left: 26%; top: 32%; width: 18%; height: 18%; }
.zone-ops { left: 76%; top: 10%; width: 16%; height: 22%; }

.office-queue-guide {
    left: 42%;
    top: 28%;
    width: 16%;
    height: 24%;
    border: 2px dashed rgba(250, 204, 21, 0.22);
    border-radius: 18px;
}

.office-person-marker {
    transform: translate(-50%, -100%);
    transition: left .85s cubic-bezier(.3, .7, .2, 1), top .85s cubic-bezier(.3, .7, .2, 1), opacity .2s ease;
}

.office-speech {
    margin-bottom: 6px;
    max-width: 136px;
    padding: 6px 9px;
    border-radius: 12px 12px 12px 4px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 252, 245, 0.98);
    color: #2f2416;
    font-size: 10px;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .24s ease, transform .24s ease;
}

.office-person-marker.talking .office-speech {
    opacity: 1;
    transform: translateY(0);
}

.office-head-tag {
    margin: 0 auto 5px;
    width: fit-content;
    max-width: 102px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(2, 6, 23, 0.88);
    color: #f8fafc;
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
}

.office-person-marker.offline {
    opacity: .66;
}

.office-person-marker.blocked .office-speech {
    background: rgba(255, 241, 242, 0.96);
    border-color: rgba(248, 113, 113, 0.30);
    color: #7f1d1d;
}

.office-person-marker.speaking .office-head-tag,
.office-person-marker.queued .office-head-tag {
    border-color: rgba(250, 204, 21, 0.32);
    color: #fde68a;
}

.office-person-name {
    display: none;
}

.department-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.department-card {
    padding: 14px;
}

.department-card.blocked {
    border-color: rgba(248, 113, 113, 0.32);
    background: rgba(34, 10, 18, 0.62);
}

.department-metrics span,
.guest-pill,
.fallback-pill {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(10, 21, 41, 0.82);
}

.guest-list,
.fallback-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.guest-pill.online,
.fallback-pill {
    border-color: rgba(34, 211, 238, 0.28);
}

.brief-box {
    display: flex;
    gap: 14px;
    align-items: center;
}

.model-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 14px;
}

.scene-footer-note {
    margin-top: 12px;
}

@keyframes crew-avatar-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1px); }
}

@media (max-width: 1180px) {
    .control-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .control-layout { grid-template-columns: 1fr; }
    .crew-stage,
    .crew-grid,
    .crew-report-lane { grid-template-columns: 1fr; }
    .command-grid,
    .command-grid.two-columns,
    .department-grid,
    .control-field-grid,
    .model-kpis { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .control-shell { width: calc(100vw - 18px); }
    .control-hero { padding: 20px; flex-direction: column; }
    .control-summary-grid { grid-template-columns: 1fr; }
    .hero-actions { width: 100%; }
    .button-grid,
    .department-grid,
    .control-field-grid,
    .model-kpis { grid-template-columns: 1fr; }
    .crew-board-head {
        flex-direction: column;
        align-items: flex-start;
    }
}

.control-layout-3col {
    grid-template-columns: 320px minmax(0, 1fr) 320px;
}

.control-right-rail {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 100%;
}

.compact-phase-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 0;
}

.control-log-list {
    max-height: 720px;
}

.control-boss-brief {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(7, 15, 28, 0.72);
    color: var(--text-soft);
    line-height: 1.7;
}

.office-engine-frame {
    margin: 14px 0;
}

.office-scene-card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.office-scene-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.department-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.scene-footer-note {
    color: var(--text-soft);
    font-size: 12px;
}

@media (max-width: 1400px) {
    .control-layout-3col {
        grid-template-columns: 280px minmax(0, 1fr);
    }
    .control-right-rail {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {
    .department-grid,
    .compact-phase-track {
        grid-template-columns: 1fr;
    }
}
