@import url("brand/brand-tokens.css");

* { box-sizing: border-box; }

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  color-scheme: light only;
  background-color: var(--findspo-bg);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--findspo-font);
  background: var(--findspo-bg);
  color: var(--findspo-text);
}

body.page-sticky-footer {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--header-height);
}

body.page-sticky-footer > main { flex: 1 1 auto; width: 100%; }
body.page-sticky-footer > .site-footer { flex-shrink: 0; margin-top: auto; }
body.has-cookie-consent {
  padding-bottom: var(--cookie-banner-offset, 88px);
}

/* Layout utilities */
.page-container {
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 640px) {
  .page-container { padding: 0 24px; }
}

@media (min-width: 1024px) {
  .page-container { padding: 0 32px; }
}

.section-block { padding: 56px 0; }

@media (min-width: 768px) {
  .section-block { padding: 64px 0; }
}

.surface-alt { background: var(--surface-warm); }
.surface-hero { background: var(--surface-hero); }
.surface-muted { background: var(--surface-muted); }

.font-poppins { font-family: var(--findspo-header-font); }
.font-inter { font-family: var(--findspo-font); }

.eyebrow {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid var(--primary-200);
  background: var(--primary-50);
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary-700);
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}

.section-header h2 {
  margin: 0 0 12px;
  font-family: var(--findspo-header-font);
  font-size: 28px;
  font-weight: 600;
  color: var(--brand-ink);
}

.section-header p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--brand-body);
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 200;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  overflow: visible;
}

.app-header-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: 100%;
  min-height: var(--header-height);
  padding: 0 16px 0 0;
  font-family: var(--findspo-header-font);
}

.header-logo-link {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  height: var(--header-height);
  line-height: 0;
  text-decoration: none;
}

.header-logo {
  display: block;
  width: auto;
  height: var(--header-height);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: 72px;
  padding-bottom: 0;
  min-height: var(--header-height);
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  grid-column: 1;
  justify-self: start;
  overflow: visible;
}

.header-brand-text {
  display: block;
  line-height: 1;
  overflow: visible;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav--desktop {
  display: none;
  grid-column: 2;
  justify-self: center;
}

.header-nav--mobile {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 0;
}

.header-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  z-index: 2;
  grid-column: 2;
  justify-self: end;
}

.header-account-menu {
  display: flex;
  align-items: center;
}

.header-account-dropdown {
  position: relative;
}

.header-account-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
}

.header-account-toggle:hover {
  background: var(--surface-muted);
  color: var(--brand-ink);
}

.header-account-icon {
  width: 20px;
  height: 20px;
}

.header-account-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 60;
  min-width: 240px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  padding: 4px 0;
}

.header-account-email {
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-account-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
}

.header-account-item:hover {
  background: var(--surface-muted);
  color: var(--brand-ink);
}

.header-account-item.is-logout {
  color: #b91c1c;
}

.header-account-item.is-logout:hover {
  color: #991b1b;
  background: #fef2f2;
}

.header-account-menu-mobile {
  width: 100%;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.header-account-mobile-item {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-card);
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}

.header-account-mobile-item:hover {
  background: var(--surface-muted);
}

.header-account-mobile-item.is-logout {
  color: #b91c1c;
}

.header-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  background: #ffffff;
  color: var(--brand-ink);
  cursor: pointer;
}

.header-menu-toggle:hover {
  background: var(--surface-muted);
}

.header-menu-icon {
  width: 24px;
  height: 24px;
}

.header-menu-icon--close {
  display: none;
}

.header-menu-toggle.is-open .header-menu-icon--open {
  display: none;
}

.header-menu-toggle.is-open .header-menu-icon--close {
  display: block;
}

.header-nav-panel {
  display: none;
  width: 100%;
  border-top: 1px solid var(--border-color);
  background: #ffffff;
}

.header-nav-panel.is-open {
  display: block;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.lang-switch-link {
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 4px;
  font-family: var(--findspo-font);
}

.lang-switch-link:hover {
  color: var(--brand-ink);
  background: var(--primary-50);
}

.lang-switch-link.is-active {
  color: var(--primary-500);
  font-weight: 600;
}

.lang-switch-sep {
  color: var(--muted-foreground);
  opacity: 0.5;
  user-select: none;
}

.brand-title-main {
  display: inline-grid;
  grid-template-columns: minmax(0, max-content);
  gap: 3px;
  font-family: var(--findspo-header-font);
  line-height: 1;
  white-space: nowrap;
  overflow: visible;
}

.brand-title-word {
  justify-self: center;
  width: 100%;
  text-align: center;
  font-weight: 600;
  font-size: 24px;
  color: var(--brand-ink);
  letter-spacing: -0.02em;
}

.brand-title-highlight {
  color: var(--primary-500);
  font-weight: 600;
}

.brand-title-by {
  justify-self: end;
  width: 100%;
  text-align: right;
  margin: 0;
  font-family: var(--findspo-font);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  color: var(--muted-foreground);
  letter-spacing: 0;
}

.nav-link {
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted-foreground);
  font-family: var(--findspo-font);
  font-size: 16px;
  font-weight: 400;
}

.nav-link:hover {
  color: var(--brand-ink);
}

.nav-link.is-active,
.nav-link-active {
  color: var(--brand-ink);
  font-weight: 500;
}

.layout {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.panel {
  background: var(--findspo-surface);
  border: 1px solid var(--findspo-line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h1, .panel-head h2 { margin: 0; font-family: var(--findspo-header-font); }

.hint, .muted { color: var(--findspo-muted); font-size: 14px; line-height: 1.5; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-card);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--findspo-primary);
  color: #fff;
  border-color: var(--findspo-primary-dark);
}

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

.btn-secondary {
  background: var(--findspo-surface);
  color: var(--findspo-text);
  border-color: var(--findspo-line);
}

.btn-secondary:hover {
  border-color: var(--findspo-primary-border);
  background: var(--findspo-primary-soft);
}

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

.btn-ghost:hover {
  background: var(--accent-bg);
  color: var(--brand-ink);
}

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-field-block label,
.form-field-block .form-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.form-field-block input,
.form-field-block select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--findspo-line);
  border-radius: var(--radius-card);
  font-family: inherit;
  font-size: 14px;
  color-scheme: light;
  background-color: var(--findspo-surface);
  color: var(--findspo-text);
}

.form-field-block textarea,
.chat-composer input,
.rules-json-editor {
  color-scheme: light;
  background-color: var(--findspo-surface);
  color: var(--findspo-text);
}

.status { padding: 12px 16px; border-radius: 10px; font-size: 14px; }
.status.ok { background: #e8f8f3; border: 1px solid #a8e6d4; color: #0f6b52; }
.status.error { background: #fdecea; border: 1px solid #f5c2c0; color: var(--findspo-error); }
.status.hidden { display: none; }

.dashboard-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.dashboard-card h3 {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dashboard-card {
  background: var(--findspo-surface);
  border: 1px solid var(--findspo-line);
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.dashboard-card-accent::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--findspo-primary);
}

.dashboard-card h3 { margin: 0 0 8px; font-size: 16px; font-family: var(--findspo-header-font); }
.dashboard-card p { margin: 0 0 12px; color: var(--findspo-muted); font-size: 14px; }

.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--findspo-muted);
  margin-bottom: 12px;
}

.resource-badge {
  background: var(--findspo-primary-soft);
  color: var(--findspo-primary-dark);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Footer (Longevia two-tier) */
.site-footer {
  margin-top: auto;
  font-size: 14px;
}

.site-footer-main {
  border-top: 1px solid var(--border-color);
  background: var(--accent-bg);
}

.site-footer-main .page-container {
  padding-top: 56px;
  padding-bottom: 56px;
}

.site-footer-columns {
  display: grid;
  gap: 40px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .site-footer-columns { grid-template-columns: repeat(3, 1fr); }
}

.site-footer-column h2 {
  margin: 0;
  font-family: var(--findspo-header-font);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-ink);
}

.site-footer-links {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.site-footer-links li + li { margin-top: 8px; }

.site-footer-links a {
  color: var(--brand-body);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s;
}

.site-footer-links a:hover { color: var(--brand-ink); }

.site-footer-app-badges {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.site-footer-app-badge {
  display: inline-flex;
  width: 100%;
  max-width: 280px;
  align-items: center;
  border-radius: var(--radius-card);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.7);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--brand-body);
  opacity: 0.7;
  cursor: not-allowed;
}

.site-footer-bottom-bar {
  background: var(--brand-ink);
  color: #ffffff;
}

.site-footer-bottom-bar .page-container {
  padding-top: 24px;
  padding-bottom: 24px;
}

.site-footer-bottom-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

@media (min-width: 768px) {
  .site-footer-bottom-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    text-align: left;
  }

  .site-footer-bottom-brand { justify-self: start; }
  .site-footer-bottom-social { justify-self: center; }
  .site-footer-bottom-actions {
    justify-self: end;
    justify-content: flex-end;
  }
}

.site-footer-bottom-brand a {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer-bottom-brand a:hover { color: #ffffff; }

.site-footer-copyright {
  margin: 8px 0 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.site-footer-bottom-social {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.site-footer-social-link {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.site-footer-social-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.site-footer-social-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.site-footer-bottom-actions {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

@media (min-width: 640px) {
  .site-footer-bottom-actions {
    flex-direction: row;
    width: auto;
  }
}

.site-footer-locale-select {
  border-radius: var(--radius-card);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  font-size: 14px;
  color: #ffffff;
  font-family: var(--findspo-font);
}

.site-footer-locale-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.site-footer-contact-link {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer-contact-link:hover { color: #ffffff; }

/* Partners section */
.partners-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  margin-top: 48px;
}

@media (min-width: 768px) {
  .partners-grid { grid-template-columns: repeat(3, 1fr); }
}

.partner-card {
  display: flex;
  min-height: 144px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(224, 242, 254, 0.6);
  background: linear-gradient(to bottom, #ffffff, rgba(240, 249, 255, 0.25));
  padding: 24px;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 8px 30px -14px rgba(37, 99, 235, 0.16);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.partner-card:hover {
  transform: translateY(-2px);
  border-color: rgba(186, 230, 253, 0.8);
  box-shadow: 0 14px 36px -14px rgba(37, 99, 235, 0.24);
}

.partner-card img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 48px;
  object-fit: contain;
}

.partner-card--tall img { max-height: 56px; }

.legal-prose {
  max-width: 65ch;
  font-size: 15px;
  line-height: 1.65;
  color: var(--brand-body);
}

.legal-prose h1 {
  font-family: var(--findspo-header-font);
  color: var(--brand-ink);
  margin: 0 0 16px;
}

.legal-prose p {
  margin: 0 0 12px;
}

.legal-prose p:last-child {
  margin-bottom: 0;
}

.job-progress-panel {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--findspo-primary-border);
  border-radius: 12px;
  background: var(--findspo-primary-soft);
}

.job-progress-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.job-progress-title { margin: 0 0 4px; }

.job-progress-panel .hint { margin: 0; }

.spinner-sm {
  width: 24px;
  height: 24px;
  border-width: 2px;
  flex-shrink: 0;
  margin-top: 2px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--findspo-primary-border);
  border-top-color: var(--findspo-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.cookie-banner {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 999;
  border-top: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 16px;
  box-shadow: 0 -10px 30px rgba(17, 24, 39, 0.08);
}

@supports (background: color-mix(in srgb, white 80%, transparent)) {
  .cookie-banner {
    background: color-mix(in srgb, #ffffff 95%, transparent);
  }
}

.cookie-banner-inner {
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

@media (min-width: 768px) {
  .cookie-banner-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }
}

.cookie-banner p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted-foreground);
}

.cookie-banner a {
  color: var(--primary-500);
  font-weight: 500;
  text-decoration: none;
  text-underline-offset: 2px;
}

.cookie-banner a:hover {
  text-decoration: underline;
}

.cookie-banner.hidden { display: none; }

.cookie-banner-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 640px) {
  .layout {
    padding: 16px 16px 40px;
  }

  .panel {
    padding: 16px;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-head .btn {
    align-self: flex-start;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .site-footer-main .page-container {
    padding-top: 40px;
    padding-bottom: 40px;
  }

  .site-footer-contact-link {
    word-break: break-all;
  }

  .cookie-banner-actions .btn {
    flex: 1 1 auto;
  }

  @media (min-width: 480px) {
    .cookie-banner-actions .btn {
      flex: 0 0 auto;
    }
  }

  .partner-card {
    min-height: 120px;
  }

  .partners-legal-note {
    font-size: 12px;
  }
}

@media (min-width: 1024px) {
  .app-header-inner {
    grid-template-columns: 1fr auto 1fr;
    padding-right: 96px;
  }

  .header-brand {
    margin-left: 88px;
    grid-column: 1;
  }

  .header-nav--desktop {
    display: flex;
    gap: 24px;
    grid-column: 2;
    justify-self: center;
  }

  .header-toolbar {
    grid-column: 3;
    justify-self: end;
  }

  .header-nav-panel {
    display: none !important;
  }

  .header-menu-toggle {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .app-header-inner {
    grid-template-columns: 1fr auto;
    padding: 0 16px 0 0;
  }

  .header-logo-link,
  .header-logo {
    height: var(--header-height);
  }

  .header-brand {
    margin-left: 64px;
    padding-bottom: 0;
    grid-column: 1;
    align-items: center;
    align-self: center;
    min-height: var(--header-height);
  }

  .header-brand-text {
    display: block;
  }

  .brand-title-word {
    font-size: 20px;
  }

  .lang-switch--toolbar {
    display: none;
  }

  .header-toolbar {
    grid-column: 2;
    justify-self: end;
  }

  .header-menu-toggle {
    display: inline-flex;
  }

  .header-nav-panel {
    padding: 8px 16px 16px;
  }

  .header-nav-panel-footer {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
  }

  .lang-switch--mobile {
    justify-content: center;
    min-height: 44px;
    font-size: 14px;
  }

  .lang-switch--mobile .lang-switch-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
  }

  .header-nav--mobile .nav-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 15px;
    border-radius: var(--radius-card);
  }

  .header-nav--mobile .nav-link:hover,
  .header-nav--mobile .nav-link.is-active {
    background: var(--surface-muted);
  }
}

@media (max-width: 480px) {
  .header-brand {
    margin-left: 56px;
  }
}
