@font-face {
  font-family: 'Montserrat';
  src: local('Montserrat'), url('/fonts/Montserrat-Variable-latin.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans';
  src: local('Open Sans'), url('/fonts/OpenSans-Variable-latin.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --bg-canvas: #000000;
  --bg-surface: #1d2026;
  --bg-elevated: #15181d;
  --border-default: #2c313a;
  --text-primary: #ffffff;
  --text-muted: #d5d8de;
  --text-subtle: #9aa1ad;
  --accent: #7b109a;
  --accent-hover: #6a0e87;
  --radius-lg: 12px;
  --gap: 16px;
}

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.43;
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: var(--gap);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

h1, h2, h3 {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--gap);
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 18px;
}

p {
  color: var(--text-muted);
  margin-bottom: var(--gap);
}

.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--gap);
  border: 1px solid var(--border-default);
  margin-bottom: var(--gap);
}

.button-primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.button-secondary:hover {
  background: var(--bg-elevated);
}

.filter-bar {
  display: flex;
  gap: var(--gap);
  margin-bottom: var(--gap);
  padding: var(--gap);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
}

.filter-item {
  display: flex;
  flex-direction: column;
}

.filter-item label {
  font-size: 12px;
  color: var(--text-subtle);
  margin-bottom: 4px;
}

.filter-item select,
.filter-item input {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 8px;
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.kpi-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--gap);
  text-align: center;
}

.kpi-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 14px;
  color: var(--text-muted);
}

.kpi-trend {
  font-size: 12px;
  color: var(--accent);
  margin-top: 4px;
}

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

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
}

.table th {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
}

.table tr:hover {
  background: var(--bg-elevated);
}

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

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--gap);
  padding: var(--gap);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
}

.pagination button {
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.pagination button:hover {
  background: var(--bg-surface);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: white;
  background: var(--accent);
}

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--gap);
  color: var(--text-muted);
}

.error {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--gap);
  color: var(--text-muted);
}

.error button {
  margin-top: var(--gap);
}

.empty-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--gap);
  color: var(--text-muted);
  text-align: center;
}

.empty-state h3 {
  margin-bottom: var(--gap);
}

.empty-state p {
  margin-bottom: var(--gap);
}

@media (max-width: 768px) {
  main {
    padding: 12px;
  }
  .filter-bar {
    flex-direction: column;
    gap: 8px;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 20px;
  }
  h2 {
    font-size: 18px;
  }
  .card {
    padding: 12px;
  }
}

/* Focus ring */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Prevent horizontal scroll */
* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
}

/* Ensure text wraps */
* {
  overflow-wrap: anywhere;
}

/* Prevent layout shift */
img, video, iframe {
  max-width: 100%;
  height: auto;
}

/* Hide scrollbar on desktop */
::-webkit-scrollbar {
  display: none;
}

/* For Firefox */
* {
  scrollbar-width: none;
}

/* Ensure button hit area is 44px */
.button-primary,
.button-secondary {
  min-height: 44px;
}

/* Keep 72px free at bottom right for platform feedback button */
body::after {
  content: '';
  position: fixed;
  bottom: 0;
  right: 0;
  width: 72px;
  height: 72px;
  pointer-events: none;
}

/* Dark mode compatibility */
body {
  color-scheme: dark;
}