/* ══════════════════════════════════════════════════════════
   FleetTrack Shell — shared layout & UX primitives
   Loaded by every portal page (login, driver, employee,
   dashboard, driver-profile, access-management) on top of
   design-system.css. Nothing here duplicates tokens — only
   applies them consistently.
   ══════════════════════════════════════════════════════════ */

/* ── Unified top brand / identity ─────────────────────────── */
.ft-brand {
  display: inline-flex; align-items: baseline; gap: var(--s2);
  font-family: var(--mono); color: var(--t1);
}
.ft-brand .ft-brand-mark {
  font-size: 18px; font-weight: 700; letter-spacing: 0.02em;
}
.ft-brand .ft-brand-slash { color: var(--t3); font-weight: 500; }
.ft-brand .ft-brand-portal { color: var(--t2); font-weight: 500; font-size: 13px; }

/* Portal pill — tells the user which portal they're in. Shown top-left
   on every page for consistency. */
.ft-portal-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 6px; border-radius: var(--r6);
  background: var(--bg3); border: 1px solid var(--b1);
  font-size: 11px; font-family: var(--mono); color: var(--t2);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.ft-portal-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
}

/* ── Unified primary CTA / link buttons ───────────────────── */
.ft-cta {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 14px; border-radius: var(--r2);
  background: var(--blue); color: #fff; border: 1px solid var(--blue);
  font-size: 12.5px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all var(--fast);
  text-decoration: none; white-space: nowrap; min-height: 36px;
}
.ft-cta:hover { background: var(--blue2); border-color: var(--blue2); transform: translateY(-1px); }
.ft-cta.ghost {
  background: transparent; color: var(--t2); border-color: var(--b2);
}
.ft-cta.ghost:hover { color: var(--t1); border-color: var(--b3); background: var(--bg3); }
.ft-cta.danger { background: var(--red); border-color: var(--red); }
.ft-cta.danger:hover { background: #dc2626; border-color: #dc2626; }
.ft-cta.sm { padding: 5px 10px; font-size: 11.5px; min-height: 28px; }

/* ── Alert-with-actions row ───────────────────────────────── */
.ft-alert {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r3); margin-bottom: var(--s2);
  border: 1px solid transparent;
}
.ft-alert.red    { background: var(--redbg);   border-color: var(--redborder);   }
.ft-alert.amber  { background: var(--amberbg); border-color: var(--amberborder); }
.ft-alert.green  { background: var(--greenbg); border-color: var(--greenborder); }
.ft-alert.blue   { background: var(--bluebg);  border-color: var(--blueborder);  }
.ft-alert-dot { width: 8px; height: 8px; border-radius: 50%; }
.ft-alert.red   .ft-alert-dot { background: var(--red); }
.ft-alert.amber .ft-alert-dot { background: var(--amber); }
.ft-alert.green .ft-alert-dot { background: var(--green); }
.ft-alert.blue  .ft-alert-dot { background: var(--blue); }
.ft-alert-body  { font-size: 13px; color: var(--t1); line-height: 1.45; }
.ft-alert-title { font-weight: 600; color: var(--t1); margin-bottom: 2px; }
.ft-alert-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ft-alert-actions .ft-cta { font-size: 11.5px; padding: 5px 10px; min-height: 28px; }
@media (max-width: 640px) {
  .ft-alert { grid-template-columns: auto 1fr; }
  .ft-alert-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ── Data-state badges (used wherever a metric can be stale) ── */
.ft-freshness {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-family: var(--mono);
  color: var(--t3);
}
.ft-freshness::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--t3);
}
.ft-freshness.live::before   { background: var(--green); box-shadow: 0 0 6px var(--green); animation: ftPulse 2s infinite; }
.ft-freshness.stale::before  { background: var(--amber); }
.ft-freshness.frozen::before { background: var(--red); }
@keyframes ftPulse { 0%,100% { opacity: 1 } 50% { opacity: 0.5 } }

/* ── Empty state ──────────────────────────────────────────── */
.ft-empty {
  text-align: center;
  padding: var(--s7) var(--s4);
  color: var(--t3); font-size: 13px;
  border: 1px dashed var(--b2); border-radius: var(--r3);
  background: var(--bg2);
}
.ft-empty-icon { font-size: 24px; margin-bottom: var(--s2); opacity: 0.5; }
.ft-empty-title { font-size: 14px; font-weight: 600; color: var(--t2); margin-bottom: 4px; }
.ft-empty-cta { margin-top: var(--s3); }

/* ── Consistent top bar across portals ────────────────────── */
.ft-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
  padding: 10px var(--s5);
  background: var(--bg2); border-bottom: 1px solid var(--b1);
  min-height: 56px;
}
.ft-topbar-left  { display: flex; align-items: center; gap: var(--s4); }
.ft-topbar-right { display: flex; align-items: center; gap: var(--s2); }

/* ── User pill (replaces 3 different avatar patterns) ─────── */
.ft-user-pill {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 4px 12px 4px 4px; border-radius: var(--r6);
  background: var(--bg3); border: 1px solid var(--b1);
  font-size: 12.5px; color: var(--t1); cursor: pointer;
  transition: border-color var(--fast);
}
.ft-user-pill:hover { border-color: var(--b3); }
.ft-user-pill-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; font-family: var(--mono);
  background: var(--bluebg); color: var(--blue2);
  border: 1px solid var(--blueborder);
}
.ft-user-pill-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-user-pill-role { font-size: 10.5px; color: var(--t3); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Print (exports-as-PDF from browser) ──────────────────── */
@media print {
  .ft-topbar, .sidebar, .hamburger, .ft-cta, .nav-tabs, .ft-alert-actions { display: none !important; }
  body { background: white !important; color: black !important; }
  .card, .ft-alert { break-inside: avoid; }
}
