/* ECU Mileage — layout: tree on the left, drop zone + result on the right */
.mg-wrap {
    width: 90%;
    margin: 20px auto 60px;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    align-items: start;
}

.mg-side {
    background: #2c3136;
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .3);
    position: sticky;
    top: 20px;
}

.mg-side-head h2 {
    margin: 0 0 12px;
    font-size: 17px;
    color: #fff;
}

.mg-search {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid #454b52;
    background: #22262a;
    color: #fff;
    font-size: 13px;
    outline: none;
}

.mg-search:focus { border-color: #0d6efd; }

.mg-tree { margin-top: 14px; max-height: 60vh; overflow: auto; }

.mg-brand {
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #8f979f;
    margin: 14px 0 6px;
}

.mg-ecu {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: #22262a;
    border: 1px solid transparent;
    color: #dfe3e6;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: .18s;
}

.mg-ecu:hover { background: #2f353b; }

.mg-ecu.is-active {
    background: #0d6efd;
    border-color: #4d94ff;
    color: #fff;
}

.mg-ecu small { color: #9aa2a9; font-size: 11px; }
.mg-ecu.is-active small { color: #dbe7ff; }

.mg-side-note {
    margin: 14px 0 0;
    font-size: 11px;
    color: #8f979f;
}

.mg-main { display: flex; flex-direction: column; gap: 10px; }

.mg-drop {
    background: #2c3136;
    border: 2px dashed #4a5158;
    border-radius: 20px;
    padding: 12px 20px;
    text-align: center;
    cursor: pointer;
    transition: .2s;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .3);
    box-sizing: border-box;
}

.mg-drop:hover,
.mg-drop.is-over {
    border-color: #0d6efd;
    background: #313840;
}

.mg-drop.is-disabled {
    opacity: .55;
    cursor: not-allowed;
}

.mg-drop.is-disabled:hover {
    border-color: #4a5158;
    background: #2c3136;
}

.mg-drop-icon {
    width: 40px;
    height: 40px;
    color: #5c9dff;
    margin-bottom: 4px;
}

.mg-drop-title { color: #fff; font-size: 15px; margin: 0 0 2px; }
.mg-drop-sub { color: #9aa2a9; font-size: 12px; margin: 0 0 6px; }
.mg-drop-ecu { color: #7f8890; font-size: 12px; margin: 0; }
.mg-drop-ecu.is-set { color: #4d9bff; }

.mg-status { font-size: 13px; color: #b8c0c7; }
.mg-status.is-error { color: #ff7b72; }
.mg-status.is-busy { color: #7fb2ff; }

.mg-result {
    background: #2c3136;
    border-radius: 20px;
    padding: 12px 22px 22px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .3);
    color: #dfe3e6;
}

/* ------------------------------------------------------- instrument cluster */
.mg-gauge {
    position: relative;
    width: 100%;
    max-width: 440px;
    margin: -6px auto 10px;
}

.mg-gauge-dial {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .5));
}

.mg-dial-rim { fill: #1b1f23; stroke: #454d55; stroke-width: 2; }
.mg-dial-face { fill: #272c31; }
.mg-tick { stroke: #6f777e; stroke-width: 2; stroke-linecap: round; }
.mg-tick.is-major { stroke: #d3dade; stroke-width: 4.5; }
.mg-tick-label {
    fill: #e9eef1;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 17px;
    font-weight: 600;
}

.mg-needle {
    transform-box: view-box;
    transform-origin: 210px 190px;
}

.mg-needle-blade {
    fill: #e5342f;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .55))
            drop-shadow(0 0 7px rgba(229, 52, 47, .35));
}

.mg-needle-cap { fill: #1b1f23; stroke: #4b545c; stroke-width: 2; }

/* pencil line drawn by a mechanic where the needle rests */
.mg-pencil { pointer-events: none; }

.mg-pencil path {
    fill: none;
    stroke: #c6ccd0;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .42;
    filter: blur(.35px);
}

.mg-pencil path.is-faint {
    stroke-width: 1.3;
    opacity: .22;
    filter: blur(.5px);
}
.mg-needle-hub { fill: #e5342f; }

/* odometer — mechanical rolling drums, slightly misaligned on purpose */
.mg-odo {
    position: absolute;
    left: 50%;
    top: 85%; /* below the needle pivot; ~1 cm lower than 74% at the default width */
    transform: translate(-50%, -50%);
}

.mg-odo-window {
    background: #0a0c0e;
    border-radius: 9px;
    padding: 5px 7px;
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, .95),
                0 0 0 1px #000,
                0 2px 0 rgba(255, 255, 255, .06);
}

.mg-odo-strip { display: flex; gap: 2px; }

.mg-odo-drum {
    width: 26px;
    height: 34px;
    overflow: hidden;
    background: #15191c;
    border-radius: 3px;
    box-shadow: inset 0 6px 8px -6px rgba(0, 0, 0, .9),
                inset 0 -6px 8px -6px rgba(0, 0, 0, .9);
}

.mg-odo-column {
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.mg-odo-column span {
    height: 34px;
    line-height: 34px;
    text-align: center;
    font-family: "DejaVu Sans Mono", Consolas, "Courier New", monospace;
    font-size: 25px;
    font-weight: 700;
    color: #f4f7f9;
    text-shadow: 0 1px 0 #000, 0 0 8px rgba(255, 255, 255, .12);
}

.mg-odo-drum.is-zero .mg-odo-column span { color: #9aa2a9; }

.mg-gauge-caption {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 16px;
    padding: 8px 18px;
    background: #22262a;
    border: 1px solid #3a4046;
    border-radius: 999px;
    box-sizing: border-box;
    text-align: center;
    font-size: 13px;
    line-height: 1.45;
    color: #cfd6dc;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 520px) {
    .mg-odo-drum { width: 21px; height: 28px; }
    .mg-odo-column span { height: 28px; line-height: 28px; font-size: 20px; }
}

.mg-km {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}

.mg-km-value {
    font-size: 42px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.02em;
}

.mg-km-unit { font-size: 15px; color: #9aa2a9; }
.mg-km-layout { font-size: 12px; color: #9aa2a9; margin: 0 0 6px; }

.mg-summary {
    margin: 0 0 16px;
    font-size: 12px;
    color: #8f979f;
    font-variant-numeric: tabular-nums;
}

.mg-details {
    border: 1px solid #3a4046;
    border-radius: 12px;
    padding: 0 12px;
    margin-bottom: 8px;
    background: #262b30;
}

.mg-details summary {
    cursor: pointer;
    padding: 10px 2px;
    font-size: 12px;
    color: #9aa2a9;
    list-style: none;
}

.mg-details summary::-webkit-details-marker { display: none; }

.mg-details summary::before {
    content: '▸ ';
    color: #5c9dff;
}

.mg-details[open] summary::before { content: '▾ '; }

.mg-details summary:hover { color: #dfe3e6; }

.mg-details > *:not(summary) { margin-bottom: 10px; }

.mg-groups {
    font-size: 12px;
    color: #b8c0c7;
    font-variant-numeric: tabular-nums;
    background: #22262a;
    border-radius: 8px;
    padding: 8px 10px;
}

.mg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.mg-cell {
    background: #22262a;
    border-radius: 12px;
    padding: 10px 12px;
}

.mg-cell-k {
    display: block;
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #8f979f;
    margin-bottom: 4px;
}

.mg-cell-v { font-size: 14px; color: #fff; word-break: break-word; }

.mg-sub {
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #8f979f;
    margin: 16px 0 8px;
}

.mg-warn {
    background: rgba(255, 193, 7, .1);
    border: 1px solid rgba(255, 193, 7, .35);
    color: #ffd166;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 8px;
}

.mg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    table-layout: auto;
}

/* globalni `th` u styles.css ima jarko crvenu pozadinu — ovdje je gasimo */
.mg-table th,
.mg-table td {
    background: transparent;
    border: 0;
    border-bottom: 1px solid #3a4046;
    text-align: left;
    padding: 6px 8px;
    height: auto;
    line-height: 1.45;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.mg-table th {
    background: transparent;
    color: #8f979f;
    font-weight: 500;
}

.mg-table td {
    background: transparent;
    color: #dfe3e6;
}

.mg-table td.is-bad {
    color: #ff9d94;
    font-weight: 600;
}

.mg-table tr:hover td { background: #2f353b; }

.mg-hex {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px;
}

.mg-hex span {
    background: #22262a;
    border-radius: 6px;
    padding: 6px 0;
    text-align: center;
    color: #b8c0c7;
}

.mg-hex span.is-hit {
    background: #0d6efd;
    color: #fff;
    font-weight: 700;
}

.mg-foot { margin-top: 14px; font-size: 11px; color: #7f8890; }

@media (max-width: 860px) {
    .mg-wrap { grid-template-columns: 1fr; }
    .mg-side { position: static; }
}
