:root {
  --black: #000000;
  --black-90: #1a1a1a;
  --black-80: #2a2a2a;
  --black-70: #3a3a3a;
  --gray-60: #555555;
  --gray-40: #999999;
  --gray-20: #cccccc;
  --gray-10: #e8e8e8;
  --gray-05: #f2f2f2;
  --white: #ffffff;
  --yellow: #FFD60A;
  --yellow-hover: #FFC800;
  --yellow-soft: rgba(255, 214, 10, 0.1);
  --yellow-muted: rgba(255, 214, 10, 0.5);
  --red: #FF453A;
  --green: #30D158;

  --font: -apple-system, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.06);
  --transition: 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

body {
  font-family: var(--font);
  background: var(--gray-05);
  color: var(--black);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.5;
}

/* === NAV === */
nav {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--gray-10);
  padding: 0 2.5rem;
  display: flex;
  align-items: center;
  height: 52px;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--black);
  text-decoration: none;
  letter-spacing: -0.02em;
  margin-right: 2.5rem;
}

nav .nav-links {
  display: flex;
  gap: 0;
  height: 52px;
}

nav a {
  color: var(--gray-40);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  height: 100%;
  border-bottom: 2px solid transparent;
  transition: color var(--transition);
}

nav a:hover {
  color: var(--black);
}

nav a.active {
  color: var(--black);
  border-bottom-color: var(--black);
}

/* === LAYOUT === */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

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

.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--black);
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--gray-40);
  margin-top: 0.25rem;
  font-weight: 400;
}

/* === GRID === */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* === CARDS === */
.card {
  background: var(--white);
  border: 1px solid var(--gray-10);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-title {
  font-size: 0.75rem;
  color: var(--gray-40);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* === STAT CARDS === */
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-10);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--gray-40);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-top: 0.5rem;
  color: var(--black);
}

.stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--gray-40);
  margin-top: 0.25rem;
  font-weight: 400;
}

.stat-card.highlight {
  background: var(--black);
  border-color: var(--black);
}

.stat-card.highlight .stat-label { color: var(--gray-40); }
.stat-card.highlight .stat-value { color: var(--yellow); }
.stat-card.highlight .stat-sub { color: rgba(255,255,255,0.5); }

/* === TABLES === */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

thead th {
  text-align: left;
  padding: 0.625rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-40);
  border-bottom: 1px solid var(--gray-10);
  background: var(--gray-05);
  position: sticky;
  top: 52px;
}

thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-05);
  vertical-align: middle;
}

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

tr:hover td { background: var(--yellow-soft); }

.table-name {
  font-weight: 600;
  color: var(--black);
}

.table-meta {
  font-size: 0.8rem;
  color: var(--gray-40);
}

/* === INPUTS === */
input, select {
  background: var(--white);
  border: 1px solid var(--gray-10);
  color: var(--black);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}

input[type="number"] { width: 130px; text-align: right; }

input::placeholder { color: var(--gray-20); }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-10);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--white);
  color: var(--black);
}

.btn:hover {
  background: var(--gray-05);
  border-color: var(--gray-20);
}

.btn-primary {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.btn-primary:hover {
  background: var(--black-80);
}

.btn-yellow {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
}

.btn-yellow:hover {
  background: var(--yellow-hover);
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }

/* === TOGGLE SWITCH === */
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  display: inline-block;
  cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--gray-20);
  border-radius: 26px;
  transition: background var(--transition);
}

.toggle .slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .slider { background: var(--black); }
.toggle input:checked + .slider::before { transform: translateX(18px); }

/* === COMPLIANCE MATRIX === */
.compliance-cell {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
}

.compliance-ok {
  background: var(--black);
  color: var(--yellow);
}

.compliance-miss {
  background: var(--gray-05);
  color: var(--gray-20);
}

/* === MONTH SELECTOR === */
.month-selector {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--white);
  border: 1px solid var(--gray-10);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.month-selector button {
  background: transparent;
  border: none;
  color: var(--black);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: var(--font);
  transition: background var(--transition);
}

.month-selector button:hover { background: var(--gray-05); }

.month-selector span {
  font-size: 0.875rem;
  font-weight: 600;
  min-width: 150px;
  text-align: center;
  padding: 0.5rem 0.5rem;
  border-left: 1px solid var(--gray-10);
  border-right: 1px solid var(--gray-10);
}

/* === CHART === */
.chart-container {
  position: relative;
  height: 280px;
}

/* === FILTERS === */
.filters {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-active {
  background: var(--yellow-soft);
  color: var(--black);
  border: 1px solid var(--yellow-muted);
}

.badge-archived {
  background: var(--gray-05);
  color: var(--gray-40);
  border: 1px solid var(--gray-10);
}

.badge-excluded {
  background: rgba(255, 69, 58, 0.08);
  color: var(--red);
  border: 1px solid rgba(255, 69, 58, 0.2);
}

/* === AVATAR === */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* === SECTION SPACING === */
.section { margin-top: 1.5rem; }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--gray-40);
}

.empty-state .empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .container { padding: 1.5rem; }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  nav { padding: 0 1rem; }
  nav .nav-links { overflow-x: auto; }
  .container { padding: 1rem; }
  .page-title { font-size: 1.5rem; }
}

/* === PRINT === */
@media print {
  nav { display: none; }
  body { background: white; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  .stat-card.highlight { background: white; color: black; }
  .stat-card.highlight .stat-value { color: black; }
}

/* === COLOR PICKER === */
input[type="color"] {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  border: 2px solid var(--gray-10);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: transparent;
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border-radius: 5px; border: none; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-20); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-40); }
