:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --panel: #ffffff;
  --line: #dbe3e8;
  --text: #12202b;
  --muted: #607180;
  --accent: #0b7a75;
  --accent-soft: #e3f4f2;
  --danger: #b25555;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f6f8;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.loader-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-panel {
  width: min(320px, calc(100vw - 40px));
}

.loader-title {
  font-size: 24px;
  font-weight: 700;
}

.loader-text {
  margin-top: 8px;
  color: var(--muted);
}

.loader-bar {
  height: 6px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe3e8;
}

.loader-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: loader-slide 1s ease-in-out infinite;
}

@keyframes loader-slide {
  0% { transform: translateX(-120%); }
  55% { transform: translateX(95%); }
  100% { transform: translateX(260%); }
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.sidebar {
  background: #eef3f5;
  border-right: 1px solid var(--line);
  padding: 20px;
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
}

.brand h1,
.topbar h2,
.panel-head h2,
.detail-title h2 {
  margin: 0;
}

.brand p,
.topbar p,
.muted,
.card-meta,
.detail-meta,
.contact-note,
.lot-note {
  color: var(--muted);
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.panel, .card, .detail-card, .gallery-card, .contact-card, .lots-card, .docs-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  margin-top: 20px;
  padding: 16px;
}

.panel-head, .topbar, .detail-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.ghost-action {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 12px;
}

.field, .field-row {
  margin-top: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}

.filter-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

input, select, button, textarea {
  font: inherit;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary-btn {
  background: var(--accent);
  color: white;
  padding: 12px 14px;
  margin-top: 14px;
}

.secondary-btn {
  background: #eef3f5;
  color: var(--text);
  padding: 12px 14px;
  margin-top: 12px;
  width: 100%;
  border: 1px solid var(--line);
}

.pdf-btn {
  width: auto;
  margin: 10px 0 12px;
}

.detail-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.detail-action-row .secondary-btn {
  width: auto;
  margin: 0;
}

.subscription-wall {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.subscription-card {
  width: min(440px, 100%);
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.subscription-card h1 {
  margin: 0;
  font-size: 28px;
}

.subscription-card p,
.subscription-status {
  color: var(--muted);
}

.subscription-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef3f5;
}

.subscription-card .primary-btn,
.subscription-card .secondary-btn {
  width: 100%;
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  padding: 6px 0;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.admin-tab {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.admin-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.checkbox-line input {
  width: auto;
}

.admin-list-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.admin-draft-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-top: 12px;
}

.admin-draft-image {
  display: block;
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 8px;
  margin-top: 12px;
}

.admin-draft-text {
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 1.5;
  color: var(--text);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-actions .primary-btn,
.admin-actions .secondary-btn {
  width: auto;
  margin-top: 0;
}

.content {
  padding: 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  overflow: hidden;
}

.card-cover img,
.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-main img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.card-cover {
  aspect-ratio: 4 / 3;
  background: #e7eef2;
}

.card-body {
  padding: 14px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
}

.card-price {
  font-weight: 700;
  margin-bottom: 8px;
}

.unknown-price {
  color: var(--muted);
}

.card-meta {
  font-size: 13px;
  line-height: 1.4;
}

.card-actions {
  margin-top: 12px;
}

.open-btn, .back-btn {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 10px 12px;
  width: 100%;
}

.hidden {
  display: none !important;
}

.detail-layout {
  display: grid;
  gap: 16px;
}

.detail-top {
  margin-bottom: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.gallery-card,
.detail-card,
.contact-card,
.lots-card,
.docs-card {
  padding: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.section-head h3 {
  margin: 0;
}

.price-guide-card {
  border-color: #c8dedb;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbfa 100%);
}

.lot-note {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid #bad8d4;
  background: #e3f4f2;
  color: #0b6f6a;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.gallery-main {
  aspect-ratio: 16 / 10;
  background: #e7eef2;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-thumbs {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.gallery-thumb {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef3f5;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 24, 0.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-shell {
  position: relative;
  width: min(96vw, 1400px);
  height: min(92vh, 1000px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-tapzone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: transparent;
  border-radius: 0;
  z-index: 1;
}

.lightbox-tapzone-left {
  left: 0;
}

.lightbox-tapzone-right {
  right: 0;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  position: relative;
  z-index: 0;
}

.lightbox-counter {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
}

.lightbox-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  min-width: 120px;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(15, 23, 30, 0.72);
  color: #fff;
  font-size: 16px;
  line-height: 44px;
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 36px;
  line-height: 1;
  z-index: 2;
}

.lightbox-nav:disabled {
  opacity: 0.4;
  cursor: default;
}

.lightbox-prev {
  left: 8px;
}

.lightbox-next {
  right: 8px;
}

.detail-description {
  line-height: 1.6;
  white-space: pre-wrap;
}

textarea {
  font: inherit;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  background: #eef3f5;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.contact-card.locked {
  background: linear-gradient(180deg, #ffffff 0%, #f6fbfb 100%);
}

.contact-card .primary-btn,
.contact-card .secondary-btn {
  width: 100%;
}

.contact-divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(12, 22, 30, 0.46);
}

.lead-modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.modal-head h2,
.modal-head p {
  margin: 0;
}

.modal-head p {
  margin-top: 6px;
  color: var(--muted);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.modal-status {
  margin-top: 10px;
}

.blur-line {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dfe6ea, #cfd8de, #dfe6ea);
  margin-top: 10px;
}

.lot-table {
  width: 100%;
  border-collapse: collapse;
}

.lot-table th,
.lot-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.docs-list {
  display: grid;
  gap: 10px;
}

.doc-link {
  display: flex;
  justify-content: space-between;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
