/* ── Shared Analytics page-head chrome (Performance compact) ───────── */
.page-head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}
.page-head > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}
.page-head h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
}
.page-head > div:first-child > p,
.page-head .page-sub {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    max-width: 56ch;
}
.page-head .controls {
    flex: 0 1 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    justify-content: flex-end;
}
.page-head .control label,
.controls .control > label {
    display: block;
    font-size: 11px;
    line-height: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}
.page-head .control input,
.page-head .control select,
.controls .control input,
.controls .control select {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 4px 8px;
    font: inherit;
    font-size: 12px;
    height: 32px;
    box-sizing: border-box;
}
.page-head .control input[type="date"],
.controls .control input[type="date"] {
    width: 124px;
}
.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0 11px;
    font-weight: 700;
    font-size: 12px;
    height: 32px;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:hover {
    filter: brightness(1.08);
}
.btn-secondary {
    background: var(--bg-muted);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary.active {
    background: var(--accent-soft);
    color: var(--text);
    border-color: var(--accent);
}
.page-head .of-btn,
.controls .of-btn,
.filter-row .of-btn {
    height: 32px;
    box-sizing: border-box;
    padding: 0 11px;
    min-width: 130px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}
.page-head .action-btns,
.controls .action-btns {
    display: inline-flex;
    gap: 8px;
    align-items: stretch;
}
.page-head .mode-switch,
.controls .mode-switch {
    display: inline-flex;
    gap: 4px;
    align-items: stretch;
}
.control input:disabled {
    opacity: 0.75;
}

/* Segmented controls (mode / granularity / compare presets) */
.seg {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.seg button {
    border: 0;
    border-right: 1px solid var(--border);
    background: var(--bg-muted);
    color: var(--text-muted);
    height: 32px;
    padding: 0 12px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button.active {
    background: var(--accent-soft);
    color: var(--text);
}

.page-head .head-right { flex: 0 1 auto; }

/* Simple analytics toolbars (utilization / planning) — one horizontal row */
.page-head .toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: flex-end;
    justify-content: flex-end;
}
.page-head .toolbar .control label {
    display: block;
    font-size: 11px;
    line-height: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}
.page-head .toolbar input[type="date"],
.page-head .toolbar select {
    color-scheme: dark;
    display: block;
    height: 32px;
    box-sizing: border-box;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 4px 8px;
    font: inherit;
    font-size: 12px;
}
.page-head .toolbar input[type="date"] { width: 124px; }
.page-head .toolbar select { min-width: 124px; }

.page-head .btn,
.page-head .btn-secondary {
    min-width: 76px;
    padding: 0 14px;
    box-sizing: border-box;
}

/* Performance / Trip stats compare grid — Period 2 under Period 1 */
.page-head .head-grid.controls {
    display: grid;
    grid-template-columns: auto 124px 124px auto 76px 76px;
    gap: 8px;
    align-items: end;
    justify-content: end;
    flex-wrap: unset;
}
.page-head .head-grid.trip-grid {
    grid-template-columns: auto 124px 124px 1fr 76px 76px;
}
.head-grid > .btn,
.head-grid > .btn-secondary {
    width: 76px;
    justify-content: center;
    align-self: end;
}
.head-grid .seg { align-self: end; }
.head-grid .control label {
    display: block;
    font-size: 11px;
    line-height: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}
.head-grid input[type="date"] {
    color-scheme: dark;
    display: block;
    width: 100%;
    height: 32px;
    box-sizing: border-box;
    background: var(--bg-muted) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: 6px;
    padding: 4px 8px;
    font: inherit;
    font-size: 12px;
    -webkit-appearance: none;
    appearance: none;
}
.head-grid input[type="date"]:disabled { opacity: 0.75; }
.head-grid input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.7;
    cursor: pointer;
    filter: invert(0.85);
}
.head-grid .cmp-only { display: none; }
.head-grid.compare .control.cmp-only { display: block; }
.head-grid.compare .cmp-slot { display: block; }
.head-grid.compare .cmp-presets {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    align-self: end;
    grid-column: 4 / -1;
}
.cmp-presets .preset-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 32px;
}
.cmp-presets .preset-custom {
    margin-left: 6px;
    height: 32px;
}

/* Filter rows under the header */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    margin: 0 0 12px;
}
.filter-row + .filter-row { margin-top: -4px; }
.filter-row .flabel {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 52px;
}
.filter-row .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0;
}
.filter-row .chip,
.chips .chip {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.filter-row .chip.active,
.chips .chip.active {
    background: var(--accent-soft);
    color: var(--text);
    border-color: var(--accent);
}

.perf-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.perf-nav a {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.perf-nav a:hover {
    color: var(--text);
    border-color: var(--accent);
}
.perf-nav a.active {
    background: var(--accent-soft);
    color: var(--text);
    border-color: var(--accent);
}

.entity-panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: auto;
    max-height: min(720px, calc(100vh - 220px));
}
.entity-table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    width: max-content;
    min-width: 0;
}
.entity-table th,
.entity-table td {
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 8px 10px;
    white-space: nowrap;
    font-size: 12px;
    box-sizing: border-box;
}
.entity-table th {
    position: sticky;
    top: 0;
    background: var(--bg-muted);
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    z-index: 2;
}
.entity-table thead tr.avg-row th {
    top: 33px;
    background: #1e293b;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: 2px solid var(--border);
    z-index: 2;
}
.entity-table thead tr.avg-row th.entity-col {
    z-index: 5;
    background: #1e293b;
    color: var(--accent);
}
.entity-table .check-col {
    position: sticky;
    left: 0;
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    padding: 8px 6px;
    text-align: center;
    background: var(--bg-elevated);
    z-index: 3;
}
.entity-table th.check-col {
    z-index: 4;
    background: var(--bg-muted);
}
.entity-table thead tr.avg-row th.check-col {
    z-index: 5;
    background: #1e293b;
}
.entity-table .entity-col {
    position: sticky;
    left: 36px;
    background: var(--bg-elevated);
    z-index: 3;
    min-width: 180px;
    max-width: 220px;
    font-weight: 700;
    color: var(--text);
}
.entity-table th.entity-col {
    z-index: 4;
    background: var(--bg-muted);
}
.entity-table .cars-col {
    position: sticky;
    left: 236px;
    background: #151c27;
    z-index: 3;
    min-width: 140px;
    max-width: 200px;
    padding: 6px 8px;
    white-space: normal;
    vertical-align: middle;
}
.entity-table th.cars-col {
    z-index: 5;
    background: #1a2332;
    text-align: center;
    font-weight: 800;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
}
.entity-table thead tr.group-row th.cars-col {
    z-index: 6;
    background: #1a2332;
}
.entity-table thead tr.metric-row th.cars-col {
    z-index: 6;
    background: #1a2332;
}
.entity-table thead tr.target-row th.cars-col {
    z-index: 6;
    background: #1a2230;
    color: #fcd34d;
}
.entity-table thead tr.total-row th.cars-col {
    z-index: 6;
    background: #1e293b;
    color: var(--accent);
}
.entity-table tr:hover td.cars-col {
    background: #1a2332;
}
.entity-table tr.row-dimmed td.cars-col {
    opacity: 0.55;
    background: #151c27 !important;
}
.entity-table .car-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 2px 4px 2px 0;
    font-size: 11px;
    font-weight: 650;
    color: var(--text);
}
.entity-table .car-chip b {
    font-family: var(--font-mono);
    font-weight: 700;
}
.entity-table .car-chip .model-badge {
    font-size: 9px;
    padding: 1px 5px;
}
.entity-table .cars-empty {
    color: var(--text-muted);
}
.entity-table .row-check {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--accent);
}
.entity-sub {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
}
.entity-table .num {
    text-align: right;
    font-family: var(--font-mono);
    color: var(--text);
}
.entity-table td.metric-above {
    background: rgba(22, 163, 74, 0.55);
    color: #f0fdf4;
    font-weight: 700;
}
.entity-table td.metric-below {
    background: rgba(220, 38, 38, 0.55);
    color: #fef2f2;
    font-weight: 700;
}
.entity-table tr.row-dimmed td {
    opacity: 0.38;
    background: transparent !important;
    color: var(--text-muted) !important;
    font-weight: 500 !important;
}
.entity-table tr.row-dimmed td.check-col,
.entity-table tr.row-dimmed td.entity-col {
    opacity: 0.55;
    background: var(--bg-elevated) !important;
}
.entity-table tr.row-dimmed:hover td {
    opacity: 0.55;
    background: rgba(59, 130, 246, 0.04) !important;
}
.entity-table tr:hover td {
    background: rgba(59, 130, 246, 0.06);
}
.entity-table tr:hover td.metric-above {
    background: rgba(22, 163, 74, 0.7);
}
.entity-table tr:hover td.metric-below {
    background: rgba(220, 38, 38, 0.7);
}
.entity-table tr:hover td.entity-col,
.entity-table tr:hover td.check-col {
    background: #1a2332;
}
.entity-table th.sortable {
    cursor: pointer;
    user-select: none;
}
.entity-table th.sortable:hover {
    color: var(--text);
    background: #243044;
}
.entity-table .sort-ind {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.35;
    font-size: 10px;
}
.entity-table .sort-ind.active {
    opacity: 1;
    color: var(--accent);
}

/* Entity performance: grouped header, totals row, best / worst ranks */
.entity-table thead tr.group-row th {
    top: 0;
    height: 26px;
    box-sizing: border-box;
    padding: 4px 10px;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.entity-table thead tr.metric-row th {
    font-weight: 800;
    color: var(--text);
    white-space: normal;
    line-height: 1.2;
    vertical-align: top;
    text-align: center;
    text-transform: none;
    letter-spacing: 0;
    padding: 4px 6px 6px;
    overflow: visible;
}
.entity-table thead tr.metric-row th.metric-head {
    white-space: normal;
}
.entity-table thead tr.metric-row th.metric-head .metric-title {
    display: block;
    white-space: pre-line;
    overflow: visible;
    text-overflow: clip;
}
.entity-table thead tr.metric-row th.entity-col,
.entity-table thead tr.metric-row th.check-col {
    text-align: left;
    vertical-align: middle;
}
.entity-table thead tr.metric-row .sort-ind {
    display: block;
    margin: 1px auto 0;
    text-align: center;
    line-height: 1;
}
.entity-table tbody td.num,
.entity-table thead tr.target-row th.num,
.entity-table thead tr.total-row th.num {
    overflow: visible;
}
.entity-table thead tr.total-row th {
    background: #1e293b;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: 2px solid var(--accent);
}
.entity-table thead tr.total-row th.entity-col,
.entity-table thead tr.total-row th.check-col,
.entity-table thead tr.total-row th.cars-col {
    z-index: 6;
    background: #1e293b;
    color: var(--accent);
}
.entity-table thead tr.target-row th {
    background: #1a2230;
    color: #fcd34d;
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    padding: 5px 10px;
}
.entity-table thead tr.target-row th.entity-col,
.entity-table thead tr.target-row th.check-col,
.entity-table thead tr.target-row th.cars-col {
    z-index: 6;
    background: #1a2230;
    padding: 4px 10px;
}
.entity-table .target-sub {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 4px;
}
.entity-table .target-empty { color: #475569; }
.entity-table .target-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 11px;
    line-height: 1.2;
}
.entity-table .target-frac span:first-child {
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
    margin-bottom: 1px;
}
.entity-table th.group-head.g-summary { background: linear-gradient(rgba(100, 116, 139, 0.22), rgba(100, 116, 139, 0.22)), var(--bg-muted); }
.entity-table th.group-head.g-time { background: linear-gradient(rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.2)), var(--bg-muted); }
.entity-table th.group-head.g-orders { background: linear-gradient(rgba(14, 165, 233, 0.2), rgba(14, 165, 233, 0.2)), var(--bg-muted); }
.entity-table th.group-head.g-revenue { background: linear-gradient(rgba(34, 197, 94, 0.18), rgba(34, 197, 94, 0.18)), var(--bg-muted); }
.entity-table th.group-head.g-mileage { background: linear-gradient(rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.18)), var(--bg-muted); }
.entity-table th.group-head.g-consumption { background: linear-gradient(rgba(239, 68, 68, 0.18), rgba(239, 68, 68, 0.18)), var(--bg-muted); }
.entity-table .group-start { border-left: 2px solid #334155; }
.entity-table td.rank-best {
    background: rgba(34, 197, 94, 0.36);
    color: #bbf7d0;
    font-weight: 700;
}
.entity-table td.rank-worst {
    background: rgba(239, 68, 68, 0.34);
    color: #fecaca;
    font-weight: 700;
}
.entity-table tr:hover td.rank-best { background: rgba(34, 197, 94, 0.46); }
.entity-table tr:hover td.rank-worst { background: rgba(239, 68, 68, 0.44); }
.entity-table .low-sample {
    color: #fbbf24;
    font-weight: 600;
}
.entity-table .sort-ind {
    opacity: 1;
    color: var(--accent);
}

.shift-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}
.shift-filter .toggles-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 2px;
}
.shift-btn {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.shift-btn span {
    font-weight: 500;
    opacity: 0.7;
    margin-left: 4px;
}
.shift-btn.on {
    background: var(--accent);
    border-color: var(--accent);
    color: #0b1220;
}
.shift-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}
.shift-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.shift-badge.st-single { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.shift-badge.st-pair { background: rgba(168, 85, 247, 0.22); color: #d8b4fe; }
.shift-badge.st-mix { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.shift-badge.st-unplanned { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }
.shift-badge.st-model { background: rgba(34, 197, 94, 0.18); color: #86efac; text-transform: none; letter-spacing: 0; }
#model-filter { margin-top: -4px; }
.shift-badge.st-mix {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 8px;
}
.mix-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-size: 9px;
    line-height: 1.15;
    text-transform: none;
    letter-spacing: 0;
}
.mix-frac span:first-child {
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
    margin-bottom: 1px;
}

.leaders {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}
.leader-card {
    min-width: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 8px;
    font-size: 11px;
}
.leader-title {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.leader-fleet {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    margin: 2px 0 4px;
    white-space: nowrap;
    font-family: var(--font-mono);
}
.leader-fleet .lf-pre,
.leader-fleet .lf-unit {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: inherit;
}
.leader-fleet .lf-pre { margin-right: 5px; }
.leader-fleet .lf-unit { margin-left: 4px; }
.leader-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
}
.leader-cols.one { grid-template-columns: 1fr; }
.leader-col { min-width: 0; }
.leader-col + .leader-col {
    border-left: 1px solid var(--border);
    padding-left: 6px;
}
.leader-col-head {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}
.leader-line {
    display: flex;
    align-items: baseline;
    gap: 2px;
    font-size: 10.5px;
    white-space: nowrap;
    line-height: 1.6;
}
.leader-line .ll-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.leader-line .ll-sep { opacity: 0.6; }
.leader-line.best { color: #86efac; }
.leader-line.worst { color: #fca5a5; }
.leader-line b { font-family: var(--font-mono); flex: 0 0 auto; }

.group-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-left: auto;
}
.group-toggles .toggles-label {
    font-size: 12px;
    color: var(--text-muted);
}
.group-toggle {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    text-decoration: line-through;
}
.group-toggle.on {
    color: var(--text);
    border-color: var(--accent);
    text-decoration: none;
}

.metric-help {
    margin-top: 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-muted);
}
.metric-help summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
}
.metric-help .help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 8px 24px;
    margin-top: 10px;
}
.metric-help h4 {
    margin: 6px 0;
    color: var(--text);
    font-size: 12px;
}
.metric-help dl { margin: 0; }
.metric-help dt {
    color: var(--text);
    font-weight: 600;
    margin-top: 6px;
}
.metric-help dt .dir {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 6px;
}
.metric-help dd { margin: 2px 0 0; }
.metric-help .help-note { margin: 12px 0 2px; }

.selection-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.selection-bar button {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.selection-bar button:hover {
    color: var(--text);
    border-color: var(--accent);
}
.selection-bar .chip {
    font-size: 12px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
}

/* Targets modal */
.tm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(2, 6, 23, 0.7);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px;
    overflow: auto;
}
.tm-dialog {
    width: min(760px, 100%);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.tm-head {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}
.tm-head h3 { margin: 0; font-size: 16px; color: var(--text); }
.tm-head p { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.tm-x {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.tm-x:hover { color: var(--text); }
.tm-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 12px 16px;
    align-items: start;
}
.tm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tm-table th, .tm-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); }
.tm-table thead th {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: right;
}
.tm-table thead th:first-child, .tm-table tbody th { text-align: left; }
.tm-table tbody th { font-weight: 600; color: var(--text); white-space: nowrap; }
.tm-table td { text-align: right; width: 92px; }
.tm-table input {
    width: 84px;
    box-sizing: border-box;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #fcd34d;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    padding: 4px 6px;
}
.tm-table input:focus { outline: none; border-color: #fcd34d; }
.tm-table input.bad { border-color: #f87171; }
.tm-table input::placeholder { color: #475569; }
.tm-calc td { font-family: var(--font-mono); color: #fcd34d; font-weight: 700; }
.tm-calc .tm-none { color: #475569; font-weight: 400; }
.tm-foot {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--border);
}
.tm-foot .btn { height: 32px; font-size: 12px; }
.tm-err { margin-right: auto; font-size: 12px; color: #fca5a5; }
