/* ── Fonts & base ────────────────────────────────────────── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
}

/* ── Top navbar ──────────────────────────────────────────── */
.app-nav {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  width: 100%;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9375rem;
  font-weight: 700;
  color: #f8fafc;
  text-decoration: none;
  letter-spacing: -.01em;
  flex-shrink: 0;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366f1;
  flex-shrink: 0;
}

.app-nav-links {
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  color: #94a3b8;
  text-decoration: none;
  transition: background .12s, color .12s;
}

.nav-link-item:hover {
  background: rgba(255,255,255,.07);
  color: #e2e8f0;
}

.nav-link-item.is-active {
  background: rgba(99,102,241,.18);
  color: #a5b4fc;
}

.sync-error-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-left: auto;
}

.nav-user {
  font-size: .8125rem;
  font-weight: 500;
  color: #64748b;
}

.btn-nav-logout {
  background: transparent;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #94a3b8;
  font-size: .8125rem;
  font-weight: 500;
  padding: 5px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .12s, color .12s, background .12s;
}

.btn-nav-logout:hover {
  border-color: #475569;
  color: #e2e8f0;
  background: rgba(255,255,255,.05);
}

/* ── Page layout ─────────────────────────────────────────── */
.page-main {
  padding: 2rem 0 3rem;
  min-height: calc(100vh - 56px);
}

.page-header {
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -.025em;
  color: #0f172a;
  margin: 0 0 .25rem;
}

.page-subtitle {
  font-size: .875rem;
  color: #64748b;
  margin: 0;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  background: #fff;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid #f1f5f9;
  padding: .875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.card-header strong {
  font-size: .9375rem;
  font-weight: 600;
  color: #0f172a;
}

.card-body {
  padding: 1.25rem;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  font-size: .72rem;
  font-weight: 600;
  padding: .3em .65em;
  border-radius: 20px;
  letter-spacing: .01em;
}

.badge.bg-success   { background: #dcfce7 !important; color: #166534 !important; }
.badge.bg-danger    { background: #fee2e2 !important; color: #991b1b !important; }
.badge.bg-warning   { background: #fef9c3 !important; color: #854d0e !important; }
.badge.bg-info,
.badge.bg-info.text-dark { background: #e0f2fe !important; color: #075985 !important; }
.badge.bg-secondary { background: #f1f5f9 !important; color: #475569 !important; }

/* ── Tables ──────────────────────────────────────────────── */
.table {
  font-size: .875rem;
  margin: 0;
}

.table thead th {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: .75rem 1rem;
}

.table tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

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

.table tbody tr:hover td { background: #fafbff; }

.table-success > td { background-color: #f0fdf4 !important; }
.table-info    > td { background-color: #f0f9ff !important; }
.table-warning > td { background-color: #fffbeb !important; }

/* ── Forms ───────────────────────────────────────────────── */
.form-label {
  font-size: .8125rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: .375rem;
}

.form-control,
.form-select {
  border-color: #e2e8f0;
  border-radius: 7px;
  font-size: .9375rem;
  color: #0f172a;
  font-family: inherit;
}

.form-control:focus,
.form-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.form-control::placeholder { color: #cbd5e1; }

.form-text {
  font-size: .8125rem;
  color: #64748b;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  font-family: inherit;
  font-weight: 500;
  border-radius: 7px;
  transition: all .12s;
}

.btn-primary {
  background: #6366f1;
  border-color: #6366f1;
}

.btn-primary:hover:not(:disabled) {
  background: #4f46e5;
  border-color: #4f46e5;
}

.btn-outline-primary {
  color: #6366f1;
  border-color: #c7d2fe;
}

.btn-outline-primary:hover {
  background: #eef2ff;
  border-color: #6366f1;
  color: #4f46e5;
}

.btn-outline-secondary {
  color: #64748b;
  border-color: #e2e8f0;
}

.btn-outline-secondary:hover {
  background: #f8fafc;
  color: #0f172a;
}

.btn-outline-danger {
  color: #ef4444;
  border-color: #fecaca;
}

.btn-outline-danger:hover {
  background: #fff1f2;
  border-color: #ef4444;
  color: #ef4444;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info    { background: #f0f9ff; border-color: #bae6fd; color: #0c4a6e; }

/* ── Login page ──────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  padding: 2.25rem;
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-badge {
  display: inline-block;
  width: 40px;
  height: 40px;
  background: #eef2ff;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.login-badge::after {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  background: #6366f1;
  border-radius: 50%;
  margin: 14px auto 0;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #0f172a;
  margin: 0 0 .25rem;
}

.login-sub {
  font-size: .875rem;
  color: #64748b;
  margin: 0;
}

/* ── Empty / loading state ───────────────────────────────── */
.state-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #94a3b8;
  font-size: .9375rem;
}

code { color: #6366f1; }

/* ── Responsive navbar ───────────────────────────────────────── */
@media (max-width: 767px) {
  .app-nav {
    height: auto;
    padding: .5rem 0;
  }

  .nav-inner {
    flex-wrap: wrap;
    gap: .375rem .75rem;
    align-items: center;
  }

  .app-nav-links {
    order: 10;
    flex: 0 0 100%;
    flex-wrap: wrap;
    gap: 2px;
    padding-top: .375rem;
    border-top: 1px solid #1e293b;
    margin-top: .125rem;
  }

  .nav-link-item {
    font-size: .8125rem;
    padding: 5px 10px;
  }

  .nav-right {
    margin-left: auto;
    gap: .5rem;
  }

  .nav-user {
    display: none;
  }

  .page-main {
    padding: 1.25rem 0 2rem;
  }
}
