@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Sora:wght@500;600;700&display=swap");

:root{
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --surface-3: #eef1f6;
  --text: #151618;
  --muted: #5b606a;
  --border: #dfe3ec;

  --primary: #2b3a67;
  --primary-ink: #ffffff;
  --accent-ssbb: #c44;
  --accent-ce: #cc4;
  --accent-cev: #3a3;
  --accent-do: #36c;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 24px rgba(23, 27, 37, 0.08);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: var(--font-body);

  --panel: var(--surface);
  --content-max: clamp(1100px, 92vw, 1680px);
}

/* ================= BASE ================= */

*{ box-sizing: border-box; }

html, body{
  height: 100%;
}

body{
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
}

a{ color: inherit; }
code, pre{ font-family: var(--mono); }

/* ================= LAYOUT GLOBAL ================= */

.page{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page > main{
  flex: 1 0 auto;
  width: 100%;
}

/* ================= CONTAINER ================= */
/* ESTE es el comportamiento correcto y único */

.container{
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  min-width: 0; /* crA-tico para grids y overflow */
}

/* ================= TYPO ================= */

h1, h2, h3,
.h1, .h2, .h3{
  font-family: var(--font-display);
  letter-spacing: -.2px;
}

.h1{ font-size: 30px; margin: 0 0 10px; }
.h2{ font-size: 22px; margin: 0 0 10px; }
.h3{ font-size: 18px; margin: 0 0 8px; }

.p-muted{ color: var(--muted); margin: 0; }
.small-muted{ color: var(--muted); font-size: 13px; }

/* ================= CARDS ================= */

.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0; /* IMPORTANTÍSIMO en layouts grid */
}

.card + .card{
  margin-top: 14px;
}

/* ================= TABLE CARDS ================= */

.table-card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

.table-card.demo-watermark{
  position: relative;
  overflow: hidden;
}

.table-card.demo-watermark::after{
  content: "DEMO";
  position: absolute;
  top: 12px;
  right: -8px;
  font-size: 46px;
  font-weight: 800;
  color: rgba(45, 60, 80, 0.12);
  transform: rotate(-12deg);
  pointer-events: none;
  letter-spacing: .12em;
}

.table-card h3,
.table-card h4{
  margin: 0 0 8px;
}

.table-scroll{
  overflow: auto;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.nice-table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  line-height: 1.45;
  table-layout: auto;
}

.nice-table th,
.nice-table td{
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: break-word;
}

.nice-table th{
  background: var(--surface-3);
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  word-break: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

#table1 th.col-tipo,
#table1 td.col-tipo{
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}

.nice-table tr:nth-child(even) td{
  background: var(--surface-2);
}

.nice-table tbody tr:hover td{
  background: #eef2fb;
}

.nice-table tr:last-child td{
  border-bottom: 0;
}

.nice-table tr.relations-error td{
  background: #fff2bf !important;
  box-shadow: inset 0 0 0 9999px rgba(255, 242, 191, 0.85);
}

.nice-table tr.relations-error{
  outline: 2px solid #e7b700;
  outline-offset: -1px;
}

.leads-subjects-card{
  grid-column: 1 / -1;
}

.leads-subjects-table{
  width: 100%;
  table-layout: fixed;
}

.leads-subjects-table td{
  white-space: normal;
  word-break: break-word;
}

/* ================= HELPERS ================= */

.row{ display:flex; gap:12px; flex-wrap:wrap; align-items:center; }
.stack{ display:flex; flex-direction:column; gap:10px; }
.stack.stack-loose{ gap:16px; }
.push{ flex:1; }

/* ================= FORMS ================= */

label{
  display: inline-block;
  font-weight: 650;
  margin-bottom: 6px;
}

.input, select{
  width: 100%;
  max-width: 520px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.input:focus-visible,
select:focus-visible,
textarea.input:focus-visible{
  outline: 2px solid rgba(43, 58, 103, 0.25);
  outline-offset: 2px;
}

select{ max-width: 420px; }

/* ================= BUTTONS ================= */

:where(.btn, .btn-small, button:not(.code-pill)){
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}

:where(.btn, .btn-small, button:not(.code-pill)):hover{
  background: var(--surface-3);
  border-color: #b9ccf7;
}

:where(.btn, .btn-small, button:not(.code-pill)):active{
  transform: translateY(1px);
}

:where(.btn, .btn-small, button:not(.code-pill)):focus-visible{
  outline: 2px solid rgba(43, 58, 103, 0.25);
  outline-offset: 2px;
}

:where(.btn, .btn-small, button:not(.code-pill))[disabled],
:where(.btn, .btn-small, button:not(.code-pill)).is-disabled{
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-demo-reset{
  background: #8b1f1f;
  border-color: #741a1a;
  color: #fff;
}

.btn-demo-reset:hover{
  background: #7a1a1a;
  border-color: #641616;
}

.btn-reset-icon{
  display: inline-block;
  line-height: 1;
  margin-right: 6px;
}

.btn-reset-icon-svg{
  width: 26px;
  height: 26px;
  display: block;
  fill: currentColor;
}

.demo-tour-subject-locked{
  pointer-events: none;
}

.btn{
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
}

.btn-primary{
  background: var(--primary);
  color: var(--primary-ink);
  border-color: transparent;
}

.btn-access{
  background: #1f8f3f;
  color: #fff;
  border-color: #187534;
  box-shadow: 0 6px 16px rgba(31, 143, 63, 0.25);
}

.btn-access:hover{
  background: #187534;
  border-color: #14632c;
}

.btn-access.btn-ghost{
  background: #1f8f3f;
  color: #fff;
}

.btn-access.btn-ghost:hover{
  background: #187534;
  border-color: #14632c;
  color: #fff;
}

.btn-primary:hover{
  background: #223055;
}

.btn-ghost{
  background: transparent;
  border-color: transparent;
  color: var(--text);
}

.btn-ghost:hover{
  background: var(--surface-3);
}

.btn-small{
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.btn-small.relations-warning{
  background: #fff2bf;
  border-color: #e7b700;
}

.analysis-status{
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f3f4f6;
  border: 1px solid #e6e8ef;
  margin-bottom: 10px;
}

.analysis-status-warning{
  background: #fff2bf;
  border-color: #e7b700;
}

.analysis-status-strong{
  font-weight: 700;
}

.analysis-summary{
  font-size: 13px;
  color: #111;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f3f4f6;
  border: 1px solid #e6e8ef;
  margin-bottom: 10px;
}

.analysis-errors{
  font-size: 13px;
  color: #111;
  margin-bottom: 10px;
}

.analysis-errors-title{
  font-weight: 700;
  margin-bottom: 6px;
}

.analysis-errors-warning{
  background: #fff2bf;
  border: 1px solid #e7b700;
  padding: 6px 8px;
  border-radius: 8px;
}

/* ================= NAVBAR ================= */

.navbar{
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner{
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 12px 16px;
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
}

.navbrand{
  font-weight: 900;
  text-decoration:none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.navbrand-logo{
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
}

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

.navlinks a{
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration:none;
  font-weight: 600;
}

.navlinks a.nav-cta{
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
  border: 1px solid transparent;
  box-shadow: 0 6px 16px rgba(43, 58, 103, 0.2);
  padding: 9px 12px;
}

.navlinks a.nav-cta:hover{
  background: #223055;
  border-color: transparent;
}

.demo-pill{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ffec99;
  border: 1px solid #f0c94a;
  color: #4a3b00;
  font-weight: 800;
  letter-spacing: .08em;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.demo-pill:hover{
  background: #ffe27a;
  border-color: #e3b83f;
}

.nav-user{
  display:flex;
  gap:10px;
  align-items:center;
}

.account-card{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.account-card .username{
  font-weight: 600;
  color: var(--text);
}

.account-card form{
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.account-card .btn{
  line-height: 1;
}

/* ================= CODE RESULTS (shared) ================= */

#code-results{
  width: 100%;
  overflow-x: auto;
}

.type-grid{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 14px;
  align-items: start;
  width: max-content;
}

.type-block{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface);
  width: max-content;
}

.type-header{
  font-weight: 850;
  text-align: center;
  margin-bottom: 10px;
}

.type-cols{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 10px;
}

.type-col{
  width: max-content;
}

/* ================= CODE PILL ================= */

.code-pill{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 7px 9px;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.code-pill:hover{ filter: brightness(.98); }

.code-pill.is-disabled{
  background: #f1f2f5;
  border-color: #d8dbe2;
  color: #9aa0ad;
  cursor: not-allowed;
  filter: none;
  opacity: 1;
}

.code-pill.is-selected{
  color: white;
  font-weight: 650;
}

/* ================= COLORS BY TYPE ================= */

.type-ssbb{ border-color: #c44; }
.type-ce{ border-color: #cc4; }
.type-cev{ border-color: #3a3; }
.type-do{ border-color: #36c; }

.code-pill.type-ssbb.is-selected{ background:#c44; }
.code-pill.type-ce.is-selected{ background:#cc4; color:#222; }
.code-pill.type-cev.is-selected{ background:#3a3; }
.code-pill.type-do.is-selected{ background:#36c; }

/* ================= TABLES PAGE LAYOUT ================= */

.tables-shell{
  height: calc(100vh - 76px);
  overflow: hidden;
}

.tables-layout{
  display: grid;
  grid-template-columns: clamp(440px, 40vw, 760px) 1fr;
  gap: 14px;
  height: 100%;
}

.tables-left,
.tables-right{
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

.tables-left .panel-section + .panel-section{
  margin-top: 14px;
}

.tables-right #tables-dynamic{
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (max-width: 980px){
  .tables-shell{
    height: auto;
    overflow: visible;
  }

  .tables-layout{
    grid-template-columns: 1fr;
    height: auto;
  }

  .tables-left,
  .tables-right{
    height: auto;
    overflow: visible;
    padding-right: 0;
  }
}

/* ================= secuenciacion BUILDER ================= */

#leftPane,
#leftCodes{
  min-width: 0;
  overflow-x: auto;
}

.page{
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  align-items: stretch; /* CLAVE */
}

.page > main{
  flex: 1 0 auto;
  width: 100%;
  align-self: stretch; /* CLAVE */
  min-width: 0;
}

/* ====== FIX DEFINITIVO: evitar shrink-to-fit ====== */
.codes-scroll{
  width: 100%;
  overflow-x: auto;
}

/* ===== FIX: evita que el <body> sea flex por accidente ===== */
html, body {
  width: 100%;
  max-width: 100%;
}

body {
  display: block !important;   /* <- clave: mata el flex en body */
}

/* En vez de .page a pelo */
body > .page{
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  align-items: stretch;
}

/* y si quieres asegurar main */
body > .page > main.container{
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  min-width: 0; /* crA-tico para grids y overflow */
}

/* container de contenido: full width + max-width con margen */
main.container{
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  min-width: 0; /* crA-tico para grids y overflow */
}

/* ===== code-tag pills (tables right) ===== */
.code-tag{
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid #ddd;
  background:#fff;
  font-size:12px;
  margin:2px 4px 2px 0;
  white-space:nowrap;
  cursor: pointer;
}

.code-tag.is-disabled{
  background: #f1f2f5;
  border-color: #d8dbe2;
  color: #9aa0ad;
  cursor: not-allowed;
}

.code-tag-list{
  display:block;
}

.code-tag-list .code-tag{
  break-inside: avoid;
}

#table1 .code-tag-list{
  column-count: 1;
  column-gap: 0;
}

.code-tag.type-ssbb{ border-color:#c44; }
.code-tag.type-ce{ border-color:#cc4; }
.code-tag.type-cev{ border-color:#3a3; }
.code-tag.type-do{ border-color:#36c; }

.code-tag.is-selected{ font-weight:800; }

.code-tag.type-ssbb.is-selected{ background:#c44; color:#fff; }
.code-tag.type-ce.is-selected{ background:#cc4; color:#222; }
.code-tag.type-cev.is-selected{ background:#3a3; color:#fff; }
.code-tag.type-do.is-selected{ background:#36c; color:#fff; }

/* ================= secuenciacion UNITS ================= */

.unit-card{
  position: relative;
}

.unit-card.is-active{
  border-color: #2d6cdf;
  box-shadow: 0 0 0 2px rgba(45,108,223,.2), var(--shadow);
  background: #f7faff;
}

/* ================= secuenciacion GRID ================= */

.secuenciacion-grid{
  display: grid;
  grid-template-columns: minmax(360px, 1.1fr) minmax(300px, 0.9fr);
  gap: 14px;
}

.secuenciacion-grid.is-analysis{
  grid-template-columns: minmax(340px, 1.05fr) minmax(320px, 0.95fr) minmax(320px, 0.9fr);
}

#analysisPane{
  display: none;
}

.secuenciacion-grid.is-analysis #analysisPane{
  display: block;
}

.unit-move{
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.unit-move .btn-small{
  padding: 4px 6px;
  line-height: 1;
  min-width: 28px;
}

@media (max-width: 1100px){
  .secuenciacion-grid.is-analysis{
    grid-template-columns: 1fr;
  }
}

/* ================= MODAL ================= */

.modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(9,12,18,.45);
}

.modal-card{
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.modal-title{
  font-weight: 800;
  margin-bottom: 10px;
}

.modal-label{
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.modal-actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* ================= LANDING ================= */

.landing{
  position: relative;
  padding: 0 28px;
}

.landing::before{
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(45,108,223,.12), transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(32,130,90,.10), transparent 40%),
    linear-gradient(180deg, #f7f9fd 0%, #f6f7fb 30%, #f6f7fb 100%);
  pointer-events: none;
  z-index: 0;
}

.landing > *{
  position: relative;
  z-index: 1;
}

.landing-navbar{
  background: rgba(255,255,255,.94);
}

.landing-nav-inner{
  flex-wrap: wrap;
  gap: 16px;
}

.landing-brand{
  font-weight: 800;
  letter-spacing: -.2px;
}

.landing-links{
  gap: 12px;
  flex-wrap: wrap;
}

.landing-links a{
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.landing-links a:hover{
  color: var(--text);
}

.landing-nav-cta{
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-hero{
  padding: 48px 0 24px;
}

.landing-hero-grid{
  display: grid;
  gap: 28px;
  align-items: center;
}

.landing-hero-copy h1{
  font-size: clamp(30px, 4vw, 48px);
  margin: 0 0 14px;
  letter-spacing: -.4px;
}

.landing-hero-copy{
  padding-left: 0;
}

.landing-kicker{
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}

.landing-lead{
  font-size: 17px;
  color: var(--text);
  margin: 0 0 20px;
}

.landing-ia-row{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

.landing-ia-card{
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
  margin-top: 10px;
  width: fit-content;
  max-width: 100%;
}

.landing-ia-card span{
  line-height: 1.15;
}

.landing-ia{
  display: block;
  width: 100px;
  height: 100px;
  transform: none;
  flex: 0 0 auto;
}

.landing-ia-row span{
  display: block;
}

.landing-note{
  color: var(--muted);
  margin: 16px 0 0;
  font-size: 14px;
}

.hero-compat{
  margin: 4px 0 32px;
  color: var(--muted);
  font-size: 14px;
}

.about-project{
  padding-top: 36px;
  padding-bottom: 36px;
}

.about-project-card{
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  max-width: 920px;
  border-top-color: var(--accent-do) !important;
}

.about-project-card p{
  margin: 0 0 12px;
}

.hero-ctas{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-ctas .btn{
  width: 100%;
}

.btn-large{
  padding: 12px 18px;
  font-size: 15px;
  border-radius: 12px;
}

.btn-hero-cta{
  padding: 16px 26px;
  font-size: 18px;
  border-radius: 14px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.1;
  text-align: center;
  box-shadow: 0 10px 24px rgba(16, 22, 32, 0.18);
  text-decoration: none;
}

.lead-demo-cta .btn{
  text-decoration: none;
}

.btn-hero-main{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-hero-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 225, 0, 0.2);
  border: 1px solid rgba(255, 225, 0, 0.9);
}

.btn-hero-icon-svg{
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.btn-hero-sub{
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
}

.landing-hero-mock{
  display: flex;
  justify-content: stretch;
}

.hero-mock-card{
  width: 100%;
  max-width: 760px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent-do);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.hero-mock-card .landing-demo-img{
  width: auto;
  max-width: 100%;
  height: auto;
}

.hero-mock-title{
  font-weight: 700;
  margin-bottom: 10px;
}

.hero-mock-foot{
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.landing-section{
  padding: 56px 0;
  scroll-margin-top: 96px;
}

.landing-section-head{
  margin-bottom: 18px;
}

.landing-section-head h2{
  margin: 0 0 8px;
}

.landing-muted{
  color: var(--muted);
  margin: 0;
}

.landing-section-grid{
  display: grid;
  gap: 18px;
}

.landing-panel,
.landing-card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 3px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.landing-card-muted{
  background: #f2f5fb;
  color: var(--muted);
}

.landing-list{
  margin: 0;
  padding-left: 18px;
}

.landing-list li{
  margin-bottom: 8px;
}

.landing-list li:last-child{
  margin-bottom: 0;
}

.landing-strong{
  color: var(--text);
  margin: 0;
}

.landing-space{
  height: 10px;
}

.landing-grid{
  display: grid;
  gap: 16px;
}

.landing-stack h2{
  margin: 0 0 12px;
}

.landing-section .landing-panel:nth-child(1){
  border-top-color: var(--accent-ssbb);
}

.landing-section .landing-panel:nth-child(2){
  border-top-color: var(--accent-cev);
}

.landing-grid .landing-card:nth-child(4n + 1){
  border-top-color: var(--accent-ssbb);
}

.landing-grid .landing-card:nth-child(4n + 2){
  border-top-color: var(--accent-ce);
}

.landing-grid .landing-card:nth-child(4n + 3){
  border-top-color: var(--accent-cev);
}

.landing-grid .landing-card:nth-child(4n + 4){
  border-top-color: var(--accent-do);
}

.landing-grid .landing-card-what-not{
  border-top-color: var(--accent-ce) !important;
}

.landing-grid .landing-card-what-is{
  border-top-color: var(--accent-do) !important;
}

.landing-card-what-does{
  border-top-color: var(--accent-do);
}

.faq-item{
  border-left: 4px solid var(--accent-do);
}

.faq-item:nth-child(4n + 1){
  border-left-color: var(--accent-ssbb);
}

.faq-item:nth-child(4n + 2){
  border-left-color: var(--accent-ce);
}

.faq-item:nth-child(4n + 3){
  border-left-color: var(--accent-cev);
}

.faq-item:nth-child(4n + 4){
  border-left-color: var(--accent-do);
}

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

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

@media (min-width: 900px){
  .landing-grid-2{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landing-grid-3{
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.landing-compact{
  padding-top: 24px;
}

.landing-table-card{
  padding: 22px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.landing-example-stack{
  display: grid;
  gap: 16px;
  align-items: start;
}

.landing-example-stack .landing-table-card{
  border-top: 3px solid var(--accent-ssbb);
}

.landing-example-stack .landing-table-card:nth-child(2){
  border-top-color: var(--accent-cev);
}
.landing-table-caption{
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.landing-card-title{
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.excel-mock{
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.landing-demo-img{
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
}

.excel-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.excel-table th,
.excel-table td{
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.excel-table th{
  background: #eef2f9;
  font-weight: 700;
}

.excel-table tr:nth-child(even) td{
  background: #f9fbff;
}

.faq-list{
  display: grid;
  gap: 12px;
}

.faq-item{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.faq-toggle{
  width: 100%;
  padding: 16px;
  background: none;
  border: none;
  text-align: left;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-body);
  cursor: pointer;
}

.faq-toggle:focus-visible{
  outline: 2px solid rgba(43, 58, 103, 0.25);
  outline-offset: 2px;
}

.faq-panel{
  padding: 0 16px 16px;
  color: var(--muted);
}

.faq-icon{
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
}

.faq-icon::before,
.faq-icon::after{
  content: "";
  position: absolute;
  background: var(--muted);
}

.faq-icon::before{
  width: 10px;
  height: 2px;
  top: 8px;
  left: 4px;
}

.faq-icon::after{
  width: 2px;
  height: 10px;
  top: 4px;
  left: 8px;
}

.faq-toggle[aria-expanded="true"] .faq-icon::after{
  opacity: 0;
}

.landing-cta{
  padding: 40px 0 56px;
}

.landing-cta-inner{
  background: linear-gradient(120deg, #e9f1ff 0%, #f7fbff 65%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: flex-start;
  box-shadow: var(--shadow);
}

.landing-footer{
  padding: 28px 0 40px;
}

.landing-footer-inner{
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--muted);
}

.landing-footer-links{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.landing-footer-links a{
  text-decoration: none;
  color: var(--muted);
}

.landing-footer-links a:hover{
  color: var(--text);
}

/* ================= LANDING MODAL ================= */

.flash-messages{
  margin: 0 0 24px;
  display: grid;
  gap: 10px;
}

.flash-message{
  background: #ecfdf3;
  border: 1px solid #a6f4c5;
  color: #027a48;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.modal.is-open{
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 28, 0.55);
}

.modal-card{
  position: relative;
  z-index: 1;
  width: min(560px, 96vw);
  max-height: min(720px, 92vh);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,.2);
  padding: 20px;
}

.modal-card-large{
  width: min(620px, 96vw);
}

.modal-title{
  font-weight: 800;
  margin-bottom: 6px;
}

.modal-subtitle{
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 14px;
}

.lead-demo-cta{
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 6px 0 16px;
  padding: 14px;
  color: #2b2f38;
  border: 1px solid rgba(44, 133, 255, 0.6);
}

.lead-demo-divider{
  height: 1px;
  background: rgba(19, 22, 28, 0.1);
  margin: 4px 0 12px;
}

.modal-close{
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.modal-close:focus-visible{
  outline: 2px solid rgba(43, 58, 103, 0.25);
  outline-offset: 2px;
}

.lead-form{
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lead-form .field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label{
  font-weight: 650;
}

.field-options{
  display: grid;
  gap: 8px;
}

.field-options label{
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.field-options input{
  margin: 0;
}

.lead-form textarea.input{
  resize: vertical;
}

.field-error{
  color: #b42318;
  font-size: 12px;
  min-height: 14px;
}

.form-privacy{
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.form-note{
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.form-actions{
  display: flex;
  justify-content: flex-start;
}

.form-success{
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ecfdf3;
  border: 1px solid #a6f4c5;
  color: #027a48;
  font-size: 13px;
}

.hp-field{
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

@media (max-width: 640px){
  .modal-card{
    width: 100%;
    height: 92vh;
    max-height: 92vh;
    border-radius: 14px;
  }
}

@media (min-width: 700px){
  .hero-ctas{
    flex-direction: row;
    align-items: center;
  }

  .hero-ctas .btn{
    width: auto;
  }
}

@media (min-width: 900px){
  .landing-hero{
    padding: 72px 0 40px;
  }

  .landing-hero-grid{
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }

  .landing-section-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landing-grid-2{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landing-grid-3{
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .landing-cta-inner{
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .landing-footer-inner{
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* ================= DEMO TOUR ================= */

.demo-tour{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  pointer-events: none;
}

.demo-tour.is-active{
  display: block;
}

.demo-tour-backdrop{
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

.demo-tour-highlight{
  position: fixed;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 9999px rgba(10, 14, 25, 0.55);
  background: transparent;
  pointer-events: none;
  transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.demo-tour-card{
  position: fixed;
  width: min(360px, calc(100vw - 28px));
  background: #ffffff;
  color: #10131a;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 14px 34px rgba(16, 22, 32, 0.24);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.demo-tour-skip{
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  padding: 4px 8px;
  line-height: 1.1;
}

.demo-tour-step{
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}


.demo-tour-title{
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
}

.demo-tour-text{
  font-size: 14px;
  color: #2b2f38;
  margin: 0;
}

.demo-tour-hint{
  font-size: 12px;
  color: #9c3c2f;
  background: rgba(255, 225, 0, 0.18);
  border: 1px solid rgba(255, 225, 0, 0.4);
  border-radius: 8px;
  padding: 6px 8px;
}

.demo-tour-actions{
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.demo-tour-restart{
  margin-right: auto;
}

.demo-tour-restart-small{
  transform: scale(0.65);
  transform-origin: left center;
}

.demo-tour-cta{
  text-align: center;
}

.demo-tour-cta .demo-tour-actions{
  justify-content: center;
}

.code-pill.demo-tour-glow{
  box-shadow: 0 0 0 2px #ffffff, 0 0 12px rgba(255, 255, 255, 0.7);
  position: relative;
  z-index: 2;
}

body.demo-tour-block-codes .code-pill{
  pointer-events: none;
}

.demo-tour-pulse{
  position: relative;
  z-index: 4;
  animation: demoTourPulse 0.95s ease-in-out infinite;
}

.demo-tour-pulse-sky{
  position: relative;
  z-index: 4;
  animation: demoTourPulseSky 0.95s ease-in-out infinite;
}

@keyframes demoTourPulse{
  0% {
    box-shadow:
      0 0 0 0 rgba(255, 255, 255, 0),
      0 0 0 0 rgba(255, 225, 0, 0);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 255, 255, 1),
      0 0 0 8px rgba(255, 225, 0, 1);
  }
  100% {
    box-shadow:
      0 0 0 2px rgba(255, 255, 255, 0.9),
      0 0 0 6px rgba(255, 225, 0, 0.85);
  }
}

@keyframes demoTourPulseSky{
  0% {
    box-shadow:
      0 0 0 0 rgba(255, 255, 255, 0),
      0 0 0 0 rgba(48, 210, 255, 0);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 255, 255, 1),
      0 0 0 8px rgba(48, 210, 255, 1);
  }
  100% {
    box-shadow:
      0 0 0 2px rgba(255, 255, 255, 0.9),
      0 0 0 6px rgba(48, 210, 255, 0.9);
  }
}
