:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef4fb;
  --ink: #102033;
  --muted: #617388;
  --line: rgba(16, 32, 51, 0.1);
  --navy: #113b67;
  --blue: #1f6fb2;
  --teal: #0f8b8d;
  --gold: #c7922b;
  --shadow: 0 22px 60px rgba(17, 59, 103, 0.1);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --max-width: 1380px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  direction: rtl;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 178, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(199, 146, 43, 0.15), transparent 20%),
    linear-gradient(180deg, #f9fbfe 0%, var(--bg) 100%);
}

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

.page-shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.page-label,
.filters-panel,
.companies-panel {
  margin-bottom: 1rem;
}

.page-label,
.filters-panel,
.companies-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.page-label {
  padding: 1.4rem 1.5rem;
  text-align: right;
}

.page-label-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.page-title-block {
  min-width: 0;
}

.eyebrow,
.kpi-label,
.company-type,
.filter-title {
  margin: 0 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue);
}

h1,
.company-name {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 0.95;
}

.subtitle,
.results-summary,
.search-field span {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.subtitle {
  max-width: 64ch;
  margin-top: 0.8rem;
}

.page-cta-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  margin-top: 1.15rem;
}

.sheet-cta,
.email-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-inline-size: 2.9rem;
  block-size: 2.9rem;
  flex: 0 0 auto;
  padding: 0 0.9rem;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.sheet-cta {
  color: #ffffff;
  background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
  box-shadow: 0 16px 30px rgba(27, 94, 32, 0.2);
}

.sheet-cta.is-disabled {
  background: linear-gradient(135deg, #7f8ea0 0%, #97a7bb 100%);
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}

.email-cta {
  color: #ffffff;
  background: linear-gradient(135deg, #587089 0%, #72879d 100%);
  box-shadow: 0 16px 30px rgba(88, 112, 137, 0.18);
}

.sheet-cta svg,
.email-cta svg {
  inline-size: 1.15rem;
  block-size: 1.15rem;
}

.sheet-cta svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.email-cta svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sheet-cta span {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sheet-cta:hover,
.email-cta:hover {
  transform: translateY(-1px);
}

.sheet-cta:hover {
  box-shadow: 0 22px 42px rgba(27, 94, 32, 0.26);
}

.sheet-cta.is-disabled:hover {
  transform: none;
  box-shadow: none;
}

.email-cta:hover {
  box-shadow: 0 22px 42px rgba(88, 112, 137, 0.28);
}

.page-cta-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.page-stat-card {
  min-width: 168px;
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-soft) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
  text-align: center;
  flex: 0 0 auto;
}

.page-stat-card strong {
  display: block;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  line-height: 1;
}

.filters-panel,
.companies-panel {
  padding: 1.1rem;
}

.filters-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
}

.filters-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.filters-toolbar {
  display: flex;
  justify-content: flex-start;
}

.filters-toggle,
.filters-actions .ghost-button {
  white-space: nowrap;
}

.filters-collapsible {
  display: grid;
  gap: 1rem;
  margin-top: 0.2rem;
  grid-column: 1 / -1;
}

.filters-collapsible[hidden] {
  display: none !important;
}

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

.search-field {
  text-align: right;
}

.search-field input,
.ghost-button {
  min-height: 3.1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.search-field input {
  width: 100%;
  padding: 0.85rem 1rem;
  outline: none;
  text-align: right;
}

.search-field input:focus {
  border-color: rgba(31, 111, 178, 0.6);
  box-shadow: 0 0 0 4px rgba(31, 111, 178, 0.1);
}

.ghost-button,
.chip,
.primary-link,
.copy-button {
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.ghost-button,
.chip,
.copy-button {
  cursor: pointer;
}

.ghost-button,
.chip,
.copy-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.ghost-button:hover,
.chip:hover,
.primary-link:hover,
.copy-button:hover {
  transform: translateY(-1px);
}

.filter-group + .filter-group {
  margin-top: 1rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chip,
.primary-link,
.copy-button {
  border-radius: var(--radius-pill);
}

.chip {
  padding: 0.58rem 0.85rem;
}

.chip.is-active {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  color: #ffffff;
  border-color: transparent;
}

.companies-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
}

.company-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.95rem;
  min-height: 210px;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f3f8fd 100%);
  text-align: center;
}

.company-head {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 0.7rem;
  align-items: center;
}

.company-header-main {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.75rem;
  min-width: 0;
}

.company-name {
  display: grid;
  gap: 0.2rem;
  font-size: clamp(0.98rem, 1.65vw, 1.28rem);
  line-height: 1.06;
  max-width: none;
  text-wrap: balance;
  overflow-wrap: anywhere;
  justify-items: center;
}

.company-name-line {
  display: block;
}

.company-name-line--en {
  direction: ltr;
  text-align: center;
}

.company-name-line--ar {
  direction: rtl;
  text-align: center;
}

.company-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  padding: 0;
  background: #eef5ff;
  color: var(--navy);
  border-radius: 50%;
}

.company-type svg,
.primary-link svg,
.copy-button svg {
  inline-size: 1.2rem;
  block-size: 1.2rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.company-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  inline-size: 100%;
}

.primary-link,
.copy-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
}

.primary-link {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  color: #ffffff;
  border: 0;
}

.copy-button {
  inline-size: 3.5rem;
  block-size: 3.2rem;
  padding: 0;
}

.empty-state {
  padding: 2rem;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.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;
}

@media (max-width: 1024px) {
  .filters-top {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(calc(100% - 1rem), var(--max-width));
  }

  .filters-panel {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .page-label-top,
  .filters-top {
    grid-template-columns: 1fr;
  }

  .page-label-top {
    display: grid;
  }

  .page-stat-card {
    width: 100%;
  }

  .filters-toolbar {
    justify-content: stretch;
  }

  .filters-actions {
    justify-content: stretch;
  }

  .filters-actions .ghost-button,
  .filters-toolbar .ghost-button,
  .filters-toggle {
    width: 100%;
  }

  .companies-head,
  .company-head {
    flex-direction: column;
    align-items: stretch;
  }

  .company-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .company-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.85rem;
  }

  .primary-link {
    inline-size: 100%;
  }

  .page-cta-row {
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
  }

  .sheet-cta,
  .email-cta {
    justify-content: center;
    align-items: center;
  }

  .page-cta-note {
    width: 100%;
    text-align: center;
    font-size: 0.98rem;
  }

}
