:root {
  --bg: #e8eaee;
  --bg-subtle: #f2f3f6;
  --surface: #ffffff;
  --border: #d1d5db;
  --text: #1a1d23;
  --muted: #5c6370;
  --accent: #0d6efd;
  --accent-soft: #e7f1ff;
  --success: #198754;
  --danger: #dc3545;
  --warn-bg: #fff8e6;
  --warn-text: #8a5a00;
  --radius: 10px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,600;0,9..40,700;1,9..40,400&display=swap");

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

.evk-static .add-row,
.evk-hosted .add-row {
  display: none;
}

.evk-static .btn-refresh,
.evk-hosted .btn-refresh {
  display: none !important;
}

.evk-static .live-hint,
.evk-hosted .live-hint {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.static-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  width: 100%;
  margin-bottom: 0.5rem;
}

@media (min-width: 720px) {
  .static-toolbar-actions {
    width: auto;
    margin-bottom: 0;
    margin-right: 0.75rem;
  }
}

.btn-toolbar {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.btn-toolbar:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-toolbar.subtle {
  font-size: 0.72rem;
  opacity: 0.9;
}

.card.card-rating-highlight {
  background: linear-gradient(135deg, #f0faf2 0%, #fffaf5 100%);
  border-color: #c5e1c8;
  box-shadow: 0 2px 12px rgba(46, 125, 50, 0.07);
}

.card.card-rating-highlight-strong {
  background: linear-gradient(135deg, #e8f6ea 0%, #fff4e6 100%);
  border-color: #9ccc9f;
  box-shadow: 0 2px 14px rgba(232, 166, 84, 0.1);
  border-left: 4px solid #e8a654;
}

.top {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0.75rem;
}

.brand h1 {
  margin: 0 0 0.65rem;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.add-row input {
  flex: 1 1 260px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
}

.add-row button {
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.add-row button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.sort {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.sort select {
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.status {
  font-size: 0.82rem;
  color: var(--muted);
}

.status.busy {
  color: var(--accent);
}

.grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr minmax(200px, 260px);
  gap: 0;
  overflow: hidden;
  min-height: 220px;
}

.card-gallery-col {
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

@media (max-width: 960px) {
  .card {
    grid-template-columns: 1fr;
  }

  .card-gallery-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .gallery-slider {
    flex: 0 0 auto;
  }

  .gallery-viewport {
    aspect-ratio: 4 / 3;
    flex: none;
    width: 100%;
    min-height: 200px;
    max-height: min(72vw, 380px);
  }
}

.open-site {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 0.3rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--border);
}

.gallery-slider {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.gallery-viewport {
  flex: 1;
  min-width: 0;
  min-height: 220px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-gallery-scroll {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  gap: 8px;
  padding: 12px 40px 8px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 32px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.gallery-nav:hover:not(:disabled) {
  background: var(--surface);
  color: var(--accent);
}

.gallery-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.gallery-prev {
  left: 6px;
}

.gallery-next {
  right: 6px;
}

.card-gallery-scroll img {
  scroll-snap-align: center;
  /* Kart satırı yüksekliğini dolduran önizleme: kırparak kaplar; tam görüntü lightbox’ta */
  flex: 0 0 calc(100% - 20px);
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: #ddd;
}

.gallery-thumb {
  cursor: zoom-in;
}

.gallery-count {
  margin: 0;
  padding: 0 12px 10px;
  font-size: 0.75rem;
  color: var(--muted);
}

.card-content-col {
  padding: 0.85rem 1rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-right: 1px solid var(--border);
}

@media (max-width: 960px) {
  .card-content-col {
    border-right: none;
  }
}

.card-side-col {
  padding: 0.85rem 0.9rem;
  background: var(--bg-subtle);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.fetch-error {
  font-size: 0.78rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid #f0e0b2;
}

.fetch-error.hidden {
  display: none;
}

.field-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.title-price-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: flex-end;
}

.title-block {
  flex: 1 1 200px;
  min-width: 0;
}

.title-text {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.price-block {
  flex: 0 0 auto;
}

.price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.price-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
}

.btn-discount {
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--muted);
  cursor: pointer;
}

.btn-discount:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.saved-discount-line {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--success);
}

.discount-wrap {
  margin-top: 0.35rem;
}

.discount-input {
  width: 100%;
  max-width: 220px;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-family: inherit;
}

.loc-line {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.loc-text {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
}

.highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.hl-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: var(--accent-soft);
  border: 1px solid #cfe2ff;
  font-size: 0.78rem;
  color: var(--text);
}

.hl-chip b {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.7rem;
}

.contact-wrap {
  margin-top: 0.35rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.contact-wrap .seller-contact {
  margin-top: 0.25rem;
}

.contact-wrap .seller-contact p {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text);
}

.contact-wrap .seller-contact p:first-child {
  margin-top: 0;
}

.contact-office {
  font-weight: 600;
}

.contact-agent {
  color: var(--text);
}

.contact-phone a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.contact-phone a:hover {
  text-decoration: underline;
}

.contact-phone-plain {
  color: var(--text);
  font-weight: 500;
}

.attrs-wrap summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8rem;
}

.attrs {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.76rem;
  color: var(--muted);
  max-height: 120px;
  overflow: auto;
}

.hidden {
  display: none !important;
}

.fields label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.fields textarea,
.fields select {
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  resize: vertical;
}

.ratings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.rating-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  padding: 0.3rem 0.4rem 0.35rem;
  border-radius: 8px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.rating-row--warn {
  background: linear-gradient(
    105deg,
    rgba(127, 29, 29, 0.2) 0%,
    rgba(185, 28, 28, 0.12) 45%,
    rgba(254, 226, 226, 0.55) 100%
  );
  border-color: #b91c1c;
  border-left: 4px solid #7f1d1d;
  box-shadow: inset 0 0 0 1px rgba(127, 29, 29, 0.2);
}

.rating-row--great {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-left-color: var(--success);
}

.notes-only-block {
  margin-top: 0.25rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.notes-only-block > .field-label {
  margin-bottom: 0.25rem;
}

.notes-edit-foot {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.4rem;
}

.proscons-block {
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.text-field-group-plain {
  margin-top: 0;
}

.field-label-sub {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.1rem;
}

.text-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0;
}

.text-field-display {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.4rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  min-height: 2.35rem;
}

.text-field-display.text-field-empty {
  color: var(--muted);
  font-style: italic;
}

.btn-text-edit-notes {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
}

.btn-text-edit-notes:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.notes-only-block .text-field-input,
.proscons-block .text-field-input {
  margin-top: 0;
  width: 100%;
  padding: 0.4rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  resize: vertical;
  box-sizing: border-box;
}

.check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
  font-size: 0.8rem !important;
  color: var(--text) !important;
}

.fields-ratings-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
}

.check-contacted {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 0.55rem !important;
  margin: 0 !important;
  padding: 0.5rem 0.6rem !important;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.8rem !important;
  color: var(--text) !important;
  line-height: 1.35;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.check-contacted:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.08);
}

.check-contacted:has(input:checked) {
  border-color: var(--success);
  background: #f0fdf4;
  box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.12);
}

.check-contacted input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.12rem;
  flex-shrink: 0;
  accent-color: var(--success);
  cursor: pointer;
}

.check-contacted-text {
  display: block;
  font-weight: 600;
}

.check-contacted-hint {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.08rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.actions button {
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  cursor: pointer;
}

.actions .primary {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.actions .danger {
  border-color: #f5c2c7;
  color: var(--danger);
  margin-left: auto;
}

@media (max-width: 520px) {
  .ratings {
    grid-template-columns: 1fr;
  }

  .card-gallery-scroll {
    padding-left: 36px;
    padding-right: 36px;
  }

  .gallery-viewport {
    min-height: 200px;
  }

  .card-gallery-scroll img {
    flex: 0 0 calc(100% - 14px);
  }

  .gallery-nav {
    width: 28px;
    height: 38px;
    font-size: 1.15rem;
  }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.lightbox.hidden {
  display: none !important;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(12, 14, 18, 0.82);
  cursor: pointer;
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 1120px);
  max-height: 92vh;
  pointer-events: none;
}

.lightbox-panel > * {
  pointer-events: auto;
}

.lightbox-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #f2f4f8;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(30, 34, 42, 0.92);
  color: #f2f4f8;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-nav:hover:not(:disabled) {
  background: rgba(50, 56, 68, 0.95);
  border-color: rgba(255, 255, 255, 0.35);
}

.lightbox-nav:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.lightbox-prev {
  left: 0.25rem;
}

.lightbox-next {
  right: 0.25rem;
}

.lightbox-viewport {
  overflow: hidden;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.lightbox-strip {
  display: flex;
  flex-direction: row;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  padding: 12px 52px;
  max-height: min(85vh, 760px);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.lightbox-strip img {
  max-height: min(82vh, 720px);
  width: auto;
  max-width: min(94vw, 100%);
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
  user-select: none;
}

.lightbox-count {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(242, 244, 248, 0.85);
}

@media (max-width: 520px) {
  .lightbox-close {
    top: -2rem;
    right: -0.25rem;
  }

  .lightbox-nav {
    width: 38px;
    height: 46px;
    font-size: 1.35rem;
  }

  .lightbox-strip {
    padding: 10px 42px;
  }
}
