:root,
[data-theme="dark"] {
  --bg: #0f1216;
  --surface: #181c22;
  --surface-hover: #1f242c;
  --border: hsla(0, 0%, 100%, 0.06);
  --border-hover: hsla(0, 0%, 100%, 0.1);
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --accent: #c4a0ef;
  --accent-soft: rgba(196, 160, 239, 0.16);
  --prod: #4a9c6d;
  --prod-soft: rgba(74, 156, 109, 0.12);
  --homolog: #c4a0ef;
  --homolog-soft: rgba(196, 160, 239, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
}

[data-theme="light"] {
  --bg: #f4f1ed;
  --surface: #ffffff;
  --surface-hover: #f0efe8;
  --border: rgba(16, 16, 16, 0.08);
  --border-hover: rgba(16, 16, 16, 0.14);
  --text: #101010;
  --text-muted: #5f6368;
  --accent: #4f0e84;
  --accent-soft: rgba(79, 14, 132, 0.12);
  --prod: #2e7d4a;
  --prod-soft: rgba(46, 125, 74, 0.12);
  --homolog: #4f0e84;
  --homolog-soft: rgba(79, 14, 132, 0.12);
}

[data-theme="blue"] {
  --bg: #0c1929;
  --surface: #132f4c;
  --surface-hover: #1a3a5c;
  --border: hsla(0, 0%, 100%, 0.08);
  --border-hover: hsla(0, 0%, 100%, 0.16);
  --text: #e3f2fd;
  --text-muted: #90caf9;
  --accent: #42a5f5;
  --accent-soft: rgba(66, 165, 245, 0.2);
  --prod: #66bb6a;
  --prod-soft: rgba(102, 187, 106, 0.2);
  --homolog: #ffb74d;
  --homolog-soft: rgba(255, 183, 77, 0.2);
}

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

body {
  min-height: 100vh;
  font-family: "DM Sans", -apple-system, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

header {
  margin-bottom: 3rem;
  text-align: center;
}

.logo {
  margin-bottom: 0.5rem;
  font-family: "Playfair Display", serif;
  font-size: 1.792rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.tagline {
  font-size: 0.917rem;
  font-weight: 500;
  color: var(--text-muted);
}

.env-switches {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1.5rem;
}

.env-radio {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.env-radio-option {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.892rem;
  font-weight: 500;
  cursor: pointer;
}

.env-radio-option:first-child {
  border-right: 1px solid var(--border);
}

.env-radio-option:hover {
  color: var(--text);
}

.env-radio-option.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.env-radio-option[data-env="production"].active {
  background: var(--prod-soft);
  color: var(--prod);
}

.env-radio-option[data-env="homolog"].active {
  background: var(--homolog-soft);
  color: var(--homolog);
}

.env-section {
  margin-bottom: 2.5rem;
}

.env-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.env-badge {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.env-badge.production {
  background: var(--prod-soft);
  color: var(--prod);
}

.env-badge.homologation {
  background: var(--homolog-soft);
  color: var(--homolog);
}

.env-title {
  font-family: "Playfair Display", serif;
  font-size: 1.292rem;
  font-weight: 500;
}

.card-group {
  margin-bottom: 1.5rem;
}

.card-group:last-child {
  margin-bottom: 0;
}

.group-label {
  display: block;
  margin-bottom: 0.6rem;
  padding-left: 2px;
  color: var(--text-muted);
  font-size: 0.792rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
}

.card-list .card {
  padding: 0.75rem 1rem;
}

.card:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.card.is-disabled {
  cursor: default;
  opacity: 0.72;
}

.card.is-disabled:hover {
  border-color: var(--border);
  background: var(--surface);
  transform: none;
}

.card-favicon,
.card-icon-emoji {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.card-favicon {
  object-fit: contain;
  background: var(--bg);
}

.card-icon-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.142rem;
  line-height: 1;
}

.card-body {
  min-width: 0;
}

.card-title {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.892rem;
  font-weight: 600;
}

.card-url {
  display: block;
  color: var(--text-muted);
  font-size: 0.842rem;
  word-break: break-all;
}

footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.842rem;
  text-align: center;
}

.footer-note {
  margin: 0;
}

.ewti-signature {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.85rem;
  opacity: 0.85;
  text-decoration: none;
}

.ewti-signature img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.ewti-signature:hover {
  opacity: 1;
}

.theme-toggle {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 20;
  display: flex;
  gap: 0.25rem;
}

.theme-btn {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.73rem;
  font-weight: 500;
  cursor: pointer;
}

.theme-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.theme-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

@media (max-width: 640px) {
  .page {
    padding: 1.5rem max(1rem, env(safe-area-inset-right)) 2.5rem max(1rem, env(safe-area-inset-left));
  }

  header {
    margin-bottom: 2rem;
  }

  .logo {
    font-size: 1.417rem;
  }

  .env-radio {
    width: 100%;
    max-width: 280px;
  }

  .env-radio-option {
    flex: 1;
    justify-content: center;
  }

  .env-title {
    width: 100%;
    font-size: 1.042rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .theme-toggle {
    top: max(0.5rem, env(safe-area-inset-top));
    right: max(0.5rem, env(safe-area-inset-right));
  }
}
