/* ============ VESC Konfigurator ============
   PC: aufgebaut wie VESC Tool (Seitenliste links, Werkzeugleiste rechts,
   Statusleiste unten). Handy: wie die VESC-App (Reiter oben, Fußleiste
   mit Zahnrad, Verbindung und CAN). Farben aus VESC Tool (Utility::mAppColors). */

.vt {
	--vt-darkest: #272727;
	--vt-bg: #303030;
	--vt-light: #424242;
	--vt-lightest: #505050;
	--vt-text: #b4b4b4;
	--vt-text-hi: #dcdcdc;
	--vt-text-dis: #7f7f7f;
	--vt-accent: #81d4fa;
	--vt-accent-dark: #477589;
	--vt-red: #c83434;
	--vt-orange: #ce7d2c;
	--vt-yellow: #d2d27f;
	--vt-green: #7fc87f;
	--vt-blue: #4d7fc4;
	--vt-line: #3c3c3c;
	--vt-input: #272727;
	--vt-font: "Roboto", "Segoe UI", system-ui, sans-serif;

	position: fixed;
	inset: 0;
	display: grid;
	grid-template-columns: 236px minmax(0, 1fr) 50px;
	grid-template-rows: 44px minmax(0, 1fr) 30px;
	grid-template-areas:
		"top top top"
		"side main tools"
		"status status status";
	font-family: var(--vt-font);
	font-size: 14px;
	color: var(--vt-text);
	background: var(--vt-bg);
	overflow: hidden;
}

/* Die Seite hat keinen eigenen Cursor, also den normalen zurück */
@media (hover: hover) and (pointer: fine) {
	body.vt-body, body.vt-body a, body.vt-body button, body.vt-body label, body.vt-body summary { cursor: pointer; }
	body.vt-body { cursor: default; }
	body.vt-body input, body.vt-body textarea { cursor: text; }
	body.vt-body select { cursor: pointer; }
}

body.vt-body { background: #303030; overflow: hidden; }

.vt button { font-family: inherit; }
.vt .mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.vt a { color: var(--vt-accent); }

/* ---- Titelleiste ---- */
.vt-top {
	grid-area: top;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 12px;
	background: var(--vt-lightest);
	border-bottom: 1px solid var(--vt-darkest);
}

.vt-back {
	padding: 5px 10px;
	font-size: 13px;
	color: var(--vt-text-hi) !important;
	text-decoration: none;
	border-radius: 4px;
}

.vt-back:hover { background: rgba(255, 255, 255, 0.08); }

.vt-brand { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--vt-text-hi); }
.vt-brand svg { width: 18px; height: 18px; color: var(--vt-accent); }
.vt-brand-sub { font-size: 11px; color: var(--vt-text-dis); }

.vt-beta {
	display: inline-block;
	padding: 1px 7px;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	vertical-align: 2px;
	color: #272727;
	background: var(--vt-yellow);
	border-radius: 3px;
}

.vt-beta-note {
	margin: 14px 0 0;
	padding: 9px 12px;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--vt-text-hi);
	background: rgba(210, 210, 127, 0.1);
	border-left: 3px solid var(--vt-yellow);
	border-radius: 3px;
}

.vt-fw { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--vt-text-hi); }
.vt-fw select { width: auto; min-width: 150px; }
.vt-top .vt-fw { margin-left: auto; }
.vt-fw-start { display: none; margin-top: 14px; }
.vt-fw-start span { flex: none; }
.vt-fw-start select { flex: 1; }

.vt-search {
	display: flex;
	align-items: center;
	gap: 6px;
	width: min(320px, 40vw);
	padding: 0 10px;
	background: var(--vt-darkest);
	border: 1px solid var(--vt-line);
	border-radius: 4px;
}

.vt-search svg { width: 15px; height: 15px; flex: none; color: var(--vt-text-dis); }
.vt-search input { width: 100%; padding: 6px 0; font: inherit; font-size: 13px; color: var(--vt-text-hi); background: none; border: 0; outline: none; }

/* ---- Seitenliste ---- */
.vt-side {
	grid-area: side;
	overflow-y: auto;
	padding: 6px 0;
	background: var(--vt-darkest);
	border-right: 1px solid #1d1d1d;
}

.vt-nav-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 7px 12px;
	font-size: 13.5px;
	text-align: left;
	color: var(--vt-text);
	background: none;
	border: 0;
	border-left: 3px solid transparent;
}

.vt-nav-item svg { width: 18px; height: 18px; flex: none; color: var(--vt-text-dis); }
.vt-nav-item:hover { color: var(--vt-text-hi); background: rgba(255, 255, 255, 0.04); }
.vt-nav-item.active { color: var(--vt-text-hi); background: var(--vt-light); border-left-color: var(--vt-accent); }
.vt-nav-item.active svg { color: var(--vt-accent); }
.vt-nav-item.sub { padding-left: 40px; font-size: 13px; }
.vt-nav-item.head { margin-top: 6px; font-weight: 500; color: var(--vt-text-hi); }
.vt-nav-item[aria-disabled="true"] { color: var(--vt-text-dis); }

/* ---- Hauptbereich ---- */
.vt-main {
	grid-area: main;
	position: relative;
	overflow-y: auto;
	padding: 20px 24px 40px;
	background: var(--vt-bg);
}

.vt-page { display: none; max-width: 980px; }
.vt-page.active { display: block; }

.vt-h1 { margin: 0 0 16px; font-size: 20px; font-weight: 500; color: var(--vt-text-hi); }
.vt-h2 { margin: 0 0 10px; font-size: 15px; font-weight: 500; color: var(--vt-text-hi); }
.vt-h3 { margin: 14px 0 6px; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.6px; color: var(--vt-text-dis); }
.vt-h2-icon { display: flex; align-items: center; gap: 8px; }
.vt-h2-icon svg { width: 18px; height: 18px; color: var(--vt-accent); }

.vt-card {
	padding: 16px;
	margin-bottom: 14px;
	background: var(--vt-light);
	border: 1px solid var(--vt-lightest);
	border-radius: 6px;
}

.vt-note { margin: 0 0 10px; font-size: 12.5px; line-height: 1.55; color: var(--vt-text); }
.vt-legal { margin-top: 18px; font-size: 11px; line-height: 1.6; color: var(--vt-text-dis); }
.vt-legal a { color: inherit; }

/* Knöpfe und Felder */
.vt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 500;
	color: var(--vt-text-hi);
	background: var(--vt-lightest);
	border: 1px solid #5c5c5c;
	border-radius: 4px;
}

.vt-btn svg { width: 16px; height: 16px; }
.vt-btn:hover:not(:disabled) { background: #5a5a5a; }
.vt-btn:disabled { color: var(--vt-text-dis); opacity: 0.6; cursor: not-allowed; }
.vt-btn-accent { color: #10232c; background: var(--vt-accent); border-color: var(--vt-accent); }
.vt-btn-accent:hover:not(:disabled) { background: #a6e1fc; }
.vt-btn-big { width: 100%; padding: 12px; font-size: 14px; }
.vt-btnrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.vt-input {
	width: 100%;
	min-width: 0;
	padding: 7px 9px;
	font: inherit;
	font-size: 13.5px;
	color: var(--vt-text-hi);
	background: var(--vt-input);
	border: 1px solid var(--vt-lightest);
	border-radius: 3px;
}

.vt-input:focus { outline: none; border-color: var(--vt-accent); }
.vt-input option { color: #000; }
.vt-input:disabled { opacity: 0.6; }
.vt-input-sm { width: auto; padding: 5px 7px; }
.vt-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }

.vt-check { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 13px; color: var(--vt-text-hi); }
.vt-check input { width: 16px; height: 16px; accent-color: var(--vt-accent); }

.vt-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--vt-text-dis); }
.is-ok .vt-dot { background: var(--vt-green); }
.is-busy .vt-dot { background: var(--vt-yellow); animation: pulse 1.4s ease-in-out infinite; }
.is-warn .vt-dot { background: var(--vt-orange); }
.is-error .vt-dot { background: var(--vt-red); }

.vt-msg {
	position: sticky;
	bottom: 0;
	z-index: 5;
	margin: 14px 0 0;
	padding: 10px 14px;
	font-size: 13px;
	line-height: 1.5;
	background: var(--vt-light);
	border: 1px solid var(--vt-lightest);
	border-left: 4px solid var(--vt-text-dis);
	border-radius: 4px;
	box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.25);
}

.vt-msg.is-ok { border-left-color: var(--vt-green); }
.vt-msg.is-warn { border-left-color: var(--vt-orange); }
.vt-msg.is-error { border-left-color: var(--vt-red); }
.vt-msg:empty { display: none; }
.vt-msg.is-ok { color: var(--vt-green); }
.vt-msg.is-warn { color: var(--vt-orange); }
.vt-msg.is-error { color: #e06666; }

/* ---- Start ---- */
.vt-welcome-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.vt-welcome-head strong { color: var(--vt-text-hi); font-weight: 500; font-size: 15px; }
.vt-welcome-head p { margin: 4px 0 0; font-size: 12.5px; }

.vt-logo {
	width: 52px; height: 52px;
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--vt-accent);
	background: var(--vt-darkest);
	border-radius: 10px;
}

.vt-logo svg { width: 28px; height: 28px; }
.vt-welcome .vt-btn { flex: 1 1 150px; padding: 11px; }
.vt-welcome .vt-note { margin: 12px 0 0; }

.vt-wizards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }

.vt-wiz {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	padding: 16px;
	text-align: left;
	color: var(--vt-text);
	background: var(--vt-light);
	border: 1px solid var(--vt-lightest);
	border-radius: 6px;
}

.vt-wiz:hover { border-color: var(--vt-accent-dark); background: #474747; }
.vt-wiz svg { width: 26px; height: 26px; color: var(--vt-accent); }
.vt-wiz strong { font-weight: 500; color: var(--vt-text-hi); }
.vt-wiz span { font-size: 12px; line-height: 1.45; }

/* ---- Verbindung ---- */
.vt-conn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.vt-conn-grid .vt-card { margin-bottom: 0; }
.vt-conn-grid + .vt-card { margin-top: 14px; }
.vt-connstate { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 14px; color: var(--vt-text-hi); }
.vt-connstate + .vt-btn { margin-top: 12px; }

.vt-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--vt-lightest); border-radius: 4px; }
.vt-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 13px; }
.vt-list li + li { border-top: 1px solid var(--vt-lightest); }
.vt-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.vt-list li small { display: block; font-size: 11px; color: var(--vt-text-dis); }
.vt-list li.active { background: rgba(129, 212, 250, 0.08); }
.vt-list .vt-btn { padding: 5px 10px; font-size: 12px; }
.vt-empty { color: var(--vt-text-dis); }

/* ---- Konfigurationsseiten ---- */
.vt-conf-head { display: flex; align-items: center; gap: 12px; }
.vt-conf-head .vt-h1 { margin-bottom: 12px; }
#confGroup { display: none; }

.vt-subtabs {
	display: flex;
	gap: 2px;
	margin-bottom: 12px;
	overflow-x: auto;
	border-bottom: 1px solid var(--vt-lightest);
	scrollbar-width: thin;
}

.vt-subtab {
	flex: none;
	padding: 8px 14px;
	font-size: 13px;
	color: var(--vt-text);
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
}

.vt-subtab:hover { color: var(--vt-text-hi); }
.vt-subtab.active { color: var(--vt-accent); border-bottom-color: var(--vt-accent); }

.vt-group { margin-bottom: 18px; }
.vt-group-title { margin: 0 0 4px; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.6px; color: var(--vt-accent); }
.vt-sep { margin: 14px 0 4px; padding-bottom: 4px; font-size: 12.5px; font-weight: 500; color: var(--vt-text-hi); border-bottom: 1px solid var(--vt-lightest); }

.vt-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(160px, 260px) 26px;
	align-items: center;
	gap: 4px 10px;
	padding: 6px 8px;
	border-radius: 3px;
}

.vt-row:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.vt-row.changed { background: rgba(206, 125, 44, 0.16); }
.vt-row.changed .vt-label::before { content: "● "; color: var(--vt-orange); font-size: 10px; vertical-align: 1px; }

.vt-label { font-size: 13.5px; line-height: 1.35; color: var(--vt-text-hi); }
.vt-pname { display: block; font-size: 10.5px; color: var(--vt-text-dis); font-family: "JetBrains Mono", ui-monospace, monospace; }
.vt-ctl { display: flex; align-items: center; gap: 7px; }
.vt-suf { flex: none; min-width: 26px; font-size: 12px; color: var(--vt-text-dis); white-space: nowrap; }
.vt-row .vt-ctl input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--vt-accent); }

.vt-info {
	width: 24px; height: 24px;
	font-size: 12px;
	font-weight: 700;
	color: var(--vt-text);
	background: var(--vt-lightest);
	border: 0;
	border-radius: 50%;
}

.vt-info:hover { color: #10232c; background: var(--vt-accent); }

.vt-desc {
	grid-column: 1 / -1;
	margin: 4px 0;
	padding: 9px 11px;
	font-size: 12.5px;
	line-height: 1.6;
	white-space: pre-line;
	color: var(--vt-text);
	background: var(--vt-darkest);
	border-left: 3px solid var(--vt-accent-dark);
}

.vt-bits { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.vt-bit { display: flex; gap: 6px; align-items: center; }
.vt-calc { margin: 8px 0 0; font-size: 12.5px; color: var(--vt-accent); }
.vt-calc:empty { display: none; }

/* ---- Assistent ---- */
.vt-step-title { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-size: 15px; font-weight: 500; color: var(--vt-text-hi); }

.vt-num {
	width: 22px; height: 22px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	color: #10232c;
	background: var(--vt-accent);
	border-radius: 50%;
}

.vt-motors { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.vt-motor { position: relative; }
.vt-motor input { position: absolute; opacity: 0; pointer-events: none; }

.vt-motor-box {
	display: flex;
	flex-direction: column;
	gap: 3px;
	height: 100%;
	padding: 10px 12px;
	font-size: 13px;
	color: var(--vt-text-hi);
	background: var(--vt-bg);
	border: 1px solid var(--vt-lightest);
	border-radius: 4px;
}

.vt-motor-box span { font-size: 11.5px; color: var(--vt-text-dis); }
.vt-motor:hover .vt-motor-box { border-color: var(--vt-accent-dark); }
.vt-motor input:checked + .vt-motor-box { background: rgba(129, 212, 250, 0.12); border-color: var(--vt-accent); }
.vt-motor input:focus-visible + .vt-motor-box { outline: 2px solid var(--vt-accent); outline-offset: 2px; }

.vt-warn { margin: 10px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--vt-yellow); }
.vt-warn-strong { margin: 0 0 12px; padding: 10px 12px; color: #f2c4c4; background: rgba(200, 52, 52, 0.15); border: 1px solid rgba(200, 52, 52, 0.5); border-radius: 4px; }

.vt-adv { margin-top: 10px; }
.vt-adv summary { font-size: 13px; color: var(--vt-text); }
.vt-adv[open] summary { margin-bottom: 10px; }

.vt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; align-items: start; }
.vt-field label { display: block; margin-bottom: 5px; font-size: 12.5px; color: var(--vt-text-hi); }
.vt-field .vt-note { margin: 4px 0 0; font-size: 11.5px; color: var(--vt-text-dis); }
.vt-grid .vt-check { align-self: end; margin: 0 0 8px; }

.vt-progress { height: 6px; margin-top: 14px; overflow: hidden; background: var(--vt-darkest); border-radius: 3px; }
.vt-progress div { width: 35%; height: 100%; background: var(--vt-accent); animation: vt-indef 1.4s ease-in-out infinite; }
@keyframes vt-indef { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

.vt-steps-log { margin: 14px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.8; }
.vt-steps-log:empty { display: none; }
.vt-steps-log .is-ok { color: var(--vt-green); }
.vt-steps-log .is-error { color: #e06666; }

.vt-result { margin-top: 14px; padding: 14px 16px; font-size: 13px; background: rgba(127, 200, 127, 0.08); border: 1px solid rgba(127, 200, 127, 0.45); border-radius: 4px; }
.vt-result strong { color: var(--vt-green); font-weight: 500; }
.vt-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 13px; }
.vt-table th { padding: 4px 10px 4px 0; text-align: left; font-weight: 400; color: var(--vt-text); }
.vt-table td { padding: 4px 0; text-align: right; color: var(--vt-text-hi); }
.vt-table tr + tr { border-top: 1px solid var(--vt-lightest); }

/* ---- Echtzeit ---- */
.vt-live { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }

.vt-tile {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 10px 12px;
	background: var(--vt-light);
	border: 1px solid var(--vt-lightest);
	border-radius: 4px;
}

.vt-tile-label { font-size: 11.5px; color: var(--vt-text); }
.vt-tile-val { font-size: 19px; color: var(--vt-text-hi); font-family: "JetBrains Mono", ui-monospace, monospace; }
.vt-tile.is-fault { border-color: var(--vt-red); }
.vt-tile.is-fault .vt-tile-val { font-size: 14px; color: #e06666; }

.vt-chart-card { padding: 10px 12px; }
.vt-chart-card canvas { display: block; width: 100%; height: 220px; }
.vt-chart-legend { display: flex; gap: 16px; margin-bottom: 6px; font-size: 12px; }
.vt-chart-legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: middle; }
.vt-chart-legend .c1::before { background: var(--vt-blue); }
.vt-chart-legend .c2::before { background: var(--vt-red); }
.vt-chart-legend .c3::before { background: var(--vt-green); }

/* ---- Terminal und Konsole ---- */
.vt-term {
	min-height: 240px;
	max-height: calc(100dvh - 300px);
	margin: 0 0 10px;
	padding: 10px 12px;
	overflow: auto;
	font-size: 12.5px;
	line-height: 1.5;
	white-space: pre-wrap;
	word-break: break-word;
	color: var(--vt-text-hi);
	background: var(--vt-darkest);
	border: 1px solid var(--vt-lightest);
	border-radius: 4px;
}

.vt-term:empty::before { content: "Noch nichts."; color: var(--vt-text-dis); }
.vt-term-row { display: flex; gap: 8px; margin-bottom: 10px; }
.vt-term-quick .vt-btn { padding: 6px 10px; font-size: 12px; font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ---- Ohne Verbindung ---- */
.vt-offline { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 420px; margin: 60px auto; text-align: center; }
.vt-offline svg { width: 54px; height: 54px; color: var(--vt-text-dis); }
.vt-offline strong { font-size: 17px; font-weight: 500; color: var(--vt-text-hi); }
.vt-offline p { margin: 0 0 8px; font-size: 13px; }

/* ---- Werkzeugleiste rechts ---- */
.vt-tools {
	grid-area: tools;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 8px 0;
	background: var(--vt-light);
	border-left: 1px solid var(--vt-darkest);
}

.vt-tools button {
	position: relative;
	width: 38px; height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--vt-text-hi);
	background: none;
	border: 1px solid transparent;
	border-radius: 4px;
}

.vt-tools button svg { width: 20px; height: 20px; }
.vt-tools button:hover:not(:disabled) { background: var(--vt-lightest); border-color: #5c5c5c; }
.vt-tools button:disabled { color: var(--vt-text-dis); opacity: 0.45; cursor: not-allowed; }
.vt-tools-sep { width: 28px; height: 1px; margin: 4px 0; background: var(--vt-lightest); }

/* "M↓", "A↑" wie die Knöpfe in VESC Tool */
.vt-tl b { font-size: 17px; font-weight: 700; color: var(--vt-text-hi); }
.vt-tl i { position: absolute; right: 4px; bottom: 2px; font-style: normal; font-size: 14px; font-weight: 700; color: var(--vt-green); }
.vt-tl-w i { color: var(--vt-orange); }
.vt-tl em { position: absolute; left: 4px; top: 2px; font-style: normal; font-size: 9px; font-weight: 700; color: var(--vt-accent); }
.vt-tl.dirty { background: rgba(206, 125, 44, 0.22); border-color: var(--vt-orange); }
.vt-tl .vt-badge { position: absolute; top: -4px; right: -4px; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; color: #fff; background: var(--vt-orange); border-radius: 8px; }

/* ---- Statusleiste ---- */
.vt-status {
	grid-area: status;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 0 10px;
	font-size: 12px;
	background: var(--vt-light);
	border-top: 1px solid var(--vt-darkest);
}

.vt-st-conn { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0; font-size: 12px; color: var(--vt-text-hi); background: none; border: 0; }
.vt-st-conn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-st-fw { margin-left: auto; color: var(--vt-text-dis); white-space: nowrap; }
.vt-foot-btn { display: flex; align-items: center; gap: 6px; padding: 4px 6px; font-size: 12px; color: var(--vt-text-hi); background: none; border: 0; border-radius: 4px; }
.vt-foot-btn svg { width: 17px; height: 17px; }
.vt-foot-btn:hover { background: rgba(255, 255, 255, 0.06); }
#btnDrawer { display: none; }
.vt-st-can.is-fwd { color: var(--vt-accent); }

/* ---- Handy-Teile, am PC aus ---- */
.vt-tabbar, .vt-mobile-actions, .vt-drawer, .vt-scrim { display: none; }

/* ================= Handy: wie die VESC-App ================= */
@media (max-width: 899px) {
	.vt {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto minmax(0, 1fr) calc(40px + env(safe-area-inset-bottom));
		grid-template-areas: "tabs" "main" "status";
	}

	.vt-top, .vt-side, .vt-tools, .vt-st-fw { display: none; }
	.vt-fw-start { display: flex; }

	.vt-tabbar {
		grid-area: tabs;
		display: flex;
		overflow-x: auto;
		padding-top: env(safe-area-inset-top);
		background: var(--vt-light);
		box-shadow: inset 0 -1px var(--vt-darkest);
		scrollbar-width: none;
	}

	.vt-tabbar::-webkit-scrollbar { display: none; }

	.vt-tabbar button {
		flex: 1 0 auto;
		min-width: 76px;
		padding: 13px 10px 11px;
		font-size: 14px;
		color: var(--vt-text);
		background: none;
		border: 0;
		border-bottom: 2px solid transparent;
	}

	.vt-tabbar button.active { color: var(--vt-accent); border-bottom-color: var(--vt-accent); }

	.vt-main { padding: 14px 12px 20px; background: var(--vt-darkest); }
	.vt-h1 { font-size: 18px; }
	.vt-card { padding: 14px 12px; border-radius: 6px; }
	.vt-conn-grid { grid-template-columns: 1fr; }
	.vt-conn-grid .vt-card { margin-bottom: 0; }

	/* Gruppe per Auswahl oben, wie die Combobox in der App */
	.vt-conf-head { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 4px; }
	.vt-conf-head .vt-h1 { display: none; }
	#confGroup { display: block; font-size: 15px; padding: 10px; }

	.vt-row {
		grid-template-columns: minmax(0, 1fr) 30px;
		gap: 6px 8px;
		padding: 12px;
		margin-bottom: 6px;
		background: var(--vt-light) !important;
		border-radius: 6px;
	}

	.vt-row.changed { box-shadow: inset 3px 0 var(--vt-orange); }
	.vt-row .vt-ctl { grid-column: 1 / -1; grid-row: 2; }
	.vt-row .vt-info { grid-row: 1; grid-column: 2; width: 28px; height: 28px; }
	.vt-row .vt-input { padding: 10px; font-size: 15px; }

	.vt-mobile-actions {
		position: sticky;
		bottom: -20px;
		z-index: 10;
		gap: 8px;
		margin: 12px -12px -20px;
		padding: 10px 12px;
		background: var(--vt-light);
		border-top: 1px solid var(--vt-lightest);
	}

	.vt-main.show-actions .vt-mobile-actions { display: flex; }
	.vt-main.show-actions .vt-msg { bottom: 50px; }
	.vt-mobile-actions .vt-btn { flex: 1; padding: 11px 6px; }

	.vt-status {
		gap: 6px;
		padding: 0 6px env(safe-area-inset-bottom);
		font-size: 13px;
		background: var(--vt-light);
		box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
	}

	#btnDrawer { display: flex; }
	.vt-st-conn { flex: 1; justify-content: center; font-size: 13px; }
	.vt-st-can span { display: none; }

	.vt-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.55); }

	.vt-drawer:not([hidden]) {
		display: flex;
		flex-direction: column;
		position: fixed;
		top: 0; bottom: 0; left: 0;
		z-index: 41;
		width: min(290px, 82vw);
		padding: env(safe-area-inset-top) 0 0;
		background: var(--vt-bg);
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
		animation: vt-drawer 0.2s ease-out;
	}

	@keyframes vt-drawer { from { transform: translateX(-100%); } to { transform: none; } }

	.vt-drawer-head { padding: 22px 18px 16px; font-size: 17px; font-weight: 500; color: var(--vt-text-hi); background: var(--vt-light); }

	.vt-drawer button, .vt-drawer a {
		padding: 14px 18px;
		font-size: 15px;
		text-align: left;
		text-decoration: none;
		color: var(--vt-text-hi) !important;
		background: none;
		border: 0;
		border-bottom: 1px solid var(--vt-line);
	}

	.vt-term { max-height: calc(100dvh - 330px); }
	.vt-live { grid-template-columns: 1fr 1fr; }
}

/* ================= Legacy (XP) ================= */
html.theme-xp .vt {
	--vt-darkest: #ffffff;
	--vt-bg: #ece9d8;
	--vt-light: #ffffff;
	--vt-lightest: #c9c7ba;
	--vt-text: #222;
	--vt-text-hi: #000;
	--vt-text-dis: #6b6b6b;
	--vt-accent: #316ac5;
	--vt-accent-dark: #7f9db9;
	--vt-line: #d6d3c4;
	--vt-input: #ffffff;
	--vt-font: Tahoma, "Segoe UI", Verdana, sans-serif;
	bottom: 34px; /* über der Taskleiste */
}

html.theme-xp body.vt-body { background: #ece9d8; }
html.theme-xp .vt-top { color: #fff; background: linear-gradient(180deg, #0997ff, #0053ee 8%, #0050ee 40%, #0066ff 88%, #005bff 95%, #003dd7); border-bottom: 0; }
html.theme-xp .vt-brand, html.theme-xp .vt-back { color: #fff !important; text-shadow: 1px 1px #0f1089; font-weight: 700; }
html.theme-xp .vt-brand svg { color: #fff; }
html.theme-xp .vt-brand-sub { color: #cfe0ff; text-shadow: none; }
html.theme-xp .vt-top .vt-fw { color: #fff; }
html.theme-xp .vt-search { background: #fff; border: 1px solid #7f9db9; border-radius: 0; }

/* Seitenliste wie der blaue Aufgabenbereich im Explorer */
html.theme-xp .vt-side { padding: 10px; background: linear-gradient(180deg, #7ba2e7, #6375d6); border-right: 0; }
html.theme-xp .vt-nav-item { color: #215dc6; background: #d6dff7; border-left: 0; }
html.theme-xp .vt-nav-item svg { color: #215dc6; }
html.theme-xp .vt-nav-item:hover { color: #428eff; text-decoration: underline; background: #d6dff7; }
html.theme-xp .vt-nav-item.head { margin-top: 10px; color: #fff; font-weight: 700; background: linear-gradient(90deg, #0c32a8, #2e6be0); border-radius: 3px 3px 0 0; }
html.theme-xp .vt-nav-item.head svg { color: #fff; }
html.theme-xp .vt-nav-item.active { color: #fff; font-weight: 700; background: #316ac5; text-decoration: none; }
html.theme-xp .vt-nav-item.active svg { color: #fff; }

html.theme-xp .vt-main { background: #ece9d8; }
html.theme-xp .vt-card, html.theme-xp .vt-wiz, html.theme-xp .vt-tile { background: #fff; border-color: #7f9db9; border-radius: 0; }
html.theme-xp .vt-wiz:hover { background: #f3f6fd; border-color: #316ac5; }

html.theme-xp .vt-btn {
	color: #000;
	font: 12px Tahoma, sans-serif;
	background: linear-gradient(180deg, #ffffff, #ece9d8 86%, #d6d0c5);
	border: 1px solid #003c74;
	border-radius: 3px;
}

html.theme-xp .vt-btn-accent { box-shadow: inset 0 0 0 1px #6c8fe4; }
html.theme-xp .vt-btn:hover:not(:disabled) { background: linear-gradient(180deg, #ffffff, #ece9d8 86%, #d6d0c5); box-shadow: inset -1px 1px #fff0cf, inset 1px 2px #fdd889, inset -2px 2px #fbc761, inset 2px -2px #e5a01a; }
html.theme-xp .vt-input { border-color: #7f9db9; border-radius: 0; }

html.theme-xp .vt-subtabs { border-bottom-color: #919b9c; }
html.theme-xp .vt-subtab { margin-bottom: -1px; color: #000; background: linear-gradient(180deg, #fff, #ecebe5); border: 1px solid #919b9c; border-bottom: 0; border-radius: 3px 3px 0 0; }
html.theme-xp .vt-subtab.active { color: #000; background: #fcfcfe; border-top: 3px solid #e68b2c; }

html.theme-xp .vt-row:nth-child(even) { background: #f7f6f0; }
html.theme-xp .vt-row.changed { background: #ffffe1; }
html.theme-xp .vt-info { color: #000; background: linear-gradient(180deg, #ffffff, #ece9d8 86%, #d6d0c5); border: 1px solid #003c74; }
html.theme-xp .vt-desc { background: #ffffe1; border: 1px solid #000; }
html.theme-xp .vt-term { color: #c0c0c0; background: #000; font-family: "Lucida Console", monospace; }
html.theme-xp .vt-num { color: #fff; background: #316ac5; }
html.theme-xp .vt-motor-box { background: #fff; border-color: #7f9db9; border-radius: 0; }
html.theme-xp .vt-motor input:checked + .vt-motor-box { color: #fff; background: #316ac5; border-color: #0a246a; }
html.theme-xp .vt-motor input:checked + .vt-motor-box span { color: #e6eefc; }
html.theme-xp .vt-warn { color: #8a5a00; }
html.theme-xp .vt-warn-strong { color: #000; background: #ffffe1; border-color: #000; }
html.theme-xp .vt-progress { height: 16px; padding: 2px; background: #fff; border: 1px solid #686868; }
html.theme-xp .vt-progress div { background: repeating-linear-gradient(90deg, #2fb52f 0 8px, transparent 8px 10px); }
html.theme-xp .vt-steps-log .is-ok, html.theme-xp .vt-msg.is-ok, html.theme-xp .vt-result strong { color: #1c7a1c; }
html.theme-xp .vt-result { background: #fff; border-color: #2e9e2e; }
html.theme-xp .vt-msg.is-error, html.theme-xp .vt-steps-log .is-error { color: #c00000; }
html.theme-xp .vt-msg.is-warn { color: #8a5a00; }

html.theme-xp .vt-tools { background: #ece9d8; border-left: 1px solid #c9c7ba; }
html.theme-xp .vt-tools button:hover:not(:disabled) { background: #fff; border-color: #7f9db9; }
html.theme-xp .vt-status { color: #000; background: #ece9d8; border-top: 1px solid #c9c7ba; }
html.theme-xp .vt-st-conn, html.theme-xp .vt-foot-btn { color: #000; }

@media (max-width: 899px) {
	html.theme-xp .vt-tabbar { background: #ece9d8; }
	html.theme-xp .vt-tabbar button { color: #000; font-family: Tahoma, sans-serif; }
	html.theme-xp .vt-tabbar button.active { color: #000; background: #fcfcfe; border-bottom: 0; box-shadow: inset 0 3px #e68b2c; }
	html.theme-xp .vt-main { background: #ece9d8; }
	html.theme-xp .vt-row { background: #fff !important; border: 1px solid #c9c7ba; border-radius: 0; }
	html.theme-xp .vt-mobile-actions { background: #ece9d8; }
	html.theme-xp .vt-drawer:not([hidden]) { background: #fff; }
	html.theme-xp .vt-drawer-head { color: #fff; background: linear-gradient(180deg, #0997ff, #0053ee 8%, #0050ee 40%, #0066ff 88%, #003dd7); }
}

html.theme-xp .vt-search input { border: 0; background: none; box-shadow: none; }

html.theme-xp .vt-beta { color: #000; background: #ffd84d; border: 1px solid #b38f00; text-shadow: none; }
html.theme-xp .vt-beta-note { color: #000; background: #ffffe1; border: 1px solid #000; border-left-width: 3px; }

/* ---- Firmware ---- */
.vt-fwinfo { margin-top: 12px; }
.vt-fwinfo table { width: 100%; border-collapse: collapse; font-size: 13px; }
.vt-fwinfo th { padding: 4px 10px 4px 0; text-align: left; font-weight: 400; color: var(--vt-text); white-space: nowrap; }
.vt-fwinfo td { padding: 4px 0; color: var(--vt-text-hi); word-break: break-all; }
.vt-fwinfo tr + tr { border-top: 1px solid var(--vt-lightest); }
.vt-fwinfo .ok { color: var(--vt-green); }
.vt-fwinfo .bad { color: #e06666; }
.vt-fw-cancel { margin-top: 8px; }
.vt-fwprog { height: 10px; margin-top: 14px; overflow: hidden; background: var(--vt-darkest); border-radius: 5px; }
.vt-fwprog div { width: 0; height: 100%; background: var(--vt-accent); transition: width 0.2s ease; }
.vt-list li.disabled span { color: var(--vt-text-dis); }
.vt-list .vt-pick { padding: 5px 10px; font-size: 12px; }
.vt-note code { padding: 1px 5px; font-size: 12px; background: var(--vt-darkest); border-radius: 3px; }

html.theme-xp .vt-fwprog { height: 16px; padding: 2px; background: #fff; border: 1px solid #686868; border-radius: 3px; }
html.theme-xp .vt-fwprog div { background: repeating-linear-gradient(90deg, #2fb52f 0 8px, transparent 8px 10px); }
html.theme-xp .vt-fwinfo .ok { color: #1c7a1c; }
html.theme-xp .vt-fwinfo .bad { color: #c00000; }

/* hidden gewinnt immer, auch gegen display:flex von .vt-btnrow usw. */
.vt [hidden] { display: none !important; }

/* ---- Echtzeit: Wischen zwischen Tachos und Werten ---- */
.vt-page.vt-live-page.active { display: flex; flex-direction: column; height: 100%; max-width: none; }
.vt-live-head { display: flex; align-items: center; gap: 14px; }
.vt-live-head .vt-h1 { margin-bottom: 10px; }
.vt-dots { display: flex; gap: 8px; margin: 0 auto 10px; }
.vt-dots button { width: 9px; height: 9px; padding: 0; background: var(--vt-text-dis); border: 0; border-radius: 50%; opacity: 0.6; }
.vt-dots button.active { background: var(--vt-text-hi); opacity: 1; }

.vt-swipe {
	flex: 1;
	min-height: 0;
	display: flex;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	touch-action: pan-x pan-y;
}

.vt-swipe::-webkit-scrollbar { display: none; }
.vt-swipe.dragging { scroll-snap-type: none; scroll-behavior: auto; cursor: grabbing; }
.vt-swipe-page { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto; }
.vt-dash-page { position: relative; overflow: hidden; background: var(--vt-darkest); border-radius: 6px; }
.vt-dash-page canvas { display: block; width: 100%; height: 100%; }
.vt-values-page { padding-left: 2px; }

@media (max-width: 899px) {
	.vt-live-head .vt-h1 { display: none; }
	.vt-dots { margin: 2px auto 10px; }
	.vt-main:has(.vt-live-page.active) { padding: 8px 8px 8px; }
	.vt-dash-page { border-radius: 0; }
}

html.theme-xp .vt-dash-page { background: #272727; border: 2px inset #c9c7ba; }
html.theme-xp .vt-dots button { background: #7f9db9; }
html.theme-xp .vt-dots button.active { background: #316ac5; }
