:root {
  --brand-blue-50: #eef4ff;
  --brand-blue-100: #dce8ff;
  --brand-blue-200: #c4d4ff;
  --brand-blue-500: #4d65ff;
  --brand-blue-700: #3142c7;
  --brand-orange-100: #ffedd5;
  --brand-orange-500: #f97316;
  --brand-teal-100: #dff7f1;
  --surface-page: #ffffff;
  --surface-card: rgba(255, 255, 255, 0.94);
  --surface-subtle: #f7f9fc;
  --surface-strong: #eef3ff;
  --border-light: #e2e8f0;
  --border-strong: #c7d4ff;
  --text-primary: #18212f;
  --text-secondary: #526175;
  --text-muted: #7d8a9a;
  --success: #0f9f68;
  --neutral: #3157c7;
  --danger: #c2410c;
  --shadow-card: 0 18px 42px rgba(24, 33, 47, 0.08);
  --shadow-soft: 0 8px 24px rgba(77, 101, 255, 0.1);
  --shadow-chat: 0 24px 56px rgba(24, 33, 47, 0.16);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;

  /* Spacing Scale (8px base) */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */

  /* Border Radius Extensions */
  --radius-xl: 16px;
  --radius-2xl: 24px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html[lang="he"] body {
  font-family: "Heebo", "Manrope", sans-serif;
}

body {
  margin: 0;
  font-family: "Manrope", "Heebo", sans-serif;
  color: var(--text-primary);
  background:
    radial-gradient(circle at top right, rgba(77, 101, 255, 0.08), transparent 20%),
    radial-gradient(circle at bottom left, rgba(15, 159, 104, 0.06), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(14px);
}

.brand-row,
.brand-block,
.brand,
.header-actions,
.header-nav,
.hero-controls,
.country-tabs,
.section-head-actions,
.detail-badges,
.explorer-actions,
.pagination-row {
  display: flex;
  align-items: center;
}

.brand-row,
.header-actions,
.header-nav,
.country-tabs,
.section-head-actions,
.detail-badges,
.pagination-row {
  gap: 12px;
}

.brand-row {
  justify-content: space-between;
  padding-block: 18px;
}

.brand-block {
  flex: 1 1 auto;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  gap: 16px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--brand-blue-700);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand h1,
.hero h2,
.section-head h3 {
  margin: 0;
}

.subtitle,
.section-subtext,
.chart-meta,
.results-meta,
.footer-grid,
.hero-text {
  color: var(--text-secondary);
}

.subtitle {
  margin: 4px 0 0;
}

.header-nav {
  flex-wrap: wrap;
}

.header-nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-weight: 700;
}

.header-nav a:hover {
  background: var(--surface-subtle);
}

.header-pill,
.detail-badge,
.network-chip {
  border-radius: 999px;
  font-weight: 700;
}

.header-pill {
  padding: 10px 14px;
  background: var(--brand-blue-50);
  border: 1px solid var(--brand-blue-200);
  color: var(--brand-blue-700);
}

.lang-toggle {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: #fff;
}

.lang-button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.lang-button.active {
  background: linear-gradient(135deg, var(--brand-blue-500), var(--brand-blue-700));
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.page {
  padding-block: 28px 56px;
}

.card {
  background: var(--surface-card);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.hero,
.section-card {
  padding: 24px;
}

.hero {
  display: grid;
  gap: 22px;
}

.hero-copy {
  max-width: 860px;
}

.hero h2 {
  font-size: clamp(2rem, 2vw + 1rem, 3.3rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.hero-text {
  margin: 14px 0 0;
  max-width: 780px;
  font-size: 1.03rem;
}

.country-tab,
.toggle,
.primary-button,
.secondary-button,
.sort-button,
.chat-launcher,
.icon-button {
  transition: 160ms ease;
}

.country-tabs {
  flex-wrap: wrap;
}

.country-tab {
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
}

.country-tab.active {
  background: linear-gradient(135deg, var(--brand-blue-500), var(--brand-blue-700));
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.stats-grid,
.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-tile,
.insight-tile,
.detail-copy {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.stat-tile,
.insight-tile {
  padding: 16px;
}

.detail-copy {
  padding: 14px;
}

.stat-label,
.insight-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value,
.insight-value {
  margin-top: 10px;
  font-size: clamp(1.45rem, 1.2vw + 1rem, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-subtext,
.insight-subtext {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.section-card {
  margin-top: 20px;
  min-width: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-subtext {
  margin: 8px 0 0;
}

.section-head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.control,
.checkbox-control {
  display: grid;
  gap: 8px;
}

.control {
  color: var(--text-secondary);
  font-weight: 700;
}

.control input,
.control select,
.chat-form textarea {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  color: var(--text-primary);
}

.control input:focus,
.control select:focus,
.chat-form textarea:focus {
  outline: 2px solid rgba(77, 101, 255, 0.18);
  border-color: var(--brand-blue-500);
}

.control-wide {
  min-width: min(360px, 56vw);
}

.toggle-group {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  background: var(--surface-subtle);
  border-radius: 999px;
}

.toggle,
.sort-button,
.secondary-button,
.primary-button,
.chat-launcher,
.icon-button {
  border: 0;
}

.toggle {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.toggle.active {
  background: #fff;
  color: var(--brand-blue-700);
  box-shadow: 0 6px 18px rgba(24, 33, 47, 0.08);
}

.chart-frame {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  min-height: 340px;
}

.chart-frame.compact {
  min-height: 300px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.table-wrap.compact {
  max-height: 360px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  text-align: start;
  white-space: nowrap;
}

.data-table thead th {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 800;
}

.data-table tbody tr:hover {
  background: rgba(77, 101, 255, 0.04);
}

.data-table tbody tr.is-selected {
  background: rgba(77, 101, 255, 0.08);
}

.data-table tbody tr[data-cascade-table] {
  cursor: pointer;
}

.network-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-strong);
  color: var(--brand-blue-700);
}

.network-chip-button,
.detail-badge-button,
.table-link {
  border: 0;
}

.network-chip.big4 {
  background: linear-gradient(135deg, var(--brand-blue-500), var(--brand-blue-700));
  color: #fff;
}

.network-chip-button:hover,
.network-chip-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.checkbox-control {
  align-content: end;
  color: var(--text-secondary);
  font-weight: 700;
}

.checkbox-control input {
  margin: 0;
}

.explorer-actions {
  display: flex;
  gap: 10px;
}

.secondary-button,
.primary-button {
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 800;
}

.secondary-button {
  background: var(--surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.primary-button {
  background: linear-gradient(135deg, var(--brand-blue-500), var(--brand-blue-700));
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.sort-button {
  background: transparent;
  color: var(--text-secondary);
  font-weight: 800;
  padding: 0;
}

.sort-button.active {
  color: var(--brand-blue-700);
}

.results-meta,
.pagination-label {
  font-size: 0.92rem;
}

.pagination-row {
  justify-content: space-between;
  margin-top: 16px;
}

.detail-card {
  padding-bottom: 24px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 20px;
}

.firm-detail-grid,
.firm-lists-grid,
.movement-grid {
  display: grid;
  gap: 20px;
}

.firm-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}

.firm-lists-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
  align-items: start;
}

.movement-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.movement-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 16px;
  align-self: start;
}

.movement-head {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.movement-list,
.variant-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.cascade-row td {
  padding: 0;
  border-bottom: 0;
}

.cascade-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border-top: 1px solid var(--border-light);
}

.cascade-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cascade-meta {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 700;
}

.cascade-table-wrap {
  max-width: 100%;
}

.cascade-table {
  min-width: 640px;
}

.cascade-show-all {
  padding: 8px 12px;
}

.movement-item {
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

.movement-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.firm-stats-grid {
  margin-top: 6px;
}

.findings-panel {
  padding: 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at top right, rgba(77, 101, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #fafdff 0%, #f2f6ff 100%);
}

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

.finding-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-light);
}

.finding-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.finding-text {
  color: var(--text-primary);
  line-height: 1.5;
}

.severity-positive .finding-badge {
  background: rgba(15, 159, 104, 0.12);
  color: var(--success);
}

.severity-neutral .finding-badge {
  background: rgba(49, 87, 199, 0.12);
  color: var(--neutral);
}

.severity-negative .finding-badge {
  background: rgba(194, 65, 12, 0.12);
  color: var(--danger);
}

.variant-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font-weight: 700;
}

.detail-badge {
  padding: 8px 12px;
  background: var(--brand-orange-100);
  color: #9a3412;
}

.table-link {
  padding: 0;
  background: transparent;
  color: var(--brand-blue-700);
  font-weight: 800;
  text-align: start;
}

.table-link:hover,
.table-link:focus-visible {
  text-decoration: underline;
}

.detail-panel,
.detail-summary {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.detail-copy {
  color: var(--text-secondary);
}

.muted {
  color: var(--text-muted);
}

.positive {
  color: var(--success);
}

.negative {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.app-footer {
  border-top: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.86);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  padding-block: 24px 36px;
}

.footer-grid p {
  margin: 8px 0 0;
}

.chat-widget {
  position: fixed;
  inset-block-end: 24px;
  inset-inline-end: 24px;
  z-index: 40;
  display: grid;
  justify-items: end;
  gap: 12px;
}

.chat-launcher {
  padding: 14px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-blue-500), var(--brand-blue-700));
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow-chat);
}

.chat-panel {
  width: min(420px, calc(100vw - 24px));
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 22px;
  box-shadow: var(--shadow-chat);
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, #fbfdff 0%, #f2f6ff 100%);
}

.chat-header p {
  margin: 6px 0 0;
  color: var(--text-secondary);
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 1.2rem;
}

.chat-messages {
  display: grid;
  gap: 12px;
  max-height: 440px;
  overflow: auto;
  padding: 16px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 249, 252, 0.98) 100%);
}

.chat-message {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 18px;
  white-space: pre-wrap;
  unicode-bidi: plaintext;
  line-height: 1.45;
}

.chat-message.assistant {
  justify-self: start;
  background: var(--surface-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.chat-message.user {
  justify-self: end;
  background: linear-gradient(135deg, var(--brand-blue-500), var(--brand-blue-700));
  color: #fff;
}

.chat-form {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--border-light);
  background: #fff;
}

.chat-form textarea {
  resize: vertical;
  min-height: 84px;
}

html[dir="rtl"] .brand-row,
html[dir="rtl"] .brand-block,
html[dir="rtl"] .brand,
html[dir="rtl"] .header-actions,
html[dir="rtl"] .chat-header,
html[dir="rtl"] .pagination-row {
  flex-direction: row-reverse;
}

html[dir="rtl"] .chat-widget {
  inset-inline-end: auto;
  inset-inline-start: 24px;
}

html[dir="rtl"] .chat-panel,
html[dir="rtl"] .chat-message.assistant,
html[dir="rtl"] .chat-message.user {
  direction: rtl;
}

.freemium-quota-bar {
  position: sticky;
  top: 0;
  z-index: 45;
  border-bottom: 1px solid rgba(77, 101, 255, 0.18);
  background: rgba(239, 243, 255, 0.96);
  backdrop-filter: blur(10px);
}

.freemium-quota-inner {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
}

.freemium-quota-action {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  background: var(--brand-blue-600);
  color: #fff;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.freemium-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.freemium-modal {
  position: relative;
  width: min(100%, 460px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 28px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.freemium-modal h2 {
  margin: 4px 0 10px;
}

.freemium-modal form {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.freemium-modal-close {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-end: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: all 150ms ease;
}

.freemium-modal-close:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
}

.freemium-form-error {
  min-height: 20px;
  color: #b42318;
  font-size: 0.84rem;
}

html[dir="rtl"] .freemium-quota-inner {
  flex-direction: row-reverse;
}

@media (max-width: 1180px) {
  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .layout-grid,
  .detail-grid,
  .firm-detail-grid,
  .firm-lists-grid,
  .movement-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

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

  .brand-row,
  .brand-block,
  .header-actions,
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  html[dir="rtl"] .brand-row,
  html[dir="rtl"] .brand-block,
  html[dir="rtl"] .header-actions,
  html[dir="rtl"] .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1440px);
  }

  .page {
    padding-top: 14px;
  }

  .hero,
  .section-card {
    padding: 18px;
  }

  .stats-grid,
  .insight-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .toggle-group,
  .section-head-actions {
    width: 100%;
  }

  .toggle-group {
    flex-wrap: wrap;
  }

  .control-wide {
    min-width: 100%;
  }

  .country-tabs {
    width: 100%;
  }

  .country-tab {
    flex: 1 1 0;
    text-align: center;
  }

  .cascade-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .finding-item {
    grid-template-columns: 1fr;
  }

  .chart-frame {
    min-height: 280px;
  }

  .chat-panel {
    width: min(100vw - 20px, 420px);
  }

  .freemium-quota-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-block: 10px;
  }

  html[dir="rtl"] .freemium-quota-inner {
    flex-direction: column;
  }
}
