/* ==========================================================================
   TachoCockpit — Design System v9
   Exact implementation of React reference design
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@300;400;500;600;700;900&family=JetBrains+Mono:wght@400;500;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:      #07070A;
  --surface: #0F0F14;
  --card:    #131318;
  --card2:   #18181F;
  --elevated:#1E1E27;
  --border:  rgba(255,255,255,0.055);
  --border2: rgba(255,255,255,0.10);
  --green:   #00E87A;
  --green-dim: rgba(0,232,122,0.10);
  --amber:   #FF9F0A;
  --amber-dim: rgba(255,159,10,0.10);
  --red:     #FF453A;
  --red-dim: rgba(255,69,58,0.12);
  --blue:    #0A84FF;
  --text:    #F0F0F5;
  --text2:   #8A8A96;
  --text3:   #44444E;
  --df: 'Barlow Condensed', sans-serif;
  --dm: 'JetBrains Mono', monospace;
  --db: 'DM Sans', sans-serif;

  /* compat aliases */
  --bg-app: var(--bg);
  --bg-card: var(--card);
  --bg-elevated: var(--elevated);
  --border-subtle: var(--border);
  --text-primary: var(--text);
  --text-secondary: var(--text2);
  --accent-success: var(--green);
  --accent-warning: var(--amber);
  --accent-danger:  var(--red);
  --radius: 20px;
  --spacing: 14px;
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { background: #000; }

body {
  background: #000;
  font-family: var(--db);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app-shell {
  width: 100%;
  max-width: 430px;
  background: var(--bg);
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* green glow top radial */
.app-shell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% -10%, rgba(0,232,122,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* grid background */
.grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   STATUS BAR
   ========================================================================== */
.sbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px 8px;
  position: relative;
  z-index: 5;
}

.sbar-l {
  font-size: 11px;
  color: var(--text2);
  font-weight: 500;
  letter-spacing: 0.02em;
  font-family: var(--db);
}

.badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--green-dim);
  border: 1px solid rgba(0,232,122,0.18);
  border-radius: 20px;
  padding: 4px 11px 4px 8px;
  font-family: var(--df);
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: glow 2s infinite;
  flex-shrink: 0;
}

@keyframes glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--green); }
  50% { opacity: 0.5; box-shadow: 0 0 3px var(--green); }
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.hdr {
  padding: 2px 22px 14px;
  position: relative;
  z-index: 5;
}

.hdr-sub {
  font-family: var(--df);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 1px;
}

.hdr-t {
  font-family: var(--df);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.05;
  color: var(--text);
}

/* last-update compat */
.last-update {
  font-size: 9px;
  color: var(--text3);
  opacity: 0;
  transition: opacity 0.3s;
  font-family: var(--dm);
}
.last-update.visible { opacity: 1; }

/* compat ids */
#app-header { display: none; } /* replaced by .sbar + .hdr */
#offline-banner { display: none; } /* handled by .offline-banner below */

/* ==========================================================================
   OFFLINE BANNER
   ========================================================================== */
.offline-banner {
  display: none;
  margin: 0 14px 8px;
  background: var(--red-dim);
  border: 1px solid rgba(255,69,58,0.25);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 12px;
  color: var(--red);
  text-align: center;
  font-weight: 600;
  font-family: var(--dm);
  letter-spacing: 0.04em;
  position: relative;
  z-index: 5;
}

.offline-banner.show { display: block; }

.cached-badge {
  display: inline-block;
  background: var(--amber-dim);
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: 8px;
  text-transform: uppercase;
  font-family: var(--dm);
}

/* ==========================================================================
   SCREEN BODY
   ========================================================================== */
.body, .screen-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 14px 8px;
  position: relative;
  z-index: 1;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  min-height: 0; /* allow flex shrink */
}

.body::-webkit-scrollbar,
.screen-container::-webkit-scrollbar { display: none; }

/* ==========================================================================
   BOTTOM NAV
   ========================================================================== */
.bnav, .bottom-nav {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 10px 6px 26px;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg, rgba(7,7,10,0.98), rgba(15,15,20,0.95));
  position: relative;
  z-index: 10;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

.ni, .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 14px;
  transition: all 0.15s;
  border: none;
  background: none;
  min-width: 58px;
  position: relative;
}

.ni.on, .nav-item.active {
  background: rgba(0,232,122,0.07);
}

.ni-ic, .nav-icon {
  font-size: 21px;
  line-height: 1;
  font-family: var(--df);
  font-weight: 700;
  color: var(--text2);
}

.ni.on .ni-ic,
.nav-item.active .nav-icon {
  color: var(--green);
}

.ni-lb, .nav-label {
  font-family: var(--df);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  transition: color 0.2s;
  text-align: center;
  white-space: nowrap;
}

.ni.on .ni-lb,
.nav-item.active .nav-label {
  color: var(--green);
}

.ni-pip {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 5px var(--green);
  margin-top: 1px;
}

/* nav badge (infractions) */
.nav-badge {
  position: absolute;
  top: 3px;
  right: 8px;
  background: var(--red);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  font-family: var(--dm);
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  line-height: 14px;
}

/* ==========================================================================
   CARD BASE
   ========================================================================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

/* inner top highlight */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent);
}

.card.g {
  border-color: rgba(0,232,122,0.18);
}
.card.g::before {
  background: linear-gradient(90deg, transparent, rgba(0,232,122,0.25), transparent);
}

.card.r {
  border-color: rgba(255,69,58,0.22);
}

.clbl {
  font-family: var(--df);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
}

/* ==========================================================================
   T-20: HOJE
   ========================================================================== */
.screen-today { padding-bottom: 8px; }

/* START/STOP button */
.sbtn, .btn-session {
  width: 100%;
  height: 66px;
  background: linear-gradient(145deg, #00E87A, #00CB68);
  border: none;
  border-radius: 20px;
  font-family: var(--df);
  font-size: 22px;
  font-weight: 700;
  color: #000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,232,122,0.28), 0 2px 6px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  transition: all 0.15s;
}

.sbtn::before, .btn-session::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, transparent 55%);
}

.sbtn:active, .btn-session:active {
  transform: scale(0.98);
}

.sbtn.stop, .btn-stop {
  background: linear-gradient(145deg, #FF453A, #C8302A);
  box-shadow: 0 8px 30px rgba(255,69,58,0.28), 0 2px 6px rgba(0,0,0,0.4);
}

/* session info text */
.session-block { display: contents; }
.session-info {
  display: none; /* hidden per design — not in reference */
}

/* Risk Gauge card */
.risk-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: var(--card);
  border: 1px solid rgba(0,232,122,0.18);
  border-radius: 20px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

.risk-row::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,232,122,0.25), transparent);
}

/* right-side text block in risk row */
.rs-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.g-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}

.risk-gauge-ring, .g-wrap { /* compat */ }

.g-svg, .risk-gauge-svg {
  width: 88px;
  height: 88px;
  transform: rotate(-90deg);
}

.g-track, .risk-gauge-track {
  fill: none;
  stroke: var(--elevated);
  stroke-width: 6;
  stroke-linecap: round;
}

.g-fill, .risk-gauge-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}

.g-c, .risk-gauge-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.g-num, .risk-gauge-number {
  font-family: var(--dm);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}

.g-unit, .risk-gauge-number-label {
  font-size: 9px;
  color: var(--text3);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.rs-lb, .risk-gauge-label {
  font-family: var(--df);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 3px;
}

.rs-v, .risk-gauge-status {
  font-family: var(--df);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.rs-v.s { color: var(--green); text-shadow: 0 0 18px rgba(0,232,122,0.35); }
.rs-v.w { color: var(--amber); text-shadow: 0 0 18px rgba(255,159,10,0.35); }
.rs-v.d { color: var(--red);   text-shadow: 0 0 18px rgba(255,69,58,0.35); }

.rs-sub, .risk-gauge-desc {
  font-size: 13px;
  color: var(--text2);
  margin-top: 4px;
  font-family: var(--db);
}

/* risk-gauge-card is the card wrapping risk-row */
.risk-gauge-card {
  background: var(--card);
  border: 1px solid rgba(0,232,122,0.18);
  border-radius: 20px;
  padding: 0;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.risk-gauge-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,232,122,0.25), transparent);
}

/* 2x2 metric grid */
.mgrid, .counters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 10px;
}

.mc, .counter-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.mc::before, .counter-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.055), transparent);
}

/* colored dot */
.mdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  position: absolute;
  top: 14px;
  right: 14px;
}

.mdot.g, .counter-card-driving::after  { background: var(--green); box-shadow: 0 0 7px var(--green); }
.mdot.a, .counter-card-amplitude::after{ background: var(--amber); box-shadow: 0 0 7px var(--amber); }
.mdot.b, .counter-card-break::after    { background: var(--blue);  box-shadow: 0 0 7px var(--blue); }
.mdot.x, .counter-card-weekly::after   { background: var(--text3); }

/* remove old ::before dot from previous implementation */
.counter-card-driving::before,
.counter-card-break::before,
.counter-card-amplitude::before,
.counter-card-weekly::before {
  /* override old design - handled by .mc::before gradient */
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.055), transparent) !important;
  width: auto !important;
  height: 1px !important;
  top: 0 !important;
  right: auto !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.counter-card::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  position: absolute;
  top: 14px;
  right: 14px;
}

.counter-card-driving::after  { background: var(--green); box-shadow: 0 0 7px var(--green); }
.counter-card-break::after    { background: var(--blue);  box-shadow: 0 0 7px var(--blue); }
.counter-card-amplitude::after{ background: var(--amber); box-shadow: 0 0 7px var(--amber); }
.counter-card-weekly::after   { background: var(--text3); }

.ml, .counter-label {
  font-family: var(--df);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 7px;
  line-height: 1;
}

.mv, .counter-value {
  font-family: var(--dm);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}

.mv.e, .counter-value {
  color: var(--text3);
  font-size: 18px;
}

.counter-value-md {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ms, .counter-sub {
  font-size: 11px;
  color: var(--text2);
  margin-top: 3px;
  font-family: var(--db);
}

/* warning state */
.counter-card.counter-card-warning {
  border-color: rgba(255,159,10,0.3);
}

/* break alert banner */
.break-alert-banner {
  display: none;
  background: var(--amber-dim);
  border: 1px solid rgba(255,159,10,0.25);
  border-radius: 12px;
  padding: 11px 14px;
  font-family: var(--df);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--amber);
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 10px;
  animation: pulse-banner 1.5s ease infinite;
}

@keyframes pulse-banner {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* "Ver timeline" link button */
.lbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text2);
  padding: 10px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  transition: color 0.2s;
  font-family: var(--db);
}

.lbtn:active { color: var(--text); }

/* infractions block on today dashboard */
.today-infractions-block {
  display: none;
  background: var(--amber-dim);
  border: 1px solid rgba(255,159,10,0.25);
  border-radius: 16px;
  padding: 13px 15px;
  margin-bottom: 10px;
  gap: 10px;
  flex-direction: column;
}

.today-infractions-block.today-infractions-critical {
  background: var(--red-dim);
  border-color: rgba(255,69,58,0.25);
}

.today-inf-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.today-inf-icon { font-size: 18px; line-height: 1; }

.today-inf-title {
  flex: 1;
  font-family: var(--df);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--amber);
}

.today-infractions-critical .today-inf-title { color: var(--red); }

.today-inf-link {
  background: none;
  border: 1px solid var(--border2);
  font-family: var(--dm);
  font-size: 10px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.today-inf-summary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* severity badges */
.inf-badge-msi, .inf-badge-vsi, .inf-badge-si, .inf-badge-mi {
  font-family: var(--dm);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.inf-badge-msi { background: rgba(255,69,58,0.18); color: var(--red); }
.inf-badge-vsi { background: rgba(255,69,58,0.13); color: #FF7B72; }
.inf-badge-si  { background: rgba(255,159,10,0.13); color: var(--amber); }
.inf-badge-mi  { background: rgba(255,255,255,0.06); color: var(--text2); }

.today-footer { text-align: center; padding: 4px 0 8px; }

/* ==========================================================================
   T-50: COPILOT
   ========================================================================== */
.screen-copilot {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.copilot-alerts {
  background: var(--amber-dim);
  border: 1px solid rgba(255,159,10,0.2);
  border-radius: 12px;
  padding: 11px 14px;
  margin: 0 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.copilot-alerts.hidden { display: none; }

.copilot-alert-item {
  font-size: 13px;
  color: var(--amber);
  line-height: 1.4;
  font-family: var(--db);
}

/* quick chips */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 2px 14px 12px;
}

.copilot-chips-row { /* compat */
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 2px 0 12px;
}

.chip, .copilot-chip {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: var(--db);
  transition: border-color 0.15s, color 0.15s;
}

.chip:active, .copilot-chip:active {
  border-color: rgba(0,232,122,0.3);
  color: var(--green);
}

/* chat */
.chat-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.chat-body, .copilot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0 14px 12px;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.chat-body::-webkit-scrollbar,
.copilot-messages::-webkit-scrollbar { display: none; }

.chat-area { display: flex; flex-direction: column; gap: 11px; }

.msg, .copilot-message {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.msg.u, .copilot-message-user {
  flex-direction: row-reverse;
}

.av, .copilot-avatar, .copilot-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex-shrink: 0;
  background: var(--elevated);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.bub, .copilot-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px 18px 18px 4px;
  padding: 12px 14px;
  max-width: 280px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  font-family: var(--db);
}

.copilot-welcome {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.copilot-bubble-assistant {
  border-radius: 18px 18px 18px 4px;
}

.msg.u .bub,
.copilot-bubble-user {
  background: rgba(0,232,122,0.08);
  border-color: rgba(0,232,122,0.18);
  border-radius: 18px 18px 4px 18px;
  color: var(--text);
}

.copilot-bubble-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  font-family: var(--db);
}

.copilot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.copilot-action-btn {
  background: rgba(0,232,122,0.08);
  border: 1px solid rgba(0,232,122,0.18);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  cursor: pointer;
  font-family: var(--db);
  transition: background 0.15s;
}

.copilot-action-btn:active { background: rgba(0,232,122,0.15); }

/* input area */
.cin-row, .copilot-input-area {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 5;
}

.copilot-input-row {
  display: flex;
  gap: 9px;
  align-items: center;
  width: 100%;
}

.cin, .copilot-input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 24px;
  padding: 12px 18px;
  font-size: 15px;
  color: var(--text);
  font-family: var(--db);
  outline: none;
  resize: none;
  min-height: unset;
}

.cin::placeholder, .copilot-input::placeholder { color: var(--text3); }

.csnd, .copilot-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,232,122,0.28);
  transition: opacity 0.2s;
}

.csnd:disabled, .copilot-send-btn:disabled { opacity: 0.5; }
.csnd:active, .copilot-send-btn:active { opacity: 0.8; }

/* --------------------------------------------------------------------------
   Copilot V2 — Modern chat UI additions
   -------------------------------------------------------------------------- */

/* Chat header */
.copilot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.copilot-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0,232,122,0.15), rgba(0,232,122,0.05));
  border: 1px solid rgba(0,232,122,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.copilot-header-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--db);
}

.copilot-header-status {
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.copilot-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: copilot-pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes copilot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Message rows — proper alignment */
.copilot-row {
  display: flex;
  gap: 9px;
  align-items: flex-end;
  padding: 0 2px;
}

.copilot-row-user {
  flex-direction: row-reverse;
}

.copilot-row-assistant {
  flex-direction: row;
}

.copilot-avatar-wrap {
  flex-shrink: 0;
  margin-bottom: 2px;
}

/* Bubble time */
.copilot-bubble-time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 5px;
  text-align: right;
  opacity: 0.7;
}

.copilot-row-assistant .copilot-bubble-time {
  text-align: left;
}

/* Chips wrap */
.copilot-chips-wrap {
  padding: 8px 14px 0;
  flex-shrink: 0;
}

.copilot-chips-label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 7px;
  font-family: var(--db);
}

/* Typing indicator */
.copilot-bubble-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
  min-width: 56px;
}

.copilot-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
  display: inline-block;
  animation: copilot-bounce 1.2s infinite;
}

.copilot-dot:nth-child(2) { animation-delay: 0.2s; }
.copilot-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes copilot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* Infraction code badge inline */
.copilot-code-badge {
  display: inline-block;
  background: rgba(0,232,122,0.1);
  border: 1px solid rgba(0,232,122,0.2);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  font-family: monospace;
  letter-spacing: 0.03em;
}

/* Send button spinner animation */
.copilot-spinner {
  animation: copilot-spin 0.9s linear infinite;
  color: white;
}

@keyframes copilot-spin {
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   T-40: SINCRONIZAR
   ========================================================================== */
.screen-sync { padding-bottom: 8px; }

.sopt {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s;
}

.sopt::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.02), transparent);
}

.sopt.sg { border-color: rgba(0,232,122,0.18); }

.sopt:active { background: var(--card2); }

.siw {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--elevated);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  font-family: var(--df);
  font-weight: 700;
  color: var(--text2);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.sopt.sg .siw {
  background: var(--green-dim);
  border-color: rgba(0,232,122,0.18);
  color: var(--green);
}

.si-t {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--db);
}

.si-s {
  font-size: 13px;
  color: var(--text2);
  margin-top: 3px;
  font-family: var(--db);
}

.si-a {
  color: var(--text3);
  font-size: 20px;
  font-family: var(--df);
}

/* Android badge */
.ab {
  background: rgba(10,132,255,0.12);
  border: 1px solid rgba(10,132,255,0.25);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--df);
  margin-left: 8px;
}

/* compat */
.sync-options { display: contents; }
.sync-option { display: none; } /* replaced by .sopt */

/* ==========================================================================
   T-41: UPLOAD
   ========================================================================== */
.screen-upload { padding-bottom: 8px; }

.udz, .upload-zone {
  background: var(--card);
  border: 1.5px dashed var(--border2);
  border-radius: 20px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 10px;
}

.udz.err {
  border-color: rgba(255,69,58,0.35);
  background: var(--red-dim);
}

.udz:active, .upload-zone:active { border-color: rgba(0,232,122,0.4); }
.udz.drag-over, .upload-zone.drag-over { border-color: rgba(0,232,122,0.4); background: var(--green-dim); }

.ui, .upload-icon {
  font-size: 38px;
  display: block;
  margin-bottom: 11px;
}

.ut, .upload-label {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
  font-family: var(--db);
}

.us, .upload-hint {
  font-size: 13px;
  color: var(--text2);
  font-family: var(--db);
}

.ue {
  font-size: 14px;
  color: var(--red);
  font-weight: 500;
  margin-bottom: 5px;
  font-family: var(--db);
}

.rbtn {
  background: var(--elevated);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
  font-family: var(--db);
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 10px;
}

.upload-progress span {
  font-size: 13px;
  color: var(--text2);
  font-family: var(--db);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.driver-preview {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

.driver-preview::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,232,122,0.25), transparent);
}

.preview-title {
  font-family: var(--df);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 10px;
}

.preview-grid { display: flex; flex-direction: column; gap: 8px; }

.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-lbl {
  font-family: var(--dm);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.06em;
}

.preview-val {
  font-family: var(--dm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
}

.analysis-result {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  margin-bottom: 10px;
}

.result-icon { font-size: 36px; line-height: 1; }

.result-message {
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
  font-family: var(--db);
}

.result-details { width: 100%; text-align: left; }

.result-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.upload-error {
  background: var(--red-dim);
  border: 1px solid rgba(255,69,58,0.22);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  margin-bottom: 10px;
}

.error-icon { font-size: 30px; }

.upload-error div, .upload-error #error-message {
  font-size: 14px;
  color: var(--red);
  font-weight: 500;
  line-height: 1.5;
  font-family: var(--db);
}

/* infraction list in result */
.infraction-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.infraction-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--card2);
  border-radius: 10px;
  border-left: 3px solid var(--border);
  font-size: 12px;
}

.infraction-item.severity-msi { border-left-color: var(--red); }
.infraction-item.severity-vsi { border-left-color: #FF7B72; }
.infraction-item.severity-si  { border-left-color: var(--amber); }
.infraction-item.severity-mi  { border-left-color: var(--text3); }

.infraction-code {
  font-family: var(--dm);
  font-size: 10px;
  font-weight: 700;
  background: var(--elevated);
  border-radius: 4px;
  padding: 2px 5px;
  color: var(--text3);
  flex-shrink: 0;
}

.infraction-desc {
  font-size: 12px;
  color: var(--text);
  line-height: 1.3;
  font-family: var(--db);
}

.infraction-more {
  font-family: var(--dm);
  font-size: 11px;
  color: var(--text2);
  text-align: center;
  padding: 4px;
}

/* ==========================================================================
   T-30: HISTÓRICO
   ========================================================================== */
.screen-history { padding-bottom: 8px; }

/* section header with week label */
.hwh {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 2px 11px;
}

.wl {
  font-family: var(--df);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
}

.wr {
  font-size: 13px;
  color: var(--text2);
  font-family: var(--dm);
}

/* day row with bar */
.drow {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 5px;
}

.dd {
  font-family: var(--dm);
  font-size: 11px;
  color: var(--text3);
  width: 46px;
  flex-shrink: 0;
}

.dbw {
  flex: 1;
  height: 3px;
  background: var(--elevated);
  border-radius: 2px;
}

.db {
  height: 3px;
  border-radius: 2px;
}

.db.s { background: var(--green); }
.db.w { background: var(--amber); }
.db.d { background: var(--red); }

.dt {
  font-family: var(--dm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  width: 46px;
  text-align: right;
  flex-shrink: 0;
}

/* infraction count box */
.ib {
  background: rgba(255,69,58,0.10);
  border: 1px solid rgba(255,69,58,0.2);
  border-radius: 16px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 10px;
}

.ib-n {
  background: var(--red);
  color: #fff;
  font-family: var(--dm);
  font-size: 14px;
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ib-t {
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  font-family: var(--db);
}

.ib-s {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
  font-family: var(--db);
}

/* infraction row */
.irow {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 5px;
}

.sp {
  font-family: var(--df);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.sp.v  { background: rgba(255,69,58,0.18);  color: var(--red); }
.sp.si { background: rgba(255,159,10,0.13); color: var(--amber); }

.ir-c {
  font-family: var(--dm);
  font-size: 10px;
  color: var(--text3);
}

.ir-d {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  font-family: var(--db);
}

/* compat for old history styles */
.history-summary-card,
.history-cta-card {
  display: none; /* replaced by .mgrid + .ib + .hwh + .drow etc */
}

/* ==========================================================================
   T-70: DEFINIÇÕES
   ========================================================================== */
.screen-settings { padding-bottom: 28px; }

.slbl {
  font-family: var(--df);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 14px 3px 7px;
}

/* setting field */
.sfield {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 6px;
}

.sfield label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
  display: block;
  margin-bottom: 5px;
  font-family: var(--db);
}

.sinput, .settings-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  font-family: var(--db);
}

/* language grid — 2 columns */
.lgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 0;
}

/* compat old lang-grid */
.lang-grid { display: none; }
.settings-section { display: none; }
.settings-actions { display: none; }

.lbtn2 {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 13px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--db);
  transition: all 0.15s;
}

.lbtn2.on {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
}

.lbtn2.full { grid-column: 1 / -1; }

.lbtn2:active { opacity: 0.8; }

/* save button */
.svbtn {
  width: 100%;
  height: 52px;
  background: linear-gradient(145deg, #00E87A, #00CB68);
  border: none;
  border-radius: 14px;
  font-family: var(--df);
  font-size: 18px;
  font-weight: 700;
  color: #000;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(0,232,122,0.22);
  margin-top: 14px;
  transition: opacity 0.15s;
}

.svbtn:active { opacity: 0.9; }

/* about rows */
.arow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.arow:last-child { border-bottom: none; }

.albl { font-size: 14px; color: var(--text2); font-family: var(--db); }

.aval {
  font-family: var(--dm);
  font-size: 13px;
  color: var(--green);
}

/* ==========================================================================
   T-60: INFRAÇÕES
   ========================================================================== */
.screen-infractions { padding-bottom: 8px; }

.infractions-empty,
.infractions-clean {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  margin-bottom: 10px;
}

.empty-icon, .clean-icon { font-size: 40px; }

.empty-title, .clean-title {
  font-family: var(--df);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.empty-desc, .clean-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  font-family: var(--db);
}

.clean-message {
  font-family: var(--dm);
  font-size: 11px;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(0,232,122,0.15);
  border-radius: 20px;
  padding: 5px 14px;
  letter-spacing: 0.04em;
}

.infraction-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.sev-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-top: 3px solid var(--sev-color, var(--border));
}

.sev-count {
  font-family: var(--dm);
  font-size: 24px;
  font-weight: 700;
  color: var(--sev-color, var(--text));
  line-height: 1;
}

.sev-code {
  font-family: var(--dm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--sev-color, var(--text2));
}

.sev-label {
  font-size: 9px;
  color: var(--text3);
  text-align: center;
  line-height: 1.3;
  font-family: var(--db);
}

.infraction-context-msg {
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
  font-family: var(--db);
}

.msg-critical {
  background: var(--red-dim);
  border: 1px solid rgba(255,69,58,0.18);
  color: var(--red);
}

.msg-warning {
  background: var(--amber-dim);
  border: 1px solid rgba(255,159,10,0.18);
  color: var(--amber);
}

.infraction-list-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.section-title {
  font-family: var(--df);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 8px 2px 4px;
}

.infraction-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 5px;
}

.infraction-card-msi { border-left: 3px solid var(--red); }
.infraction-card-vsi { border-left: 3px solid #FF7B72; }
.infraction-card-si  { border-left: 3px solid var(--amber); }
.infraction-card-mi  { border-left: 3px solid var(--text3); }

.infraction-card-header {
  display: flex;
  align-items: center;
  gap: 9px;
}

.infraction-num {
  font-family: var(--dm);
  font-size: 10px;
  color: var(--text3);
}

.infraction-code-big {
  font-family: var(--dm);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.infraction-sev-badge {
  font-family: var(--df);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #000;
  padding: 3px 8px;
  border-radius: 6px;
}

.infraction-card-desc {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
  font-family: var(--db);
}

.infraction-card-period {
  font-family: var(--dm);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.04em;
}

.infraction-card-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.metric-item {
  background: var(--elevated);
  border-radius: 8px;
  padding: 5px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-lbl {
  font-family: var(--dm);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
}

.metric-val {
  font-family: var(--dm);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.metric-excess .metric-val { color: var(--red); }

.infraction-card-legal {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.4;
  font-family: var(--db);
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-top: 2px;
}

.infraction-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 8px;
}

/* ==========================================================================
   INFRACTION POPUP OVERLAY
   ========================================================================== */
.infraction-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  padding: 0 0 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.infraction-popup-overlay.visible { opacity: 1; }

.infraction-popup {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 22px 22px 18px 18px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(40px);
  transition: transform 0.3s ease;
}

.infraction-popup-overlay.visible .infraction-popup { transform: translateY(0); }

.infraction-popup-icon {
  font-size: 34px;
  text-align: center;
  animation: shake 0.5s ease 0.3s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.infraction-popup-title {
  font-family: var(--df);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--red);
  text-align: center;
  text-transform: uppercase;
}

.infraction-popup-subtitle {
  font-size: 14px;
  color: var(--text2);
  text-align: center;
  line-height: 1.5;
  font-family: var(--db);
}

.infraction-popup-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.popup-infraction-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.popup-sev-msi, .popup-sev-vsi { border-left: 3px solid var(--red); }
.popup-sev-si { border-left: 3px solid var(--amber); }
.popup-sev-mi { border-left: 3px solid var(--text3); }

.popup-sev-badge {
  font-family: var(--dm);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--elevated);
  color: var(--text2);
}

.popup-sev-msi .popup-sev-badge,
.popup-sev-vsi .popup-sev-badge { background: rgba(255,69,58,0.18); color: var(--red); }
.popup-sev-si .popup-sev-badge  { background: rgba(255,159,10,0.13); color: var(--amber); }

.popup-inf-desc {
  font-size: 13px;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
  font-family: var(--db);
}

.popup-infraction-more {
  font-family: var(--dm);
  font-size: 11px;
  color: var(--text2);
  text-align: center;
  padding: 4px;
}

.infraction-popup-message {
  font-size: 12px;
  color: var(--text2);
  text-align: center;
  line-height: 1.5;
  font-family: var(--db);
}

.infraction-popup-actions { display: flex; flex-direction: column; gap: 7px; }

.btn-popup-detail {
  background: rgba(255,69,58,0.12) !important;
  border: 1px solid rgba(255,69,58,0.25) !important;
  color: var(--red) !important;
  font-family: var(--db) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  border-radius: 14px !important;
  padding: 14px !important;
}

.btn-popup-close {
  background: var(--elevated) !important;
  border: 1px solid var(--border2) !important;
  color: var(--text2) !important;
  font-family: var(--db) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  border-radius: 14px !important;
  padding: 14px !important;
}

/* ==========================================================================
   BUTTONS (global)
   ========================================================================== */
button { cursor: pointer; outline: none; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(145deg, #00E87A, #00CB68);
  color: #000;
  font-family: var(--df);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 22px;
  border-radius: 14px;
  border: none;
  width: 100%;
  box-shadow: 0 6px 22px rgba(0,232,122,0.22);
  transition: opacity 0.15s;
  margin-bottom: 8px;
}

.btn-primary:active { opacity: 0.88; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--elevated);
  color: var(--text);
  font-family: var(--db);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  width: 100%;
  transition: opacity 0.15s;
  margin-bottom: 8px;
}

.btn-secondary:active { opacity: 0.8; }

.btn-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text2);
  padding: 10px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  transition: color 0.2s;
  font-family: var(--db);
}

.btn-link:active { color: var(--text); }

/* CTA button (action solid white) */
.ctabtn {
  background: var(--text);
  color: #000;
  border: none;
  border-radius: 14px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--db);
  width: 100%;
  justify-content: center;
  margin-top: 4px;
  transition: opacity 0.15s;
}

.ctabtn:active { opacity: 0.88; }

/* ==========================================================================
   ONBOARDING
   ========================================================================== */
.screen-onboarding {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 28px;
}

.onboarding-hero {
  text-align: center;
  padding: 16px 0 8px;
}

.onboarding-hero-icon { font-size: 56px; line-height: 1; margin-bottom: 14px; display: block; }

.onboarding-hero-title {
  font-family: var(--df);
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.onboarding-hero-sub {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  font-family: var(--db);
}

.onboarding-form { display: flex; flex-direction: column; gap: 12px; }

.onboarding-field { display: flex; flex-direction: column; gap: 5px; }

.onboarding-field label {
  font-family: var(--dm);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
}

.onboarding-input {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  width: 100%;
  outline: none;
  font-family: var(--db);
  transition: border-color 0.2s;
}

.onboarding-input:focus { border-color: rgba(0,232,122,0.35); }
.onboarding-input::placeholder { color: var(--text3); }

.onboarding-lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.onboarding-lang-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--db);
  transition: all 0.15s;
}

.onboarding-lang-btn.active {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
}

.onboarding-footer {
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  line-height: 1.5;
  font-family: var(--db);
}

/* ==========================================================================
   USB SCREEN
   ========================================================================== */
.screen-usb { padding-bottom: 8px; }

.usb-status-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  margin-bottom: 10px;
}

.usb-status-icon { font-size: 44px; }

.usb-status-title {
  font-family: var(--df);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.usb-status-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  font-family: var(--db);
}

.usb-device-card {
  background: var(--green-dim);
  border: 1px solid rgba(0,232,122,0.18);
  border-radius: 16px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 10px;
}

.usb-device-icon { font-size: 26px; }

.usb-device-name {
  font-family: var(--df);
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.02em;
}

.usb-device-detail {
  font-family: var(--dm);
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
}

/* ==========================================================================
   LOADING
   ========================================================================== */
.screen-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--border2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}

/* ==========================================================================
   EMPTY / ERROR STATES
   ========================================================================== */
.empty-state, .error-state {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  margin-bottom: 10px;
}

.empty-icon { font-size: 40px; }

.empty-text {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  font-family: var(--db);
}

.error-state p {
  font-size: 13px;
  color: var(--red);
  font-family: var(--db);
}

.screen-error {
  padding: 20px;
  color: var(--red);
  font-size: 14px;
  text-align: center;
  font-family: var(--db);
}

/* ==========================================================================
   SCREEN HEADER (compat — hidden by new design)
   ========================================================================== */
.screen-header { display: none; }

/* ==========================================================================
   SCREEN ENTRY ANIMATION
   ========================================================================== */
@keyframes scin {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen-today,
.screen-copilot,
.screen-sync,
.screen-upload,
.screen-history,
.screen-settings,
.screen-infractions {
  animation: scin 0.18s ease;
}

/* ==========================================================================
   UPLOAD RESULT MODAL — 10A.2
   ========================================================================== */

.upload-result-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.urm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(12px);
}

.urm-card {
  position: relative;
  background: var(--bg-card, #18181b);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  animation: urmSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.urm-card--warn { border-color: rgba(245, 158, 11, 0.3); }

@keyframes urmSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.urm-icon      { font-size: 3.5rem; margin-bottom: 1rem; display: block; }
.urm-title     { font-size: 1.4rem; font-weight: 700; color: var(--text-primary, #f4f4f5); margin: 0 0 0.75rem; }
.urm-body      { color: var(--text-secondary, #a1a1aa); line-height: 1.55; margin: 0 0 1.5rem; font-size: 0.9rem; }
.urm-body--edu { font-size: 0.82rem; margin-top: 0.75rem; opacity: 0.65; }

.urm-list { list-style: none; padding: 0; margin: 0 0 1rem; text-align: left; }
.urm-infraction {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.875rem;
}
.urm-code {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--accent-warning, #f59e0b);
  background: rgba(245,158,11,0.1);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.urm-inf-desc { color: var(--text-secondary, #a1a1aa); }
.urm-more     { color: var(--text-muted, #71717a); font-size: 0.82rem; padding: 0.4rem 0; list-style: none; }

.urm-cta     { width: 100%; padding: 0.875rem; border-radius: 12px; font-weight: 600;
               font-size: 0.95rem; cursor: pointer; border: none; margin-top: 0.5rem; }
.urm-dismiss { font-size: 0.75rem; color: var(--text-muted, #71717a); margin: 1rem 0 0; }

/* ICI score badge inside upload result popup */
.urm-ici {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  margin: 0.75rem 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.urm-ici-score { font-family: var(--dm, monospace); font-size: 0.88rem; font-weight: 600; color: var(--text, #F0F0F5); }
.urm-ici-level { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

.urm-ici--excellent { border-color: rgba(0,232,122,0.3); background: rgba(0,232,122,0.06); }
.urm-ici--excellent .urm-ici-level { color: var(--green, #00E87A); }
.urm-ici--good      { border-color: rgba(0,232,122,0.2); background: rgba(0,232,122,0.04); }
.urm-ici--good      .urm-ici-level { color: var(--green, #00E87A); }
.urm-ici--attention { border-color: rgba(255,159,10,0.3); background: rgba(255,159,10,0.06); }
.urm-ici--attention .urm-ici-level { color: var(--amber, #FF9F0A); }
.urm-ici--risk      { border-color: rgba(255,69,58,0.25); background: rgba(255,69,58,0.05); }
.urm-ici--risk      .urm-ici-level { color: var(--red, #FF453A); }
.urm-ici--critical  { border-color: rgba(255,69,58,0.4);  background: rgba(255,69,58,0.09); }
.urm-ici--critical  .urm-ici-level { color: var(--red, #FF453A); }

/* ==========================================================================
   AUDIO PLAYER — TachoAudioPlayer component
   ========================================================================== */
.audio-player {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  margin: 0.6rem 0;
}
.ap-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--blue, #0A84FF);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ap-progress {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.10);
  border-radius: 2px;
  overflow: hidden;
}
.ap-bar {
  height: 100%;
  background: var(--blue, #0A84FF);
  border-radius: 2px;
  transition: width 0.2s linear;
}
.ap-time  { font-family: var(--dm, monospace); font-size: 0.72rem; color: var(--text2, #8A8A96); white-space: nowrap; }
.ap-label { font-size: 0.72rem; color: var(--text2, #8A8A96); white-space: nowrap; }

/* ==========================================================================
   TODAY BLOCK — generic card container (10B)
   ========================================================================== */
.today-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1rem 0.85rem;
  margin: 0.75rem 0;
}
.today-block.tblock--warning { border-color: var(--amber); }
.today-block.tblock--critical { border-color: var(--red); }

.tblock-title {
  font-family: var(--df);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 0.5rem;
}
.tblock-value {
  font-family: var(--df);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.tblock-sub {
  font-size: 0.78rem;
  color: var(--text2);
}
.tblock-debt {
  font-size: 0.78rem;
  color: var(--amber);
  margin-top: 0.4rem;
}

/* Block 3 — Balance bars */
.bal-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.bal-label {
  font-size: 0.72rem;
  color: var(--text2);
  width: 100px;
  flex-shrink: 0;
}
.bal-track {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.bal-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.bal-bar--safe    { background: var(--green); }
.bal-bar--warning { background: var(--amber); }
.bal-bar--danger  { background: var(--red); }
.bal-value {
  font-family: var(--dm);
  font-size: 0.68rem;
  color: var(--text2);
  width: 64px;
  text-align: right;
  flex-shrink: 0;
}
.bal-value--warning { color: var(--amber); }
.bal-value--danger  { color: var(--red); }

/* ==========================================================================
   DATA ANCHOR BAR — DDD sync status indicator (10A.3)
   ========================================================================== */
.data-anchor-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  margin: 0.5rem 0 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.78rem;
  color: var(--text2);
}
.dab-icon  { font-size: 0.75rem; flex-shrink: 0; }
.dab-label { line-height: 1.2; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (min-width: 430px) {
  .bnav, .bottom-nav {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
