/* Flat 101 corporate look (from flat101.es): yellow #F9CB0D on black/white,
   DM Serif Text for headings (italic on hover), Nunito Sans for text. */
:root {
  --f-yellow: #F9CB0D;
  --f-yellow-dark: #bb9805;
  --f-yellow-soft: #fef6d3;
  --f-black: #000000;
  --f-white: #ffffff;
  --f-gray-0: #353535;
  --f-gray-1: #666666;
  --f-gray-2: #999999;
  --f-gray-4: #D9D9D9;
  --f-gray-5: #EFEFEF;
  --f-gray-6: #F8F8F8;
  --font-serif: "DM Serif Text", Georgia, "Times New Roman", serif;
  --font-sans: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ink: var(--f-black);
  --muted: var(--f-gray-1);
  --bg: var(--f-gray-6);
  --card: var(--f-white);
  --line: var(--f-gray-4);
  --warn: #8a4b00;
  --warn-bg: var(--f-yellow-soft);
}

* { box-sizing: border-box; }
/* Column layout so the footer sits at the bottom on tall screens. */
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; font: 16px/1.55 var(--font-sans); color: var(--ink); background: var(--bg); }
a { color: var(--f-yellow-dark); text-underline-offset: 3px; }
.page a:hover, .debug a:hover { font-family: var(--font-serif); font-style: italic; }
pre { background: var(--f-gray-0); color: #f2f2f2; padding: 14px; border-radius: 12px; overflow-x: auto; font-size: 12px; max-height: 420px; }
h1, h2, h3 { line-height: 1.15; }
code { font-size: .9em; }

/* Brand typography for the tool pages only; landing components keep their own look. */
.page h1, .page h2, .debug h2, .trace h2 { font-family: var(--font-serif); font-weight: 400; letter-spacing: -.01em; }
.page h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 8px 0 12px; }
.page h1 em, .page h2 em { color: var(--f-yellow-dark); }
.page h2 { font-size: 1.6rem; margin: 32px 0 14px; }

.topnav { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; padding: 14px 24px; background: var(--f-black); color: var(--f-white); }
.topnav .brand { font-family: var(--font-serif); font-size: 1.3rem; color: var(--f-white); text-decoration: none; margin-right: 10px; }
.topnav .brand span { color: var(--f-yellow); }
.topnav a { color: var(--f-white); text-decoration: none; font-weight: 600; }
.topnav a:hover, .topnav a.active { color: var(--f-yellow); }
.topnav a.active { font-family: var(--font-serif); font-style: italic; font-weight: 400; }
.topnav-right { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.topnav-note { font-size: 12px; font-weight: 700; color: #ff4d4d; }
.logout-form { display: flex; gap: 10px; align-items: center; margin: 0; }
.topnav-user { font-size: 13px; color: var(--f-gray-4); }
.logout-form button { padding: 5px 14px; border: 1px solid var(--f-gray-1); border-radius: 50px; background: transparent; color: var(--f-white); font: 600 12px var(--font-sans); cursor: pointer; }
.logout-form button:hover { border-color: var(--f-yellow); color: var(--f-yellow); }

/* Login */
.login-page { display: grid; place-items: center; padding-block: 64px; }
.login-card { width: 100%; max-width: 440px; }
.login-card h1 { font-family: var(--font-serif); font-weight: 400; font-size: 2rem; margin: 0 0 8px; }
.login-card h1 em { color: var(--f-yellow-dark); }
.login-fields { grid-template-columns: 1fr; margin-top: 16px; }
.login-card button.primary { width: 100%; margin-top: 18px; }
.login-error { background: #fdecea; color: #9b1c1c; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; }

.site-footer { display: flex; flex-wrap: wrap; gap: 6px 24px; align-items: center; margin-top: auto; padding: 20px 24px; background: var(--f-black); color: var(--f-gray-2); font-size: 13px; }
.site-footer .brand { font-family: var(--font-serif); font-size: 1.1rem; color: var(--f-white); }
.site-footer .brand span { color: var(--f-yellow); }
.site-footer .copyright { margin-left: auto; }
.site-footer a { color: var(--f-yellow); }
.site-footer a:hover { font-family: var(--font-serif); font-style: italic; }

.page { width: 100%; max-width: 1120px; margin: 0 auto; padding: 32px 20px 48px; }
.lead { font-size: 1.1rem; color: var(--f-gray-0); }
.small { font-size: 12px; color: var(--muted); }

.tag { display: inline-block; padding: 2px 10px; margin: 2px; border-radius: 17px; background: var(--f-gray-5); font-size: 12px; white-space: nowrap; }
.tag-warn { background: var(--f-yellow); color: var(--f-black); font-weight: 700; }

/* Fallback banner and debug panel */
.fallback-banner { background: var(--f-yellow); color: var(--f-black); padding: 10px 24px; font-weight: 600; }
.page .fallback-banner { border-radius: 12px; }
.debug { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 24px; }
.debug summary { cursor: pointer; padding: 4px 0; }
.debug-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; padding: 8px 0; }
.debug h3, .trace h3 { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 10px 0 6px; }
.debug dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.debug dt { color: var(--muted); }
.debug dd { margin: 0; overflow-wrap: anywhere; }

/* Full debug trace (?debug=ON) */
.trace { background: var(--f-black); color: var(--f-white); border-bottom: 4px solid var(--f-yellow); padding: 16px 24px; }
.trace h2 { margin: 0 0 8px; font-size: 1.5rem; color: var(--f-yellow); }
.trace h3 { color: var(--f-gray-2); }
.trace .small { color: var(--f-gray-2); }
.trace summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--f-yellow); }
.trace-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.trace-grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.trace pre { max-height: 360px; margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; background: #1c1c1c; border: 1px solid var(--f-gray-0); }

/* Landing blocks */
.landing-blocks { width: 100%; max-width: 960px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.block-wrap { position: relative; }
.block-label { position: absolute; top: -9px; right: 12px; z-index: 1; background: var(--ink); color: #fff; font: 600 11px/1 ui-monospace, monospace; padding: 4px 8px; border-radius: 4px; }
.c { border-radius: 12px; padding: 24px; background: var(--card); border-left: 8px solid var(--line); }
.c h1 { font-size: 2rem; margin: 8px 0; }
.c h2 { font-size: 1.35rem; margin: 8px 0; }
/* Previews inside tool pages must look exactly like the landing, not like Flat 101. */
.c h1, .c h2 { font-family: inherit; font-weight: 700; letter-spacing: normal; }
.component-preview a:hover { font-family: inherit; font-style: normal; }
.c-tag { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 4px; background: rgba(0,0,0,.08); }
.cta { display: inline-block; margin-top: 8px; padding: 10px 18px; border-radius: 8px; background: var(--ink); color: #fff; text-decoration: none; font-weight: 600; }
.grid3 { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.grid3 li { background: rgba(255,255,255,.6); border-radius: 8px; padding: 12px; }

.c-hero-oferta { background: linear-gradient(135deg, #ff5f45, #ff9f1c); color: #fff; border-left-color: #b4260f; }
.c-hero-oferta .price s { opacity: .8; }
.c-hero-oferta .price strong { font-size: 1.6rem; }
.c-hero-oferta .cta { background: #fff; color: #b4260f; }
.c-hero-marca { background: linear-gradient(135deg, #1d2b53, #3b5bdb); color: #fff; border-left-color: #0b1230; }
.c-hero-marca .cta { background: #fff; color: #1d2b53; }
.c-beneficios { background: #e8f7ee; border-left-color: #2b9a5a; }
.c-prueba-social { background: #eef2ff; border-left-color: #4c5fd5; }
.c-testimonios { background: #f6effc; border-left-color: #8b46c4; }
.c-testimonios blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid #c9a7e8; font-style: italic; }
.c-comparativa { background: #eef8fb; border-left-color: #1d8aa8; }
.table-scroll { overflow-x: auto; }
.c-comparativa table { border-collapse: collapse; width: 100%; min-width: 420px; }
.c-comparativa th, .c-comparativa td { border-bottom: 1px solid #c6e3ec; padding: 6px 8px; text-align: left; }
.c-comparativa td:nth-child(2), .c-comparativa th:nth-child(2) { font-weight: 700; color: #135f74; }
.c-garantias { background: #f1f5f0; border-left-color: #4f7942; }
.c-urgencia { background: #fff0f0; border-left-color: #d62828; }
.c-urgencia h2 { color: #b11d1d; font-variant-numeric: tabular-nums; }
.c-galeria { background: #fff8e6; border-left-color: #e0a100; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ph { aspect-ratio: 4 / 3; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 700; }
.ph1 { background: linear-gradient(135deg, #ff7eb3, #ff758c); }
.ph2 { background: linear-gradient(135deg, #7ee8fa, #3b82f6); }
.ph3 { background: linear-gradient(135deg, #a8e063, #56ab2f); }
.c-faq { background: #f7f7f7; border-left-color: #777; }
.c-faq details { padding: 6px 0; border-bottom: 1px solid var(--line); }
.c-formulario { background: #fffbe6; border: 2px dashed #e0a100; border-left: 8px solid #e0a100; }
.lead-form { display: flex; flex-wrap: wrap; gap: 8px; }
.lead-form input { flex: 1 1 180px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.lead-form button { padding: 10px 18px; border: 0; border-radius: 8px; background: #e0a100; color: #1d1f24; font-weight: 700; }
.c-footer { background: #2a2d34; color: #c9ccd3; border-left-color: #000; font-size: 13px; }
.c-footer .c-tag { background: rgba(255,255,255,.12); }


/* Landing components use a neutral system font so they read as the demo brand, not Flat 101. */
.landing-blocks { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }

/* Simulator, history, prompt */
.scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: 20px; padding: 22px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.card h3 { margin: 0 0 6px; font-family: var(--font-serif); font-weight: 400; font-size: 1.35rem; }
.card code { font-size: 12px; overflow-wrap: anywhere; }
.scenarios .card { display: flex; flex-direction: column; border-top: 6px solid var(--f-yellow); }
.scenarios .card p { margin: 0 0 12px; }
.scenarios .card h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Params and cookies: at most three lines, the rest scrolls inside the block. */
.scenario-details { font-size: 11px; line-height: 1.6; max-height: 4.8em; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--f-gray-3, #B7B7B7) transparent; }
.scenario-details code { font-size: inherit; }
.scenario-details:focus-visible { outline: 2px solid var(--f-yellow); outline-offset: 2px; }
.scenario-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.scenarios .card button { align-self: flex-start; margin-top: auto; }
.page-wide { max-width: 1440px; padding-top: 20px; }
.page-wide h1 { margin-bottom: 4px; }
.page-wide h2 { margin: 18px 0 10px; }
.sim-layout { display: grid; gap: 24px; align-items: start; }
.sim-main { min-width: 0; }
.sim-sidebar h2 { margin-top: 0; font-size: 1.35rem; }
.cookie-list { list-style: none; margin: 0 0 4px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.cookie-list li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; min-width: 0; padding: 8px 10px; border-radius: 8px; background: var(--f-gray-5); font-size: 13px; }
.cookie-list li strong { overflow-wrap: anywhere; }
.cookie-list li code { font-size: 11px; color: var(--f-gray-1); overflow-wrap: anywhere; word-break: break-all; }
.cookie-list li.empty { color: var(--muted); }
@media (min-width: 1000px) {
  .sim-layout { grid-template-columns: minmax(0, 1fr) 260px; }
  /* Sidebar stays in view while scrolling; the h2 margin aligns it with "Escenarios". */
  .sim-sidebar { position: sticky; top: 16px; margin-top: 18px; }
}
@media (min-width: 1200px) {
  /* All five scenarios on one row, next to the sidebar. */
  .scenarios { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
  .scenarios .card { padding: 16px; }
  .scenarios .card h3 { font-size: 1rem; }
  .scenarios .card .scenario-desc { font-size: 14px; }
  .scenarios .card button { padding: 9px 16px; font-size: .8rem; }
}
button.primary, .btn {
  display: inline-block; margin-top: 12px; padding: 11px 24px; border: 2px solid var(--f-black); border-radius: 50px;
  background: var(--f-black); color: var(--f-white); font: 400 .95rem var(--font-serif); text-transform: uppercase; letter-spacing: .04em;
  cursor: pointer; text-decoration: none; transition: background .15s, color .15s;
}
button.primary:hover, .btn:hover { background: var(--f-yellow); color: var(--f-black); font-style: italic; }
button.secondary { background: transparent; color: var(--f-black); }
button.secondary:hover { background: var(--f-black); color: var(--f-yellow); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.form-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--f-gray-0); }
.form-grid input, .form-grid select, .form-grid textarea { padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; background: var(--f-gray-5); font: 400 15px var(--font-sans); color: var(--ink); }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { outline: none; border-color: var(--f-black); background: var(--f-white); }
.form-actions-row { margin-top: 10px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: flex-end; }
@media (min-width: 1000px) {
  /* Buttons beside the cookies field so the whole simulator fits on one screen. */
  .form-actions-row { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions button { margin-top: 8px; }
}
.status { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* Components catalog */
.component-index { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 24px; }
.component-index .tag { text-decoration: none; color: var(--ink); }
.component-index .tag:hover { background: var(--f-yellow); font-family: inherit; font-style: normal; }
.component-entry { margin-bottom: 20px; scroll-margin-top: 16px; }
.component-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.component-meta h2 { margin: 0; font-size: 1.4rem; }
.component-meta h2 code { font-family: ui-monospace, monospace; font-size: .8rem; color: var(--f-gray-1); }
.component-entry dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0 16px; font-size: 14px; }
.component-entry dt { font-weight: 700; color: var(--f-gray-0); }
.component-entry dd { margin: 0; }
.component-preview { max-width: none; padding: 16px; border-radius: 12px; background: var(--f-gray-6); }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: 20px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
table.history { border-collapse: collapse; width: 100%; font-size: 13px; }
table.history th, table.history td { padding: 10px 12px; border-bottom: 1px solid var(--f-gray-5); text-align: left; vertical-align: top; }
table.history th { background: var(--f-black); color: var(--f-white); font-weight: 700; white-space: nowrap; }
table.history tbody tr:hover { background: var(--f-yellow-soft); }
