body.dark-theme {
    --bg: #0a1929;
    --surface: #112233;
    --text: #e9ecef;
    --text-secondary: #8696a7;
    --border: #334b61;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --accent: #3b82f6;
}

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

.header-content h1 { display: flex; align-items: center; }
.symbol-count { font-size: 0.7rem; color: var(--text-secondary); margin-left: 0.5rem; white-space: nowrap; }
.theme-switcher { display: flex; align-items: center; gap: 0.5rem; color: rgba(255,255,255,0.7); font-size: 0.8rem; }
.switch { position: relative; display: inline-block; width: 50px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.2); transition: .3s; border-radius: 26px; }
.slider::before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: #fbbf24; }
input:checked + .slider::before { transform: translateX(24px); }

.app-header { padding-bottom: 0.5rem; }
.app-header .header-content { margin-bottom: 0.75rem; }

.search-container {
  position: relative;
  width: 100%;
  padding: 0;
  margin-bottom: 0.6rem;
}

.search-container .fa-search {
  position: absolute;
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem 0.7rem 3rem;
  color: #fff;
  font-size: 0.85rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.search-input::placeholder { color: rgba(255,255,255,0.35); }
.search-input:focus { border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.12); }

.tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  flex: 1;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-family: var(--font);
  -webkit-appearance: none;
}
.tab-btn.active { background: var(--accent); color: #fff; }
.tab-btn.inactive { background: rgba(255,255,255,0.06); color: var(--text-secondary); border: 1px solid rgba(255,255,255,0.08); }

.main-content { padding: 0.75rem; flex: 1; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: var(--shadow);
}
.card:active { transform: scale(0.97); }

.fav-indicator {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  z-index: 10;
  font-weight: 800;
  color: #e11d48;
  background: rgba(225,29,72,0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

.canvas-box {
  background: #fff;
  width: 100%;
  height: 100px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  margin-bottom: 8px;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.06);
  overflow: hidden;
}
.canvas-box svg { width: 100% !important; height: 100% !important; max-width: 100% !important; max-height: 88px !important; display: block !important; }

.card-label { font-size: 11px; font-weight: 700; color: var(--text); text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }

.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
}
.empty-state.visible { display: flex; }
.empty-state span { font-size: 2.5rem; margin-bottom: 8px; opacity: 0.5; }
.empty-state p { font-size: 0.85rem; font-weight: 600; }

.modal-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
  padding: 0;
}
.modal-bg.active { display: flex; opacity: 1; }

.sheet {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
  opacity: 0;
  border-radius: 0;
  overflow: hidden;
}
.modal-bg.active .sheet { transform: scale(1); opacity: 1; }

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sheet-meta .tag { font-size: 9px; font-weight: 900; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }
.sheet-meta h2 { font-size: 1.1rem; font-weight: 800; color: var(--text); margin-top: 2px; }

.btn-close {
  background: var(--border);
  color: var(--text-secondary);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  font-family: var(--font);
}
.btn-close:hover { background: var(--text-secondary); color: #fff; }

.sheet-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1.25rem;
}

.sheet-canvas {
  background: #fff;
  border-radius: var(--radius);
  padding: 12px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  overflow: hidden;
  flex-shrink: 0;
}
.sheet-canvas svg { width: 100% !important; height: 100% !important; max-height: 160px !important; object-fit: contain !important; }

.sheet-descricao {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.sheet-descricao h3 { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 0.05em; margin-bottom: 4px; }
.sheet-descricao p { font-size: 0.85rem; color: var(--text); line-height: 1.5; }

.sheet-actions { display: flex; flex-direction: column; gap: 10px; padding-bottom: 0; flex-shrink: 0; }

.action-btn {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  transition: all 0.2s;
}
.action-btn:active { transform: scale(0.97); }
.btn-fav { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-fav.favourited { background: rgba(225,29,72,0.08); color: #e11d48; border-color: rgba(225,29,72,0.2); }
.btn-copy { background: var(--accent); color: #fff; }

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-50px);
  background: #10b981;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.55rem 1.25rem;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: transform 0.25s, opacity 0.25s;
  opacity: 0;
  z-index: 999;
  font-family: var(--font);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

@media (min-width: 768px) {
  .sheet { width: 90%; max-width: 420px; height: auto; max-height: 90vh; border-radius: var(--radius); }
}

@media (min-width: 992px) {
  .app-container {
    max-width: 100%;
    padding: 0 0.4rem;
  }

  .app-header {
    padding: 2rem 0.75rem 1.75rem;
    margin: 0;
    border-radius: var(--radius);
    width: 100%;
  }

  .app-header .header-content {
    gap: 1rem;
  }

  .search-container {
    margin-bottom: 0.8rem;
    max-width: none;
    width: 100%;
  }

  .tabs {
    gap: 14px;
  }

  .tab-btn {
    padding: 0.85rem 1.1rem;
    font-size: 0.9rem;
  }

  .main-content {
    padding: 1.75rem 0;
  }

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

  .card {
    min-height: 200px;
  }

  .sheet {
    max-width: 1100px;
    max-height: 90vh;
    min-height: 520px;
  }

  .sheet-body {
    flex-direction: row;
    gap: 1.5rem;
    padding: 1.75rem;
  }

  .sheet-canvas {
    flex: 0 0 42%;
    min-height: 380px;
    margin-bottom: 0;
  }

  .sheet-canvas svg {
    max-height: 100% !important;
  }

  .sheet-descricao {
    flex: 1;
    min-width: 0;
  }

  .sheet-actions {
    flex: 0 0 200px;
    align-self: flex-start;
    padding-top: 0;
  }

  .sheet-descricao + .sheet-descricao {
    margin-top: 1rem;
  }

  .modal-bg {
    padding: 1.5rem;
  }
}
