:root {
  --bg: #0c0c0e;
  --card: #131316;
  --card-alt: #101013;
  --border: #26262c;
  --text: #e4e4ea;
  --text-dim: #a0a0aa;
  --accent: #c4c4ce;
  --success: #23a55a;
  --warning: #f0b232;
  --danger: #ed4245;
  --radius: 14px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2f2f4;
    --card: #ffffff;
    --card-alt: #f7f7f9;
    --border: #e0e0e4;
    --text: #262630;
    --text-dim: #6e6e78;
    --accent: #4b5563;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(196,196,206,.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(196,196,206,.04) 0%, transparent 50%);
  background-attachment: fixed;
}
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}
h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 12px;
  color: var(--text);
}

/* Summary bar */
.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.sum-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
}
.sum-item::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.sum-total::before { background: var(--accent); }
.sum-checking::before { background: var(--warning); }
.sum-free::before { background: var(--success); }
.sum-rented {
  color: var(--danger);
  border-color: rgba(237, 66, 69, 0.5);
}
.sum-rented::before { background: var(--danger); }

/* Card grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.acc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease;
}
.acc-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
}
/* Status border + soft background tint so it doesn't hurt the eyes */
.acc-card.acc-available { border-color: rgba(35, 165, 90, 0.35); background-color: rgba(35, 165, 90, 0.08); }
.acc-card.acc-rented { border-color: rgba(237, 66, 69, 0.35); background-color: rgba(237, 66, 69, 0.08); }
.acc-card.acc-checking { border-color: rgba(240, 178, 50, 0.35); background-color: rgba(240, 178, 50, 0.08); }
.acc-card.acc-metro_ban { border-color: rgba(139, 143, 163, 0.35); }
.acc-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.num-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #8a8a94);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
/* Num-badge tinted by account status */
.num-badge.nb-available { background: linear-gradient(135deg, #1f8a4c, #176b3a); }
.num-badge.nb-rented { background: linear-gradient(135deg, #c23538, #9a2a2d); }
.num-badge.nb-checking { background: linear-gradient(135deg, #c4922a, #9a7220); }
.num-badge.nb-metro_ban { background: linear-gradient(135deg, #5a5e6e, #44475a); }
.acc-title { flex: 1; min-width: 0; }
.acc-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; }
.badge-available { background: rgba(35,165,90,.12); color: var(--success); }
.badge-available .badge-dot { background: var(--success); }
.badge-rented { background: rgba(237,66,69,.12); color: var(--danger); }
.badge-rented .badge-dot { background: var(--danger); }
.badge-metro_ban { background: rgba(240,178,50,.12); color: var(--warning); }
.badge-metro_ban .badge-dot { background: var(--warning); }

.rental-until {
  display: inline-block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--danger);
}

/* Rental progress bar */
.rental-progress {
  margin-top: 8px;
}
.rental-progress-bar {
  width: 100%;
  height: 5px;
  border-radius: 4px;
  background: rgba(237, 66, 69, 0.15);
  overflow: hidden;
}
.rental-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #c23538, #ed4245);
  transition: width 0.9s linear;
}
.rental-progress-label {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 4px;
}
.rental-remain {
  font-variant-numeric: tabular-nums;
}

/* Price */
.price-block {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.5;
}

/* Actions */
.acc-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* Video preview in card */
.acc-video {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  margin-top: auto;
  aspect-ratio: 16/9;
  background: #000;
}
.acc-video video,
.acc-video img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.acc-video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
  transition: background .2s ease;
}
.acc-video:hover .acc-video-overlay {
  background: rgba(0,0,0,.2);
}
.acc-video-play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  display: flex;
  align-items: center;
  justify-content: center;
}
.acc-video-play::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent #1a1d27;
  margin-left: 3px;
}

.link-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s ease;
}
.link-btn:hover { opacity: .8; }
.link-video {
  background: linear-gradient(135deg, rgba(196,196,206,.12), rgba(196,196,206,.06));
  color: var(--text);
  border: 1px solid rgba(196,196,206,.25);
}
.link-fp {
  background: linear-gradient(135deg, var(--card-alt), var(--card));
  color: var(--text);
  border: 1px solid var(--border);
}
.no-link {
  flex: 1;
  text-align: center;
  padding: 8px 10px;
  color: var(--text-dim);
  font-size: 12px;
}

/* Video modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: min(1600px, 98vw);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 600; font-size: 14px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}
.modal-close:hover {
  color: var(--text);
  background: rgba(255,255,255,.1);
}

/* Custom video player */
.player-layout {
  display: flex;
  align-items: stretch;
}
.player-wrap {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.player-wrap video {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: contain;
  display: block;
  -webkit-user-select: none;
  user-select: none;
}
@media (max-width: 700px) {
  .modal-overlay#modal {
    align-items: center;
    justify-content: center;
    padding: 8px;
  }
  .modal-overlay#modal .modal-box {
    width: 100%;
    max-width: 100% !important;
    height: auto;
  }
  .modal-overlay#modal .player-wrap {
    max-height: calc(100vh - 120px);
  }
  .modal-overlay#modal .player-wrap video {
    max-height: calc(100vh - 120px);
    width: auto;
    max-width: 100%;
    margin: 0 auto;
  }
}
.player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  padding: 30px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 1;
  transition: opacity .3s ease;
}
.player-wrap.hide-controls .player-controls {
  opacity: 0;
  pointer-events: none;
}
.player-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.player-progress {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,.25);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}
.player-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  position: relative;
}
.player-progress-fill::after {
  content: '';
  position: absolute;
  right: -6px;
  top: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transition: opacity .2s;
}
.player-progress:hover .player-progress-fill::after { opacity: 1; }
.player-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background .15s;
}
.player-btn:hover { background: rgba(255,255,255,.15); }
.player-btn svg { width: 22px; height: 22px; fill: #fff; }
.player-time {
  color: rgba(255,255,255,.8);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 80px;
  text-align: center;
}
.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.player-vol {
  display: flex;
  align-items: center;
  gap: 6px;
}
.player-vol input[type=range] {
  width: 70px;
  accent-color: var(--accent);
}

@media (max-width: 600px) {
  .modal-overlay { padding: 10px; }
  .modal-box { max-width: 100%; border-radius: 10px; }
  .player-wrap video { max-height: 50vh; }
  .player-vol { display: none; }
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
  font-size: 13px;
  grid-column: 1 / -1;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Details modal prices */
.det-price-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.det-price-row:last-child { border-bottom: none; }
.det-price-row span:last-child { font-weight: 600; color: var(--accent); }

/* Clickable ID */
.copy-id {
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(196,196,206,.12);
  border: 1px solid rgba(196,196,206,.25);
  transition: all .2s;
}
.copy-id:hover {
  background: rgba(196,196,206,.22);
  border-color: var(--accent);
}

/* Lots in details modal */
.det-lot {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.det-lot:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.det-lot-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 4px;
}
