/**
 * Public companies table — scoped styles.
 *
 * Everything lives under the `.iet` root so it never collides with the site's
 * Oxygen-built global styles. BEM with the `iet-` prefix; tokens mirror the
 * wizard palette (company-profiles.css). Deliberate out-of-scope selectors:
 * body.iet-scroll-lock (scroll lock), and .iet-filter-panel / .iet-drawer +
 * their subtrees and .iet-filter-backdrop — JS portals the panel and the
 * drawer to <body> at boot so their position: fixed geometry can't be trapped
 * by page-builder wrappers (overflow/transform/filter), which is why both
 * carry their own tokens.
 */

.iet,
.iet-filter-panel,
.iet-drawer {
  /* Design tokens — shared with the filter panel and the drawer, which both
     live at body level after the JS portal and would otherwise fall out of the
     .iet var scope. */
  --iet-ink: #1c1c1c; /* text, solid buttons, chips, current page */
  --iet-paper: #ffffff;
  --iet-border: #000; /* pill borders, table hairlines */
  --iet-muted: #8a8a8a; /* placeholders, secondary text, "+N" */
  --iet-link: #2743e0; /* Șterge tot / download links (design blue) */
  --iet-hover: #f9fafb; /* row hover */
  --iet-radius-card: 16px;
  --iet-radius-input: 24px; /* pill controls & buttons */
  --iet-row-h: 56px;
  --iet-drawer-w: 714px;
  --iet-table-border: #e0e1e1;

  color: var(--iet-ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  box-sizing: border-box;
}

.iet {
  width: 100%;
  margin: 0 auto;
}

.iet *,
.iet *::before,
.iet *::after,
.iet-filter-panel *,
.iet-filter-panel *::before,
.iet-filter-panel *::after {
  box-sizing: border-box;
}

/* The [hidden] attribute must win over the display rules below. */
.iet [hidden],
.iet-filter-panel[hidden],
.iet-filter-panel [hidden] {
  display: none !important;
}

.iet .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------ Actions row */

.iet-actions {
  position: relative;
  margin: 0;
}

.iet-actions__bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.iet-filter-toggle,
.iet-sort__select,
.iet-per-page__select {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  gap: 6px;
  border: 0.5px solid var(--iet-border);
  border-radius: var(--iet-radius-input);
  background: var(--iet-paper);
  color: var(--iet-ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.iet-filter-toggle:hover,
.iet-sort__select:hover,
.iet-per-page__select:hover {
  border-color: var(--iet-ink);
}

.iet-filter-toggle__icon {
  flex: none;
}

.iet-sort {
  display: inline-flex;
  align-items: center;
}

.iet-sort__label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.iet-sort__select,
.iet-per-page__select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' fill='none'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%231c1c1c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
}

.iet-clear-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--iet-link);
  font-size: 14px;
  text-decoration: none;
}

.iet-clear-all:hover {
  text-decoration: underline;
}

.iet-search {
  position: relative;
  margin-left: auto;
  width: min(320px, 100%);
}

.iet-search__input {
  width: 100%;
  height: 44px;
  padding: 0 48px 0 20px;
  border: 1px solid var(--iet-border);
  border-radius: var(--iet-radius-input);
  background: var(--iet-paper);
  color: var(--iet-ink);
  font: inherit;
  font-size: 14px;
}

.iet-search__input::placeholder {
  color: var(--iet-muted);
}

.iet-search__input:focus {
  outline: none;
  border-color: var(--iet-ink);
}

.iet-search__submit {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--iet-ink);
  cursor: pointer;
}

/* ----------------------------------------------------------- Filter panel */

/* Body-portaled by JS. Above 768px JS owns the geometry (top/bottom/left/
   width/max-height inline, computed from the toggle's viewport rect); the
   ≤768px media query owns the bottom sheet. No top/left defaults here. */
.iet-filter-panel {
  position: fixed;
  z-index: 10000; /* one value at all widths; above the drawer's 9999 */
  width: min(360px, calc(100vw - 32px));
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--iet-paper);
  border: 0.5px solid var(--iet-border);
  border-radius: var(--iet-radius-card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.iet-filter-panel__groups {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 24px;
}

.iet-filter-group + .iet-filter-group {
  border-top: 0.5px solid var(--iet-border);
}

.iet-filter-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 0;
  border: 0;
  background: none;
  color: var(--iet-ink);
  font: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 140%; /* 1.575rem */
  letter-spacing: -0.00563rem;
  text-align: left;
  cursor: pointer;
}

.iet-filter-group__chevron {
  flex: none;
  transition: transform 0.2s ease;
}

.iet-filter-group:not(.is-open) .iet-filter-group__chevron {
  transform: rotate(-90deg);
}

/* Inline option search — only groups above CompanyTableRenderer::SEARCH_MIN_OPTIONS
   render one. Sibling of __body, not a child: the body is the 200px scroller, so
   nesting the field would cost list height and need position: sticky. */
.iet-filter-search {
  position: relative;
  margin-bottom: 8px;
}

.iet-filter-group:not(.is-open) .iet-filter-search {
  display: none;
}

.iet-filter-search__input {
  width: 100%;
  height: 30px;
  /* Right pad clears the absolute ✕ (20px wide, 5px from the edge) so typed
     text can never run underneath it. */
  padding: 0 28px 0 12px;
  /* Not --iet-border (#000): a black pill here competes with the group titles
     and the checkboxes. The light table hairline reads as a secondary control. */
  border: 1px solid var(--iet-table-border);
  border-radius: var(--iet-radius-input);
  background: var(--iet-paper);
  color: var(--iet-ink);
  font: inherit;
  font-size: 13px;
}

.iet-filter-search__input::placeholder {
  color: var(--iet-muted);
}

.iet-filter-search__input:focus {
  outline: none;
  border-color: var(--iet-ink);
}

/* type=search draws its own ✕ in WebKit — we ship our own. */
.iet-filter-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.iet-filter-search__clear {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--iet-muted);
  cursor: pointer;
}

.iet-filter-search__clear:hover {
  color: var(--iet-ink);
}

.iet-filter-group__empty {
  margin: 0;
  padding: 8px 0;
  color: var(--iet-muted);
  font-size: 14px;
}

.iet-filter-group__body {
  max-height: 200px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 4px 16px 0;
}

.iet-filter-group:not(.is-open) .iet-filter-group__body {
  display: none;
}

.iet-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
}

.iet-check__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.iet-check__box {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1px solid var(--iet-border);
  border-radius: 5px;
  background: var(--iet-paper);
}

.iet-check__input:checked + .iet-check__box {
  border-color: var(--iet-ink);
  background-color: var(--iet-ink);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' fill='none'%3E%3Cpath d='M1 5l3.5 3.5L11 1' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.iet-check__input:focus-visible + .iet-check__box {
  outline: 2px solid var(--iet-ink);
  outline-offset: 2px;
}

.iet-check__label {
  font-size: 14px;
}

.iet-filter-panel__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-top: 0.5px solid var(--iet-border);
}

/* JS-created dimmer under the mobile sheet; inert (display: none) on desktop.
   Lives directly on <body> next to the portaled panel. */
.iet-filter-backdrop {
  display: none;
}

.iet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 28px;
  border-radius: var(--iet-radius-input);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.iet-btn--outline {
  border: 1px solid var(--iet-ink);
  background: var(--iet-paper);
  color: var(--iet-ink);
}

.iet-btn--solid {
  border: 1px solid var(--iet-ink);
  background: var(--iet-ink);
  color: var(--iet-paper);
}

.iet-btn--solid:hover,
.iet-btn--outline:hover {
  opacity: 0.85;
}

/* ------------------------------------------------------------------ Chips */

.iet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.iet-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--iet-ink);
  color: var(--iet-paper);
  text-decoration: none;
  font-size: 1rem;
  font-style: normal;
  font-weight: 400;
  line-height: 140%;
  letter-spacing: -0.005rem;
}

.iet-chip__field {
  color: #bcbcbc;
}

.iet-chip__value {
  color: white;
}

.iet-chip__x {
  display: inline-flex;
  padding: 4px;
  border-radius: 100px;
  background: var(--White, #fff);
  color: var(--iet-ink);
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.iet-chip:hover .iet-chip__x {
  background: black;
  color: white;
}

/* ------------------------------------------------------------------ Table */

.iet-table-wrap {
  margin-top: 24px;
  border: 0.5px solid var(--iet-table-border);
  border-radius: var(--iet-radius-card);
  overflow: hidden;
}

.iet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.iet-table__th {
  height: var(--iet-row-h);
  padding: 8px;
  border-bottom: 0.5px solid var(--iet-table-border);
  background: var(--iet-hover);
  color: var(--iet-ink);
  color: var(--Body-text, #3b3b3b);

  font-size: 0.875rem;
  font-weight: 700;
  line-height: 140%; /* 1.225rem */
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.iet-table__td {
  height: var(--iet-row-h);
  padding: 12px 8px;
  border-bottom: 0.5px solid var(--iet-table-border);
  vertical-align: middle;

  color: #3b3b3b;
  font-size: 0.875rem;
  font-style: normal;
  font-weight: 400;
  line-height: 140%;
}

.iet-table tbody tr:last-child .iet-table__td {
  border-bottom: 0;
}

.iet-table__td + .iet-table__td,
.iet-table__th + .iet-table__th {
  border-left: 0.5px solid var(--iet-table-border);
}

.iet-table__row {
  cursor: pointer;
}

.iet-table__row:hover,
.iet-table__row:focus-visible {
  background: var(--iet-hover);
}

.iet-table__row:focus-visible {
  outline: 2px solid var(--iet-ink);
  outline-offset: -2px;
}

.iet-table__link {
  font-size: 1rem;
  font-style: normal;
  font-weight: 700;
  line-height: 140%; /* 1.4rem */
  letter-spacing: -0.005rem;
  text-decoration: none;
  color: black;
}

.iet-table__link:hover {
  color: var(--iet-link);
}

.iet-table__none {
  color: var(--iet-muted);
}

.iet-tags__more {
  margin-left: 6px;
  color: var(--iet-muted);
  white-space: nowrap;
}

.iet-table__empty td {
  padding: 48px 16px;
  color: var(--iet-muted);
  text-align: center;
}

/* ------------------------------------------------------------- Pagination */

.iet-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}

.iet-per-page {
  margin: 0;
}

.iet-per-page__label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--iet-muted);
  font-size: 13px;
}

.iet-per-page__select {
  height: 36px;
  padding: 0 36px 0 14px;
  background-position: right 14px center;
}

.iet-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
}

.iet-pager__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--iet-ink);
  font-size: 14px;
  text-decoration: none;
}

.iet-pager__link:hover {
  background: var(--iet-hover);
}

.iet-pager__link.is-current {
  background: var(--iet-ink);
  color: var(--iet-paper);
}

.iet-pager__link.is-disabled {
  color: var(--iet-muted);
}

.iet-pager__gap {
  color: var(--iet-muted);
  padding: 0 4px;
}

/* ----------------------------------------------------------------- Drawer */

.iet-drawer {
  position: fixed;
  inset: 0;
  z-index: 10001; /* modal dialog — above the filter panel's 10000, both at body level */
}

.iet-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.iet-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(var(--iet-drawer-w), 100vw);
  overflow-y: auto;
  background: var(--iet-paper);
  border-radius: var(--iet-radius-card) 0 0 var(--iet-radius-card);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.1);
  padding: 64px 48px 48px;
}

.iet-drawer__close {
  position: absolute;
  top: 20px;
  right: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--iet-ink);
  cursor: pointer;
}

.iet-drawer__close:hover {
  background: var(--iet-hover);
}

.iet-drawer__loading {
  width: 36px;
  height: 36px;
  margin: 96px auto;
  border: 3px solid var(--iet-border);
  border-top-color: var(--iet-ink);
  border-radius: 50%;
  animation: iet-spin 0.7s linear infinite;
}

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

.iet-drawer__error {
  margin: 96px auto;
  max-width: 320px;
  color: var(--iet-muted);
  text-align: center;
}

/* Drawer scroll lock — deliberately outside the .iet scope. */
body.iet-scroll-lock {
  overflow: hidden;
}

/* ---------------------------------------------------------------- Profile */

.iet-profile__logo {
  display: block;
  max-width: 200px;
  max-height: 96px;
  width: auto;
  height: auto;
  margin-bottom: 24px;
}

.iet-profile__name {
  margin: 0 0 12px;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--iet-ink);
}

.iet-profile__desc {
  margin: 0 0 24px;
  color: var(--iet-ink);
  font-size: 14px;
}

.iet-profile__row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px 24px;
  padding: 14px 0;
  border-bottom: 1px solid #ececec;
}

.iet-profile__key {
  color: var(--iet-muted);
  font-size: 14px;
}

.iet-profile__value {
  font-size: 15px;
  overflow-wrap: anywhere; /* fiscal codes and social urls have no break points */
}

.iet-profile__link,
.iet-profile__download {
  color: var(--iet-ink);
  text-decoration: underline;
}

.iet-profile__download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--iet-link);
  font-weight: 600;
  text-decoration: none;
}

.iet-profile__download:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------- Responsive */

@media (max-width: 1100px) {
  .iet-table-wrap {
    overflow-x: auto;
  }

  /* Sized for the 4 current columns; retune if columns are added back. */
  .iet-table {
    min-width: 720px;
  }
}

@media (max-width: 768px) {
  .iet-actions__bar {
    flex-wrap: wrap;
  }

  .iet-search {
    order: 9;
    margin-left: 0;
    width: 100%;
  }

  /* CSS-owned bottom sheet. Only wins because JS clears its inline geometry
     (top/left/bottom/width/max-height) whenever this breakpoint matches. */
  .iet-filter-panel {
    top: auto;
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
    max-height: 75vh; /* fallback where dvh is unsupported */
    max-height: 75dvh; /* stays honest under the iOS dynamic URL bar */
  }

  .iet-filter-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9999; /* under the panel's 10000, same plane as the drawer */
    background: rgba(0, 0, 0, 0.4);
  }

  .iet-drawer__panel {
    width: 100vw;
    border-radius: 0;
    padding: 56px 20px 32px;
  }

  .iet-profile__row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .iet-profile__name {
    font-size: 26px;
  }

  .iet-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .iet-pager {
    flex-wrap: wrap;
  }
}
