/*
    STORM :: mobile data terminal

    Two layouts share this file.

    .mdt-desktop   a floating window: dark chrome, tab strip, tiles and a
                   units on rail down the right
    .mdt-handheld  full bleed in vehicle tablet: status strip, segmented
                   button bar, four tiles with captions beneath
*/

.mdt-root { font-family: var(--font-ui); }

/* ====================================================================== */
/* Desktop                                                                 */
/* ====================================================================== */

.mdt-desktop {
    width: 92vw;
    height: 88vh;
    max-width: 1840px;
    max-height: 980px;
    border-radius: var(--radius);
    background: var(--mdt-bg);
    color: var(--mdt-text);
}

/* -- Top bar ------------------------------------------------------------ */

.mdt-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 8px 14px;
    background: var(--mdt-chrome);
    color: #fff;
    flex: none;
}

.mdt-top-left { display: flex; align-items: center; gap: 8px; font-size: var(--text-base); }
.mdt-clock-text { font-variant-numeric: tabular-nums; }

.mdt-top-right { display: flex; align-items: center; gap: var(--space-4); }

.mdt-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: .02em;
    color: #cfd3d7;
}

.mdt-chip-status { color: #fff; background: var(--grey); }

.mdt-layout-toggle,
.mdt-close {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.mdt-layout-toggle:hover, .mdt-close:hover { background: rgba(255, 255, 255, .2); }

/* -- Urgent assistance -------------------------------------------------- */

.mdt-alert {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 16px;
    border: 0;
    background: var(--mdt-alert);
    color: #fff;
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: 700;
    letter-spacing: .04em;
    text-align: left;
    cursor: pointer;
    flex: none;
}

.mdt-alert:hover { background: #c62b38; }

/* -- Tabs --------------------------------------------------------------- */

.mdt-tabs {
    display: flex;
    align-items: stretch;
    gap: var(--space-2);
    padding: 0 10px;
    background: var(--mdt-surface);
    border-bottom: 1px solid var(--mdt-border);
    flex: none;
}

.mdt-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 0;
    background: none;
    color: #3a3a3a;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: .04em;
    cursor: pointer;
    white-space: nowrap;
}

.mdt-tab:hover { background: rgba(0, 0, 0, .05); }
.mdt-tab.is-active { background: var(--blue); color: #fff; }

/* -- Body --------------------------------------------------------------- */

.mdt-body {
    display: flex;
    gap: var(--space-4);
    flex: 1 1 auto;
    min-height: 0;
    padding: var(--space-4);
}

.mdt-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    flex: 1 1 auto;
    min-width: 0;
}

.mdt-side { flex: 0 0 350px; display: flex; flex-direction: column; min-height: 0; }

/* -- Panels ------------------------------------------------------------- */

.mdt-panel {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-sm);
    background: var(--mdt-surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    min-height: 0;
}

.mdt-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 9px 14px;
    background: var(--mdt-chrome);
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: .06em;
    flex: none;
}

.mdt-panel-body { padding: var(--space-4); overflow: auto; }

.mdt-units-count {
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .16);
    font-size: var(--text-xs);
}

.mdt-units-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 0; }
.mdt-units-body .table th { padding: 8px 12px; }
.mdt-units-body .table td { padding: 9px 12px; }

.mdt-officer { color: var(--blue); font-weight: 600; }

/* -- Status tiles ------------------------------------------------------- */

.mdt-tiles { display: flex; gap: var(--space-3); flex-wrap: wrap; }

.mdt-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1 1 160px;
    min-height: 112px;
    padding: var(--space-3);
    border: 3px solid transparent;
    border-radius: 2px;
    font-family: inherit;
    cursor: pointer;
    transition: filter .12s ease;
}

.mdt-tile:hover { filter: brightness(1.12); }
.mdt-tile.is-active { border-color: #1a1a1a; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }

.mdt-tile-label { font-size: var(--text-md); font-weight: 700; }

/* Handheld variant: bigger squares with the caption underneath. */
.mdt-tiles-below { justify-content: center; gap: var(--space-4); }

.mdt-tile-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.mdt-tiles-below .mdt-tile {
    flex: 0 0 auto;
    width: 220px;
    height: 220px;
}

.mdt-tile-caption { font-size: var(--text-md); color: #2a2a2a; }

/* -- Callsign panel ----------------------------------------------------- */

.mdt-callsign {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.mdt-callsign .field > label {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--mdt-muted);
}

/* -- Incident log ------------------------------------------------------- */

.mdt-log {
    max-height: 240px;
    padding: 10px;
    border: 1px solid var(--mdt-border);
    border-radius: var(--radius-sm);
    background: #fafafa;
    font-size: var(--text-sm);
    user-select: text;
}

.mdt-log-row { display: flex; gap: 10px; padding: 4px 0; }
.mdt-log-row + .mdt-log-row { border-top: 1px solid rgba(0, 0, 0, .05); }

.mdt-log-time { color: var(--mdt-muted); font-variant-numeric: tabular-nums; flex: none; }
.mdt-log-who { font-weight: 700; flex: none; min-width: 110px; }

/* ====================================================================== */
/* Handheld                                                                */
/* ====================================================================== */

.mdt-handheld {
    background: var(--hh-bg);
    color: #1f1f1f;
}

.hh-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: var(--hh-chrome);
    color: #fff;
    font-size: var(--text-base);
    flex: none;
}

.hh-status .row { gap: 8px; }
.hh-status .right { gap: 10px; }

.hh-bar {
    display: flex;
    align-items: stretch;
    background: var(--hh-bar);
    border-bottom: 1px solid #c4c4c4;
    flex: none;
}

.hh-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 0;
    padding: 14px 10px;
    border: 0;
    border-right: 1px solid #c9c9c9;
    background: none;
    color: #1f4f8f;
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.hh-cell:hover { background: rgba(0, 0, 0, .05); }
.hh-cell-accent { color: #0b57c4; }
.hh-cell-spacer { cursor: default; }
.hh-cell-spacer:hover { background: none; }

/* The first four cells are icon only and narrower than the labelled ones. */
.hh-cell:nth-child(-n+5) { flex: 0 0 78px; }

.hh-alert-row { display: flex; align-items: stretch; flex: none; }

.hh-alert {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 290px;
    padding: 11px 16px;
    border: 0;
    background: var(--hh-alert);
    color: #fff;
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: 700;
    letter-spacing: .03em;
    cursor: pointer;
}

.hh-alert:hover { background: #a52020; }

.hh-layout-toggle {
    display: grid;
    place-items: center;
    width: 46px;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, .2);
    background: #2b2b2b;
    color: #fff;
    cursor: pointer;
}
.hh-layout-toggle:hover { background: #3d3d3d; }

/* Fill the gap between the alert button and the toggles. */
.hh-alert-row::before {
    content: "";
    flex: 1 1 auto;
    background: var(--hh-bar);
    border-bottom: 1px solid #c4c4c4;
}

.hh-page {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    padding: 48px var(--space-6);
    overflow-y: auto;
}

.hh-panel {
    width: 100%;
    max-width: 1560px;
    align-self: flex-start;
    border: 1px solid #b9bfcb;
    background: var(--hh-bar);
}

.hh-panel-tab {
    display: inline-block;
    padding: 9px 22px;
    background: #111;
    color: #fff;
    font-size: var(--text-base);
    font-weight: 700;
    letter-spacing: .06em;
}

.hh-panel-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-6);
}

.hh-rule { border-top: 1px solid #b9bfcb; }

.hh-panel-body .btn-block { border-radius: 0; padding: 11px; }

/* -- Narrow screens ----------------------------------------------------- */

@media (max-width: 1280px) {
    .mdt-side { flex-basis: 300px; }
    .mdt-tiles-below .mdt-tile { width: 170px; height: 170px; }
}

@media (max-width: 1000px) {
    .mdt-body { flex-direction: column; }
    .mdt-side { flex: none; }
    .mdt-desktop { width: 96vw; height: 92vh; }
    .hh-cell:nth-child(-n+5) { flex: 0 0 56px; }
    .hh-cell span { display: none; }
}
