:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #666666;
  --line: #eaeaea;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Inter, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 16px;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--fg);
  color: var(--bg);
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  font-size: 14px;
}

.skip-link:focus {
  top: 6px;
}

/* Layout */
.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 20px;
}

.card {
  background: var(--bg);
  border: 0.5px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 160ms ease;
  padding: 20px;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card--large {
  padding: 32px;
}

/* Typography */
h1 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.2;
}

h3 {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 12px;
  line-height: 1.2;
}

p {
  margin-bottom: 16px;
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 160ms ease;
  min-height: 44px;
}

.btn:hover {
  background: #f8f8f8;
  border-color: var(--muted);
}

.btn:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.btn--primary:hover {
  background: #333;
}

.btn--secondary {
  background: transparent;
  color: var(--muted);
}

.btn--secondary:hover {
  color: var(--fg);
  background: #f8f8f8;
}

.btn--small {
  padding: 8px 16px;
  font-size: 13px;
  min-height: 36px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--fg);
  transition: all 160ms ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--fg);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.1);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--fg);
}

/* Tables */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

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

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

.table th {
  background: #f8f8f8;
  font-weight: 600;
  font-size: 14px;
}

.table td {
  font-size: 14px;
}

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

.table tr:hover {
  background: #f8f8f8;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal__content {
  background: var(--bg);
  border-radius: 12px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal__close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
}

/* Header */
.header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header__content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header__logo {
  font-size: 20px;
  font-weight: 600;
  text-decoration: none;
  color: var(--fg);
}

.header__user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 20px;
  transition: left 160ms ease;
  z-index: 200;
}

.sidebar.active {
  left: 0;
}

.sidebar__nav {
  margin-top: 60px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--fg);
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: all 160ms ease;
}

.sidebar__link:hover,
.sidebar__link.active {
  background: #f8f8f8;
}

.sidebar__icon {
  width: 20px;
  height: 20px;
}

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}

.metric-card__value {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 8px;
}

.metric-card__label {
  color: var(--muted);
  font-size: 14px;
}

/* Chart */
.chart-container {
  margin-bottom: 32px;
}

.chart {
  width: 100%;
  height: 200px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* Status badges */
.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status--active {
  background: #dcfce7;
  color: #166534;
}

.status--inactive {
  background: #fef2f2;
  color: #991b1b;
}

.status--pending {
  background: #fef3c7;
  color: #92400e;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  opacity: 0.3;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

.pagination__btn {
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  transition: all 160ms ease;
}

.pagination__btn:hover {
  background: #f8f8f8;
}

.pagination__btn.active {
  background: var(--fg);
  color: var(--bg);
}

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

/* Search */
.search-box {
  margin-bottom: 24px;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  padding-left: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%23666666' viewBox='0 0 24 24'%3E%3Cpath d='M11 19c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8zm0-14c-3.3 0-6 2.7-6 6s2.7 6 6 6 6-2.7 6-6-2.7-6-6-6z'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 16px center;
}

/* Utilities */
.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-16 {
  gap: 16px;
}

.text-center {
  text-align: center;
}

.mb-24 {
  margin-bottom: 24px;
}

.mt-24 {
  margin-top: 24px;
}

/* Login page specific */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.login-logo {
  display: block;
  margin: 0 auto 32px;
  width: 60px;
  height: 60px;
}

/* Home page specific */
.home-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.home-content {
  text-align: center;
  max-width: 800px;
}

.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.home-card {
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease;
}

.home-card:hover {
  transform: translateY(-2px);
}

.home-card h3 {
  margin-bottom: 8px;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
}

.sidebar-overlay.active {
  display: block;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }
  
  .card {
    padding: 20px;
  }
  
  .card--large {
    padding: 24px;
  }
  
  h1 {
    font-size: 24px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  .metrics {
    grid-template-columns: 1fr;
  }
  
  .home-cards {
    grid-template-columns: 1fr;
  }
  
  .sidebar-toggle {
    display: block;
  }
  
  .table-container {
    font-size: 14px;
  }
  
  .table th,
  .table td {
    padding: 12px 8px;
  }
}

@media (min-width: 1024px) {
  .sidebar {
    position: static;
    width: 280px;
    height: auto;
    border-right: 1px solid var(--line);
  }
  
  .main-layout {
    display: flex;
  }
  
  .main-content {
    flex: 1;
    min-height: 100vh;
  }
  
  .sidebar__nav {
    margin-top: 20px;
  }
}