/* ===================== BASE ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 600px;
  height: 600px;
  background: #000;          /* additive display: black = transparent */
  color: #fff;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
}
.hidden { display: none !important; }

/* ===================== BRAND / HEADER ===================== */
.t-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 22px;
  background: linear-gradient(150deg, #e82127 0%, #b5161b 100%);
  flex: none;
}

.header {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  margin-top: 16px;
  flex: none;
}
.header-title {
  font-size: 24px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.state-pill {
  font-size: 13px;
  font-weight: 600;
  color: #b0b3b8;
  background: #2a2d31;
  border-radius: 999px;
  padding: 5px 12px;
  flex: none;
}
.state-pill.online { color: #4ade80; background: #14331f; }
.state-pill.asleep { color: #ffcf70; background: #3a2a08; }

.back-btn {
  width: 56px;
  height: 56px;
  font-size: 26px;
  background: #1c1e21;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  flex: none;
}

/* ===================== CONTENT / LISTS ===================== */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.list-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
}

/* ===================== FOCUS STATE ===================== */
.focusable {
  outline: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  opacity: .9;
}
.focusable:focus {
  opacity: 1;
  transform: scale(1.03);
  box-shadow: 0 0 0 3px #00e5ff, 0 0 16px rgba(0,229,255,.6);
}

/* ===================== INFO CARDS (dashboard) ===================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  flex: none;
}
.card {
  background: #1c1e21;
  border-radius: 14px;
  padding: 12px 14px;
}
.card-label { font-size: 13px; color: #b0b3b8; }
.card-value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card-sub { font-size: 12px; color: #777; margin-top: 2px; }
.card.batt .card-value { color: #4ade80; }
.card.batt.low .card-value { color: #ff6b6b; }

/* ===================== ACTION TILES (dashboard nav) ===================== */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  flex: none;
}
.action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 96px;
  background: #1c1e21;
  border: none;
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
}
.action-icon { font-size: 32px; line-height: 1; }
.action-label { font-size: 16px; font-weight: 600; }

/* ===================== MENU / LOGOUT ===================== */
.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 64px;
  padding: 0 20px;
  background: #1c1e21;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 19px;
  text-align: left;
  cursor: pointer;
  flex: none;
}
.menu-icon { font-size: 24px; flex: none; }
.menu-label { flex: 1; font-weight: 600; }
.menu-logout { background: #2a1416; }
.menu-logout .menu-label { color: #ff6b6b; }

/* ===================== ASLEEP BANNER ===================== */
.asleep-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #3a2a08;
  box-shadow: inset 0 0 0 2px #ffb000;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 16px;
  color: #ffcf70;
  flex: none;
}

/* ===================== CONTROL PANEL (climate / lock / charge) ===================== */
.ctrl-toggle {
  height: 64px;
  border: none;
  border-radius: 14px;
  background: #1c1e21;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  flex: none;
}
.ctrl-toggle.on { background: #14331f; box-shadow: inset 0 0 0 2px #4ade80; color: #4ade80; }
.ctrl-toggle.danger { background: #2a1416; box-shadow: inset 0 0 0 2px #ff6b6b; color: #ff6b6b; }
.ctrl-toggle.big { height: 96px; font-size: 26px; }

.ctrl-pill {
  border: none;
  border-radius: 12px;
  background: #e82127;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 18px;
  cursor: pointer;
  flex: none;
}

.dim-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.dim-btn {
  width: 72px;
  height: 64px;
  border: none;
  border-radius: 14px;
  background: #2a2d31;
  color: #fff;
  font-size: 34px;
  font-weight: 700;
  cursor: pointer;
  flex: none;
}
.dim-val {
  flex: 1;
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dim-row.big .dim-btn { height: 84px; }

.temp-readout {
  display: flex;
  justify-content: space-around;
  font-size: 15px;
  color: #b0b3b8;
  flex: none;
}
.hint-line { font-size: 13px; color: #777; text-align: center; flex: none; }

/* ===================== BIG ACTION (trunks) ===================== */
.big-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 130px;
  background: #1c1e21;
  border: none;
  border-radius: 16px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  flex: none;
}
.big-sub { font-size: 13px; font-weight: 500; color: #b0b3b8; }

/* ===================== STATUS READOUTS ===================== */
.lock-status, .charge-status {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 18px 12px;
  background: #1c1e21;
  border-radius: 14px;
  flex: none;
}
.lock-status.locked { color: #4ade80; }
.lock-status.unlocked { color: #ff6b6b; }
.charge-status.charging { color: #4ade80; }

/* ===================== AUTH / KEYPAD ===================== */
.auth-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 16px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.brand-name { font-size: 28px; font-weight: 700; }
.auth-hint { font-size: 15px; color: #b0b3b8; text-align: center; line-height: 1.45; margin-bottom: 8px; }
.auth-url { color: #e82127; font-weight: 600; }

.code-display { display: flex; gap: 8px; margin: 14px 0; }
.code-cell {
  width: 52px;
  height: 64px;
  background: #1c1e21;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 700;
  color: #fff;
}
.code-cell.filled { background: #2a2d31; box-shadow: inset 0 0 0 2px #e82127; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 84px);
  gap: 10px;
  margin-top: 6px;
}
.key {
  height: 64px;
  background: #1c1e21;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 26px;
  font-weight: 600;
  cursor: pointer;
}
.key-go { background: #e82127; color: #fff; }
.key-alt { background: #2a2d31; }
.auth-status { margin-top: 12px; font-size: 14px; min-height: 18px; color: #ff6b6b; text-align: center; }
.auth-status.ok { color: #4ade80; }

/* ===================== TILE (vehicle picker) ===================== */
.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  min-height: 120px;
  padding: 14px;
  background: #1c1e21;
  border: none;
  border-radius: 16px;
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.tile-icon { font-size: 30px; }
.tile-name { font-size: 17px; font-weight: 700; margin-top: 10px; }
.tile-sub { font-size: 13px; color: #b0b3b8; margin-top: 4px; }

/* ===================== STATES ===================== */
.state {
  position: absolute;
  inset: 80px 8px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #b0b3b8;
  text-align: center;
  padding: 0 24px;
}
.spinner {
  width: 44px; height: 44px;
  border: 4px solid #2a2d31;
  border-top-color: #e82127;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== TOAST ===================== */
.toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #1c1e21;
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: 520px;
  text-align: center;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #3a1416; }
.toast.success { background: #14331f; }
