:root {
  --bg: #0c1937;
  --panel: #f4f8ff;
  --panel-alt: #e4edfa;
  --card: #f4f8ff;
  --brand: #4b78ad;
  --brand-dark: #17345f;
  --brand-soft: #d7e5f7;
  --text: #152746;
  --muted: #60728f;
  --line: #c6d4e8;
  --success: #32727f;
  --warning: #a77a3c;
  --shadow: 0 22px 55px rgba(3, 13, 35, 0.22);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Heebo', 'Inter', sans-serif;
  direction: rtl;
  background:
    linear-gradient(135deg, #1a3560 0%, #10234a 48%, #09152f 100%);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.1rem 1rem 2.5rem;
}

.topbar {
  padding: 0.9rem 0 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  direction: rtl;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 7px;
  object-fit: contain;
  box-sizing: border-box;
  border-radius: 14px;
  background: #d7e5f7;
  box-shadow: 0 8px 20px rgba(5, 18, 45, 0.28);
}

.topbar h1 {
  color: #f1f6ff;
}

.topbar .eyebrow {
  color: #bdcce2;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.1;
}

.card {
  background: rgba(244, 248, 255, 0.97);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(190, 210, 238, 0.78);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.card.results-mode {
  background: transparent;
  backdrop-filter: none;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.results-mode .results-export {
  padding: 20px;
  background: transparent;
  overflow: visible;
}

.results-mode .results-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.results-mode #share-results-button {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #d0def5, #a9c1e9);
  color: #102047;
}

.results-mode #share-results-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.results-mode #suggest-yeshiva-button,
.results-mode .reset-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(208, 222, 245, 0.35);
  color: #e6eefb;
}

.results-mode .reset-button {
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 520px) {
  .results-mode .results-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.progress-wrap {
  margin-bottom: 1rem;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #dce7f5;
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0 0 0 auto;
  width: 0%;
  background: linear-gradient(90deg, #2f5c99, #78a1d4);
  border-radius: inherit;
  transition: width 260ms ease;
}

.question-panel {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  min-height: 410px;
  animation: fadeUp 0.32s ease;
}

.rating-scale-helper {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  direction: ltr;
  color: var(--muted);
  font-size: 0.78rem;
}

.option-grid.rating-option-grid {
  width: min(100%, 22rem);
  margin-inline: auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
}

.rating-option-grid .option-button {
  text-align: center;
  direction: ltr;
}

.rating-option-grid .option-button strong {
  text-align: center;
  font-size: 1.2rem;
}

.option-grid.category-option-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  direction: rtl;
}

.study-slider {
  display: grid;
  gap: 1.15rem;
  width: min(100%, 45rem);
  margin-inline: auto;
  direction: ltr;
}

.study-slider input {
  appearance: none;
  width: 100%;
  height: 10px;
  margin: 0;
  border-radius: 999px;
  background: #c6d9ef;
  cursor: pointer;
}

.study-slider input::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 2px 6px rgba(19, 52, 95, 0.3);
}

.study-slider input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 2px 6px rgba(19, 52, 95, 0.3);
}

.study-slider input:focus-visible {
  outline: 2px solid var(--brand-dark);
  outline-offset: 6px;
}

.study-slider output {
  text-align: center;
  color: var(--brand-dark);
  font-size: 1.35rem;
  font-weight: 700;
}

.parameter-weight-field select {
  max-width: 10rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #f8fbff;
}

.rating-transition-panel {
  min-height: 410px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  animation: fadeUp 0.32s ease;
}

.rating-transition-panel h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  color: var(--brand-dark);
}

.rating-transition-panel > p:not(.eyebrow) {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.rating-transition-art {
  position: relative;
  width: 110px;
  height: 100px;
  display: grid;
  place-items: center;
  color: var(--brand);
}

.rating-ruler {
  width: 68px;
  height: 68px;
  overflow: visible;
  animation: rating-ruler-sway 1.8s ease-in-out infinite;
}

@keyframes rating-ruler-sway {
  0%, 100% { transform: rotate(-7deg); }
  50% { transform: rotate(7deg); }
}

@media (prefers-reduced-motion: reduce) {
  .rating-transition-panel,
  .rating-ruler {
    animation: none;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.question-heading {
  margin: 0;
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  line-height: 1.25;
  text-align: right;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  direction: ltr;
}

.option-button {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 0.9rem 0.95rem;
  text-align: right;
  direction: rtl;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.option-button:hover,
.option-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(64, 112, 172, 0.65);
  box-shadow: 0 10px 22px rgba(28, 62, 107, 0.14);
}

.option-button.selected {
  background: linear-gradient(180deg, #d9e7f8, #f6f9ff);
  border-color: rgba(64, 112, 172, 0.68);
  box-shadow: inset 0 0 0 1px rgba(52, 94, 146, 0.12);
}

.option-button strong {
  display: block;
  font-size: 1rem;
  line-height: 1.45;
  text-align: right;
}

.controls {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
}

.nav-button {
  border: none;
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.nav-button svg,
.secondary-action-button svg,
.share-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.nav-button svg,
.secondary-action-button svg,
.share-button svg {
  margin-inline-end: 0.45rem;
}

.nav-button:hover,
.nav-button:focus-visible {
  transform: translateY(-1px);
}

.nav-button.secondary {
  background: #dce8f8;
  color: var(--brand-dark);
}

.nav-button.primary {
  background: linear-gradient(135deg, #244c80, #4f80b4);
  color: white;
  box-shadow: 0 12px 20px rgba(19, 52, 95, 0.22);
}

.nav-button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.results-panel {
  animation: fadeUp 0.32s ease;
}

.results-export {
  display: grid;
  gap: 0.7rem;
  overflow: hidden;
  padding: clamp(1rem, 4vw, 1.5rem);
  border-radius: 16px;
  background: #102047;
}

.top-three {
  display: grid;
  gap: 0.7rem;
}

.result-card {
  --row-width: 100%;
  display: grid;
  grid-template-columns: 2.3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  width: var(--row-width);
  min-height: 82px;
  margin-left: auto;
  padding: 0.9rem 1rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(100deg, #4c78a8, #315c8d);
  color: #fff;
  text-align: right;
  direction: rtl;
}

.result-card.rank-1 {
  --row-width: 100%;
  background: linear-gradient(100deg, #d0def5, #a9c1e9);
  color: #102047;
}

.result-card.rank-2 {
  background: linear-gradient(100deg, #8eabce, #6d8ebb);
  color: #102047;
}

.result-rank {
  display: grid;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.result-main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.result-main h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.15rem;
}

.result-area {
  font-size: 0.78rem;
  opacity: 0.82;
}

.result-percentage {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.results-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

.reset-button,
.secondary-action-button {
  flex: 1;
  border: none;
  border-radius: 14px;
  background: #dce8f8;
  color: var(--brand-dark);
  padding: 0.9rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.welcome-panel {
  position: relative;
  isolation: isolate;
  max-width: 680px;
  min-height: 410px;
  margin: 0 auto;
  padding: clamp(1.2rem, 5vw, 3.2rem) 0.4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  animation: fadeUp 0.4s ease;
}

.welcome-kicker {
  position: relative;
  z-index: 1;
  color: var(--brand-dark);
  font-weight: 700;
  margin-bottom: 1rem;
}

.welcome-panel h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.6rem);
  line-height: 1.2;
  color: #17345f;
}

.welcome-panel > p {
  position: relative;
  z-index: 1;
  max-width: 560px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.8;
  margin: 1rem 0 1.5rem;
}

.area-preference-control {
  display: grid;
  gap: 0.4rem;
  width: min(100%, 320px);
  margin-bottom: 1rem;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
}

fieldset.area-preference-control {
  min-width: 0;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.area-preference-control legend {
  padding: 0;
  margin-bottom: 0.5rem;
}

.area-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.area-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
  font-weight: 600;
  cursor: pointer;
}

.area-option:has(input:checked) {
  border-color: #4b78ad;
  background: #d7e5f7;
}

.area-preference-control select,
.editor-fields select {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fbff;
  color: var(--text);
  font: inherit;
}

.welcome-actions,
.admin-login-actions,
.modal-actions,
.admin-actions,
.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.start-button {
  min-width: 150px;
}

.welcome-actions {
  position: relative;
  z-index: 1;
}

.admin-entry,
.text-link {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration-color: rgba(42, 84, 137, 0.4);
  text-underline-offset: 4px;
}

.admin-entry {
  margin-top: 2rem;
  font-size: 0.85rem;
}

.share-button {
  border: 0;
}

.notice {
  position: fixed;
  z-index: 30;
  right: 50%;
  bottom: 1.2rem;
  transform: translateX(50%);
  max-width: calc(100% - 2rem);
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.results-actions {
  flex-wrap: wrap;
}

.results-actions > button {
  min-width: min(100%, 180px);
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 15, 36, 0.64);
  animation: fadeUp 0.18s ease;
}

.feedback-modal {
  width: min(100%, 760px);
  max-height: min(90vh, 900px);
  overflow-y: auto;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-heading,
.request-heading,
.section-heading,
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.modal-heading h2,
.admin-login h2,
.admin-header h2 {
  margin: 0.25rem 0 0;
}

.icon-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-intro,
.local-save-note,
.security-note {
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.9rem;
}

.feedback-fields,
.feedback-question-list {
  display: grid;
  gap: 0.85rem;
}

.feedback-fields label,
.admin-login label,
.admin-editor label {
  display: grid;
  gap: 0.4rem;
  font-weight: 700;
}

.feedback-fields input,
.feedback-fields select,
.feedback-fields textarea,
.admin-login input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: #fffefa;
}

.yeshiva-name-field {
  position: relative;
  display: grid;
  gap: 0.4rem;
  font-weight: 700;
}

.feedback-fields .yeshiva-name-field {
  grid-column: 1 / -1;
}

.yeshiva-suggestions {
  position: absolute;
  z-index: 5;
  top: calc(100% - 0.25rem);
  inset-inline: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.yeshiva-suggestion {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 0;
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  text-align: start;
  cursor: pointer;
}

.yeshiva-suggestion:hover,
.yeshiva-suggestion:focus-visible {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.suggestion-empty,
.field-validation {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}

.suggestion-empty {
  padding: 0.55rem 0.7rem;
}

.field-validation.invalid {
  color: #9d382f;
}

.modal-actions button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.feedback-fields textarea {
  resize: vertical;
}

.feedback-question-list {
  margin-top: 1rem;
}

.feedback-question {
  min-width: 0;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.feedback-question legend {
  padding: 0 0.35rem;
  font-weight: 700;
  line-height: 1.55;
}

.feedback-options {
  display: grid;
  gap: 0.5rem;
}

.feedback-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  color: var(--muted);
  line-height: 1.5;
  cursor: pointer;
}

.feedback-option input {
  margin-top: 0.3rem;
  accent-color: var(--brand);
}

.modal-actions {
  justify-content: flex-start;
  margin-top: 1rem;
}

.feedback-success {
  text-align: center;
}

.success-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 0.8rem;
  border-radius: 50%;
  color: #fff;
  background: var(--success);
  font-size: 1.4rem;
}

.admin-login {
  --muted: #425674;
  max-width: 480px;
  min-height: 380px;
  margin: 0 auto;
  padding: 2rem 0.3rem;
}

.admin-login form {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.admin-login-actions {
  justify-content: space-between;
  margin-top: 0.5rem;
}

.form-error,
.admin-message {
  padding: 0.7rem;
  border-radius: 10px;
  color: #8f332b;
  background: #f9e7e0;
}

.admin-panel {
  --muted: #425674;
  animation: fadeUp 0.3s ease;
}

.admin-user-label {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.editor-list,
.option-editor-list {
  display: grid;
  gap: 0.9rem;
}

.admin-question-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffefa;
  box-shadow: 0 5px 16px rgba(83, 59, 35, 0.05);
}

.editor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.editor-card-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.editor-fields label,
.admin-option-card label,
.weight-row label {
  display: grid;
  gap: 0.35rem;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}

.editor-fields input,
.editor-fields textarea,
.admin-option-card input,
.weight-row input {
  width: 100%;
  min-width: 0;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: #fffefa;
}

.editor-fields textarea {
  resize: vertical;
}

.wide-field {
  grid-column: 1 / -1;
}

.admin-option-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 0.7rem;
  padding: 0.85rem;
  border: 1px solid #eee2d3;
  border-radius: 10px;
  background: #fcf7ef;
}

.admin-option-card label:nth-child(3) {
  grid-column: 1 / -1;
}

.parameter-checkboxes {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.parameter-checkboxes legend {
  padding-inline: 0.3rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.parameter-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.admin-option-card .parameter-checkbox-list label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  background: #f5ede2;
  font-size: 0.76rem;
}

.parameter-checkbox-list input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

.admin-option-card .text-button {
  justify-self: start;
}

.add-option-button,
.remove-yeshiva-button {
  margin-top: 0.8rem;
}

.yeshiva-editor {
  padding: 0.3rem 0.9rem 1rem;
}

.profile-weights {
  margin-top: 1.1rem;
}

.profile-weights h4 {
  margin: 0;
}

.weight-list {
  display: grid;
  gap: 0;
  margin-top: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: visible;
  background: var(--panel);
}

.weight-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.weight-row:last-child {
  border-bottom: 0;
}

.parameter-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.parameter-name {
  font-weight: 700;
}

.parameter-subtext {
  font-size: 0.74rem;
  color: #718096;
  line-height: 1.4;
}

.parameter-weight {
  width: 4.6rem;
  min-width: 3.2rem;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fffefa;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.parameter-weight:focus-visible {
  outline: 2px solid rgba(169, 79, 55, 0.42);
  outline-offset: 1px;
}

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

.parameter-change {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.parameter-change.positive {
  color: #24633c;
  border-color: #b7d8c0;
  background: #e1f2e5;
}

.parameter-change.negative {
  color: #9d382f;
  border-color: #e7c0b8;
  background: #f9e4df;
}

.parameter-change.neutral {
  color: #6b5d4d;
  border-color: var(--line);
  background: #f4eee6;
}

.parameter-suggestion-details {
  position: relative;
}

.parameter-suggestion-details summary {
  list-style: none;
}

.parameter-suggestion-details summary::-webkit-details-marker {
  display: none;
}

.parameter-suggestion-popover {
  position: absolute;
  z-index: 8;
  inset-inline-end: 0;
  top: calc(100% + 0.35rem);
  display: grid;
  gap: 0.35rem;
  min-width: 210px;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.yeshiva-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.85rem 0.9rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.65);
}

.parameter-management-section,
.analytics-yeshivot {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefa;
  box-shadow: 0 5px 16px rgba(83, 59, 35, 0.05);
}

.parameter-editor-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.parameter-editor-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.7rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
}

.parameter-editor-card label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.parameter-editor-card input {
  min-width: 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: white;
}

.analytics-notice {
  padding: 0.8rem 1rem;
  border: 1px solid #c9daca;
  border-radius: 11px;
  color: #385b3e;
  background: #edf6ee;
}

.analytics-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

.analytics-card,
.analytics-yeshiva-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fffefa, #f8f2e9);
}

.analytics-card {
  display: grid;
  gap: 0.5rem;
}

.analytics-card span,
.analytics-yeshiva-card span {
  color: var(--muted);
  font-size: 0.85rem;
}

.analytics-card strong {
  color: var(--brand-dark);
  font-size: 1.7rem;
  font-variant-numeric: tabular-nums;
}

.analytics-yeshivot h3 {
  margin-top: 0;
}

.analytics-yeshiva-card {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.analytics-yeshiva-card h4 {
  margin: 0;
}

.analytics-rank-chart {
  display: grid;
  gap: 0.6rem;
}

.analytics-bar-row {
  display: grid;
  grid-template-columns: 7rem 3rem minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
  font-size: 0.84rem;
}

.analytics-bar-row strong {
  font-variant-numeric: tabular-nums;
  text-align: end;
}

.analytics-bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee7dc;
}

.analytics-bar {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  transition: width 300ms ease;
}

.analytics-bar.first {
  background: linear-gradient(90deg, #789c69, #4b7a50);
}

.analytics-bar.second {
  background: linear-gradient(90deg, #e4bd71, #c18a39);
}

.analytics-bar.third {
  background: linear-gradient(90deg, #d79a80, #b85e47);
}

.analytics-bar.average {
  background: linear-gradient(90deg, #b97552, #8b3e2c);
}

.analytics-share-section,
.analytics-parameter-section {
  margin-top: 1.25rem;
}

.share-chart {
  display: grid;
  gap: 0.9rem;
}

.share-chart {
  grid-template-columns: 1fr;
}

.share-bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 48px;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.92rem;
}

.parameter-distribution-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.parameter-distribution-heading h3 {
  margin: 0;
}

.parameter-distribution-heading .muted-note {
  margin: 0.35rem 0 0;
}

.parameter-distribution-select {
  display: grid;
  gap: 0.3rem;
  min-width: min(230px, 45%);
  color: var(--muted);
  font-size: 0.8rem;
}

.parameter-distribution-select select {
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font: inherit;
}

.parameter-distribution-description {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.parameter-distribution-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.parameter-distribution-summary > div {
  display: grid;
  gap: 0.2rem;
}

.parameter-distribution-summary span,
.distribution-count small {
  color: var(--muted);
  font-size: 0.75rem;
}

.parameter-distribution-summary strong {
  font-size: 1.15rem;
}

.parameter-distribution-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.parameter-distribution-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 5rem;
  align-items: center;
  gap: 0.75rem;
}

.distribution-value {
  font-weight: 700;
  text-align: center;
}

.distribution-track {
  width: 100%;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eee8;
}

.distribution-bar {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #91aa7f, #477b5c);
  transition: width 240ms ease;
}

.distribution-count {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.parameter-distribution-empty {
  margin: 1rem 0 0;
  padding: 1.1rem;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.statistics-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 1rem;
}

.danger-icon {
  color: #9d382f;
  border-color: #e6c6bd;
}

.boost-editor {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.boost-editor summary {
  margin-bottom: 0.8rem;
  color: var(--brand-dark);
  font-weight: 700;
  cursor: pointer;
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  font-weight: 700;
}

.toggle-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.reset-cloud-button {
  margin-top: 1rem;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.2rem 0;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f2e9dd;
}

.admin-tab {
  flex: 1 1 130px;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.admin-tab.active {
  color: var(--brand-dark);
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(83, 59, 35, 0.1);
}

.admin-tab,
.managed-yeshiva,
.text-button,
.nav-button {
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.admin-tab:hover,
.text-button:hover {
  border-color: rgba(169, 79, 55, 0.42);
}

.admin-header {
  align-items: center;
  margin-bottom: 1rem;
}

.admin-header-actions {
  flex-wrap: wrap;
}

.text-button {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--brand-dark);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.danger-button {
  color: #9d382f;
}

.dataset-form {
  display: grid;
  gap: 1rem;
}

.admin-editor {
  display: grid;
  gap: 0.5rem;
}

.admin-editor textarea {
  width: 100%;
  min-height: 260px;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #2e2822;
  background: #fffefa;
  direction: ltr;
  text-align: left;
  font: 0.85rem/1.5 Consolas, monospace;
  resize: vertical;
}

.admin-actions {
  flex-wrap: wrap;
}

.requests-section {
  margin: 0 0 1.8rem;
}

.section-heading {
  align-items: center;
}

.section-heading h3 {
  margin: 0.2rem 0 0;
}

.request-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.request-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
  box-shadow: 0 4px 12px rgba(83, 59, 35, 0.04);
}

.managed-yeshivot-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.managed-yeshiva {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
}

.managed-yeshiva.has-pending {
  border-color: #d5a66d;
  background: #fbf0df;
  box-shadow: inset 4px 0 0 #c78d4c;
}

.managed-yeshiva.has-pending:hover {
  border-color: #c78d4c;
  box-shadow: inset 4px 0 0 #c78d4c, 0 8px 20px rgba(124, 79, 31, 0.08);
}

.managed-yeshiva > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 58px;
  padding: 0.75rem 0.9rem;
  list-style: none;
  cursor: pointer;
}

.managed-yeshiva > summary::-webkit-details-marker {
  display: none;
}

.managed-yeshiva-title {
  font-weight: 800;
}

.pending-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  color: #754516;
  background: #f0d6ae;
  font-size: 0.75rem;
  font-weight: 800;
}

.new-yeshiva-badge {
  color: #74412a;
  background: #efd2c2;
}

.summary-chevron {
  margin-inline-start: auto;
  transition: transform 160ms ease;
}

.managed-yeshiva[open] .summary-chevron {
  transform: rotate(180deg);
}

.managed-profile-summary {
  margin: 0;
  padding: 0 0.9rem 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

.average-update-button {
  margin: 0 0.9rem 0.9rem;
}

.submission-list {
  display: grid;
  gap: 0.6rem;
  padding: 0 0.9rem 0.9rem;
}

.submission-list:empty {
  display: none;
}

.submission-answers {
  margin-top: 0.6rem;
}

.submission-answers summary {
  color: var(--brand-dark);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.submission-answers ul {
  padding-inline-start: 1.3rem;
  color: var(--muted);
  line-height: 1.6;
}

.submission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.muted-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.request-heading {
  align-items: center;
}

.request-heading div {
  display: grid;
  gap: 0.2rem;
}

.request-heading span,
.request-heading time,
.empty-state {
  color: var(--muted);
  font-size: 0.85rem;
}

.request-card p {
  line-height: 1.6;
}

.request-card details summary {
  color: var(--brand-dark);
  font-weight: 700;
  cursor: pointer;
}

.security-note {
  padding: 0.75rem;
  border-right: 3px solid #c78d4c;
  background: rgba(242, 222, 196, 0.32);
}

@media (min-width: 700px) {
  .app-shell {
    padding-top: 1.5rem;
  }

  .card {
    padding: 1.4rem 1.6rem 1.3rem;
  }

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

  .top-three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .welcome-panel {
    min-height: 440px;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .welcome-actions,
  .results-actions,
  .admin-actions,
  .admin-header,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .welcome-actions button,
  .results-actions button,
  .admin-actions button,
  .modal-actions button {
    width: 100%;
  }

  .admin-header-actions {
    justify-content: flex-start;
  }

  .request-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .rating-option-grid {
    gap: 0.45rem;
  }

  .rating-option-grid .option-button {
    padding: 0.75rem 0.4rem;
  }

  .rating-scale-helper {
    font-size: 0.7rem;
  }

  .parameter-editor-card,
  .analytics-summary,
  .analytics-yeshiva-card {
    grid-template-columns: 1fr;
  }

  .parameter-distribution-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .parameter-distribution-select {
    min-width: 0;
    width: 100%;
  }

  .parameter-distribution-row {
    grid-template-columns: 1.6rem minmax(0, 1fr) 4.2rem;
    gap: 0.5rem;
  }

  .analytics-yeshiva-card h4 {
    grid-column: auto;
  }

  .weight-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .weight-row .parameter-suggestion-details,
  .weight-row > .parameter-change,
  .weight-row > .muted-note {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .editor-fields,
  .admin-option-card {
    grid-template-columns: 1fr;
  }

  .admin-option-card label:nth-child(3),
  .wide-field {
    grid-column: auto;
  }

  .weight-row {
    grid-template-columns: minmax(0, 1fr) 90px 38px;
  }

  .admin-tabs {
    flex-direction: column;
  }

  .analytics-bar-row {
    grid-template-columns: 6.3rem 2.4rem minmax(0, 1fr);
    gap: 0.4rem;
    font-size: 0.75rem;
  }
}

body {
  background: linear-gradient(135deg, #1a3560 0%, #10234a 48%, #09152f 100%);
  background-color: var(--bg);
}

.card {
  background: rgba(244, 248, 255, 0.97);
  border-color: rgba(190, 210, 238, 0.78);
}

.brand-mark {
  background: #d7e5f7;
  box-shadow: 0 8px 20px rgba(5, 18, 45, 0.28);
}

.topbar h1 {
  color: #f1f6ff;
}

.topbar .eyebrow {
  color: #bdcce2;
}

.progress-bar {
  background: #dce7f5;
}

.progress-fill {
  background: linear-gradient(90deg, #2f5c99, #78a1d4);
}

.option-button {
  border-color: #c6d4e8;
  background: #f8fbff;
  color: #152746;
}

.option-button:hover,
.option-button:focus-visible {
  border-color: rgba(64, 112, 172, 0.65);
  box-shadow: 0 10px 22px rgba(28, 62, 107, 0.14);
}

.option-button.selected {
  background: linear-gradient(180deg, #d9e7f8, #f6f9ff);
  border-color: rgba(64, 112, 172, 0.68);
  box-shadow: inset 0 0 0 1px rgba(52, 94, 146, 0.12);
}

.nav-button.secondary,
.reset-button,
.secondary-action-button {
  background: #dce8f8;
  color: #17345f;
}

.nav-button.primary {
  background: linear-gradient(135deg, #244c80, #4f80b4);
  box-shadow: 0 12px 20px rgba(19, 52, 95, 0.22);
}

.welcome-panel h2 {
  color: #17345f;
}

.area-preference-control select,
.editor-fields select,
.feedback-fields input,
.feedback-fields select,
.feedback-fields textarea,
.admin-login input,
.editor-fields input,
.editor-fields textarea,
.admin-option-card input,
.weight-row input,
.parameter-editor-card input,
.parameter-weight,
.admin-editor textarea {
  border-color: #bdcde3;
  background-color: #f8fbff;
}

.text-link {
  text-decoration-color: rgba(42, 84, 137, 0.4);
}

.modal-backdrop {
  background: rgba(5, 15, 36, 0.64);
}

.admin-question-card,
.request-card,
.managed-yeshiva,
.parameter-management-section,
.analytics-yeshiva-card,
.parameter-editor-card,
.parameter-suggestion-popover,
.weight-list {
  border-color: #c6d4e8;
  background: #f5f8fe;
  box-shadow: 0 5px 16px rgba(22, 47, 86, 0.08);
}

.admin-option-card,
.parameter-editor-card,
.parameter-management-section {
  border-color: #c3d3e9;
  background: #edf3fb;
}

.admin-option-card .parameter-checkbox-list label,
.parameter-management-section .parameter-checkbox-list label {
  background: #dce8f8;
}

.yeshiva-bulk-actions,
.admin-tabs {
  border-color: #c6d4e8;
  background: #e5edf8;
}

.admin-tab.active {
  color: #17345f;
  background: #f8fbff;
  box-shadow: 0 2px 8px rgba(20, 45, 82, 0.12);
}

.admin-panel input::placeholder,
.admin-panel textarea::placeholder,
.admin-login input::placeholder {
  color: #536782;
  opacity: 1;
}

.admin-panel .nav-button.primary,
.admin-login .nav-button.primary {
  background: linear-gradient(135deg, #244c80, #386692);
}

.admin-tab:hover,
.text-button:hover {
  border-color: rgba(64, 112, 172, 0.5);
}

.parameter-subtext {
  color: #425674;
}

.parameter-weight:focus-visible {
  outline-color: rgba(64, 112, 172, 0.55);
}

.parameter-change.neutral {
  color: #3d5e87;
  border-color: #bfd0e6;
  background: #e5edf8;
}

.analytics-notice {
  border-color: #bfd2ed;
  color: #26476e;
  background: #eaf2fd;
}

.analytics-card,
.analytics-yeshiva-card {
  border-color: #c6d4e8;
  background: linear-gradient(180deg, #f7faff, #eaf1fb);
}

.analytics-card strong {
  color: #244b7c;
}

.analytics-bar-track {
  background: #dfe8f4;
}

.analytics-bar.first {
  background: linear-gradient(90deg, #8eacd2, #527bab);
}

.analytics-bar.second {
  background: linear-gradient(90deg, #7d9fc9, #426b9e);
}

.analytics-bar.third {
  background: linear-gradient(90deg, #9fb6d4, #617fa8);
}

.analytics-bar.average,
.distribution-bar {
  background: linear-gradient(90deg, #79a4d5, #315c8d);
}

.distribution-track {
  background: #dfe8f4;
}

.managed-yeshiva.has-pending {
  border-color: #89a9d1;
  background: #edf4fd;
  box-shadow: inset 4px 0 0 #5c83b3;
}

.managed-yeshiva.has-pending:hover {
  border-color: #5c83b3;
  box-shadow: inset 4px 0 0 #5c83b3, 0 8px 20px rgba(28, 62, 107, 0.12);
}

.pending-badge,
.new-yeshiva-badge {
  color: #244b7c;
  background: #dce8f8;
}

.security-note {
  border-right-color: #6288b7;
  background: rgba(214, 229, 248, 0.55);
}
