/* Dashboard layout is profile-driven; management pages keep their existing styles. */
.dashboard-page { --dashboard-header-height: 100px; --demo-toolbar-height: 0px; height: 100dvh; overflow: hidden; }
.dashboard-page .app-header { height: var(--dashboard-header-height); }
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: var(--dashboard-tracks);
    gap: .6rem;
    padding: calc(var(--dashboard-header-height) + var(--demo-toolbar-height) + .5rem) .7rem .7rem;
    height: 100dvh;
    box-sizing: border-box;
}
.dashboard-tile { min-width: 0; min-height: 0; padding: .55rem; display: flex; flex-direction: column; overflow: hidden; }
.dashboard-tile h5 { font-size: 1rem; margin: 0 0 .4rem; flex-shrink: 0; }
.dashboard-tile a { color: inherit; text-decoration: none; }
.tile-content { flex: 1; min-height: 0; min-width: 0; }
.tile-scroll { overflow: auto; overflow-wrap: anywhere; }
.tile-team { padding: .3rem .55rem; }
.team-summary { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1rem; min-height: 1.5rem; line-height: 1.5; }
.team-summary > span { font-size: .85rem; }
.dashboard-page #map { height: auto; margin: 0; width: 100%; }
.camera-wall { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: .5rem; position: relative; }
.camera-tile { min-height: 0; min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--uav-color); border-radius: .25rem; overflow: hidden; }
.camera-tile h6 { font-size: .9rem; padding: .3rem .4rem; margin: 0; color: var(--uav-color); }
.camera-tile h6 small { color: var(--text-color); font-size: .75rem; }
.camera-viewport { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.camera-uav-id { font-size: .65rem; padding: .1rem .4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera-placeholder { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; background: #102137; }
.camera-viewport iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 3; }
.camera-wall canvas { z-index: 1; pointer-events: none; }
.uav-image-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 4; background: #0008; }
.camera-viewport .uav-tag-overlay { z-index: 5; }
.uav-event { padding: .3rem .5rem; margin-bottom: .4rem; border-left: 3px solid; font-size: .8rem; }
.uav-event p { font-size: .75rem; margin: .2rem 0 0; }
.uav-status { margin-left: .5rem; font-size: .7rem; }
/* A side pocket lets a readable QR extend alongside the table header without
   covering any text or rules, and without consuming a whole heading row. */
.tile-table { display: grid; grid-template-columns: minmax(0, 1fr) max-content; grid-template-rows: auto minmax(0, 1fr); gap: .35rem .6rem; }
.tile-heading { grid-column: 1; grid-row: 1; display: flex; align-items: center; min-width: 0; }
.dashboard-tile .tile-heading h5 { margin: 0; min-width: 0; }
.tile-table .tile-content { grid-column: 1; grid-row: 2; }
.tile-qr { --qr-foreground: #78b487; grid-column: 2; grid-row: 1 / span 2; align-self: start; width: 88px; height: 88px; padding: 16px; box-sizing: content-box; background: transparent; }
.tile-qr img, .tile-qr canvas { width: 88px; height: 88px; image-rendering: pixelated; }
.tile-leaderboard .gridjs-th:first-child, .tile-leaderboard .gridjs-td:first-child:not([colspan]) { text-align: center; white-space: nowrap; }
.tile-leaderboard .gridjs-td:last-child:not([colspan]) { text-align: right; white-space: nowrap; }
.dashboard-page .tile-table .gridjs-th, .dashboard-page .tile-table .gridjs-td { padding: .3rem .35rem !important; }
.goal-row { display: flex; gap: .5rem; align-items: center; padding: .4rem 0; font-size: .85rem; }
.goal-row > span:first-child { flex: 1; }
.dashboard-page #abstract-schema { overflow: hidden; }
.dashboard-page #abstract-schema svg { width: 100%; height: 100%; }
.dashboard-page .gridjs-container { border: 0; border-radius: 0; }
.dashboard-page .gridjs-th { border-width: 0 0 1px !important; }
.dashboard-page .gridjs-table { font-size: .8rem; }
.dashboard-page .gridjs-th, .dashboard-page .gridjs-td { padding: .3rem; }
@media (max-width: 900px) {
    .dashboard-page { height: auto; overflow: auto; }
    .dashboard-grid { display: flex; flex-direction: column; height: auto; }
    .dashboard-tile { min-height: 150px; }
    .tile-team { min-height: 0; }
    .tile-map { height: 350px; flex: none; }
    .tile-cameras { height: 650px; flex: none; }
    .tile-events { max-height: 400px; }
    .tile-schema { height: 400px; flex: none; }
}
@media (min-width: 769px) and (max-height: 1080px) {
    .dashboard-page { --dashboard-header-height: 75px; }
}
@media (max-width: 768px) { .dashboard-page { --dashboard-header-height: 70px; } }

/* Only the isolated demo has a playback toolbar. */
.demo-page { --demo-toolbar-height: 44px; }
.demo-toolbar { position: fixed; top: var(--dashboard-header-height); left: .7rem; right: .7rem; height: var(--demo-toolbar-height); display: flex; align-items: center; gap: .5rem; z-index: 900; background: #0A1A2F; padding: .3rem; border-bottom: 1px solid #67C23A; font-size: .8rem; }
.demo-toolbar > strong, .demo-time { white-space: nowrap; }
.demo-speed { width: 65px; flex: none; }
.demo-chapters { width: 230px; }
.demo-progress { flex: 1; min-width: 60px; accent-color: #67C23A; }
@media (max-width: 900px) {
    .demo-page { --demo-toolbar-height: 94px; }
    .demo-toolbar { flex-wrap: wrap; align-content: center; }
    .demo-toolbar > strong { font-size: .7rem; }
    .demo-chapters { width: 180px; flex: 1; }
    .demo-progress { flex-basis: 45%; }
}
