/* ==========================================================================
   Components: shared across all pages
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .7rem 1.35rem; border-radius: var(--radius-pill);
  border: 1.5px solid transparent; font-weight: 700; font-size: var(--fs-base); line-height: 1.2;
  text-decoration: none; white-space: nowrap; transition: background .2s, color .2s, border-color .2s, transform .15s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 18px rgba(var(--b-primary-rgb, 26, 127, 102), .22); }
.btn--primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn--secondary { background: var(--surface); color: var(--accent-text); border-color: var(--border); }
.btn--secondary:hover { border-color: var(--primary); color: var(--accent-text); }
.btn--ghost { background: transparent; color: var(--accent-text); padding-inline: .6rem; min-height: 40px; }
.btn--ghost:hover { background: var(--surface-3); }
.btn--gold { background: var(--gold); color: var(--on-gold); }
.btn--gold:hover { filter: brightness(1.05); color: var(--on-gold); }
.btn--on-dark { background: transparent; color: var(--on-brand); border-color: rgba(255, 255, 255, .35); }
.btn--on-dark:hover { border-color: var(--on-brand); color: var(--on-brand); }
.btn--sm { min-height: 38px; padding: .45rem 1rem; font-size: var(--fs-sm); }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }

.link-arrow { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; text-decoration: none; }
.link-arrow::after { content: "→"; transition: transform .2s; }
.link-arrow:hover::after { transform: translateX(3px); }

/* ---------- Pills, chips, badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border); color: var(--accent-text);
  font-size: var(--fs-sm); font-weight: 700;
}
.pill svg { width: 15px; height: 15px; }
.badge-verified {
  display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: var(--radius-pill);
  background: var(--surface-3); color: var(--accent-text); font-size: var(--fs-xs); font-weight: 800;
}
.badge-verified svg { width: 13px; height: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  min-height: 38px; padding: .4rem 1rem; border-radius: var(--radius-pill); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-weight: 700; font-size: var(--fs-sm);
}
.chip:hover { border-color: var(--primary); color: var(--accent-text); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.tag { display: inline-block; padding: .15rem .55rem; border-radius: 6px; background: var(--surface-3); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 700; }

/* ---------- Icons & flags ---------- */
.icon { width: 22px; height: 22px; flex: none; }
.icon-tile {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--surface-3); color: var(--accent-text);
}
.icon-tile svg { width: 24px; height: 24px; }
.flag { width: 22px; height: 16px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.08); object-fit: cover; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s, box-shadow .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--border-soft); box-shadow: var(--shadow-sm); }
.nav { height: 100%; display: flex; align-items: center; gap: var(--sp-4); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand__mark { width: 32px; height: 32px; }
.brand b { color: var(--accent-text); font-weight: 800; }
.nav-links { display: none; gap: var(--sp-1); margin-left: var(--sp-4); }
.nav-links a { padding: .45rem .7rem; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 600; font-size: .95rem; text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: var(--surface-3); }
.nav-links .nav-partner { color: var(--accent-text); font-weight: 700; }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.nav-actions .btn { display: none; }
@media (min-width: 1080px) {
  .nav-links { display: flex; }
  .nav-actions .btn { display: inline-flex; }
  .menu-btn { display: none !important; }
}

/* Segmented language toggle */
.seg { display: inline-flex; padding: 3px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border); }
.seg button {
  min-width: 38px; min-height: 32px; padding: 0 .55rem; border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--text-muted); font-size: var(--fs-xs); font-weight: 800; letter-spacing: .04em;
}
.seg button[aria-pressed="true"] { background: var(--brand-deep); color: #fff; }
html[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); display: inline-grid; place-items: center; flex: none;
}
.icon-btn:hover { border-color: var(--primary); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: block; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }

/* Mobile drawer */
.drawer {
  position: fixed; inset: var(--header-h) 0 0 0; z-index: 99; background: var(--bg);
  padding: var(--sp-5) var(--gutter) var(--sp-7); overflow-y: auto;
  transform: translateX(100%); visibility: hidden; transition: transform .28s ease, visibility .28s;
}
.drawer.is-open { transform: none; visibility: visible; }
.drawer nav { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-5); }
.drawer nav a { padding: .9rem 1rem; border-radius: var(--radius); font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; border: 1px solid var(--border-soft); background: var(--surface); }
.drawer .btn-row .btn { flex: 1; }
body.drawer-open { overflow: hidden; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-5); box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: var(--sp-2); }
.card p { color: var(--text-muted); margin: 0; }
.card--hover { transition: transform .2s, box-shadow .2s, border-color .2s; }
.card--hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }

/* ---------- Media + image placeholders ----------
   <div class="media" data-label="..."><img src="assets/img/x.jpg" alt="..." onerror="this.remove()"></div>
   Shows the label until the real image file exists. */
.media {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  background: var(--ph-fill); border: 1.5px dashed var(--ph-stroke); aspect-ratio: 4 / 3;
}
.media::before {
  content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: var(--sp-4); color: var(--text-faint); font-size: var(--fs-sm); font-weight: 600; line-height: 1.4;
}
.media img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.media:has(img) { border-style: solid; border-color: transparent; }

/* ---------- Content placeholders ---------- */
.ph { outline: 1.5px dashed var(--gold); outline-offset: 2px; border-radius: 4px; }
.ph-note {
  display: inline-flex; align-items: center; gap: .35rem; margin-top: var(--sp-3);
  font-size: var(--fs-xs); font-weight: 700; color: var(--warn-text); background: var(--warn-soft);
  padding: .3rem .65rem; border-radius: var(--radius-pill);
}
.ph-note::before { content: "◆"; font-size: .6rem; color: var(--gold); }

/* ---------- Accordion (native details/summary) ---------- */
.faq { display: grid; gap: var(--sp-3); max-width: 820px; margin-inline: auto; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.faq summary {
  list-style: none; cursor: pointer; padding: 1.05rem 1.2rem; font-weight: 700; display: flex; justify-content: space-between; gap: var(--sp-4); align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-text); font-size: 1.2rem; font-weight: 700; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details[open] { border-color: var(--primary); }
.faq .faq__a { padding: 0 1.2rem 1.1rem; color: var(--text-muted); }
.faq .faq__a p:last-child { margin: 0; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: var(--sp-4); }
@media (min-width: 640px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: 1 / -1; } }
.field { display: grid; gap: .4rem; }
.field label, .field .label { font-weight: 700; font-size: var(--fs-sm); display: flex; justify-content: space-between; gap: var(--sp-2); }
.field label a { font-weight: 600; }
.req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: .7rem .95rem; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface-2); color: var(--text); transition: border-color .2s, box-shadow .2s, background .2s;
}
.textarea { min-height: 120px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.field.is-invalid .input, .field.is-invalid .select, .field.is-invalid .textarea { border-color: var(--danger); }
.field .error { display: none; color: var(--danger); font-size: var(--fs-xs); font-weight: 700; }
.field.is-invalid .error { display: block; }
.hint { font-size: var(--fs-xs); color: var(--text-faint); }
.check { display: flex; gap: .6rem; align-items: flex-start; font-size: var(--fs-sm); color: var(--text-muted); }
.field .check { justify-content: flex-start; font-weight: 500; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.form-status { display: none; padding: .8rem 1rem; border-radius: var(--radius); font-weight: 600; font-size: var(--fs-sm); }
.form-status.is-shown { display: block; }
.form-status--ok { background: var(--surface-3); color: var(--accent-text); }
.divider { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-faint); font-size: var(--fs-sm); margin: var(--sp-4) 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }

/* ---------- Tabs ---------- */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.tabs [role="tab"] {
  border: 0; background: transparent; border-radius: 12px; padding: .6rem .3rem; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
  color: var(--text-muted); font-weight: 700; font-size: .8rem; line-height: 1.2; text-align: center;
}
.tabs [role="tab"] svg { width: 20px; height: 20px; }
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs [role="tab"][aria-selected="true"] svg { color: var(--accent-text); }

/* ---------- Draft banner (legal pages) ---------- */
.draft-banner {
  background: var(--warn-soft); color: var(--warn-text); border: 1px solid var(--gold);
  border-radius: var(--radius); padding: .9rem 1.1rem; font-weight: 700; font-size: var(--fs-sm);
  display: flex; gap: .6rem; align-items: flex-start;
}

/* ---------- CTA band ---------- */
.cta-band {
  position: relative; overflow: hidden; border-radius: 28px; padding: var(--sp-7) var(--sp-5);
  background: radial-gradient(120% 140% at 100% 0%, var(--b-mid, #2A8A70) 0%, var(--brand-deep) 45%, var(--brand-deeper) 100%);
  color: var(--on-brand); text-align: center;
}
html[data-theme="dark"] .cta-band { background: radial-gradient(120% 140% at 100% 0%, var(--b-shade-1, #1E4A40) 0%, var(--b-shade-2, #12302A) 50%, var(--b-shade-3, #0C221E) 100%); border: 1px solid var(--border); }
.cta-band h2 { color: #fff; }
.cta-band p { color: var(--on-brand-muted); max-width: 560px; margin-inline: auto; margin-bottom: var(--sp-5); }
.cta-band .btn-row { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); color: var(--footer-text); padding: var(--sp-7) 0 var(--sp-5); margin-top: var(--sp-7); }
.site-footer a { color: var(--footer-text); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; gap: var(--sp-6); }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.4fr repeat(3, 1fr); } }
.footer-brand .brand { color: #fff; }
.footer-brand .brand b { color: var(--b-mint-2, #7FE0BC); }
.footer-brand p { color: var(--footer-muted); margin: var(--sp-3) 0; font-size: var(--fs-sm); max-width: 320px; }
.footer-contact { display: grid; gap: .45rem; font-size: var(--fs-sm); color: var(--footer-muted); }
.footer-col h4 { color: #fff; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .08em; margin-bottom: var(--sp-3); }
.footer-col ul { list-style: none; display: grid; gap: .55rem; font-size: var(--fs-sm); }
.footer-bottom { margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--footer-muted); }
.site-footer .ph-note { background: rgba(var(--b-gold-rgb, 227, 181, 90), .15); color: var(--b-sand, #F0CF8C); }

/* ---------- Myla: floating button, chooser, chat panel ---------- */
.myla-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 120; display: inline-flex; align-items: center; gap: .55rem;
  padding: .45rem 1.05rem .45rem .45rem; border-radius: var(--radius-pill); border: 0;
  background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: var(--fs-sm);
  box-shadow: 0 10px 30px rgba(var(--b-ink-rgb, 16, 54, 48), .3);
}
.myla-fab:hover { background: var(--primary-hover); }
.myla-fab .avatar { width: 38px; height: 38px; }
@media (max-width: 480px) { .myla-fab > span:not(.avatar) { display: none; } .myla-fab { padding: .4rem; } .myla-fab .avatar { width: 46px; height: 46px; } }

.avatar { display: inline-block; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: none; background: var(--b-mint-3, #CFEFE2) url("../icons/myla-avatar.svg") center / cover no-repeat; border: 2px solid #fff; position: relative; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.myla-chooser {
  position: fixed; right: 18px; bottom: 82px; z-index: 121; width: min(320px, calc(100vw - 36px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: var(--sp-4); display: none;
}
.myla-chooser.is-open { display: block; animation: pop .18s ease-out; }
.myla-chooser h3 { font-size: 1rem; margin-bottom: .25rem; }
.myla-chooser p { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
.chooser-opt {
  width: 100%; display: flex; align-items: center; gap: .75rem; text-align: left; padding: .75rem; margin-top: .5rem;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 700;
}
.chooser-opt:hover { border-color: var(--primary); color: var(--text); }
.chooser-opt small { display: block; font-weight: 500; color: var(--text-muted); font-size: var(--fs-xs); }
.chooser-opt .icon-tile { width: 38px; height: 38px; border-radius: 12px; }
.chooser-opt .icon-tile--wa { background: rgba(37, 211, 102, .14); color: #128C4B; }
html[data-theme="dark"] .chooser-opt .icon-tile--wa { color: #5BE38F; }

.myla-panel {
  position: fixed; right: 18px; bottom: 18px; z-index: 130; width: min(380px, calc(100vw - 24px)); height: min(600px, calc(100vh - 36px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden;
}
.myla-panel.is-open { display: flex; animation: pop .2s ease-out; }
@media (max-width: 480px) { .myla-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; } }
.myla-head { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; background: var(--brand-deep); color: #fff; }
.myla-head b { display: block; font-size: 1rem; }
.myla-head small { color: var(--on-brand-muted); font-size: var(--fs-xs); }
.myla-head .icon-btn { margin-left: auto; background: transparent; border-color: rgba(255,255,255,.3); color: #fff; width: 36px; height: 36px; }
.myla-log { flex: 1; overflow-y: auto; padding: var(--sp-4); background: var(--surface-2); display: flex; flex-direction: column; gap: .6rem; }
.msg { max-width: 86%; padding: .65rem .9rem; border-radius: 16px; font-size: .94rem; line-height: 1.5; white-space: pre-line; }
.msg--her { background: var(--surface); border: 1px solid var(--border-soft); border-bottom-left-radius: 5px; align-self: flex-start; }
.msg--me { background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 5px; align-self: flex-end; }
.msg--typing { color: var(--text-faint); font-style: italic; }
.myla-quick { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem var(--sp-4) 0; background: var(--surface-2); }
.myla-quick button { border: 1px solid var(--primary); background: var(--surface); color: var(--accent-text); border-radius: var(--radius-pill); padding: .35rem .8rem; font-weight: 700; font-size: var(--fs-xs); min-height: 32px; }
.myla-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--border-soft); background: var(--surface); }
.myla-form .input { min-height: 44px; border-radius: var(--radius-pill); }
.myla-form .icon-btn { width: 44px; height: 44px; background: var(--primary); color: var(--on-primary); border: 0; }
.myla-note { font-size: .72rem; color: var(--text-faint); text-align: center; padding: 0 .75rem .6rem; background: var(--surface); }

@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Legal prose ---------- */
.prose { max-width: 780px; }
.prose h2 { font-size: 1.35rem; margin-top: var(--sp-6); }
.prose h3 { margin-top: var(--sp-5); }
.prose p, .prose li { color: var(--text-muted); }
.prose ul, .prose ol { padding-left: 1.3rem; margin-bottom: var(--sp-4); display: grid; gap: .35rem; }
.prose strong { color: var(--text); }
.toc { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: .35rem; font-size: var(--fs-sm); }
.toc a { color: var(--text-muted); text-decoration: none; padding: .3rem .6rem; border-radius: 8px; }
.toc a:hover { background: var(--surface-3); color: var(--text); }
