@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

:root {
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #64748b;
  --color-text-faint: #9ca3af;
  --color-text-body: #374151;
  --color-brand-green: #16a34a;
  --color-brand-green-dark: #15803d;
  --color-surface-page: #f8fafc;
  --color-surface-card: #ffffff;
  --color-border-light: #e2e8f0;
  --color-navy: #080f1c;
  --color-navy-header: #0b1120;
  --color-navy-input: #0f1d33;
  --color-danger: #ef4444;
  --color-danger-text: #f87171;
  --color-ok: #16a34a;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-surface-page);
  color: var(--color-text-primary);
  line-height: 1.5;
}

a {
  color: var(--color-brand-green);
}

img {
  max-width: 100%;
  display: block;
}

button,
.btn {
  font-family: inherit;
  cursor: pointer;
}

button:disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Login ─────────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--color-navy);
  color: #fff;
}

.login-hero {
  position: relative;
  flex: 0 0 48%;
  display: none;
  overflow: hidden;
}

.login-hero img.login-hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.login-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(8, 15, 28, 0.55) 0%,
    rgba(8, 15, 28, 0.05) 35%,
    rgba(8, 15, 28, 0.05) 55%,
    rgba(8, 15, 28, 0.88) 100%
  );
}

.login-hero-logo {
  position: absolute;
  top: 2rem;
  left: 2rem;
  z-index: 1;
  height: 36px;
  width: auto;
}

.login-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-navy);
}

.login-panel-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: 3rem 2.5rem 4rem;
}

.login-mobile-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.login-mobile-brand img {
  height: 36px;
  width: auto;
}

.login-mobile-brand span {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-heading {
  margin: 0 0 1rem;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #fff;
}

.login-lead {
  margin: 0 0 2.5rem;
  font-size: 1.05rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.6;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  padding: 16px 0;
  border: 0;
  border-radius: 12px;
  background: var(--color-brand-green);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s;
}

.btn-google:hover {
  background: var(--color-brand-green-dark);
}

.btn-google svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.login-hint {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
}

@media (min-width: 768px) {
  .login-hero {
    display: block;
  }
  .login-mobile-brand {
    display: none;
  }
  .login-panel-inner {
    padding-left: 4rem;
    padding-right: 4rem;
  }
}

/* ── Alerts ────────────────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0 0 1.25rem;
}

.alert svg {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

.alert.error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--color-danger-text);
}

.alert.ok {
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.28);
  color: #86efac;
}

.page-alert.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.page-alert.ok {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
}

/* ── App chrome ────────────────────────────────────────────────────────── */

.app-header {
  background: var(--color-navy-header);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-header-top {
  padding: 1rem 1.5rem;
}

.app-header-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 52px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-shrink: 0;
  text-decoration: none;
}

.header-brand img {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.header-brand-copy {
  padding-left: 1.25rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.header-brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.header-meta-pill {
  display: none;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.header-meta-icon {
  display: flex;
  color: var(--color-text-faint);
}

.header-meta-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.header-meta-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
}

.header-meta-value {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: #f9fafb;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.5);
}

.header-btn-signout {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.header-btn-signout:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.65);
  color: #fecaca;
}

.header-btn svg {
  width: 16px;
  height: 16px;
}

form.inline {
  display: inline;
  margin: 0;
}

.app-header-nav {
  padding: 8px 1.5rem 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.header-tab-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header-tab {
  position: relative;
  padding: 14px 22px;
  font-size: 17px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.header-tab:hover {
  color: rgba(255, 255, 255, 0.88);
}

.header-tab-active {
  color: #fff;
}

.header-tab-active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 18px;
  right: 18px;
  height: 3px;
  background: #34d399;
  border-radius: 1px;
}

@media (min-width: 768px) {
  .app-header-top,
  .app-header-nav {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  .header-meta-pill {
    display: inline-flex;
  }
}

@media (min-width: 1024px) {
  .app-header-top,
  .app-header-nav {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
}

/* ── Page body ─────────────────────────────────────────────────────────── */

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3.5rem;
}

@media (min-width: 768px) {
  .page {
    padding: 2rem 2rem 4rem;
  }
}

.page-title {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-text-primary);
}

.page-lead {
  margin: 0 0 1.75rem;
  color: var(--color-text-muted);
  font-size: 1rem;
  font-weight: 500;
}

.card {
  background: var(--color-surface-card);
  border: 1px solid #f1f5f9;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1.5px solid #f1f5f9;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.card-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ── App grid ──────────────────────────────────────────────────────────── */

.app-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .app-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  background: #fff;
  border: 1px solid #f1f5f9;
  border-radius: 16px;
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s, transform 0.15s;
}

.app-card:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.app-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}

.app-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-icon svg {
  width: 22px;
  height: 22px;
}

.app-icon.fleet {
  background: #ecfdf5;
  color: #059669;
}

.app-icon.labeller {
  background: #eff6ff;
  color: #2563eb;
}

.app-icon.analytics {
  background: #f0fdf4;
  color: #16a34a;
}

.app-icon.default {
  background: #f1f5f9;
  color: #475569;
}

.app-card h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-card p {
  margin: 0.2rem 0 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  word-break: break-all;
}

.app-card .btn-primary {
  margin-top: auto;
  align-self: flex-start;
}

.empty-card {
  text-align: left;
}

.empty-card p {
  margin: 0;
  color: var(--color-text-secondary);
}

/* ── Buttons (light surfaces) ──────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  background: var(--color-brand-green);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s;
}

.btn-primary:hover {
  background: var(--color-brand-green-dark);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  background: #fff;
  color: var(--color-text-body);
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.btn-secondary:hover {
  background: #f8fafc;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-danger:hover {
  background: #fee2e2;
}

/* ── Admin table ───────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 0 0.5rem 12px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.data-table td {
  padding: 1rem 0.5rem 1rem 0;
  font-size: 0.95rem;
  color: var(--color-text-body);
  vertical-align: top;
  border-bottom: 1px solid #f1f5f9;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.user-email {
  font-weight: 700;
  color: var(--color-text-primary);
}

.muted {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 0.15rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-green {
  color: #15803d;
  background: #f0fdf4;
}

.status-green::before {
  background: #16a34a;
}

.status-red {
  color: #b91c1c;
  background: #fef2f2;
}

.status-red::before {
  background: #ef4444;
}

.status-amber {
  color: #b45309;
  background: #fffbeb;
}

.status-amber::before {
  background: #f59e0b;
}

.stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

.checks {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 0.75rem;
}

.checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--color-border-light);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.checks input {
  accent-color: var(--color-brand-green);
}

/* ── Error page ────────────────────────────────────────────────────────── */

.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-surface-page);
}

.error-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.error-card {
  width: 100%;
  max-width: 440px;
  text-align: left;
}

.error-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.error-card p {
  margin: 0 0 1.25rem;
  color: var(--color-text-muted);
}

/* ── Scrollbar ─────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
