* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; background: #faf8f3; color: #1a1a1a; }

/* NAV */
.nav { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: #fff; border-bottom: 1px solid #ede8dd; }
.logo { display: flex; flex-direction: column; gap: 1px; text-decoration: none; }
.logo-name { font-size: 17px; font-weight: 500; letter-spacing: -0.3px; color: #1a1a1a; }
.logo-name span { color: #185FA5; }
.logo-sub { font-size: 10px; color: #999; letter-spacing: 0.03em; }
.nav-links { display: flex; gap: 20px; align-items: center; }

/* NARSIL — nav */
.narsil { transition: filter 0.3s; }
.narsil.shining { animation: narsil-glow 0.9s ease-out forwards; }
@keyframes narsil-glow {
  0%   { filter: drop-shadow(0 0 0px #185FA5); }
  40%  { filter: drop-shadow(0 0 5px #185FA5) drop-shadow(0 0 10px #60a5fa); }
  100% { filter: drop-shadow(0 0 1px #185FA5); }
}

/* LOADER */
#narsil-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: #faf8f3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 0.5s ease;
}
#narsil-loader.fade-out { opacity: 0; pointer-events: none; }
.loader-sword { overflow: visible; }
.loader-shine {
  animation: loader-sweep 2.4s ease-in-out infinite;
}
@keyframes loader-sweep {
  0%   { transform: translateY(-120px); opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateY(60px); opacity: 0; }
}
.nav-link { font-size: 13px; color: #888; cursor: pointer; text-decoration: none; }
.nav-link:hover { color: #1a1a1a; }
.nav-link.active { color: #185FA5; }
.nav-cta { font-size: 13px; color: #185FA5; border: 1px solid #378ADD; padding: 5px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.nav-cta:hover { background: #E6F1FB; }

/* MAIN */
main { max-width: 720px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* HERO */
.hero { text-align: center; padding: 2.5rem 0 2rem; }
.hero h1 { font-size: 28px; font-weight: 500; line-height: 1.3; margin-bottom: 10px; }
.hero p { font-size: 15px; color: #666; margin-bottom: 1.75rem; }

/* SEARCH */
.search-wrap { display: flex; gap: 8px; max-width: 560px; margin: 0 auto 10px; }
.search-wrap input { flex: 1; font-size: 15px; padding: 9px 16px; border: 1px solid #ddd; border-radius: 8px; outline: none; font-family: inherit; background: #fff; }
.search-wrap input:focus { border-color: #378ADD; }
.search-wrap button { flex-shrink: 0; padding: 0 20px; font-size: 14px; cursor: pointer; background: #185FA5; color: #fff; border: none; border-radius: 8px; height: 40px; font-family: inherit; }
.search-wrap button:hover { background: #0C447C; }
.search-wrap button:disabled { opacity: 0.6; cursor: not-allowed; }
.input-hint { font-size: 12px; color: #A32D2D; margin-top: 4px; text-align: center; min-height: 18px; }

/* VALUE PILLARS */
.value-pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 1.5rem; }
.pillar { text-align: center; padding: 14px 12px; background: #fff; border: 1px solid #e3ddd0; border-radius: 10px; }
.pillar-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.pillar-sub { font-size: 11px; color: #888; line-height: 1.5; }

/* TAGS */
.tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.tag { font-size: 12px; color: #666; background: #faf8f3; border: 1px solid #e0e0e0; padding: 4px 12px; border-radius: 20px; cursor: pointer; }
.tag:hover { border-color: #aaa; color: #333; }

/* SEARCH RESULTS */
.search-results { margin: 1.5rem 0; }

/* MODULES */
.modules-section { margin-top: 1.5rem; }
.modules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.module { background: #fff; border: 1px solid #e3ddd0; border-radius: 12px; padding: 1rem; cursor: pointer; transition: border-color 0.15s; }
.module:hover { border-color: #bbb; }
.module.active { border: 1.5px solid #185FA5; background: #f7fbff; }
.module-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.module-icon.blue { background: #E6F1FB; }
.module-icon.teal { background: #E1F5EE; }
.module-icon.amber { background: #FAEEDA; }
.module-icon.purple { background: #EEEDFE; }
.module-name { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.module-desc { font-size: 12px; color: #888; line-height: 1.5; }

/* FIN-CARD (finanzas inline results) */
.fin-card { border: 1px solid #e8e2d8; border-radius: 10px; overflow: hidden; background: #fff; }
.fin-card-header { background: #faf8f4; padding: 12px 14px; }
.fin-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.fin-card-result:not(:empty) { padding: 12px 14px; border-top: 1px solid #ede8dd; }

/* MODULE QUERIES (dentro del panel externo) */
.module-queries, #panel-queries { display: flex; flex-direction: column; gap: 16px; margin-bottom: 4px; }
.module-query { background: #f2efe7; border-radius: 8px; padding: 10px 12px; cursor: default; }
.module-query-btn { cursor: pointer; }
.module-query-btn:hover { background: #f0f0ee; }
.query-label { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.query-sub { font-size: 11px; color: #888; margin-bottom: 8px; }
.module-query-btn .query-sub { margin-bottom: 0; }
.module-input-row { display: flex; gap: 6px; margin-top: 8px; }
.module-input-row input { flex: 1; font-size: 13px; padding: 7px 10px; border: 1px solid #ddd; border-radius: 6px; outline: none; font-family: inherit; }
.module-input-row input:focus { border-color: #378ADD; }
.module-input-row button { flex-shrink: 0; padding: 0 14px; font-size: 13px; cursor: pointer; background: #185FA5; color: #fff; border: none; border-radius: 6px; height: 34px; font-family: inherit; }
.module-input-row button:hover { background: #0C447C; }
.module-input-row button:disabled { opacity: 0.6; cursor: not-allowed; }
.module-result { margin-top: 12px; }

/* MODULE PANEL */
.module-panel { margin-top: 12px; background: #fff; border: 1px solid #e3ddd0; border-radius: 12px; overflow: hidden; }
.module-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #ede8dd; }
.module-panel-title { font-size: 14px; font-weight: 500; color: #1a1a1a; }
.module-panel-close { font-size: 12px; color: #888; cursor: pointer; border: none; background: none; padding: 4px 8px; border-radius: 6px; font-family: inherit; }
.module-panel-close:hover { background: #faf8f3; color: #333; }
.module-panel-body { padding: 16px; }
.module-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.module-input-row input { flex: 1; font-size: 14px; padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; outline: none; font-family: inherit; }
.module-input-row input:focus { border-color: #378ADD; }
.module-input-row button { flex-shrink: 0; padding: 0 18px; font-size: 14px; cursor: pointer; background: #185FA5; color: #fff; border: none; border-radius: 8px; height: 38px; font-family: inherit; }
.module-input-row button:hover { background: #0C447C; }
.module-input-row button:disabled { opacity: 0.6; cursor: not-allowed; }

/* RESULT CARDS */
.result-card { background: #fff; border: 1px solid #e3ddd0; border-radius: 12px; padding: 1.25rem; margin-bottom: 10px; }
.result-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.result-avatar { width: 40px; height: 40px; border-radius: 8px; background: #E6F1FB; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; color: #0C447C; flex-shrink: 0; }
.result-title { font-size: 15px; font-weight: 500; }
.result-sub { font-size: 12px; color: #888; margin-top: 2px; }
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.result-stat { background: #f2efe7; border-radius: 8px; padding: 10px 12px; }
.stat-label { font-size: 11px; color: #888; margin-bottom: 3px; }
.stat-value { font-size: 14px; font-weight: 500; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.badge.ok { background: #EAF3DE; color: #3B6D11; }
.badge.warn { background: #FAEEDA; color: #854F0B; }
.badge.error { background: #FCEBEB; color: #7A1212; }
.divider { border: none; border-top: 1px solid #ede8dd; margin: 1rem 0; }

/* API BANNER */
.api-banner { background: #f2efe7; border: 1px solid #e3ddd0; border-radius: 12px; padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2rem; }
.api-banner-text { font-size: 13px; color: #666; }
.api-banner-text strong { color: #1a1a1a; font-weight: 500; }
.api-banner a { flex-shrink: 0; font-size: 13px; padding: 6px 16px; cursor: pointer; border: 1px solid #ddd; border-radius: 8px; background: #fff; font-family: inherit; text-decoration: none; color: #1a1a1a; }
.api-banner a:hover { background: #faf8f3; }

/* API PLAYGROUND (api.html) */
.section-label { font-size: 12px; color: #888; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 8px; }
.endpoint-bar { display: flex; align-items: center; gap: 8px; background: #f2efe7; border: 1px solid #e3ddd0; border-radius: 8px; padding: 10px 14px; margin-bottom: 1rem; }
.method { font-size: 12px; font-weight: 500; color: #0C447C; background: #E6F1FB; padding: 3px 8px; border-radius: 4px; flex-shrink: 0; }
.url { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; color: #888; flex: 1; }
.url span { color: #1a1a1a; }
.input-row { display: flex; gap: 8px; margin-bottom: 1rem; }
.input-row input { flex: 1; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 14px; padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; outline: none; }
.input-row input:focus { border-color: #378ADD; }
.input-row button { flex-shrink: 0; padding: 0 20px; font-size: 14px; cursor: pointer; border: 1px solid #ddd; border-radius: 8px; background: #fff; font-family: inherit; }
.input-row button:hover { background: #faf8f3; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 1.5rem; }
.plan-card { border: 1px solid #e3ddd0; border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.plan-card.active { border: 1.5px solid #185FA5; background: #E6F1FB; }
.plan-name { font-size: 13px; font-weight: 500; }
.plan-detail { font-size: 11px; color: #888; margin-top: 2px; }
.plan-card.active .plan-name { color: #0C447C; }
.response-box { border: 1px solid #e3ddd0; border-radius: 8px; overflow: hidden; }
.response-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: #f2efe7; border-bottom: 1px solid #e3ddd0; }
.status-ok { font-size: 12px; font-weight: 500; color: #3B6D11; background: #EAF3DE; padding: 2px 8px; border-radius: 4px; }
.status-err { font-size: 12px; font-weight: 500; color: #A32D2D; background: #FCEBEB; padding: 2px 8px; border-radius: 4px; }
.response-time { font-size: 12px; color: #888; }
.response-body { padding: 14px; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; line-height: 1.7; white-space: pre; overflow-x: auto; }
.key { color: #185FA5; }
.str { color: #3B6D11; }
.num { color: #BA7517; }
.bool-true { color: #3B6D11; }
.bool-false { color: #A32D2D; }
.empty-state { padding: 2rem; text-align: center; color: #888; font-size: 14px; }
.usage-bar { margin-top: 1.5rem; }
.bar-track { height: 6px; background: #ede8dd; border-radius: 3px; margin: 6px 0 4px; }
.bar-fill { height: 6px; border-radius: 3px; background: #185FA5; transition: width 0.4s; }
.bar-labels { display: flex; justify-content: space-between; font-size: 11px; color: #888; }

/* SEARCH HINT */
.search-hint-box { padding: 1rem 1.25rem; background: #f2efe7; border: 1px solid #e3ddd0; border-radius: 12px; }
.search-hint-title { font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.search-hint-items { display: flex; flex-direction: column; gap: 6px; }
.hint-item { font-size: 13px; color: #444; }
.hint-item-link { color: #185FA5; cursor: pointer; }
.hint-item-link:hover { text-decoration: underline; }

/* PERIOD BUTTONS */
.period-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.period-btn { font-size: 12px; padding: 5px 12px; cursor: pointer; background: #faf8f3; border: 1px solid #ddd; border-radius: 6px; font-family: inherit; color: #444; }
.period-btn:hover { background: #ebebea; border-color: #bbb; }
.period-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* CONTACT */
.contact-section { background: #fff; border: 1px solid #e3ddd0; border-radius: 12px; padding: 1.25rem; margin-top: 1rem; }
.contact-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.contact-title { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.contact-sub { font-size: 13px; color: #888; }
.contact-toggle { flex-shrink: 0; font-size: 13px; padding: 6px 16px; cursor: pointer; background: #185FA5; color: #fff; border: none; border-radius: 8px; font-family: inherit; }
.contact-toggle:hover { background: #0C447C; }
.contact-form { margin-top: 1rem; border-top: 1px solid #ede8dd; padding-top: 1rem; }
.contact-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.contact-form input, .contact-form textarea { width: 100%; font-size: 13px; padding: 8px 12px; border: 1px solid #e3ddd0; border-radius: 8px; outline: none; font-family: inherit; background: #faf8f3; resize: none; }
.contact-form input:focus, .contact-form textarea:focus { border-color: #378ADD; background: #fff; }
.contact-form textarea { margin-bottom: 8px; }
.contact-form button[type="submit"] { font-size: 13px; padding: 8px 20px; cursor: pointer; background: #185FA5; color: #fff; border: none; border-radius: 8px; font-family: inherit; }
.contact-form button[type="submit"]:hover { background: #0C447C; }
.contact-form button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; }
.contact-success { font-size: 13px; color: #3B6D11; background: #EAF3DE; border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.contact-error { font-size: 13px; color: #A32D2D; background: #FCEBEB; border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }

/* UTILITIES */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
.spinner.dark { border-color: rgba(0,0,0,0.1); border-top-color: #185FA5; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { padding: 1.5rem; text-align: center; color: #888; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* AUTH */
.auth-btn { font-size: 13px; padding: 5px 14px; border-radius: 8px; cursor: pointer; border: 1px solid #ddd; background: #fff; color: #333; font-family: inherit; }
.auth-btn:hover { background: #f5f5f3; }
.auth-btn.logged-in { border-color: #185FA5; color: #185FA5; }
.auth-searches { font-size: 11px; color: #888; margin-left: 2px; }
.auth-dropdown-wrap { position: relative; }
.auth-dropdown { display: none; position: absolute; top: calc(100% + 8px); right: 0; background: #fff; border: 1px solid #ede8dd; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.1); min-width: 160px; z-index: 100; overflow: hidden; }
.auth-dropdown.open { display: block; }
.auth-dropdown-email { font-size: 12px; color: #888; padding: 10px 14px 6px; border-bottom: 1px solid #f0f0f0; }
.auth-dropdown-item { font-size: 13px; padding: 10px 14px; cursor: pointer; color: #333; }
.auth-dropdown-item:hover { background: #f5f5f3; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.visible { display: flex; }
.modal { background: #fff; border-radius: 16px; padding: 2rem; max-width: 380px; width: 90%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal h2 { font-size: 20px; font-weight: 500; margin-bottom: 8px; }
.modal p { font-size: 14px; color: #666; margin-bottom: 1.5rem; line-height: 1.5; }
.modal-btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 11px; border: 1px solid #ddd; border-radius: 10px; background: #fff; font-size: 14px; cursor: pointer; font-family: inherit; }
.modal-btn-google:hover { background: #f5f5f3; }
.modal-btn-close { margin-top: 12px; font-size: 13px; color: #888; cursor: pointer; background: none; border: none; font-family: inherit; }

/* RESPONSIVE */
@media (max-width: 640px) {
  main { padding: 0 1rem; }
  .nav { padding: 12px 16px; }
  .logo-name { font-size: 15px; }
  .hero { padding: 1.5rem 0 1rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 13px; }
  .search-wrap { flex-direction: column; gap: 8px; }
  .search-wrap input { width: 100%; }
  .search-wrap button { width: 100%; }
  .value-pillars { grid-template-columns: 1fr; gap: 8px; }
  .modules { grid-template-columns: 1fr; gap: 8px; }
  .module { padding: 0.875rem; }
  .api-banner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .contact-fields { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr 1fr; }
}
