.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--button);
  animation: spin 1s linear infinite;
  opacity: 0;
}

.spinner.active {
  opacity: 1;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.primary,
.ghost,
.danger {
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary {
  background: linear-gradient(135deg, rgba(82, 148, 220, 0.9), rgba(72, 178, 160, 0.85));
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 12px 24px rgba(20, 35, 60, 0.25);
}

.ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--ink);
}

.danger {
  background: var(--danger);
  color: #fff;
}

.primary:hover,
.ghost:hover,
.danger:hover {
  transform: translateY(-1px);
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 16, 0.45);
  backdrop-filter: blur(6px);
}

.busy-card {
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--glass-shadow);
}

.busy-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--button);
  animation: spin 1s linear infinite;
}

.busy-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.toast-container {
  position: sticky;
  top: 6px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.toast {
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--blur));
}

.toast-danger {
  background: linear-gradient(135deg, rgba(255, 92, 92, 0.95), rgba(255, 150, 92, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  box-shadow: 0 18px 36px rgba(255, 92, 92, 0.3);
}

.toast-success {
  background: linear-gradient(135deg, rgba(50, 205, 120, 0.95), rgba(60, 220, 180, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  box-shadow: 0 18px 36px rgba(40, 200, 120, 0.3);
}

.ad-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 12px;
  background: var(--glass);
  backdrop-filter: blur(calc(var(--blur) / 2));
  overflow: hidden;
  position: relative;
  animation: card-enter 220ms ease-out;
}

.ad-photo {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  object-position: center 58%;
  border-radius: 0;
  margin: 0;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  display: block;
}

.ad-gallery {
  display: grid;
  gap: 0;
  width: 100%;
  margin: 0;
  overflow: hidden;
  height: 220px;
}

.ad-gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 58%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  display: block;
}

.ad-gallery-top {
  border-radius: var(--radius) var(--radius) 0 0;
}

.ad-gallery-bottom .ad-gallery-img:first-child {
  border-radius: 0;
}

.ad-gallery-bottom .ad-gallery-img:last-child {
  border-radius: 0;
}

.ad-gallery-two .ad-gallery-img:first-child {
  border-radius: 0;
}

.ad-gallery-two .ad-gallery-img:last-child {
  border-radius: 0;
}

.ad-gallery-two {
  grid-template-rows: 1fr;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}

.ad-gallery-three {
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
}

.ad-gallery-top {
  height: 100%;
  min-height: 0;
}

.ad-gallery-bottom {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
}

.ad-gallery-two .ad-gallery-img,
.ad-gallery-bottom .ad-gallery-img {
  height: 100%;
}

.ad-body {
  padding: 14px;
}

.ad-card:not(.ad-card-media) .ad-body {
  padding-top: 44px;
}

.ad-header {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 4;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ad-date-tag,
.ad-status-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  backdrop-filter: blur(8px);
  background: rgba(16, 20, 28, 0.58);
}

.ad-status-tag {
  margin-left: auto;
}

.ad-date-tag {
  color: var(--ink);
  background: rgba(120, 130, 150, 0.18);
}

.ad-status-tag.is-draft {
  color: #ffcc8a;
  background: rgba(255, 180, 86, 0.16);
}

.ad-status-tag.is-published {
  color: #8ee6b3;
  background: rgba(82, 195, 129, 0.16);
}

.ad-status-tag.is-updated {
  color: #96d2ff;
  background: rgba(82, 148, 220, 0.16);
}

.ad-status-tag.is-removed {
  color: #ffb0b0;
  background: rgba(201, 61, 61, 0.22);
}

:root[data-theme="light"] .ad-status-tag.is-draft {
  color: #9d5d09;
  background: rgba(255, 181, 70, 0.18);
}

:root[data-theme="light"] .ad-status-tag.is-published {
  color: #1a7f44;
  background: rgba(67, 176, 108, 0.17);
}

:root[data-theme="light"] .ad-status-tag.is-updated {
  color: #0b5ea1;
  background: rgba(67, 130, 210, 0.16);
}

:root[data-theme="light"] .ad-status-tag.is-removed {
  color: #a11f1f;
  background: rgba(214, 84, 84, 0.17);
}

:root[data-theme="light"] .ad-date-tag {
  color: #2f3b49;
  background: rgba(96, 110, 130, 0.14);
}

.ad-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 600;
}

:root[data-theme="light"] .ad-card,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .tabs,
:root[data-theme="light"] .modal,
:root[data-theme="light"] .busy-card,
:root[data-theme="light"] .toast {
  border-color: rgba(15, 18, 22, 0.08);
}

.ad-description {
  white-space: pre-wrap;
  word-break: break-word;
}

.ad-description blockquote {
  margin: 6px 0;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

.ad-description code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.ad-description .spoiler-text {
  border-radius: 4px;
  padding: 0 3px;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  color: transparent;
}

.ad-meta {
  display: flex;
  justify-content: space-between;
  color: var(--meta-text);
  font-size: 12px;
  margin-bottom: 10px;
}

.ad-card-expired {
  border-color: rgba(201, 61, 61, 0.6);
  box-shadow: inset 0 0 0 1px rgba(201, 61, 61, 0.3);
}

.ad-removed-note {
  margin: 0 0 10px;
  color: #ffb0b0;
  font-size: 12px;
  font-weight: 600;
}

:root[data-theme="light"] .ad-card-expired {
  border-color: rgba(184, 60, 60, 0.42);
  box-shadow: inset 0 0 0 1px rgba(184, 60, 60, 0.22);
}

:root[data-theme="light"] .ad-removed-note {
  color: #a11f1f;
}

.ad-price {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.ad-price-label {
  font-weight: 700;
  color: var(--ink);
}

.ad-price-value {
  font-weight: 600;
  color: var(--meta-text);
}

.ad-timestamp {
  margin-bottom: 14px;
}

.ad-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: nowrap;
}

.ad-action {
  flex: 1 1 auto;
  min-height: 38px;
  font-size: 12px;
}

.ad-action-main {
  flex: 1 1 auto;
}

.ad-action-icon {
  flex: 0 0 38px;
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ad-action-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ad-action-delete {
  box-shadow: none;
}

.ad-action-comments {
  position: relative;
}

.ad-action-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8b6b, #ff5d7a);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.ad-action-comments:disabled {
  opacity: 0.55;
  cursor: default;
}

.ad-open {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.14);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

:root[data-theme="light"] .ad-open {
  background: rgba(15, 20, 26, 0.08);
}

.ad-open:hover {
  background: rgba(255, 255, 255, 0.22);
}

@keyframes card-enter {
  from {
    transform: translateY(4px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal {
  width: min(92vw, 360px);
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  padding: 18px;
  animation: modal-enter 200ms ease-out;
}

.modal-wide {
  width: min(94vw, 520px);
}

#commentsOverviewModal .modal {
  background: rgba(24, 28, 36, 0.94);
  border-color: rgba(255, 255, 255, 0.18);
}

:root[data-theme="light"] #commentsOverviewModal .modal {
  background: rgba(248, 250, 255, 0.97);
  border-color: rgba(15, 20, 26, 0.14);
}

.modal-body {
  max-height: min(70vh, 520px);
  overflow: auto;
  padding-right: 4px;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-text {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 16px;
}

.modal-text-muted {
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-actions-wide {
  margin-top: 8px;
}

.comments-overview-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.comments-overview-empty {
  color: var(--meta-text);
  font-size: 13px;
  line-height: 1.4;
  padding: 6px 0 2px;
}

.comments-overview-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 10px;
  background: rgba(17, 21, 29, 0.84);
}

:root[data-theme="light"] .comments-overview-item {
  border-color: rgba(15, 20, 26, 0.14);
  background: rgba(255, 255, 255, 0.92);
}

.comments-overview-text {
  flex: 1 1 auto;
  min-width: 0;
}

.comments-overview-desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.comments-overview-meta {
  color: var(--meta-text);
  font-size: 12px;
}

.comments-overview-open {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 7px 10px;
  font-size: 12px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: linear-gradient(135deg, #3f8cff, #34b7a8);
  box-shadow: 0 8px 18px rgba(28, 56, 94, 0.35);
}

.comments-overview-open:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

:root[data-theme="light"] .comments-overview-open {
  color: #fff;
  border-color: rgba(32, 97, 184, 0.32);
  background: linear-gradient(135deg, #3a82ea, #2fa998);
  box-shadow: 0 6px 14px rgba(38, 100, 183, 0.2);
}

.comments-overview-actions {
  margin-top: 10px;
  padding-top: 2px;
}

.stats-body {
  padding-right: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stats-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .stats-card {
  background: rgba(15, 20, 26, 0.04);
}

.stats-card-label {
  font-size: 12px;
  color: var(--meta-text);
  line-height: 1.35;
  margin-bottom: 6px;
}

.stats-card-value {
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  color: var(--ink);
}

.stats-list-title {
  grid-column: 1 / -1;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.stats-ads-empty {
  grid-column: 1 / -1;
  color: var(--meta-text);
  font-size: 13px;
}

.stats-ad-row {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="light"] .stats-ad-row {
  background: rgba(15, 20, 26, 0.03);
}

.stats-ad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.stats-ad-owner {
  font-size: 12px;
  color: var(--meta-text);
}

.stats-ad-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid var(--border);
}

.stats-ad-status.is-draft {
  background: rgba(255, 175, 38, 0.18);
}

.stats-ad-status.is-published {
  background: rgba(72, 178, 160, 0.2);
}

.stats-ad-status.is-updated {
  background: rgba(82, 148, 220, 0.2);
}

.stats-ad-desc {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.expired-ads-body {
  display: grid;
  gap: 8px;
}

.expired-ads-empty {
  color: var(--meta-text);
  font-size: 13px;
}

.expired-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
}

.expired-ad-row {
  border: 1px solid rgba(201, 61, 61, 0.4);
  border-radius: 12px;
  padding: 10px;
  background: rgba(201, 61, 61, 0.1);
}

.draft-ad-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.expired-ad-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.expired-ad-owner {
  font-size: 12px;
  color: var(--meta-text);
}

.expired-ad-age {
  font-size: 11px;
  font-weight: 700;
  color: #ffb0b0;
}

.expired-ad-desc {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
  margin-bottom: 6px;
}

.expired-ad-date {
  font-size: 12px;
  color: var(--meta-text);
}

.expired-ad-open {
  margin-top: 8px;
}

.expired-draft-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.expired-ad-delete {
  min-width: 96px;
}

:root[data-theme="light"] .expired-ad-row {
  border-color: rgba(184, 60, 60, 0.35);
  background: rgba(184, 60, 60, 0.08);
}

:root[data-theme="light"] .draft-ad-row {
  background: rgba(15, 20, 26, 0.03);
}

:root[data-theme="light"] .expired-ad-age {
  color: #a11f1f;
}

@keyframes modal-enter {
  from {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
