:root {
  --bg: #0f172a;
  --sidebar: #111827;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #10b981;
  --primary-dark: #059669;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #e2e8f0;
}

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

.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0f172a, #1e293b 55%, #064e3b);
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,0.98);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  display: grid;
  gap: 16px;
}

.brand { text-align: center; margin-bottom: 8px; }
.brand-icon { font-size: 42px; }
.brand h1 { margin: 8px 0 4px; }
.brand p { margin: 0; color: var(--muted); }

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-warning { background: #fef3c7; color: #92400e; }
.btn-ghost { background: transparent; color: #cbd5e1; }

.error-text { color: #b91c1c; font-size: 14px; margin: 0; }

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

.sidebar {
  background: var(--sidebar);
  color: white;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 18px;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
}
.nav-item:hover, .nav-item.active {
  background: rgba(16,185,129,0.15);
  color: white;
}

.logout-btn { margin-top: auto; }

.main {
  padding: 24px;
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section { display: none; }
.section.active { display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: white;
  border-radius: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15,23,42,0.05);
}
.stat-card .value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary-dark);
}
.stat-card .label {
  color: var(--muted);
  margin-top: 6px;
}

.toolbar { margin-bottom: 16px; }

.table-wrap {
  background: white;
  border-radius: 18px;
  border: 1px solid var(--border);
  overflow: auto;
}

table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}
th { background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

.tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.tag-ok { background: #dcfce7; color: #166534; }
.tag-bad { background: #fee2e2; color: #991b1b; }
.tag-warn { background: #fef3c7; color: #92400e; }

.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions .btn { padding: 7px 10px; font-size: 12px; }

.admin-map {
  height: 520px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.hint { color: var(--muted); font-size: 13px; }

.cards-grid {
  display: grid;
  gap: 16px;
}

.panel-card, .shop-card, .report-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}

.shop-card h3, .report-card h3 { margin-top: 0; }

.report-card .muted {
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.report-card code {
  font-size: 12px;
}

.report-preview {
  margin: 10px 0 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  background: #f8fafc;
}

.report-preview summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.report-preview-body {
  margin: 10px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
  max-height: 240px;
  overflow: auto;
}

.product-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.ad-form { margin-bottom: 20px; }
.ad-image-field { grid-column: 1 / -1; }
.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.ad-image-preview {
  margin-top: 10px;
  width: 120px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f8fafc;
}
.ad-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ad-image-preview.hidden { display: none; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.form-actions { display: flex; gap: 10px; margin-top: 14px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111827;
  color: white;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
  z-index: 9999;
}

.listing-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 10px;
  background: #f1f5f9;
  display: block;
}

.listing-thumb-empty {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10000;
}

.modal.hidden { display: none; }

.modal-card {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: white;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 20px;
}

.listing-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.listing-gallery img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 14px;
  background: #f8fafc;
  flex: 0 0 auto;
}

.listing-modal-desc {
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 10px;
  white-space: pre-wrap;
}

.listing-modal-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.lang-switcher {
  display: flex;
  gap: 6px;
  padding: 0 4px;
}

.lang-switcher-login {
  justify-content: center;
  margin-bottom: 4px;
}

.lang-btn {
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.sidebar .lang-btn {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
  flex: 1;
}

.lang-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.sidebar .lang-btn.active {
  background: rgba(16,185,129,0.35);
  border-color: rgba(16,185,129,0.6);
  color: white;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 10; }
  .nav-item { font-size: 13px; padding: 10px; }
}
