:root {
  --by-els-text: #17201a;
  --by-els-muted: #3f4d43;
  --by-els-surface: #ffffff;
  --by-els-surface-soft: #f3f8f2;
  --by-els-border: #789274;
  --by-els-heading: #123f20;
  --by-els-action: #145c2a;
  --by-els-action-hover: #0b421c;
  --by-els-focus: #005fcc;
  --by-els-warning-bg: #fff4c7;
  --by-els-warning-text: #3b2a00;
  --by-els-hit-bg: #ffe08a;
  --by-els-hit-text: #651000;
}

.by-els-wrapper {
  color-scheme: light;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  border: 2px solid var(--by-els-border);
  border-radius: 18px;
  background: var(--by-els-surface) !important;
  color: var(--by-els-text) !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

.by-els-wrapper *,
.by-els-wrapper *::before,
.by-els-wrapper *::after { box-sizing: border-box; }

.by-els-wrapper h2,
.by-els-wrapper h3 {
  color: var(--by-els-heading) !important;
  line-height: 1.25;
}

.by-els-wrapper p,
.by-els-wrapper li,
.by-els-wrapper dt,
.by-els-wrapper dd,
.by-els-wrapper label { color: var(--by-els-text) !important; }

.by-els-warning {
  margin: 18px 0;
  padding: 14px 18px;
  border: 2px solid #9a7200;
  border-inline-start-width: 6px;
  border-radius: 8px;
  background: var(--by-els-warning-bg) !important;
  color: var(--by-els-warning-text) !important;
  font-weight: 650;
}

.by-els-course,
.by-els-free-matrix {
  background: var(--by-els-surface-soft) !important;
  color: var(--by-els-text) !important;
}

.by-els-form { display: grid; gap: 16px; }
.by-els-form label { display: grid; gap: 7px; font-weight: 700; }

.by-els-wrapper textarea,
.by-els-wrapper select,
.by-els-wrapper input[type="text"],
.by-els-wrapper input[type="number"],
.by-els-wrapper input:not([type]) {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 2px solid #596e57 !important;
  border-radius: 8px;
  background: #ffffff !important;
  color: #101512 !important;
  -webkit-text-fill-color: #101512 !important;
  caret-color: #101512;
  font: inherit;
  opacity: 1 !important;
}

.by-els-wrapper select {
  min-height: 46px;
  padding: 10px 38px 10px 12px;
  border: 2px solid #596e57 !important;
  border-radius: 8px;
  background-color: #ffffff !important;
  color: #101512 !important;
  -webkit-text-fill-color: #101512 !important;
  font: inherit;
}

.by-els-wrapper textarea[dir="rtl"],
.by-els-wrapper input[dir="rtl"] {
  font-family: "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
  font-size: 25px;
  line-height: 1.7;
}

.by-els-wrapper input::placeholder,
.by-els-wrapper textarea::placeholder {
  color: #59625b !important;
  -webkit-text-fill-color: #59625b !important;
  opacity: 1;
}

.by-els-wrapper input:focus,
.by-els-wrapper textarea:focus,
.by-els-wrapper button:focus-visible {
  outline: 4px solid var(--by-els-focus) !important;
  outline-offset: 2px;
}

.by-els-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.by-els-check { display: flex !important; align-items: center; gap: 9px; }
.by-els-check input { width: 22px !important; height: 22px; accent-color: var(--by-els-action); }

.by-els-wrapper button {
  min-height: 46px;
  padding: 11px 18px !important;
  border: 2px solid #0b421c !important;
  border-radius: 8px !important;
  background: var(--by-els-action) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font: inherit;
  font-weight: 800 !important;
  line-height: 1.25;
  text-shadow: none !important;
  cursor: pointer;
  opacity: 1;
}

.by-els-wrapper button:hover { background: var(--by-els-action-hover) !important; color: #ffffff !important; }
.by-els-wrapper button:disabled { opacity: .58; cursor: wait; }
.by-els-wrapper button[hidden] { display: none !important; }

.by-els-status {
  margin: 22px 0 10px;
  color: #123f20 !important;
  font-size: 18px;
  font-weight: 800;
}

.by-els-result-card {
  margin: 16px 0;
  padding: 17px;
  border: 2px solid var(--by-els-border);
  border-radius: 13px;
  background: var(--by-els-surface-soft) !important;
  color: var(--by-els-text) !important;
}

.by-els-result-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; }
.by-els-result-card dt { font-weight: 800; }
.by-els-result-card dd { margin: 0; }

.by-els-context {
  padding: 12px;
  border: 2px dashed #557a50;
  border-radius: 8px;
  background: #ffffff !important;
  color: #101512 !important;
  font-family: "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
  font-size: 24px;
  line-height: 1.8;
}

.by-els-context strong,
.by-els-grid-hit {
  background: var(--by-els-hit-bg) !important;
  color: var(--by-els-hit-text) !important;
  -webkit-text-fill-color: var(--by-els-hit-text) !important;
  font-weight: 900 !important;
}

.by-els-grid-controls { display: flex; align-items: end; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.by-els-grid-controls label { display: grid; gap: 5px; font-weight: 700; }
.by-els-grid-controls input { width: 120px !important; }
.by-els-grid-panel { overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }

.by-els-grid-view {
  display: grid;
  grid-template-columns: repeat(var(--by-els-cols), 2.15rem);
  width: max-content;
  padding: 8px;
  border: 2px solid #52664f;
  background: #ffffff !important;
}

.by-els-grid-ltr { direction: ltr; }
.by-els-grid-rtl { direction: rtl; }

.by-els-grid-cell {
  direction: rtl;
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid #b7c2b5;
  background: #ffffff !important;
  color: #101512 !important;
  -webkit-text-fill-color: #101512 !important;
  font-family: "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
  font-size: 21px;
  font-weight: 650;
}

.by-els-grid-hit { outline: 3px solid #8b1705; outline-offset: -2px; z-index: 1; }

@media (max-width: 700px) {
  .by-els-wrapper { padding: 15px; font-size: 16px; }
  .by-els-fields { grid-template-columns: 1fr; }
  .by-els-result-card dl { grid-template-columns: 1fr; }
  .by-els-result-card dd { margin-bottom: 7px; }
  .by-els-grid-cell { width: 1.9rem; height: 1.9rem; font-size: 19px; }
  .by-els-grid-view { grid-template-columns: repeat(var(--by-els-cols), 1.9rem); }
}
