:root {
  --bg: #121212;
  --card-bg: #232425;
  --header-bg: #1a1a1a;
  --accent: #a2e014; /* Neon Lime Green */
  --accent-rgb: 162, 224, 20;
  --ink: #ffffff;
  --muted: #888888;
  --line: #333333;
  --danger: #ff4444;
  --font: "Inter", "Roboto", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  text-transform: uppercase;
}

/* ---------- LOGIN PAGE ---------- */
.login-body {
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #1a1b1c 0%, #0a0a0a 100%);
  text-transform: none; /* Login shouldn't be all caps usually, but we'll follow theme */
}

.login-card {
  background: #1e1e1e;
  border: 1px solid var(--line);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  border-radius: 4px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.login-card .eyebrow {
  color: var(--accent);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 2px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 0 0 10px 0;
  font-size: 28px;
  font-weight: 900;
}

.login-card .muted {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 30px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#login-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

#login-form input {
  background: #121212;
  border: 1px solid var(--line);
  color: #fff;
  padding: 12px;
  border-radius: 2px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

#login-form input:focus {
  border-color: var(--accent);
}

#login-form button {
  background: var(--accent);
  color: #000;
  font-weight: 900;
  padding: 14px;
  border-radius: 2px;
  font-size: 14px;
  text-transform: uppercase;
  margin-top: 10px;
  transition: all 0.2s;
}

#login-form button:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.3);
}

#login-form button:active {
  transform: translateY(1px);
}

#login-error {
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  margin: 0;
}

button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

/* ---------- MODAL OVERLAY ---------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-overlay[hidden] { display: none; }

.modal-content {
  background: #1e1e1e;
  border: 1px solid var(--accent);
  width: 450px;
  border-radius: 4px;
  box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  background: #121212;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
  font-size: 14px;
  color: var(--accent);
}

.close-btn { font-size: 24px; color: var(--muted); }
.close-btn:hover { color: var(--accent); }

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; }

.setting-group { display: flex; flex-direction: column; gap: 10px; }
.group-label { font-size: 11px; font-weight: 800; color: var(--muted); }

.radio-group { display: flex; flex-direction: column; gap: 12px; }
.radio-item { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; font-weight: 700; }
.radio-item input { display: none; }
.radio-custom { width: 16px; height: 16px; border: 2px solid var(--muted); border-radius: 50%; position: relative; }
.radio-item input:checked + .radio-custom { border-color: var(--accent); }
.radio-item input:checked + .radio-custom::after { content: ""; position: absolute; top: 3px; left: 3px; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }

.hud-input {
  background: #121212;
  border: 1px solid var(--line);
  color: #fff;
  padding: 10px 12px;
  border-radius: 2px;
  font-size: 14px;
  outline: none;
}
.hud-input:focus { border-color: var(--accent); }
.input-hint { font-size: 9px; color: var(--muted); }

.status-box {
  background: #121212;
  padding: 12px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 800;
}
.status-val { flex: 1; text-align: right; }
.status-val.offline { color: var(--danger); }
.status-val.online { color: var(--accent); }
.status-val.connecting { color: #f1c40f; }
.status-val.demo { color: var(--muted); }

.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot.red { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.status-dot.yellow { background: #f1c40f; box-shadow: 0 0 8px #f1c40f; }
.status-dot.green { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.status-dot.demo { background: var(--muted); box-shadow: none; }

.conn-notice {
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid var(--danger);
  padding: 10px 12px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.conn-notice[hidden] { display: none; }
.conn-notice .notice-text { font-size: 11px; font-weight: 700; color: #fff; }
.conn-notice .notice-actions { display: flex; gap: 8px; }

.hud-btn-ghost {
  flex: 1;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 800;
  font-size: 11px;
  padding: 8px;
  border-radius: 2px;
  transition: all 0.1s;
}
.hud-btn-ghost:hover { background: var(--accent); color: #000; }
.hud-btn-ghost:active { transform: translateY(1px); }

.hud-btn-primary {
  background: var(--accent);
  color: #000;
  font-weight: 900;
  padding: 12px;
  border-radius: 2px;
  text-align: center;
  transition: all 0.1s;
}
.hud-btn-primary:hover { filter: brightness(1.1); }
.hud-btn-primary:active { transform: translateY(1px); }

/* ---------- TOP BAR ---------- */
.header-bar {
  height: 48px;
  background: #000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.header-left { display: flex; align-items: center; gap: 20px; font-weight: 700; font-size: 14px; }
.header-left .coords { color: var(--muted); font-size: 11px; }

.header-center { display: flex; align-items: center; gap: 8px; font-weight: 900; letter-spacing: 1px; font-style: italic; }
.badge-25 { background: var(--accent); color: #000; padding: 0 4px; border-radius: 2px; font-size: 14px; }

.header-right { display: flex; align-items: center; gap: 16px; }
.header-right .weather { font-size: 11px; color: var(--muted); }

.icon-btn { color: var(--accent); display: flex; align-items: center; }

/* ---------- GRID ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10px;
  padding: 10px;
  flex: 1;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  background: rgba(0,0,0,0.3);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
}

.card-header.tabs { display: flex; padding: 0; }
.card-header.tabs .tab { flex: 1; padding: 6px; text-align: center; color: var(--muted); cursor: pointer; }
.card-header.tabs .tab.active { background: var(--accent); color: #000; }

.card-header-split {
  display: flex;
  justify-content: space-between;
  background: rgba(0,0,0,0.3);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}
.card-header-split .header-left { color: var(--accent); }

.card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; }
.card-body.centered { align-items: center; justify-content: center; text-align: center; }
.card-body.row { flex-direction: row; gap: 15px; }

/* DATA CARD */
.vehicle-title { margin-bottom: 12px; font-weight: 900; font-size: 16px; }
.vehicle-title .model { color: var(--accent); }
.stats-list { display: flex; flex-direction: column; gap: 6px; }
.stat-row { display: flex; justify-content: space-between; font-size: 13px; }
.stat-row .label { color: var(--muted); }
.stat-row b { color: #fff; }

.card-footer-bar { padding: 10px; display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,0.2); }
.progress-container { flex: 1; height: 20px; background: #333; border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); color: #000; font-size: 11px; font-weight: 900; display: flex; align-items: center; padding-left: 8px; }
.crop-type { font-size: 12px; font-weight: 800; color: #fff; }

/* ENGINE CARD */
.hint { font-size: 8px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.gauge-wrap { position: relative; width: 160px; height: 160px; }
.digital-speed { position: absolute; bottom: 25px; left: 50%; transform: translateX(-50%); font-size: 32px; font-weight: 900; color: #fff; }
.engine-telemetry { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 10px; padding: 10px; margin-top: auto; }
.tel-item { display: flex; flex-direction: column; align-items: center; }
.tel-item .label { font-size: 9px; color: var(--muted); font-weight: 900; }
.tel-item b { font-size: 20px; color: #fff; }
.tel-item b.large { font-size: 30px; }
.tractor-icon-box { margin-top: 10px; color: var(--accent); }

/* HITCH CARD */
.attachment-meta { display: flex; justify-content: space-between; font-weight: 900; font-size: 14px; margin-bottom: 10px; }
.hitch-layout { display: flex; flex: 1; gap: 15px; }
.hitch-sidebar { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 40px; }
.hitch-sidebar .label { font-size: 10px; font-weight: 900; color: var(--muted); }
.v-bar { width: 14px; flex: 1; background: #111; border: 1px solid #444; border-radius: 1px; display: flex; flex-direction: column-reverse; }
.v-bar .fill { background: var(--accent); width: 100%; }

.control-grid-2x3 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); gap: 6px; flex: 1; }
.ctrl-tile { background: #2B2C2E; border: 1px solid #444; border-radius: 2px; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; transition: transform .08s ease, background .12s ease, box-shadow .12s ease, border-color .12s ease; }
.ctrl-tile:hover { border-color: var(--accent); background: #3a3b3e; }
.ctrl-tile:active { transform: scale(0.95); }
.ctrl-tile.active { background: var(--accent); color: #000; box-shadow: 0 0 12px rgba(162, 224, 20, .45); }
.ctrl-tile.active:hover { background: var(--accent); }
.ctrl-tile.danger { color: var(--danger); }
.ctrl-tile.danger.active { color: #000; }

/* LIGHTS & DATA */
.lights-section { flex: 1.2; display: flex; flex-direction: column; }
.bottom-stat { margin-top: 8px; font-size: 14px; font-weight: 900; color: #fff; }
.data-section { flex: 0.8; }
.v-bars-wrap { display: flex; gap: 12px; height: 100%; }
.v-bar-item { display: flex; flex-direction: column; align-items: center; flex: 1; }
.v-bar-item .label { font-size: 8px; font-weight: 900; color: var(--muted); margin-top: 4px; }

/* TOOLS CARD */
.tool-matrix { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; gap: 4px; flex: 1; }
.tool-cell { background: #2B2C2E; border: 1px solid #444; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px; text-align: center; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; transition: transform .08s ease, background .12s ease, box-shadow .12s ease, border-color .12s ease; }
.tool-cell:hover { border-color: var(--accent); background: #3a3b3e; }
.tool-cell:active { transform: scale(0.95); }
.tool-cell.active { background: var(--accent); color: #000; box-shadow: 0 0 12px rgba(162, 224, 20, .45); }
.tool-cell.active:hover { background: var(--accent); }
.tool-cell .status { font-size: 8px; font-weight: 900; }
.tool-cell .rpm-val { font-size: 10px; font-weight: 900; margin-top: 2px; }

/* OPERATIONS CARD */
.control-grid-3x3 { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 6px; flex: 1; }

/* FOOTER BAR */
.footer-bar {
  height: 32px;
  background: #000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
}
.footer-left { display: flex; align-items: center; gap: 10px; }
.footer-right { display: flex; align-items: center; gap: 20px; color: var(--muted); }
.status-indicator { color: #fff; display: flex; align-items: center; gap: 6px; }
.dot.live { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 8px var(--accent); }
.dot.demo { width: 8px; height: 8px; background: var(--muted); border-radius: 50%; }
.dot.off { width: 8px; height: 8px; background: var(--danger); border-radius: 50%; box-shadow: 0 0 8px var(--danger); }

/* SVG COLORS */
.accent { color: var(--accent); }
