/* Estimize site-wide search modal (command palette) */

:root {
  --ezs-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ezs-ink: #0f172a;
  --ezs-ink-soft: #64748b;
  --ezs-ink-faint: #94a3b8;
  --ezs-surface: #ffffff;
  --ezs-surface-2: #f6f8fb;
  --ezs-line: #e5e9f0;
  --ezs-accent: #2563eb;
  --ezs-accent-soft: rgba(37, 99, 235, 0.10);
  --ezs-accent-ink: #1d4ed8;
  --ezs-up: #15803d;
  --ezs-kpi: #7c3aed;
  --ezs-kpi-soft: rgba(124, 58, 237, 0.10);
  --ezs-econ: #0e7490;
  --ezs-econ-soft: rgba(14, 116, 144, 0.10);
  --ezs-user: #b45309;
  --ezs-user-soft: rgba(180, 83, 9, 0.12);
  --ezs-page: #475569;
  --ezs-page-soft: rgba(71, 85, 105, 0.10);
  --ezs-radius: 16px;
  --ezs-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(15, 23, 42, 0.06);
  --ezs-z: 100000;
}

.ezs,
.ezs * {
  box-sizing: border-box;
}

.ezs {
  position: fixed;
  inset: 0;
  z-index: var(--ezs-z);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
  font-family: var(--ezs-font);
  color: var(--ezs-ink);
  -webkit-font-smoothing: antialiased;
}

.ezs[hidden] {
  display: none !important;
}

.ezs__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  backdrop-filter: blur(6px) saturate(120%);
  animation: ezs-fade 140ms ease-out;
}

.ezs__panel {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--ezs-surface);
  border-radius: var(--ezs-radius);
  box-shadow: var(--ezs-shadow);
  overflow: hidden;
  animation: ezs-pop 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- search bar ---------- */

.ezs__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 14px 18px;
  border-bottom: 1px solid var(--ezs-line);
}

.ezs__icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--ezs-ink-faint);
}

.ezs__bar.is-loading .ezs__icon {
  color: var(--ezs-accent);
  animation: ezs-pulse 900ms ease-in-out infinite;
}

.ezs__input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 4px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ezs-ink);
  box-shadow: none;
  height: auto;
}

.ezs__input::placeholder {
  color: var(--ezs-ink-faint);
  font-weight: 400;
  font-style: normal;
  opacity: 1;
}

.ezs__input:focus {
  border: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
}

.ezs__input::-webkit-search-cancel-button,
.ezs__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.ezs__clear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--ezs-surface-2);
  color: var(--ezs-ink-soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.ezs__clear:hover {
  background: var(--ezs-line);
  color: var(--ezs-ink);
}

.ezs__clear[hidden] {
  display: none;
}

.ezs kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--ezs-line);
  border-bottom-width: 2px;
  background: var(--ezs-surface-2);
  color: var(--ezs-ink-soft);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.ezs__esc {
  flex: 0 0 auto;
  cursor: pointer;
}

.ezs__cancel {
  display: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--ezs-accent-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- results ---------- */

.ezs__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.ezs__group + .ezs__group {
  margin-top: 6px;
}

.ezs__group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ezs-ink-faint);
}

.ezs__group-count {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.ezs__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  outline: none;
}

.ezs__item:hover {
  text-decoration: none;
  color: inherit;
}

.ezs__item.is-active {
  background: var(--ezs-accent-soft);
}

.ezs__item.is-active .ezs__title {
  color: var(--ezs-accent-ink);
}

.ezs__badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--ezs-page-soft);
  color: var(--ezs-page);
}

.ezs__badge svg {
  width: 18px;
  height: 18px;
}

.ezs__badge--instrument {
  background: var(--ezs-accent-soft);
  color: var(--ezs-accent-ink);
  font-size: 12px;
}

.ezs__badge--instrument.is-long {
  font-size: 10px;
}

.ezs__badge--kpi {
  background: var(--ezs-kpi-soft);
  color: var(--ezs-kpi);
}

.ezs__badge--economic_indicator {
  background: var(--ezs-econ-soft);
  color: var(--ezs-econ);
}

.ezs__badge--user {
  background: var(--ezs-user-soft);
  color: var(--ezs-user);
  border-radius: 50%;
  font-size: 13px;
}

.ezs__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ezs__title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ezs-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ezs__subtitle {
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--ezs-ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ezs__item mark {
  background: transparent;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(37, 99, 235, 0.45);
  text-underline-offset: 2px;
}

.ezs__meta {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--ezs-ink-faint);
  white-space: nowrap;
}

.ezs__item.is-active .ezs__meta {
  color: var(--ezs-accent-ink);
}

.ezs__enter {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--ezs-accent-ink);
}

.ezs__item.is-active .ezs__enter {
  display: inline-flex;
}

/* ---------- empty / status ---------- */

.ezs__status {
  padding: 36px 20px;
  text-align: center;
  color: var(--ezs-ink-soft);
  font-size: 14px;
}

.ezs__status strong {
  color: var(--ezs-ink);
  font-weight: 600;
}

.ezs__status-hint {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ezs-ink-faint);
}

.ezs__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.ezs__chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--ezs-line);
  background: var(--ezs-surface-2);
  color: var(--ezs-ink-soft);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.ezs__chip:hover {
  border-color: var(--ezs-accent);
  color: var(--ezs-accent-ink);
}

/* ---------- footer ---------- */

.ezs__foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--ezs-line);
  background: var(--ezs-surface-2);
  font-size: 12px;
  color: var(--ezs-ink-soft);
}

.ezs__foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ezs__foot-brand {
  margin-left: auto;
  font-weight: 600;
  color: var(--ezs-ink-faint);
  letter-spacing: 0.02em;
}

/* ---------- triggers (optional shared look) ---------- */

.ezs-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: text;
  white-space: nowrap;
}

.ezs-trigger svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

.ezs-trigger kbd {
  margin-left: 6px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  opacity: 0.8;
}

.ezs-trigger__label {
  opacity: 0.85;
}

/* ---------- motion ---------- */

@keyframes ezs-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ezs-pop {
  from { opacity: 0; transform: translateY(-8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ezs-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .ezs__backdrop,
  .ezs__panel,
  .ezs__bar.is-loading .ezs__icon {
    animation: none;
  }
}

/* ---------- mobile ---------- */

@media (max-width: 640px) {
  .ezs {
    padding: 0;
    align-items: stretch;
  }

  .ezs__panel {
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
  }

  .ezs__bar {
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }

  .ezs__input {
    font-size: 17px; /* >= 16px prevents iOS zoom */
  }

  .ezs .ezs__esc {
    display: none;
  }

  .ezs .ezs__cancel {
    display: inline-flex;
  }

  .ezs__meta {
    display: none;
  }

  .ezs__foot {
    display: none;
  }

  .ezs__item {
    padding: 11px 10px;
  }
}

body.ezs-open {
  overflow: hidden;
}
