:root {
  --bg: var(--tg-theme-bg-color, #0b1220);
  --surface: var(--tg-theme-secondary-bg-color, #111b2e);
  --card: #162238;
  --border: rgba(148, 163, 184, 0.18);
  --text: var(--tg-theme-text-color, #f1f5f9);
  --muted: var(--tg-theme-hint-color, #94a3b8);
  --accent: #0f9f53;
  --accent-hover: #14b862;
  --accent-soft: rgba(15, 159, 83, 0.16);
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 16px;
  min-height: 100vh;
}

.app-container {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-card {
  background: linear-gradient(135deg, #0f2922 0%, var(--surface) 70%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #34d399;
  font-weight: 700;
  margin-bottom: 4px;
}

h1 {
  font-size: 1.35rem;
  font-weight: 700;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.search-box {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent);
}

.tabs-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.tab-btn {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.tab-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.tab-pane.active {
  display: flex;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.mini-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.mini-card h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: #e2e8f0;
}

.mini-card p {
  font-size: 0.84rem;
  color: var(--muted);
}

.step-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.sede-chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.83rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sede-id {
  font-family: monospace;
  color: #34d399;
  font-weight: 700;
}

.accordion-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 12px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion-body {
  display: none;
  padding: 0 14px 12px 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.accordion-item.open .accordion-body {
  display: block;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  padding: 11px 16px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.status-box {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  background: var(--card);
}

.status-box.ok {
  border-color: rgba(52, 211, 153, 0.5);
  color: #6ee7b7;
}

.status-box.err {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.hidden {
  display: none !important;
}

@media (max-width: 560px) {
  .tabs-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Componente Modal Reutilizable SaaS Mobile-First (docs/07)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 9999;
  padding: 0;
  transition: opacity 0.22s ease;
}

.modal-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 14px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
  animation: slideUpModal 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

@keyframes slideUpModal {
  from {
    transform: translateY(100%);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.modal-eyebrow {
  margin-bottom: 2px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
}

.modal-close:hover {
  color: var(--text);
  background: var(--card);
}

.modal-body {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.modal-sheet.tone-ok {
  border-top: 3px solid var(--accent);
}

.modal-sheet.tone-warn {
  border-top: 3px solid var(--warn);
}

.modal-sheet.tone-err {
  border-top: 3px solid var(--danger);
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 24px;
  }

  .modal-sheet {
    border-radius: var(--radius);
    border-bottom: 1px solid var(--border);
    animation: scaleModal 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes scaleModal {
    from {
      transform: scale(0.96);
      opacity: 0;
    }
    to {
      transform: scale(1);
      opacity: 1;
    }
  }
}
