/* ════════════════════════════════════════════════════════════════
   tachograph.css — TruckHub Tachograph tab
   Mobile-first, glassmorphism, theme-aware (dark/light/amoled).
   Reuses CSS variables from base.css: --accent, --green, --red, --yellow,
                                        --glass, --glass-border, --surface,
                                        --text, --muted, --touch-min, etc.
   ════════════════════════════════════════════════════════════════ */

/* ────── Animations ────── */
@keyframes tgPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .65; transform: scale(1.06); }
}
@keyframes tgGaugeFill {
  from { stroke-dashoffset: var(--tg-circumference); }
}
@keyframes tgFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes tgShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes tgDrawerSlide {
  from { transform: translateY(20%); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
@keyframes tgRingPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .55); }
  50%      { box-shadow: 0 0 0 10px rgba(var(--accent-rgb), 0); }
}

/* ────── Root container ────── */
#tachograph-content {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--topbar-h, 0);
  bottom: 64px; /* above bottom-bar */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  z-index: 1;
  padding-bottom: 40px;
}
#tachograph-content::-webkit-scrollbar { width: 4px; }
#tachograph-content::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 2px; }

.tachograph-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 14px 32px;
  animation: tgFadeUp .35s ease;
}

/* ────── Section spacing helper ────── */
.tg-section { margin-bottom: 14px; }
.tg-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 18px 4px 8px;
}
.tg-section-title i { width: 14px; height: 14px; }

/* ────── Sub-navigation (chip-style horizontal scroll) ────── */
.tachograph-subnav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 4px 12px;
  margin: 0 -14px 16px;
  padding-left: 14px;
  padding-right: 14px;
  scroll-behavior: smooth;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, var(--bg) 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
}
.tachograph-subnav::-webkit-scrollbar { display: none; }

.tachograph-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .12s ease;
  min-height: var(--touch-min, 44px);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.tachograph-chip i { width: 14px; height: 14px; }
.tachograph-chip:hover { background: var(--glass-hover); color: var(--text); }
.tachograph-chip:active { transform: scale(.96); }
.tachograph-chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(var(--accent-rgb), .35);
}
.tachograph-chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  min-width: 18px;
  padding: 0 6px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
}
.tachograph-chip.active .tachograph-chip-badge {
  background: rgba(0,0,0,.32);
  color: #fff;
}

/* ────── Status card (hero) ────── */
.tachograph-status-card {
  position: relative;
  border-radius: 22px;
  padding: 20px 20px 18px;
  margin-bottom: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 14px 40px rgba(var(--accent-rgb), .28), inset 0 1px 0 rgba(255,255,255,.16);
  isolation: isolate;
}
.tachograph-status-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% -10%, rgba(255,255,255,.20), transparent 55%),
    radial-gradient(circle at 0% 110%, rgba(0,0,0,.18), transparent 50%);
  z-index: -1;
}
.tachograph-status-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: .35;
  z-index: -1;
  pointer-events: none;
}
.tachograph-status-card.status-driving       { background: linear-gradient(135deg, #16a34a, #166534); box-shadow: 0 14px 40px rgba(22,163,74,.32), inset 0 1px 0 rgba(255,255,255,.16); }
.tachograph-status-card.status-break_15,
.tachograph-status-card.status-break_30,
.tachograph-status-card.status-break_45      { background: linear-gradient(135deg, #f59e0b, #b45309); box-shadow: 0 14px 40px rgba(245,158,11,.32), inset 0 1px 0 rgba(255,255,255,.16); }
.tachograph-status-card.status-other_work,
.tachograph-status-card.status-availability  { background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: 0 14px 40px rgba(99,102,241,.32), inset 0 1px 0 rgba(255,255,255,.16); }
.tachograph-status-card.status-daily_rest,
.tachograph-status-card.status-daily_rest_split_3,
.tachograph-status-card.status-daily_rest_split_9,
.tachograph-status-card.status-weekly_rest,
.tachograph-status-card.status-weekly_rest_reduced { background: linear-gradient(135deg, #0ea5e9, #075985); box-shadow: 0 14px 40px rgba(14,165,233,.32), inset 0 1px 0 rgba(255,255,255,.16); }
.tachograph-status-card.status-idle          { background: linear-gradient(135deg, #475569, #1e293b); box-shadow: 0 14px 36px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.10); }

.tg-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.tg-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.22);
  animation: tgPulse 2.4s ease-in-out infinite;
  flex: 0 0 auto;
}
.tachograph-status-card.status-idle .tg-status-dot { animation: none; opacity: .5; }
.tg-status-label {
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  opacity: .8;
  font-weight: 700;
}
.tg-status-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.4px;
  line-height: 1.1;
  margin-top: 2px;
}
.tg-status-timer {
  font-family: 'Rajdhani', sans-serif;
  font-size: 44px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1.5px;
  line-height: 1;
  margin-top: 2px;
}
.tg-status-timer .tg-time-unit { font-size: 18px; font-weight: 600; opacity: .75; margin-left: 4px; }
.tg-status-sub {
  font-size: 13px;
  opacity: .92;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tg-status-sub i { width: 14px; height: 14px; flex: 0 0 auto; }
.tg-status-sub strong {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  margin-left: 2px;
}
.tg-status-fatigue {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.32);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.10);
  letter-spacing: .2px;
}
.tg-status-fatigue i { width: 13px; height: 13px; }
.tg-status-fatigue.high { background: rgba(220,38,38,.92); }

/* ────── Gauges grid (5 radial gauges) ────── */
.tachograph-gauges {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.tachograph-gauges .tg-gauge:first-child { grid-column: 1 / -1; }
@media (min-width: 480px) {
  .tachograph-gauges { grid-template-columns: repeat(3, 1fr); }
  .tachograph-gauges .tg-gauge:first-child { grid-column: 1 / -1; }
}
@media (min-width: 640px) {
  .tachograph-gauges { grid-template-columns: repeat(5, 1fr); gap: 12px; }
  .tachograph-gauges .tg-gauge:first-child { grid-column: span 1; }
}

.tg-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 10px 14px;
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  position: relative;
  overflow: hidden;
}
.tg-gauge::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 60%);
  pointer-events: none;
}
.tg-gauge:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.18); }
.tg-gauge.danger { border-color: rgba(239,68,68,.45); box-shadow: 0 0 0 1px rgba(239,68,68,.15) inset; }

.tg-gauge-svg {
  width: 92px;
  height: 92px;
  position: relative;
}
.tg-gauge:first-child .tg-gauge-svg { width: 124px; height: 124px; }
.tg-gauge-svg svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.tg-gauge-track {
  fill: none;
  stroke: var(--glass-border);
  stroke-width: 8;
}
.tg-gauge-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 8;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(34,197,94,.4));
  transition: stroke-dashoffset .8s cubic-bezier(.4, 0, .2, 1), stroke .3s, filter .3s;
}
.tg-gauge-fill.warning { stroke: var(--yellow); filter: drop-shadow(0 0 6px rgba(234,179,8,.4)); }
.tg-gauge-fill.danger  { stroke: var(--red);    filter: drop-shadow(0 0 8px rgba(239,68,68,.5)); }
.tg-gauge-fill.success { stroke: var(--green);  filter: drop-shadow(0 0 6px rgba(34,197,94,.4)); }

.tg-gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.tg-gauge-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
  letter-spacing: -.5px;
}
.tg-gauge:first-child .tg-gauge-value { font-size: 28px; letter-spacing: -1px; }
.tg-gauge.danger .tg-gauge-value { color: var(--red); }
.tg-gauge-max {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
}
.tg-gauge:first-child .tg-gauge-max { font-size: 12px; }
.tg-gauge-label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .9px;
  margin-top: 10px;
  text-align: center;
  line-height: 1.25;
  font-weight: 700;
}
.tg-gauge:first-child .tg-gauge-label { font-size: 12px; letter-spacing: 1.2px; }

/* ────── Action grid (start/break/rest buttons) ────── */
.tachograph-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0;
}
.tachograph-actions.has-hero { grid-template-columns: repeat(2, 1fr); }
.tachograph-actions.has-hero .tg-action-btn.hero {
  grid-column: 1 / -1;
  min-height: 92px;
  padding: 16px 16px;
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
  gap: 14px;
  font-size: 16px;
  letter-spacing: -.2px;
}
.tachograph-actions.has-hero .tg-action-btn.hero i {
  width: 32px;
  height: 32px;
}
@media (min-width: 480px) {
  .tachograph-actions { grid-template-columns: repeat(3, 1fr); }
}

.tg-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 76px;
  padding: 12px 10px;
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .12s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  line-height: 1.2;
  position: relative;
  overflow: hidden;
}
.tg-action-btn i { width: 22px; height: 22px; color: var(--accent); transition: transform .2s ease; flex: 0 0 auto; }
.tg-action-btn:hover { background: var(--glass-hover); border-color: rgba(255,255,255,.16); transform: translateY(-1px); }
.tg-action-btn:hover i { transform: scale(1.08); }
.tg-action-btn:active { transform: scale(.97); }

.tg-action-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(var(--accent-rgb), .32);
}
.tg-action-btn.primary i { color: #fff; }
.tg-action-btn.primary::after {
  content:'';
  position:absolute; inset:0;
  background: radial-gradient(circle at 100% 0%, rgba(255,255,255,.16), transparent 55%);
  pointer-events:none;
}
.tg-action-btn.success { background: linear-gradient(135deg, #16a34a, #166534); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(22,163,74,.28); }
.tg-action-btn.success i { color: #fff; }
.tg-action-btn.warning { background: linear-gradient(135deg, #f59e0b, #b45309); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(245,158,11,.28); }
.tg-action-btn.warning i { color: #fff; }
.tg-action-btn.info    { background: linear-gradient(135deg, #0ea5e9, #075985); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(14,165,233,.28); }
.tg-action-btn.info i { color: #fff; }
.tg-action-btn.ghost {
  background: transparent;
  border-color: var(--glass-border);
  color: var(--muted);
  box-shadow: none;
}
.tg-action-btn.ghost i { color: var(--muted); }
.tg-action-btn.ghost:hover { background: var(--glass); color: var(--text); border-color: rgba(255,255,255,.16); }
.tg-action-btn.ghost:hover i { color: var(--text); }
.tg-action-btn[disabled] { opacity: .4; pointer-events: none; }

/* Drawer-action flex helpers */
.tg-drawer-actions .tg-action-btn.flex-1 { flex: 1; }

/* Confirmation drawer body text */
.tg-confirm-text {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
  padding: 4px 2px 8px;
  opacity: .88;
}

/* Compact icon-only action button */
.tg-action-btn.compact {
  min-height: 36px;
  padding: 6px 10px;
  flex: 0 0 auto;
  flex-direction: row;
  gap: 6px;
  font-size: 12px;
}
.tg-action-btn.compact i { width: 14px; height: 14px; }
.tg-action-btn.icon-only {
  min-height: 36px;
  width: 36px;
  padding: 0;
  flex: 0 0 auto;
}

/* ────── Info cards ────── */
.tg-info-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.tg-info-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 60%);
  pointer-events: none;
}
.tg-info-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.tg-info-card-title i { width: 14px; height: 14px; color: var(--accent); flex: 0 0 auto; }
.tg-info-card-title .tg-info-card-meta {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.tg-next-event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tg-next-event-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.tg-next-event-time {
  font-family: 'Rajdhani', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ────── Compliance & fatigue mini-cards ────── */
.tg-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.tg-mini {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s ease;
}
.tg-mini:hover { border-color: rgba(255,255,255,.16); }
.tg-mini.danger  { border-color: rgba(239,68,68,.4);   box-shadow: 0 0 0 1px rgba(239,68,68,.10) inset; }
.tg-mini.warning { border-color: rgba(245,158,11,.4);  box-shadow: 0 0 0 1px rgba(245,158,11,.10) inset; }
.tg-mini.success { border-color: rgba(34,197,94,.35);  box-shadow: 0 0 0 1px rgba(34,197,94,.08) inset; }

.tg-mini-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(var(--accent-rgb), .14);
  color: var(--accent);
}
.tg-mini-icon i { width: 18px; height: 18px; }
.tg-mini-content { flex: 1; min-width: 0; }
.tg-mini-label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 700;
}
.tg-mini-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  margin-top: 3px;
  letter-spacing: -.3px;
}
.tg-mini-value-suffix {
  font-size: 12px;
  font-weight: 500;
  opacity: .55;
  margin-left: 1px;
}
.tg-mini-trend {
  font-size: 11px;
  margin-top: 1px;
  font-weight: 600;
}
.tg-mini-trend.up   { color: var(--green); }
.tg-mini-trend.down { color: var(--red); }

/* ────── Predict / warning banner ────── */
.tg-predict-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(245,158,11,.04));
  border: 1px solid rgba(245,158,11,.32);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 12px;
}
.tg-predict-banner.danger {
  background: linear-gradient(135deg, rgba(239,68,68,.18), rgba(239,68,68,.04));
  border-color: rgba(239,68,68,.32);
}
.tg-predict-banner i {
  width: 20px; height: 20px; flex: 0 0 auto;
  color: var(--yellow);
  filter: drop-shadow(0 0 6px rgba(234,179,8,.4));
}
.tg-predict-banner.danger i { color: var(--red); filter: drop-shadow(0 0 6px rgba(239,68,68,.4)); }

/* ────── Loading skeleton ────── */
.tg-skeleton {
  background: linear-gradient(90deg, var(--glass) 0%, var(--glass-hover) 50%, var(--glass) 100%);
  background-size: 200% 100%;
  animation: tgShimmer 1.4s infinite;
  border-radius: 12px;
  height: 88px;
}

/* ────── Empty state ────── */
.tg-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.tg-empty-state i { width: 56px; height: 56px; opacity: .35; stroke-width: 1.5; }
.tg-empty-state-text {
  font-size: 14px;
  line-height: 1.5;
  max-width: 280px;
}
.tg-empty-state-hint {
  font-size: 12px;
  color: var(--muted);
  opacity: .8;
}

/* ────── Pills (compact stat badges) ────── */
.tg-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tg-pill i { width: 13px; height: 13px; flex: 0 0 auto; }
.tg-pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* ────── Severity badges ────── */
.tg-sev-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #fff;
}
.tg-sev-badge.minor        { background: #6b7280; }
.tg-sev-badge.serious      { background: #f59e0b; }
.tg-sev-badge.very_serious { background: #dc2626; }
.tg-sev-badge.most_serious { background: #991b1b; box-shadow: 0 0 0 2px rgba(153,27,27,.25); }

/* ────── GPS sticker ────── */
.tg-gps-sticker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.32);
  border: 1px solid rgba(255,255,255,.10);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  margin-top: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tg-gps-sticker i { width: 12px; height: 12px; }
.tg-gps-sticker.active { background: rgba(34,197,94,.92); border-color: transparent; }
.tg-gps-sync-btn {
  cursor: pointer;
  border: none;
  font-family: inherit;
  color: inherit;
  transition: opacity .2s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.tg-gps-sync-btn:not(.active) { opacity: .65; }
.tg-gps-sync-btn:active { transform: scale(.96); }
.tg-gps-sync-btn.active { animation: tgGpsSyncPulse 2.5s ease infinite; }
.tg-gps-sync-btn.stale  { background: rgba(245,158,11,.85); border-color: transparent; animation: none; }
.tg-gps-sync-scores {
  font-size: 9px;
  opacity: .75;
  margin-left: 3px;
  font-variant-numeric: tabular-nums;
}
@keyframes tgGpsSyncPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* ────── Toggle switch ────── */
.tg-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex: 0 0 auto;
}
.tg-toggle input { opacity: 0; width: 0; height: 0; }
.tg-toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--glass-border);
  border-radius: 999px;
  transition: background .2s ease;
}
.tg-toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.tg-toggle input:checked + .tg-toggle-slider { background: var(--accent); }
.tg-toggle input:checked + .tg-toggle-slider::before { transform: translateX(18px); }

/* ────── Avatar (deterministic color fallback) ────── */
.tg-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 16px;
  flex: 0 0 auto;
  overflow: hidden;
  background: linear-gradient(135deg, #6366f1, #4338ca);
}
.tg-avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.tg-avatar.lg { width: 52px; height: 52px; font-size: 19px; }
.tg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tg-avatar.c0 { background: linear-gradient(135deg, #6366f1, #4338ca); }
.tg-avatar.c1 { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.tg-avatar.c2 { background: linear-gradient(135deg, #f59e0b, #b45309); }
.tg-avatar.c3 { background: linear-gradient(135deg, #ec4899, #be185d); }
.tg-avatar.c4 { background: linear-gradient(135deg, #0ea5e9, #075985); }
.tg-avatar.c5 { background: linear-gradient(135deg, #84cc16, #4d7c0f); }
.tg-avatar.c6 { background: linear-gradient(135deg, #a855f7, #6d28d9); }

/* ────── Calendar (Log subtab) ────── */
.tg-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.tg-cal-head {
  font-size: 10px;
  text-align: center;
  color: var(--muted);
  padding: 6px 0 2px;
  font-weight: 700;
  letter-spacing: .5px;
}
.tg-cal-cell {
  position: relative;
  border: 0;
  cursor: pointer;
  border-radius: 10px;
  background: var(--glass);
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 0 7px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background .15s ease, color .15s ease, transform .12s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.tg-cal-cell.empty { visibility: hidden; }
.tg-cal-cell.has-data { color: var(--text); background: rgba(34,197,94,.10); }
.tg-cal-cell.has-data.has-violation { background: rgba(239,68,68,.14); }
.tg-cal-cell.is-today { border-color: var(--accent); }
.tg-cal-cell.is-selected { background: var(--accent); color: #fff; }
.tg-cal-cell:hover:not(.is-selected) { transform: translateY(-1px); }
.tg-cal-cell-bar {
  display: block;
  height: 3px; width: 16px;
  margin: 3px auto 0;
  border-radius: 2px;
  background: #22c55e;
  opacity: .75;
}
.tg-cal-cell.has-violation .tg-cal-cell-bar { background: #ef4444; }
.tg-cal-cell.is-selected .tg-cal-cell-bar { opacity: 1; background: #fff; }

.tg-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.tg-cal-month {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 17px;
  text-transform: capitalize;
  letter-spacing: .2px;
}

/* ────── Timeline (Log subtab) ────── */
.tg-timeline {
  position: relative;
  padding-left: 22px;
}
.tg-timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--glass-border), transparent);
}
.tg-tl-item {
  position: relative;
  padding: 8px 0 14px;
  cursor: pointer;
}
.tg-tl-dot {
  position: absolute;
  left: -19px;
  top: 14px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--glass-border);
}
.tg-tl-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.tg-tl-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.1px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tg-tl-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.tg-tl-notes {
  font-size: 12px;
  margin-top: 5px;
  font-style: italic;
  color: var(--muted);
}
.tg-tl-edit-icon {
  width: 16px; height: 16px;
  color: var(--muted);
  flex: 0 0 auto;
  margin-top: 4px;
}
.tg-tl-source {
  font-size: 9.5px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* ────── Heatmap (Stats) ────── */
.tg-heatmap {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 110px;
  overflow-x: auto;
  padding: 4px 2px 6px;
  scrollbar-width: none;
}
.tg-heatmap::-webkit-scrollbar { display: none; }
.tg-hm-col {
  flex: 1 0 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}
.tg-hm-stack {
  display: flex;
  flex-direction: column;
  width: 18px;
  height: 92px;
  justify-content: flex-end;
  border-radius: 4px 4px 2px 2px;
  overflow: hidden;
  background: var(--glass);
  border: 1px solid var(--glass-border);
}
.tg-hm-stack > div { transition: height .4s ease; }
.tg-hm-day {
  font-family: 'Rajdhani', sans-serif;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tg-hm-col.is-weekend .tg-hm-stack { background: rgba(255,255,255,.02); }
.tg-hm-col.is-today .tg-hm-day { color: var(--accent); font-weight: 800; }

.tg-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}
.tg-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.tg-legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ────── Compliance gauge (Stats) ────── */
.tg-compliance {
  display: flex;
  gap: 16px;
  align-items: center;
}
.tg-compliance-svg {
  flex: 0 0 auto;
  width: 132px; height: 132px;
  position: relative;
}
.tg-compliance-svg svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tg-compliance-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.tg-compliance-num {
  font-family: 'Rajdhani', sans-serif;
  font-size: 38px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
}
.tg-compliance-suffix {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
  font-weight: 700;
}
.tg-compliance-body { flex: 1; min-width: 0; }
.tg-compliance-label {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 8px;
}
.tg-streak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(34,197,94,.15);
  color: #22c55e;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(34,197,94,.3);
  margin-top: 8px;
}
.tg-streak i { width: 14px; height: 14px; }

/* Compliance quality badge */
.tg-compliance-card { padding-top: 18px; padding-bottom: 18px; }
.tg-compliance-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
  border: 1px solid;
  letter-spacing: .1px;
}
.tg-compliance-badge i { width: 14px; height: 14px; }

/* Heatmap day-of-week letter */
.tg-hm-dow {
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  opacity: .7;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-family: 'Rajdhani', sans-serif;
}
.tg-hm-col.is-weekend .tg-hm-dow { color: rgba(245, 158, 11, .8); opacity: 1; }
.tg-hm-col.is-today .tg-hm-dow { color: var(--accent); opacity: 1; }

/* No-violations celebratory card */
.tg-no-viol {
  text-align: center;
  padding: 22px 18px;
  border-color: rgba(34, 197, 94, .28);
  background: linear-gradient(180deg, rgba(34,197,94,.05), var(--glass));
}
.tg-no-viol-icon {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgba(34, 197, 94, .14);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, .35);
}
.tg-no-viol-icon i { width: 28px; height: 28px; }
.tg-no-viol-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 18px; font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.tg-no-viol-hint {
  font-size: 12.5px; color: var(--muted);
  line-height: 1.5;
  max-width: 280px;
  margin: 0 auto;
}

/* Violations total pill in card title */
.tg-viol-total {
  font-family: 'Rajdhani', sans-serif !important;
  font-size: 13px !important;
  font-weight: 700;
  background: rgba(239, 68, 68, .14);
  color: #ef4444;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, .3);
}

/* ────── Violation card (clickable button → opens drawer) ────── */
.tg-viol-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--muted);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background .15s ease, border-color .2s ease, transform .12s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.tg-viol-card:hover {
  background: var(--glass-hover);
  border-color: rgba(255,255,255,.16);
  transform: translateY(-1px);
}
.tg-viol-card:active { transform: scale(.99); }
.tg-viol-card.sev-minor        { border-left-color: #6b7280; }
.tg-viol-card.sev-serious      { border-left-color: #f59e0b; }
.tg-viol-card.sev-very_serious { border-left-color: #dc2626; }
.tg-viol-card.sev-most_serious { border-left-color: #991b1b; box-shadow: 0 0 0 1px rgba(153,27,27,.18); }
.tg-viol-card.acked            { opacity: .58; }
.tg-viol-card-icon {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  flex: 0 0 auto;
}
.tg-viol-card-icon i { width: 18px; height: 18px; }
.tg-viol-card-body { flex: 1; min-width: 0; }
.tg-viol-card-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.tg-viol-card-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: -.1px;
}
.tg-viol-card-meta {
  display: flex; align-items: center;
  gap: 5px; flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.tg-viol-card-meta i { width: 12px; height: 12px; flex: 0 0 auto; }
.tg-viol-card-meta-sep { opacity: .5; margin: 0 2px; }
.tg-viol-card-chevron {
  display: grid; place-items: center;
  flex: 0 0 auto;
  width: 24px; height: 24px;
  color: var(--muted);
  opacity: .5;
}
.tg-viol-card-chevron i { width: 18px; height: 18px; }
.tg-viol-acked {
  font-size: 11px;
  color: #22c55e;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}
.tg-viol-acked i { width: 13px; height: 13px; }

/* Violation detail drawer */
.tg-viol-detail-head {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 4px;
}
.tg-viol-detail-icon {
  display: grid; place-items: center;
  width: 48px; height: 48px;
  border-radius: 12px;
  flex: 0 0 auto;
}
.tg-viol-detail-icon i { width: 24px; height: 24px; }
.tg-viol-detail-rule {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: .3px;
}
.tg-viol-detail-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  opacity: .9;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 14px;
}

/* ────── Alarm row ────── */
.tg-alarm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  margin-bottom: 8px;
  transition: opacity .15s ease;
}
.tg-alarm-row.disabled { opacity: .5; }
.tg-alarm-row-body { flex: 1; min-width: 0; }
.tg-alarm-row-title { font-weight: 700; font-size: 14px; letter-spacing: -.1px; }
.tg-alarm-row-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.tg-icon-btn {
  width: 36px; height: 36px;
  border: 0; cursor: pointer;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--muted);
  display: grid; place-items: center;
  transition: background .15s ease, color .15s ease;
}
.tg-icon-btn:hover { background: var(--glass-hover); color: var(--red); }
.tg-icon-btn i { width: 16px; height: 16px; }

/* ════════════════════════════════════════════════════════════════
   Crew sub-tab — empty state, pending invite, active session
   ════════════════════════════════════════════════════════════════ */

/* Empty / hero state */
.tg-crew-hero { text-align: center; padding: 24px 18px; }
.tg-crew-hero-icon {
  display: grid; place-items: center;
  width: 68px; height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(var(--accent-rgb), .22), rgba(var(--accent-rgb), .08));
  border: 1px solid rgba(var(--accent-rgb), .28);
  margin: 0 auto 14px;
}
.tg-crew-hero-icon i { width: 30px; height: 30px; color: var(--accent); }
.tg-crew-hero-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 22px; font-weight: 700;
  letter-spacing: -.3px;
  margin-bottom: 6px;
}
.tg-crew-hero-sub {
  font-size: 13px; color: var(--muted);
  line-height: 1.5;
  max-width: 320px; margin: 0 auto 20px;
}
.tg-crew-hero-btn { width: 100%; }
.tg-crew-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 10px;
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.4px; font-weight: 600;
}
.tg-crew-divider::before,
.tg-crew-divider::after {
  content: '';
  flex: 1; height: 1px;
  background: var(--glass-border);
}

/* Code input + join button */
.tg-crew-code-wrap {
  display: flex; gap: 8px; align-items: stretch;
  margin: 8px 0 4px;
}
.tg-crew-code-input {
  flex: 1;
  text-align: center;
  font-family: 'Rajdhani', sans-serif;
  font-size: 26px;
  letter-spacing: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.tg-crew-join-btn { flex: 0 0 110px; min-height: 52px; }

/* Pending invite — QR + code + countdown */
.tg-crew-pending { text-align: center; padding: 22px 18px; }
.tg-crew-qr-wrap {
  display: grid; place-items: center;
  margin: 16px auto 12px;
  padding: 12px;
  background: #fff;
  border-radius: 18px;
  width: fit-content;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.tg-crew-qr-wrap .tg-qr-img { display: block; }
.tg-crew-code-display {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 38px; font-weight: 700;
  letter-spacing: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin: 8px auto 12px;
  padding: 10px 18px 10px 28px;
  background: rgba(var(--accent-rgb), .08);
  border-radius: 14px;
  border: 1px solid rgba(var(--accent-rgb), .22);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.tg-crew-code-display:hover {
  background: rgba(var(--accent-rgb), .14);
  border-color: rgba(var(--accent-rgb), .38);
}
.tg-crew-code-display:active { transform: scale(.98); }
.tg-crew-code-copy {
  width: 18px; height: 18px;
  color: var(--muted);
  letter-spacing: 0;
  flex: 0 0 auto;
}
.tg-crew-expires {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}
.tg-crew-expires i { width: 13px; height: 13px; }
.tg-crew-cancel-btn { width: 100%; }

/* Active session header */
.tg-crew-plate {
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-variant-numeric: tabular-nums;
}
.tg-crew-session-meta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin: -4px 0 12px;
}
.tg-crew-session-meta i { width: 13px; height: 13px; }
.tg-crew-actions { margin-top: 14px; }

/* Member cards (button-like with hover) */
.tg-crew-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.tg-crew-member {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 12px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  border-left: 3px solid var(--muted);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
  font: inherit; color: inherit;
}
.tg-crew-member:hover {
  background: var(--glass-hover);
  border-color: rgba(255,255,255,.16);
  transform: translateY(-1px);
}
.tg-crew-member:active { transform: scale(.98); }
.tg-crew-member.driving       { border-left-color: #22c55e; }
.tg-crew-member.break_15,
.tg-crew-member.break_30,
.tg-crew-member.break_45      { border-left-color: #f59e0b; }
.tg-crew-member.daily_rest,
.tg-crew-member.weekly_rest   { border-left-color: #0ea5e9; }
.tg-crew-member-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.tg-crew-member-name {
  font-weight: 700; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tg-crew-member-role {
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  font-weight: 700;
}
.tg-crew-member-role.primary { color: var(--accent); }
.tg-crew-member-status { font-size: 15px; font-weight: 700; }
.tg-crew-member-sub {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.tg-crew-member-sub i { width: 11px; height: 11px; }

/* Member detail drawer */
.tg-crew-detail-head {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 4px;
}
.tg-crew-detail-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 19px; font-weight: 700;
  letter-spacing: -.2px;
}
.tg-crew-detail-role {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  font-weight: 700;
  margin-top: 2px;
}
.tg-crew-detail-status {
  font-size: 13px; font-weight: 700;
  margin-top: 4px;
}

/* ────── Crew driving conflict — blocked button state ────── */
.tg-action-btn.tg-crew-blocked {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
}
.tg-crew-blocked-lbl {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: .3px;
  color: var(--muted);
  margin-top: 3px;
}
.tg-crew-blocked-lbl i { width: 10px; height: 10px; flex: 0 0 auto; }

/* ────── Friend overview chips ────── */
.tg-friend-row {
  display: flex; gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.tg-friend-row::-webkit-scrollbar { display: none; }
.tg-friend-chip {
  flex: 0 0 100px;
  text-align: center;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 4px;
}
.tg-friend-chip:hover .tg-avatar { transform: scale(1.04); }
.tg-friend-chip-avatar {
  position: relative;
  display: inline-block;
  margin-bottom: 6px;
  transition: transform .2s ease;
}
.tg-friend-chip-status-dot {
  position: absolute; bottom: 0; right: 0;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--muted);
}
.tg-friend-chip-name {
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tg-friend-chip-status {
  font-size: 10px;
  margin-top: 2px;
}

.tg-list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-border);
}
.tg-list-row:last-child { border-bottom: 0; }
.tg-list-row-body { flex: 1; min-width: 0; }
.tg-list-row-title { font-weight: 600; font-size: 13.5px; }
.tg-list-row-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ────── Rules accordion ────── */
.tg-acc {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  margin-bottom: 8px;
  overflow: hidden;
}
.tg-acc-head {
  width: 100%;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  font-family: inherit;
}
.tg-acc-head:hover { background: var(--glass-hover); }
.tg-acc-head i:first-child { color: var(--accent); width: 18px; height: 18px; flex: 0 0 auto; }
.tg-acc-head-title { flex: 1; font-weight: 700; font-size: 14px; letter-spacing: -.1px; }
.tg-acc-head-chevron { color: var(--muted); width: 18px; height: 18px; flex: 0 0 auto; transition: transform .2s ease; }
.tg-acc.open .tg-acc-head-chevron { transform: rotate(180deg); }
.tg-acc-body { padding: 0 16px 14px; }
.tg-acc-item {
  padding: 9px 0;
  border-top: 1px solid var(--glass-border);
}
.tg-acc-item-title {
  font-weight: 600; font-size: 13px;
  margin-bottom: 3px;
  letter-spacing: -.1px;
}
.tg-acc-item-body {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

/* ────── Drawer (bottom sheet) ────── */
.tg-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9998;
  animation: tgFadeUp .2s ease;
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
}
.tg-drawer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--glass-border);
  padding: 12px 18px 22px;
  z-index: 9999;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -16px 40px rgba(0,0,0,.4);
  max-height: 88vh;
  overflow-y: auto;
  animation: tgDrawerSlide .25s cubic-bezier(.4,0,.2,1);
}
.tg-drawer-handle {
  width: 44px; height: 5px;
  background: var(--glass-border);
  border-radius: 999px;
  margin: 0 auto 14px;
}
.tg-drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.tg-drawer-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 22px; font-weight: 700;
  letter-spacing: -.3px;
}
.tg-drawer-close {
  background: none; border: 0; cursor: pointer;
  color: var(--muted); padding: 6px;
  border-radius: 8px;
  transition: background .15s ease;
}
.tg-drawer-close:hover { background: var(--glass); color: var(--text); }
.tg-drawer-close i { width: 22px; height: 22px; }
.tg-drawer-form { display: flex; flex-direction: column; gap: 12px; }
.tg-field { display: flex; flex-direction: column; gap: 5px; }
.tg-field-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 700;
}
.tg-input {
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 11px;
  color: var(--text);
  padding: 11px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.tg-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--glass-strong);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15);
}
.tg-input[type="datetime-local"], .tg-input[type="date"] {
  font-variant-numeric: tabular-nums;
}
.tg-input::placeholder { color: var(--muted); opacity: .7; }
.tg-input.tg-input-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .15);
  animation: tgInputErrorShake .35s ease-in-out;
}
@keyframes tgInputErrorShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Quick-extend buttons in edit drawer */
.tg-quick-extend {
  margin: 4px 0 8px;
  padding: 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.tg-quick-extend-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tg-quick-extend-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.tg-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.tg-quick-btn i {
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.tg-quick-btn:hover, .tg-quick-btn:active {
  background: rgba(var(--accent-rgb), .12);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.tg-quick-extend-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 8px;
  font-style: italic;
}

textarea.tg-input { min-height: 64px; resize: vertical; }
select.tg-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7494' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.tg-checkbox-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}
.tg-checkbox-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.tg-drawer-actions {
  display: flex; gap: 10px;
  margin-top: 6px;
}
.tg-drawer-actions .tg-action-btn { flex: 1; min-height: 48px; }
.tg-drawer-actions .tg-action-btn.flex-2 { flex: 2; }

/* ────── QR card ────── */
.tg-qr-card {
  text-align: center;
  padding: 20px 18px;
}
.tg-qr-img {
  width: 200px; height: 200px;
  border-radius: 14px;
  background: #fff;
  padding: 10px;
  margin: 10px auto;
  display: block;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

/* ────── Range / format chips bar ────── */
.tg-chip-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.tg-chip-bar .tachograph-chip {
  min-height: 38px;
  padding: 7px 14px;
  font-size: 12.5px;
}

/* ────── Simple stat row (severity breakdown) ────── */
.tg-stat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: 13px;
}
.tg-stat-row:last-child { border-bottom: 0; }
.tg-stat-row-left {
  display: flex; align-items: center; gap: 10px;
}
.tg-stat-row-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.tg-stat-row-value {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.tg-stat-row-icon {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  flex: 0 0 auto;
}
.tg-stat-row-icon i { width: 14px; height: 14px; }

/* ────── Bottom-bar styling for Tachograph button (CENTRAL PROEMINENT) ────── */
.bb-tachograph-btn {
  position: relative;
  flex: 0 0 auto !important;
  width: 64px;
  margin-top: -16px;
}
.bb-tachograph-btn .bb-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), .45),
              0 0 0 4px var(--bg);
  transition: transform .2s ease, box-shadow .2s ease;
}
.bb-tachograph-btn .bb-icon i { width: 26px; height: 26px; }
.bb-tachograph-btn:active .bb-icon { transform: scale(.94); }
.bb-tachograph-btn.active .bb-icon {
  box-shadow: 0 8px 28px rgba(var(--accent-rgb), .65),
              0 0 0 4px var(--bg);
  animation: tgRingPulse 2.4s ease-in-out infinite;
}
.bb-tachograph-btn.active::after { display: none; }
.bb-tachograph-btn .bb-label {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  white-space: nowrap;
  color: var(--muted);
}
.bb-tachograph-btn.active .bb-label { color: var(--accent); }
.bb-tachograph-status {
  position: absolute;
  top: -6px;
  right: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--bg);
  z-index: 2;
  display: none;
}
.bb-tachograph-status.driving      { background: var(--green); display: block; animation: tgPulse 1.6s ease-in-out infinite; }
.bb-tachograph-status.break_15,
.bb-tachograph-status.break_30,
.bb-tachograph-status.break_45     { background: var(--yellow); display: block; }
.bb-tachograph-status.daily_rest,
.bb-tachograph-status.weekly_rest  { background: #0ea5e9; display: block; }
.bb-tachograph-status.violation    { background: var(--red); display: block; animation: tgPulse 1s ease-in-out infinite; }

/* ════════════════════════════════════════════════════════════════
   Rules sub-tab — accordion list with EU 561 sections
   ════════════════════════════════════════════════════════════════ */
.tg-rules-intro {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12.5px; color: var(--muted);
  line-height: 1.5;
  background: rgba(var(--accent-rgb), .06);
  border: 1px solid rgba(var(--accent-rgb), .18);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.tg-rules-intro i { width: 16px; height: 16px; color: var(--accent); flex: 0 0 auto; margin-top: 2px; }

.tg-rule-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.tg-rule-card.open {
  border-color: rgba(var(--accent-rgb), .3);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .12) inset;
}
.tg-rule-toggle {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 14px;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease;
}
.tg-rule-toggle:hover { background: var(--glass-hover); }
.tg-rule-toggle-icon {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: rgba(var(--accent-rgb), .12);
  color: var(--accent);
  flex: 0 0 auto;
}
.tg-rule-toggle-icon i { width: 16px; height: 16px; }
.tg-rule-toggle-title {
  flex: 1; min-width: 0;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.1px;
}
.tg-rule-toggle-chevron {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  color: var(--muted);
  transition: transform .25s ease;
  flex: 0 0 auto;
}
.tg-rule-toggle-chevron i { width: 18px; height: 18px; }
.tg-rule-card.open .tg-rule-toggle-chevron { color: var(--accent); }

.tg-rule-content {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--glass-border);
  animation: tgRuleExpand .25s ease;
}
@keyframes tgRuleExpand {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tg-rule-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.tg-rule-item:last-child { border-bottom: 0; }
.tg-rule-item-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-top: 7px;
  box-shadow: 0 0 0 3px rgba(255,255,255,.04);
}
.tg-rule-item-body { flex: 1; min-width: 0; }
.tg-rule-item-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 3px;
  letter-spacing: -.1px;
}
.tg-rule-item-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}

/* ─── Rule content: tabele ─── */
.tg-rule-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 10px 0; }
.tg-rule-table th { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--glass-border); text-align: left; }
.tg-rule-table td { padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: top; line-height: 1.45; }
.tg-rule-table tr:last-child td { border-bottom: 0; }
.tg-rule-table td:first-child { font-weight: 600; color: var(--text); }
.tg-rule-table td.tg-val { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tg-rule-table td.tg-muted { color: var(--muted); }
[data-theme="light"] .tg-rule-table td { border-bottom-color: rgba(0,0,0,.06); }
[data-theme="amoled"] .tg-rule-table td { border-bottom-color: #1a1a1a; }

/* ─── Rule content: sub-headere ─── */
.tg-rule-sub-h { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 1px solid rgba(var(--accent-rgb), .2); }
.tg-rule-sub-h:first-child { margin-top: 6px; }

/* ─── Rule content: paragrafe ─── */
.tg-rule-para { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 6px 0 10px; }
.tg-rule-para strong { color: var(--text); }

/* ─── Rule content: notă/info box ─── */
.tg-rule-note { display: flex; gap: 8px; align-items: flex-start; background: rgba(var(--accent-rgb), .07); border: 1px solid rgba(var(--accent-rgb), .2); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 12px; line-height: 1.55; color: var(--text); }
.tg-rule-note i { width: 14px; height: 14px; color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.tg-rule-note.warn { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); }
.tg-rule-note.warn i { color: #f59e0b; }
.tg-rule-note.danger { background: rgba(239,68,68,.07); border-color: rgba(239,68,68,.2); }
.tg-rule-note.danger i { color: #ef4444; }

/* ─── Rule content: badge-uri severitate ─── */
.tg-rule-badge { display: inline-block; font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 2px 7px; margin: 2px 2px 2px 0; letter-spacing: .2px; }
.tg-rule-badge.mi  { background: rgba(107,114,128,.15); color: #9ca3af; }
.tg-rule-badge.si  { background: rgba(245,158,11,.15); color: #f59e0b; }
.tg-rule-badge.vsi { background: rgba(239,68,68,.15); color: #ef4444; }
.tg-rule-badge.msi { background: rgba(153,27,27,.2); color: #fca5a5; }

/* ─── Rule content: highlight număr ─── */
.tg-rule-hl { color: var(--accent); font-weight: 700; }

/* ─── Rule content: ref legală footer ─── */
.tg-rule-ref { font-size: 11px; color: var(--muted); margin-top: 12px; opacity: .7; line-height: 1.5; }

/* ════════════════════════════════════════════════════════════════
   Schedule card (program zilnic — Live tab)
   ════════════════════════════════════════════════════════════════ */
.tg-schedule-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.tg-schedule-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.tg-schedule-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--muted); flex: 1;
}
.tg-schedule-label i { width: 13px; height: 13px; }
.tg-schedule-mode {
  font-size: 11px; font-weight: 700; color: var(--accent);
  background: rgba(var(--accent-rgb), .1); border-radius: 6px; padding: 2px 8px;
}
.tg-schedule-edit {
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 4px; border-radius: 8px; transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.tg-schedule-edit:hover, .tg-schedule-edit:active { color: var(--accent); background: rgba(var(--accent-rgb), .1); }
.tg-schedule-edit i { width: 15px; height: 15px; }
.tg-schedule-times {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.tg-schedule-time-start, .tg-schedule-time-end {
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; flex: 0 0 auto;
}
.tg-schedule-bar-wrap {
  flex: 1; height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden;
}
.tg-schedule-bar {
  height: 100%; border-radius: 3px; transition: width .5s ease, background .5s ease; min-width: 3px;
}
.tg-schedule-remain { font-size: 12px; color: var(--muted); }
.tg-schedule-remain strong { color: var(--text); }
.tg-restart-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 12px;
  background: linear-gradient(135deg, rgba(34, 197, 94, .12), rgba(14, 165, 233, .08));
  border: 1px solid rgba(34, 197, 94, .35);
  border-radius: 10px;
  font-size: 12.5px;
}

/* "Sync with tachograph" button on Live status card */
.tg-sync-tacho-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  backdrop-filter: blur(6px);
}
.tg-sync-tacho-btn i { width: 16px; height: 16px; }
.tg-sync-tacho-btn:hover, .tg-sync-tacho-btn:active {
  background: rgba(255, 255, 255, .15);
  border-color: rgba(255, 255, 255, .3);
  transform: translateY(-1px);
}
[data-theme="light"] .tg-sync-tacho-btn {
  background: rgba(0, 0, 0, .06);
  border-color: rgba(0, 0, 0, .12);
}
[data-theme="light"] .tg-sync-tacho-btn:hover {
  background: rgba(0, 0, 0, .1);
}

/* Sync drawer */
.tg-sync-drawer .tg-sync-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: rgba(14, 165, 233, .1);
  border: 1px solid rgba(14, 165, 233, .3);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
}
.tg-sync-drawer .tg-sync-banner i {
  width: 18px;
  height: 18px;
  color: #0ea5e9;
  flex-shrink: 0;
  margin-top: 1px;
}
.tg-sync-duration-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tg-sync-num {
  width: 80px !important;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tg-sync-unit {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.tg-sync-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: -4px 0 4px;
}
.tg-sync-presets .tg-quick-btn {
  padding: 8px 4px;
  font-size: 13px;
}
.tg-sync-preview {
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 4px 0;
}
.tg-sync-preview-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}
.tg-sync-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 4px 0;
}
.tg-sync-preview-row i {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}
.tg-sync-preview-label {
  color: var(--muted);
  flex: 1;
}
.tg-sync-preview-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}
.tg-sync-threshold {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: #22c55e;
  font-weight: 600;
}
.tg-restart-badge i { width: 16px; height: 16px; color: #22c55e; flex-shrink: 0; }
.tg-restart-label { color: var(--muted); flex: 1; }
.tg-restart-time {
  color: #22c55e;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.tg-schedule-override {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; font-size: 11.5px; color: #f59e0b;
}
.tg-schedule-override i { width: 12px; height: 12px; }
.tg-schedule-override span { flex: 1; }
.tg-schedule-reset {
  background: none; border: none; cursor: pointer; color: var(--muted); padding: 2px;
}
.tg-schedule-reset i { width: 13px; height: 13px; }
.tg-schedule-empty {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 2px 2px; font-size: 12.5px; color: var(--muted); line-height: 1.45;
}
.tg-schedule-empty i { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 1px; opacity: .8; }
[data-theme="light"] .tg-schedule-card { background: rgba(255,255,255,.78); border-color: rgba(0,0,0,.08); }
[data-theme="amoled"] .tg-schedule-card { background: #0a0a0a; border-color: #222; }

/* ════════════════════════════════════════════════════════════════
   Weekly EU 561/2006 allowances card — Live + Stats tabs
   ════════════════════════════════════════════════════════════════ */
.tg-allowances-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.tg-allowances-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.tg-allowances-header i { width: 13px; height: 13px; color: var(--muted); }
.tg-allowances-title { font-size: 12px; font-weight: 600; color: var(--muted); flex: 1; }
.tg-allowances-week {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  background: rgba(255,255,255,.05); border-radius: 5px; padding: 2px 6px;
  letter-spacing: .5px;
}
.tg-allow-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--glass-border);
}
.tg-allow-row:first-of-type { border-top: none; padding-top: 4px; }
.tg-allow-icon { width: 18px; height: 18px; color: var(--accent); flex: 0 0 auto; }
.tg-allow-body { flex: 1; min-width: 0; }
.tg-allow-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.tg-allow-sub { font-size: 11.5px; color: var(--muted); }
.tg-allow-sub.warn { color: #f59e0b; font-weight: 600; }
.tg-allow-counter {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
}
.tg-allow-dots { display: flex; gap: 4px; }
.tg-allow-dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--glass-border);
  background: transparent;
  transition: background .25s ease, border-color .25s ease;
}
.tg-allow-dot.filled {
  /* per-dot color is set inline; default fallback */
  background: var(--accent); border-color: var(--accent);
}
.tg-allow-num {
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text); min-width: 26px; text-align: right;
}
[data-theme="light"] .tg-allowances-card { background: rgba(255,255,255,.78); border-color: rgba(0,0,0,.08); }
[data-theme="amoled"] .tg-allowances-card { background: #0a0a0a; border-color: #222; }

/* ════════════════════════════════════════════════════════════════
   Weekly compensation tracker (EU 561/2006 art. 8(6))
   ════════════════════════════════════════════════════════════════ */
.tg-comp-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-left: 3px solid #f59e0b;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.tg-comp-card.overdue { border-left-color: #ef4444; background: rgba(239,68,68,.05); }
.tg-comp-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tg-comp-header > i { width: 14px; height: 14px; color: #f59e0b; }
.tg-comp-card.overdue .tg-comp-header > i { color: #ef4444; }
.tg-comp-title { font-size: 12px; font-weight: 600; color: var(--muted); flex: 1; }
.tg-comp-total {
  font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: #f59e0b; background: rgba(245,158,11,.12); border-radius: 6px; padding: 2px 8px;
}
.tg-comp-card.overdue .tg-comp-total { color: #ef4444; background: rgba(239,68,68,.12); }
.tg-comp-row { padding: 8px 0; border-top: 1px solid var(--glass-border); }
.tg-comp-row:first-of-type { border-top: none; padding-top: 4px; }
.tg-comp-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tg-comp-row-head i { width: 16px; height: 16px; color: #f59e0b; flex: 0 0 auto; }
.tg-comp-row.overdue .tg-comp-row-head i { color: #ef4444; }
.tg-comp-row-title { font-size: 12.5px; font-weight: 600; color: var(--text); flex: 1; }
.tg-comp-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  border-radius: 5px; padding: 2px 6px;
}
.tg-comp-badge.pending  { background: rgba(245,158,11,.15); color: #f59e0b; }
.tg-comp-badge.overdue  { background: rgba(239,68,68,.15);  color: #ef4444; }
.tg-comp-row-detail {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted); padding-left: 24px;
}
.tg-comp-row-detail strong { color: var(--text); font-variant-numeric: tabular-nums; }
.tg-comp-help { margin-top: 10px; border-top: 1px solid var(--glass-border); padding-top: 8px; }
.tg-comp-help summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--accent);
}
.tg-comp-help summary::-webkit-details-marker { display: none; }
.tg-comp-help summary i { width: 13px; height: 13px; }
.tg-comp-help-body {
  margin-top: 8px; padding: 8px 10px;
  font-size: 11.5px; line-height: 1.55; color: var(--muted);
  background: rgba(255,255,255,.03); border-radius: 8px;
}
.tg-comp-help-body strong { color: var(--text); }
[data-theme="light"] .tg-comp-card { background: rgba(255,255,255,.78); border-color: rgba(0,0,0,.08); }
[data-theme="amoled"] .tg-comp-card { background: #0a0a0a; border-color: #222; }

/* ════════════════════════════════════════════════════════════════
   Alarm banners (warn + critical) — Live tab
   ════════════════════════════════════════════════════════════════ */
.tg-alarm-banners { margin-bottom: 4px; }
.tg-alarm-banner {
  border-radius: 12px; padding: 10px 14px; margin-bottom: 6px;
  display: flex; align-items: flex-start; gap: 10px;
  animation: tgAlarmSlide .3s ease;
}
@keyframes tgAlarmSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tg-alarm-banner.warn {
  background: rgba(245,158,11,.10); border: 1px solid rgba(245,158,11,.28);
}
.tg-alarm-banner.critical {
  background: rgba(239,68,68,.10); border: 1px solid rgba(239,68,68,.32);
}
.tg-alarm-banner > i { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.tg-alarm-banner.warn > i { color: #f59e0b; }
.tg-alarm-banner.critical > i { color: #ef4444; }
.tg-alarm-banner-body { flex: 1; min-width: 0; }
.tg-alarm-banner-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.tg-alarm-banner.warn .tg-alarm-banner-title { color: #f59e0b; }
.tg-alarm-banner.critical .tg-alarm-banner-title { color: #ef4444; }
.tg-alarm-banner-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.tg-alarm-banner-action {
  display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700;
  color: #ef4444; background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.2);
  border-radius: 8px; padding: 4px 10px; cursor: pointer; transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.tg-alarm-banner-action:active { background: rgba(239,68,68,.2); }
.tg-alarm-dismiss {
  background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px; flex: 0 0 auto;
}
.tg-alarm-dismiss i { width: 14px; height: 14px; }

/* Drawer form elements */
.tg-win-warn {
  font-size: 12px; color: #f59e0b;
  background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2);
  border-radius: 8px; padding: 8px 10px; margin: 6px 0;
}

/* ════════════════════════════════════════════════════════════════
   Export sub-tab — period, format, actions, share drawer
   ════════════════════════════════════════════════════════════════ */
.tg-export-chips {
  display: flex; flex-wrap: wrap;
  gap: 6px;
}
.tg-export-chips .tachograph-chip {
  min-height: 36px;
  padding: 6px 14px;
}
.tg-export-custom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.tg-export-actions {
  display: flex; flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.tg-export-primary { width: 100%; min-height: 56px; }
.tg-export-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tg-export-note {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 11px 13px;
}
.tg-export-note i { width: 14px; height: 14px; color: var(--accent); flex: 0 0 auto; margin-top: 2px; }

/* Share drawer URL box */
.tg-share-url {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: var(--accent);
  word-break: break-all;
  line-height: 1.4;
}
.tg-share-url i { width: 14px; height: 14px; color: var(--accent); flex: 0 0 auto; }
.tg-share-url span { flex: 1; min-width: 0; }
.tg-share-meta {
  display: flex; align-items: center;
  gap: 5px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
  margin-top: 2px;
}
.tg-share-meta i { width: 12px; height: 12px; flex: 0 0 auto; }
.tg-share-meta-sep { opacity: .5; margin: 0 2px; }

/* ────── Light theme adjustments ────── */
[data-theme="light"] .tg-info-card,
[data-theme="light"] .tg-rule-card,
[data-theme="light"] .tg-gauge,
[data-theme="light"] .tg-mini,
[data-theme="light"] .tg-alarm-row,
[data-theme="light"] .tg-viol-card,
[data-theme="light"] .tg-crew-member,
[data-theme="light"] .tg-acc,
[data-theme="light"] .tg-cal-cell,
[data-theme="light"] .tg-action-btn:not(.primary):not(.success):not(.warning):not(.info) {
  background: rgba(255,255,255,.78);
  border-color: rgba(0,0,0,.08);
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
[data-theme="light"] .tachograph-chip:not(.active) {
  background: rgba(255,255,255,.78);
  border-color: rgba(0,0,0,.08);
}
[data-theme="light"] .tg-drawer { background: #fff; }
[data-theme="light"] .tg-drawer-overlay { background: rgba(0,0,0,.4); }
[data-theme="light"] .tg-input {
  background: #fff;
  border-color: rgba(0,0,0,.12);
}
[data-theme="light"] .tg-icon-btn { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.08); }
[data-theme="light"] .tg-cal-cell.has-data { background: rgba(34,197,94,.14); }
[data-theme="light"] .tg-cal-cell.has-data.has-violation { background: rgba(239,68,68,.16); }
[data-theme="light"] .tg-toggle-slider { background: rgba(0,0,0,.18); }

/* ────── AMOLED theme ────── */
[data-theme="amoled"] .tg-info-card,
[data-theme="amoled"] .tg-rule-card,
[data-theme="amoled"] .tg-gauge,
[data-theme="amoled"] .tg-mini,
[data-theme="amoled"] .tg-alarm-row,
[data-theme="amoled"] .tg-viol-card,
[data-theme="amoled"] .tg-crew-member,
[data-theme="amoled"] .tg-acc,
[data-theme="amoled"] .tg-action-btn:not(.primary):not(.success):not(.warning):not(.info) {
  background: #0a0a0a;
  border-color: #222;
}
[data-theme="amoled"] .tg-cal-cell { background: #0a0a0a; border-color: #222; }
[data-theme="amoled"] .tg-drawer { background: #0a0a0a; }
[data-theme="amoled"] .tg-input { background: #0a0a0a; border-color: #222; }

/* ════════════════════════════════════════════════════════════════
   Responsive fine-tuning (mobile-first → tablet/desktop)
   ════════════════════════════════════════════════════════════════ */

/* Very narrow screens (< 380px) — single-column for tight grids */
@media (max-width: 379px) {
  .tg-crew-grid { grid-template-columns: 1fr; }
  .tg-mini-grid { grid-template-columns: 1fr; }
  .tg-export-secondary { grid-template-columns: 1fr; }
  .tg-compliance { flex-direction: column; text-align: center; gap: 12px; }
  .tg-compliance-svg { width: 120px; height: 120px; }
  .tg-compliance-body .tg-info-card-title { justify-content: center; }
  .tg-crew-code-display { font-size: 32px; letter-spacing: 6px; padding: 10px 14px 10px 22px; }
  .tg-export-custom { grid-template-columns: 1fr; }
}

/* Tablet+ (≥ 640px) */
@media (min-width: 640px) {
  .tachograph-wrap { padding: 18px 20px 32px; }
  .tg-crew-grid { grid-template-columns: repeat(3, 1fr); }
  .tg-export-actions { flex-direction: row; align-items: stretch; }
  .tg-export-primary { flex: 2; min-height: 56px; }
  .tg-export-secondary { flex: 1; grid-template-columns: 1fr; gap: 8px; }
  .tg-compliance-svg { width: 144px; height: 144px; }
  .tg-compliance-num { font-size: 42px; }
}

/* Desktop (≥ 960px) — wider container */
@media (min-width: 960px) {
  .tachograph-wrap { max-width: 880px; }
  .tg-crew-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ────── Mode switch button (Solo ↔ Echipaj) ────── */
.tg-schedule-mode-switch {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}
.tg-mode-switch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.tg-mode-switch-btn:hover,
.tg-mode-switch-btn:active { color: var(--text); border-color: var(--accent); }
.tg-mode-switch-btn i { width: 14px; height: 14px; }

/* ────── Crew event entries in activity log ────── */
.tg-tl-crew-event {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--glass-border);
  margin-bottom: 6px;
  font-size: 13px;
}
.tg-tl-crew-event .tg-tl-crew-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tg-tl-crew-event .tg-tl-crew-icon i { width: 14px; height: 14px; }
.tg-tl-crew-event .tg-tl-crew-label { flex: 1; font-weight: 600; }
.tg-tl-crew-event .tg-tl-crew-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ────── Reduced motion ────── */
@media (prefers-reduced-motion: reduce) {
  .tg-status-dot,
  .bb-tachograph-btn.active .bb-icon,
  .bb-tachograph-status.violation,
  .tg-skeleton {
    animation: none !important;
  }
  .tachograph-wrap { animation: none; }
}

/* ════════════════════════════════════════════════════════════════
   Calculator sub-tab (3 calcs: start+duration→end, now→target, X→Y)
   ════════════════════════════════════════════════════════════════ */
.tg-calc-wrap {
  display: flex; flex-direction: column; gap: 12px;
  max-width: 720px; margin: 0 auto;
}
.tg-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.tg-card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; margin-bottom: 12px;
  color: var(--text);
}
.tg-card-title i { width: 16px; height: 16px; color: var(--accent, #e50914); }

.tg-calc-prefill-banner {
  display: flex; align-items: center; gap: 8px;
  background: rgba(167, 139, 250, .14);
  border: 1px solid rgba(167, 139, 250, .35);
  border-radius: 10px; padding: 8px 12px;
  font-size: 12.5px; color: var(--text);
}
.tg-calc-prefill-banner i { width: 14px; height: 14px; color: #a78bfa; flex: 0 0 auto; }

.tg-calc-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.tg-calc-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  min-width: 70px;
}
.tg-calc-row .tg-input {
  flex: 1; min-width: 140px;
}
.tg-calc-duration-row {
  display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap;
}
.tg-calc-duration-row .tg-input {
  width: 70px; flex: 0 0 70px; text-align: center;
}
.tg-calc-unit {
  font-size: 12px; color: var(--muted); margin-right: 6px;
}
.tg-calc-now-btn {
  background: var(--glass-strong, rgba(255,255,255,.08));
  border: 1px solid var(--glass-border);
  border-radius: 8px; padding: 6px 10px;
  font-size: 12px; font-weight: 600; color: var(--text);
  cursor: pointer; transition: background .15s ease;
}
.tg-calc-now-btn:hover { background: var(--glass-hover, rgba(255,255,255,.14)); }

.tg-calc-presets {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.tg-calc-preset {
  background: var(--glass-strong, rgba(255,255,255,.06));
  border: 1px solid var(--glass-border);
  border-radius: 999px; padding: 5px 12px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tg-calc-preset:hover {
  background: rgba(var(--accent-rgb), .14);
  color: var(--text);
  border-color: rgba(var(--accent-rgb), .35);
}

.tg-calc-result {
  margin-top: 4px;
  border-top: 1px dashed var(--glass-border);
  padding-top: 12px;
}
.tg-calc-result-empty {
  font-size: 12.5px; color: var(--muted); font-style: italic;
}
.tg-calc-result-main {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 8px;
}
.tg-calc-result-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.tg-calc-result-label i { width: 12px; height: 12px; }
.tg-calc-result-value {
  font-size: 18px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tg-calc-result-secondary {
  display: flex; gap: 16px; font-size: 12.5px; color: var(--muted);
}
.tg-calc-result-secondary strong { color: var(--text); font-variant-numeric: tabular-nums; }
.tg-calc-result-live {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 6px 10px;
  background: rgba(var(--accent-rgb), .12);
  border-radius: 8px;
  font-size: 12.5px; color: var(--text);
}
.tg-calc-result-live i { width: 13px; height: 13px; color: var(--accent, #e50914); }
.tg-calc-result-live.success { background: rgba(34, 197, 94, .14); }
.tg-calc-result-live.success i { color: #22c55e; }
.tg-calc-result-warn {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 6px 10px;
  background: rgba(245, 158, 11, .14);
  border-radius: 8px;
  font-size: 12px; color: #f59e0b;
}
.tg-calc-result-warn i { width: 13px; height: 13px; }

@media (max-width: 480px) {
  .tg-calc-label { min-width: 60px; font-size: 11.5px; }
  .tg-calc-row .tg-input { min-width: 120px; }
  .tg-calc-duration-row .tg-input { width: 60px; flex-basis: 60px; }
  .tg-calc-result-value { font-size: 16px; }
}
