:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --panel: #ffffff;
  --ink: #1b2528;
  --muted: #657174;
  --line: #d8ddd7;
  --accent: #186c72;
  --accent-strong: #0d4d54;
  --blue: #358db5;
  --cyan: #10aeca;
  --warning: #9b5a10;
  --error: #a93232;
  --ok: #207245;
  --shadow: 0 14px 38px rgba(32, 43, 46, 0.09);
  font-family: "Noto Sans Hebrew", "Segoe UI", Arial, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  text-align: right;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  padding: 8px 12px;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #fff;
  color: var(--accent);
}

button.secondary:hover {
  background: #eef6f5;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.cancel-button {
  border-color: #9b5a10;
  color: #9b5a10;
}

.cancel-button:hover {
  background: #fff5e8;
  color: #6f3b00;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(16px, 3vw, 34px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  align-content: center;
}

.metric-pill {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbf8;
  padding: 7px 10px;
  color: var(--muted);
}

.metric-pill strong {
  color: var(--ink);
}

.app-shell {
  padding: 18px clamp(12px, 2vw, 24px) 28px;
}

.tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 36px;
  background: #eef5f4;
  border-color: #bed2d0;
  color: var(--accent-strong);
  font-weight: 750;
}

.tab:hover {
  background: #dde8e4;
  border-color: #9fb5ad;
  color: var(--ink);
}

.tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tab.is-active:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

.tab-note {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
}

.tab:not(.is-active) .tab-note {
  border-color: #d7c48f;
  background: #fff8df;
  color: #7b5410;
}

.tab-secondary {
  min-height: 32px;
  background: transparent;
  border-color: #cfd8d4;
  color: #3d5357;
  font-weight: 650;
}

.tab-secondary:hover {
  background: #eef3f1;
  border-color: #b8c9c4;
  color: var(--ink);
}

.tab-group-label {
  flex: 0 0 auto;
  margin-right: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  grid-template-areas: "content controls";
  gap: 16px;
  align-items: start;
  direction: ltr;
}

body[data-active-tab="compare"] .workspace,
body[data-active-tab="city"] .workspace,
body[data-active-tab="gush"] .workspace {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "content";
}

body[data-active-tab="compare"] .control-panel,
body[data-active-tab="city"] .control-panel,
body[data-active-tab="gush"] .control-panel {
  display: none;
}

.control-panel,
.content-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  grid-area: controls;
  direction: rtl;
  text-align: right;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 14px;
}

.content-panel {
  grid-area: content;
  direction: rtl;
  text-align: right;
}

.control-section {
  border-bottom: 1px solid var(--line);
  padding: 0 0 16px;
  margin-bottom: 16px;
}

.control-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

body:not([data-active-tab="analysis"]) .analysis-only-control {
  display: none;
}

body[data-active-tab="compare"] #city-select,
body[data-active-tab="compare"] #random-city {
  opacity: 0.55;
}

body[data-active-tab="compare"] #street-search::placeholder {
  color: #44575b;
}

body[data-active-tab="compare"][data-compare-has-selection="false"] .compare-requires-selection {
  display: none;
}

h2 {
  margin: 0 0 10px;
  font-size: 18px;
  letter-spacing: 0;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: -2px -2px 10px;
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
}

.section-heading h2 {
  margin: 0;
  font-size: 16px;
}

.step-kicker {
  font-size: 12px;
  font-weight: 750;
  opacity: 0.9;
}

label {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #c9d1ce;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 7px 8px;
}

.select-row,
.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.random-button {
  min-width: 78px;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

select[multiple] {
  min-height: 96px;
}

.native-picker-select {
  display: none;
}

option {
  padding: 4px;
}

.grid-2,
.grid-4 {
  display: grid;
  gap: 8px;
}

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

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

.inline-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 12px;
  margin: 10px 0;
}

.inline-controls label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.inline-controls input {
  width: auto;
  min-height: auto;
}

.filter-cluster {
  border: 1px solid #d9e6e3;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
  margin: 10px 0;
}

.filter-cluster h3 {
  margin: 0 0 8px;
  color: #304246;
  font-size: 13px;
  letter-spacing: 0;
}

.range-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.range-grid label {
  margin: 0;
  color: #46565a;
  font-size: 12px;
}

.range-grid input {
  min-height: 34px;
  background: #fff;
}

.room-filter-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  color: #46565a;
  font-size: 12px;
  font-weight: 650;
}

.room-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.include-unknown-toggle,
.unknown-filter-grid label {
  position: relative;
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 24px;
  border: 1px solid #c9dddf;
  border-radius: 999px;
  background: #fff;
  color: #476268;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  padding: 4px 8px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.include-unknown-toggle input,
.unknown-filter-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.include-unknown-toggle::before,
.unknown-filter-grid label::before {
  content: "";
  display: inline-grid;
  place-items: center;
  width: 11px;
  height: 11px;
  border: 1px solid #9db9bd;
  border-radius: 999px;
  background: #fff;
  color: #fff;
  font-size: 9px;
  line-height: 1;
}

.include-unknown-toggle:has(input:checked),
.unknown-filter-grid label:has(input:checked) {
  border-color: #86c2cb;
  background: #e8f6f8;
  color: #0f6170;
}

.include-unknown-toggle:has(input:checked)::before,
.unknown-filter-grid label:has(input:checked)::before {
  content: "✓";
  border-color: #187386;
  background: #187386;
}

.include-unknown-toggle:focus-within,
.unknown-filter-grid label:focus-within {
  outline: 2px solid rgba(44, 130, 201, 0.25);
  outline-offset: 2px;
}

.unknown-filter-title {
  color: #6b797d;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  margin: 0;
}

.unknown-filter-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: -2px 0 8px;
  padding: 6px;
  border: 1px solid #d7e5e4;
  border-radius: 8px;
  background: #f8fbfb;
}

.compact-button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.filter-chip-group,
.segmented-control {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  gap: 6px;
}

.filter-chip-scroll {
  max-height: 138px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 6px;
}

.filter-chip,
.segmented-control button {
  min-height: 34px;
  border-color: #b9d2d7;
  background: #f2f8f9;
  color: #23464b;
  padding: 6px 8px;
  font-weight: 650;
}

.filter-chip:hover,
.segmented-control button:hover {
  background: #dff0f2;
  color: #153d43;
}

.filter-chip.is-selected,
.segmented-control button.is-selected {
  border-color: #0d4d54;
  background: #1f6b85;
  color: #fff;
}

.native-filter-select {
  display: none;
}

.segmented-field {
  display: grid;
  gap: 7px;
  margin: 8px 0 10px;
}

.segmented-field > span {
  color: #46565a;
  font-size: 12px;
  font-weight: 650;
}

.plot-controls {
  border: 1px solid #9bc6db;
  border-radius: 2px;
  background: #fff;
  margin: 0 0 14px;
}

.plot-controls-heading {
  display: flex;
  align-items: center;
  min-height: 34px;
  background: var(--blue);
  color: #fff;
  padding: 7px 10px;
}

.plot-controls-heading h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.plot-control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px 22px;
  padding: 12px 12px 8px;
}

.plot-control-grid label {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

.plot-control-grid select {
  margin-top: 3px;
  min-height: 34px;
  background: #f4f4f4;
  font-weight: 400;
}

.plot-toggle-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px 22px;
  padding: 8px 12px 12px;
}

.plot-toggle-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ink);
}

.plot-toggle-row input {
  width: auto;
  min-height: auto;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: end;
  border: 1px solid #d8e5e2;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.map-toolbar label {
  min-width: 190px;
  margin: 0;
  color: #304246;
  font-weight: 700;
}

.map-toolbar .checkbox-field {
  display: inline-flex;
  min-width: auto;
  align-items: center;
  gap: 7px;
  min-height: 36px;
}

.map-toolbar .checkbox-field input {
  width: auto;
  min-height: auto;
}

.map-chart {
  width: 100%;
  height: min(72vh, 780px);
  min-height: 620px;
  background: #f7faf8;
}

.leaflet-map {
  display: block;
  overflow: hidden;
  padding: 0;
}

.leaflet-map .leaflet-control-container,
.leaflet-map .leaflet-pane {
  direction: ltr;
}

.gush-map-tooltip,
.gush-map-label {
  direction: rtl;
  text-align: right;
  font-family: inherit;
}

.gush-map-label {
  border: 1px solid rgba(24, 108, 114, 0.28);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.82);
  color: #173f44;
  box-shadow: none;
  font-size: 10px;
  font-weight: 750;
  padding: 1px 4px;
}

.source-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workflow-filter-panel {
  border: 1px solid #d9e6e3;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
  margin: 0 0 14px;
}

.warning-callout {
  border: 1px solid #d6a862;
  border-radius: 8px;
  background: #fff8ed;
  color: #68430b;
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.compare-area-panel {
  border: 1px solid #c5dcd8;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  margin: 0 0 14px;
}

.compare-area-panel h3 {
  margin: 0;
  color: #304246;
  font-size: 15px;
}

.compare-area-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.compare-area-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
  gap: 14px;
  align-items: start;
}

.compare-area-grid .picker-block,
.compare-area-grid .lookup-box {
  margin: 0;
}

.compare-filter-layout,
.workflow-filter-sections {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 10px;
  align-items: start;
}

.compare-filter-layout .filter-cluster {
  margin: 10px 0 0;
}

.compare-gush-result-label,
.gush-picker-result-label {
  display: block;
  min-width: 0;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}

.workflow-filter-panel h3 {
  margin: 0;
  color: #304246;
  font-size: 15px;
}

.workflow-filter-panel .range-grid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.workflow-filter-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.workflow-filter-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px 16px;
}

.workflow-filter-actions label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ink);
}

.workflow-filter-actions input {
  width: auto;
  min-height: auto;
}

.workflow-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.checkbox-field {
  align-content: end;
}

.checkbox-field input {
  width: auto;
  min-height: auto;
}

.workflow-quick-grid label,
.advanced-filters label {
  margin: 0;
}

.advanced-filters {
  margin-top: 10px;
  border-top: 1px solid #d9e6e3;
  padding-top: 9px;
}

.advanced-filters summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 750;
  font-size: 13px;
}

.advanced-filters .range-grid {
  margin-top: 10px;
}

.workflow-filter-panel select[multiple] {
  min-height: 92px;
}

.filter-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 14px 0 8px;
  border-top: 1px solid #d9e6e3;
  padding-top: 10px;
}

.filter-section-heading.is-first {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.filter-section-heading h4 {
  margin: 0;
  color: #304246;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.performance-advanced-filters {
  border-top: 1px solid #cfe1de;
  padding-top: 10px;
}

.performance-advanced-filters summary {
  list-style-position: inside;
}

.performance-advanced-filters .range-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.performance-advanced-filters .apartment-type-filter {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.performance-room-chips {
  margin-bottom: 8px;
}

.city-selector-panel {
  border: 1px solid #cfdeda;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  margin: 0 0 14px;
}

.city-workflow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  grid-template-areas: "city-main city-rail";
  gap: 18px;
  align-items: start;
  direction: ltr;
}

.city-filter-rail {
  grid-area: city-rail;
  direction: rtl;
  text-align: right;
  display: grid;
  gap: 14px;
}

.city-filter-rail .city-selector-panel,
.city-filter-rail .workflow-filter-panel {
  margin: 0;
}

.city-filter-rail .workflow-filter-sections,
.city-filter-rail .compare-filter-layout,
.performance-filter-rail .workflow-filter-sections,
.performance-filter-rail .compare-filter-layout {
  grid-template-columns: 1fr;
}

.city-filter-rail .workflow-filter-panel .range-grid,
.performance-filter-rail .workflow-filter-panel .range-grid,
.performance-advanced-filters .range-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.city-filter-rail .city-picker-layout {
  display: block;
}

.city-filter-rail .picker-results {
  max-height: 180px;
}

.city-filter-rail #city-comparison-selected {
  max-height: 132px;
  overflow: auto;
}

.city-selection-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  border: 1px solid #cde5e1;
  border-radius: 6px;
  background: #f5fbfa;
  padding: 9px;
  color: var(--ink);
  font-size: 12px;
}

.city-selection-summary strong {
  display: block;
  font-size: 13px;
}

.city-selection-hint {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.city-selection-summary button {
  align-self: start;
}

.city-selection-preview {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 5px;
  min-width: 0;
}

.city-selection-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  border: 1px solid #cfe4e1;
  border-radius: 999px;
  background: #fff;
  color: #315f66;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  padding: 3px 8px;
}

.city-main-stage {
  grid-area: city-main;
  direction: rtl;
  text-align: right;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.city-update-panel,
.city-plot-panel {
  border: 1px solid #1fa25a;
  background: #fff;
}

.city-update-panel h3,
.city-plot-title {
  margin: 0;
  background: #20a45d;
  color: #fff;
  padding: 10px 12px;
  font-size: 15px;
}

.city-update-panel button {
  width: calc(100% - 16px);
  margin: 8px;
  background: #20a45d;
  border-color: #1b8d50;
}

.city-update-panel label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 8px 12px;
  color: var(--ink);
}

.city-update-panel input {
  width: auto;
  min-height: auto;
}

.city-plot-controls {
  margin: 0;
}

.city-plot-controls .plot-control-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.city-plot-panel {
  border-color: var(--blue);
}

.city-plot-title {
  background: var(--blue);
}

#city-chart {
  min-height: 600px;
  border: 0;
  border-radius: 0;
  margin: 0;
}

.city-selector-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.city-selector-heading h3 {
  margin: 0 0 3px;
  font-size: 15px;
}

.city-selector-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.city-selector-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 7px;
}

.city-picker-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: 14px;
  align-items: start;
}

.city-picker-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: right;
}

.city-picker-check {
  flex: 0 0 16px;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid #b9d2d2;
  border-radius: 999px;
  background: #fff;
}

.picker-option.city-picker-option.is-selected .city-picker-check {
  border-color: #177987;
  background: #177987;
}

.picker-option.city-picker-option.is-selected .city-picker-check::before {
  content: "✓";
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.city-insights {
  display: grid;
  gap: 10px;
}

.city-insight-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.city-insight-cards .metric small {
  display: block;
  margin-top: 3px;
  color: var(--accent);
  font-weight: 750;
}

.city-ranking {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.city-ranking h4 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #f2f7f5;
  padding: 8px 10px;
  font-size: 13px;
}

.city-ranking table {
  min-width: 460px;
  font-size: 12px;
}

.city-ranking th {
  position: static;
}

.city-quick-grid {
  grid-template-columns: minmax(170px, 1.1fr) minmax(130px, 0.8fr) minmax(150px, 0.9fr) minmax(120px, 0.7fr) repeat(2, minmax(110px, 0.7fr));
}

.city-plot-options {
  grid-template-columns: minmax(120px, 0.9fr) repeat(2, minmax(100px, 0.7fr)) minmax(150px, 1fr) minmax(130px, 0.8fr);
  border-top: 1px solid #d9e6e3;
  margin-top: 10px;
  padding: 10px 0 0;
}

.city-plot-options label {
  color: var(--ink);
  font-size: 13px;
}

.city-plot-options input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.performance-quick-grid {
  grid-template-columns: repeat(2, minmax(92px, 1fr));
}

.performance-workflow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  grid-template-areas: "performance-main performance-rail";
  gap: 18px;
  align-items: start;
  direction: ltr;
}

.performance-filter-rail {
  grid-area: performance-rail;
  direction: rtl;
  text-align: right;
  display: grid;
  gap: 14px;
}

#gush-city-select {
  direction: rtl;
  text-align: right;
}

.selected-city-readout {
  margin-top: -4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  direction: rtl;
  text-align: right;
}

.performance-main-stage {
  grid-area: performance-main;
  direction: rtl;
  text-align: right;
  min-width: 0;
  display: grid;
  gap: 14px;
}

.performance-update-panel,
.city-update-panel {
  border: 1px solid #2b9d5d;
  border-radius: 8px;
  background: #f8fffb;
  padding: 12px;
}

.performance-update-panel h3,
.city-update-panel h3 {
  margin: 0 0 8px;
  color: #16663b;
  font-size: 15px;
}

.performance-update-panel button,
.city-update-panel button {
  width: 100%;
}

.performance-update-panel label,
.city-update-panel label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
}

.performance-update-panel input[type="checkbox"],
.city-update-panel input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.performance-plot-controls .plot-toggle-row {
  justify-content: center;
  gap: 32px;
  border-top: 1px solid #d9e6e3;
  margin-top: 10px;
  padding-top: 10px;
}

.selection-actions {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.room-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 10px;
}

.helper-text {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.picker-block {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.picker-block label {
  margin: 0;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.selection-chip {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  direction: rtl;
  min-height: 28px;
  max-width: 100%;
  border-color: #b7d2d0;
  background: #eef8f6;
  color: var(--accent-strong);
  padding: 4px 8px;
  text-align: right;
}

.selection-chip:hover {
  background: #dff0ee;
  color: var(--accent-strong);
}

.chip-remove {
  display: inline-grid;
  place-items: center;
  width: 1.25em;
  height: 1.25em;
  border-radius: 999px;
  background: rgba(13, 77, 84, 0.12);
  color: var(--accent-strong);
  font-weight: 800;
  line-height: 1;
}

.chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-results {
  display: grid;
  gap: 7px;
  max-height: 170px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 6px;
}

.picker-option {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: 0;
  border-color: transparent;
  background: #fff;
  color: var(--ink);
  padding: 7px 8px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: start;
  white-space: normal;
}

.picker-option:hover,
.picker-option.is-selected {
  border-color: #c8e3e0;
  background: #edf7f6;
  color: var(--accent-strong);
}

.picker-option.city-picker-option {
  display: flex;
  gap: 8px;
  align-items: center;
  direction: rtl;
  width: 100%;
  min-height: 28px;
  border: 1px solid #edf3f2;
  border-radius: 6px;
  padding: 5px 8px;
  text-align: right;
}

#compare-gush-results {
  display: block;
}

#gush-picker-results {
  display: block;
}

#compare-gush-results .picker-option.compare-gush-option,
#gush-picker-results .picker-option.gush-picker-option {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0 0 7px;
  padding: 8px 10px;
  overflow: visible;
  text-align: right;
  white-space: normal;
}

#compare-gush-results .picker-option.compare-gush-option:last-child,
#gush-picker-results .picker-option.gush-picker-option:last-child {
  margin-bottom: 0;
}

#gush-picker-selected .selection-chip {
  width: 100%;
  align-items: start;
}

#gush-picker-selected .chip-label {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.35;
}

.lookup-box {
  border-right: 3px solid var(--cyan);
  background: #f7fbfc;
  padding: 8px 10px;
  margin-top: 12px;
}

.lookup-box label {
  margin-top: 0;
}

.search-row button {
  min-width: 78px;
}

.search-results {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.search-result {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 0;
  border-color: #cfe3e7;
  background: #fff;
  color: var(--ink);
  text-align: start;
}

.search-result:hover {
  background: #eef8fa;
  color: var(--ink);
}

.search-result strong,
.search-result span {
  overflow-wrap: anywhere;
}

.search-result span {
  color: var(--muted);
  font-size: 12px;
}

.mini-notice {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  padding: 8px 9px;
  font-size: 12px;
}

.mini-notice.error {
  border-color: #e3aaa7;
  color: var(--error);
  background: #fff1f0;
}

.selection-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.selection-summary div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  padding: 8px;
  min-width: 0;
}

.selection-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.selection-summary strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-panel {
  min-height: 720px;
  padding: 18px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

#panel-compare.tab-panel.is-active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  grid-template-areas:
    "banner banner"
    "heading heading"
    "main selection"
    "main filters";
  gap: 14px 18px;
  align-items: start;
  direction: ltr;
}

#panel-compare .workflow-banner {
  grid-area: banner;
  direction: rtl;
}

#panel-compare .panel-heading {
  grid-area: heading;
  direction: rtl;
}

#panel-compare .compare-area-panel {
  grid-area: selection;
  direction: rtl;
}

#panel-compare .workflow-filter-panel {
  grid-area: filters;
  direction: rtl;
}

#panel-compare .compare-area-grid,
#panel-compare .workflow-filter-sections,
#panel-compare .compare-filter-layout {
  grid-template-columns: 1fr;
}

#panel-compare .workflow-filter-panel .range-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#panel-compare .compare-main-flow {
  grid-area: main;
  direction: rtl;
  min-width: 0;
}

.workflow-banner {
  display: grid;
  gap: 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #386d9f 0%, #4d738f 52%, #6f5aa2 100%);
  color: #fff;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 12px 30px rgba(50, 86, 118, 0.16);
}

.workflow-banner h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.workflow-banner p,
.workflow-explainer {
  margin: 0;
  max-width: 980px;
  color: rgba(255, 255, 255, 0.92);
}

.workflow-explainer {
  display: grid;
  gap: 8px;
}

.workflow-explainer div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}

.workflow-explainer dt {
  font-size: 12px;
  font-weight: 800;
}

.workflow-explainer dd {
  margin: 0;
  font-size: 13px;
}

.workflow-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 7px;
}

.workflow-tags span {
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.state {
  min-height: 0;
  margin: 10px 0;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #f9fbf8;
  color: var(--muted);
}

.notice.loading {
  color: var(--accent);
}

.notice.warning {
  border-color: #e0c28e;
  color: var(--warning);
  background: #fff8eb;
}

.notice.error {
  border-color: #e3aaa7;
  color: var(--error);
  background: #fff1f0;
}

.notice.ok {
  color: var(--ok);
}

.selected-deal {
  margin: 12px 0;
}

.deal-card {
  border: 1px solid #cfe0de;
  border-radius: 8px;
  background: #f7fbfa;
  padding: 12px;
}

.deal-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.deal-card dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px 16px;
  margin: 0;
  direction: rtl;
}

.deal-field {
  display: grid;
  grid-template-rows: auto minmax(1.35em, auto);
  align-content: start;
  min-width: 0;
  text-align: right;
}

.deal-card dt {
  color: var(--muted);
  font-size: 11px;
  min-width: 0;
}

.deal-card dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-weight: 650;
  min-width: 0;
  text-align: right;
}

.deal-card dd.ltr-text {
  text-align: right;
}

.chart {
  display: grid;
  place-items: center;
  min-height: 390px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin: 12px 0;
}

.chart:empty::before {
  content: attr(data-empty-label);
  color: var(--muted);
  font-size: 14px;
}

.chart-guide {
  place-items: stretch;
  padding: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f4fafb 100%);
}

.chart-guide:empty {
  place-items: center;
}

.chart-guide-content {
  align-self: stretch;
  justify-self: stretch;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: clamp(18px, 4vw, 42px);
  color: #26383c;
}

.chart-guide-content h3 {
  margin: 0;
  color: #176574;
  font-size: 20px;
}

.chart-guide-content ol,
.chart-guide-content ul {
  margin: 0;
  padding-left: 0;
  padding-right: 22px;
}

.chart-guide-content li {
  margin: 7px 0;
}

.chart-guide-tips {
  border-top: 1px solid #d4e7ea;
  background: #eaf6f8;
  margin: 4px -12px -12px;
  padding: 13px 14px;
  border-radius: 6px;
}

.chart-guide-tips strong {
  display: block;
  margin-bottom: 6px;
  color: #23464b;
}

.chart.js-plotly-plot {
  display: block;
  direction: ltr;
}

.metrics,
.info-grid,
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.metric,
.info-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 11px;
}

.metric span,
.info-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong,
.info-card strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.performance-summary,
.performance-info {
  border: 1px solid #d9e6e3;
  border-right: 3px solid var(--accent);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 10px 12px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.performance-summary strong,
.performance-info strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

.performance-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
}

.performance-info strong {
  flex-basis: 100%;
}

.performance-info span {
  color: var(--muted);
}

.compare-context {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.active-filter-box,
.data-summary-box {
  border: 1px solid #d9e6e3;
  border-right: 3px solid var(--ok);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.active-filter-box strong,
.data-summary-box strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.data-summary-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
}

.data-summary-box strong {
  flex-basis: 100%;
}

.compare-table-actions {
  justify-content: flex-start;
  margin: 4px 0 10px;
}

.compare-raw-table:empty {
  display: none;
}

.performance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  max-height: 470px;
}

.table-controls {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(180px, 320px) auto;
  gap: 8px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}

.table-controls label {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #edf0eb;
  padding: 8px 10px;
  text-align: start;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f2f5f0;
  color: #374548;
  font-weight: 650;
}

.table-controls + table th {
  top: 59px;
}

.column-filter-row th {
  top: 96px;
  background: #fbfcfa;
  padding: 6px;
}

.table-sort {
  min-height: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: start;
  font-weight: 700;
}

.table-sort:hover {
  background: transparent;
  color: var(--accent-strong);
}

.column-filter-row input {
  min-width: 112px;
  min-height: 30px;
  padding: 5px 7px;
  font-size: 12px;
}

.table-range-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  gap: 5px;
}

.table-range-filter input {
  min-width: 72px;
}

tbody tr:hover,
tbody tr.is-selected {
  background: #edf7f6;
}

.wide-label {
  max-width: 520px;
}

.download-grid {
  max-width: 760px;
}

.about-panel {
  display: grid;
  gap: 14px;
  max-width: 1040px;
  color: #263438;
  font-size: 15px;
  line-height: 1.75;
}

.about-panel a {
  color: var(--accent);
  font-weight: 750;
}

.about-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: clamp(16px, 2.4vw, 24px);
}

.about-intro {
  background: linear-gradient(180deg, #ffffff 0%, #eef7f6 100%);
  border-color: #c7dcda;
}

.about-section h3 {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 20px;
}

.about-section h4 {
  margin: 14px 0 5px;
  color: #254246;
  font-size: 15px;
}

.about-section p {
  margin: 0 0 12px;
}

.about-section p:last-child {
  margin-bottom: 0;
}

.about-section ul {
  margin: 0;
  padding: 0 20px 0 0;
}

.about-feature-grid,
.about-workflows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.about-feature-grid > div,
.about-workflows > div {
  border: 1px solid #dce4df;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}

.about-feature-grid h4,
.about-workflows h4 {
  margin-top: 0;
}

.rtl-text {
  direction: rtl;
  unicode-bidi: plaintext;
}

.ltr-text {
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: left;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "controls"
      "content";
  }

  .control-panel {
    position: static;
    max-height: none;
  }

  .panel-heading {
    display: grid;
  }

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

  .workflow-banner {
    display: grid;
  }

  .workflow-explainer div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .workflow-tags {
    justify-content: flex-start;
  }

  .compare-area-grid,
  .compare-filter-layout,
  .workflow-filter-sections,
  .city-workflow-grid {
    grid-template-columns: 1fr;
  }

  .city-workflow-grid {
    grid-template-areas:
      "city-rail"
      "city-main";
  }

  .performance-workflow-grid {
    grid-template-areas:
      "performance-rail"
      "performance-main";
  }

  .city-filter-rail {
    position: static;
    max-height: none;
    overflow: visible;
    padding-left: 0;
  }

  .city-plot-controls .plot-control-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar,
  .range-grid,
  .grid-4,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .summary-strip {
    justify-content: flex-start;
  }

  .inline-controls {
    grid-template-columns: 1fr;
  }

  .plot-control-grid,
  .plot-toggle-row,
  .workflow-quick-grid,
  .workflow-filter-panel .range-grid {
    grid-template-columns: 1fr;
  }

  .workflow-filter-heading {
    display: grid;
  }

  .workflow-filter-actions {
    justify-content: flex-start;
  }

  .compare-area-panel {
    padding: 10px;
  }

  .performance-workflow-grid,
  .city-picker-layout,
  .city-quick-grid,
  .city-plot-controls .plot-control-grid,
  .performance-quick-grid {
    grid-template-columns: 1fr;
  }

  .selection-summary,
  .select-row,
  .search-row {
    grid-template-columns: 1fr;
  }

  .icon-button {
    width: 100%;
  }
}
