* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f5f7;
  --card: #fff;
  --border: #e5e5ea;
  --text: #1a1a1a;
  --text-muted: #8a8a8e;
  --brand: #4a7dff;
  --danger: #ef4444;
  --success: #22c55e;
  --warn: #f59e0b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Логин */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.login-card h1 {
  font-size: 22px;
  margin-bottom: 20px;
  text-align: center;
}
.login-card input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  margin-bottom: 12px;
  outline: none;
}
.login-card input:focus { border-color: var(--brand); }
.login-card button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:disabled { opacity: 0.5; cursor: default; }
.login-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-top: 10px;
  min-height: 18px;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 0 20px 20px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-nav button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 20px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.sidebar-nav button:hover { background: var(--bg); }
.sidebar-nav button.active {
  color: var(--brand);
  border-left-color: var(--brand);
  background: rgba(74,125,255,0.08);
}
.sidebar-footer {
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
.sidebar-footer button {
  background: none;
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
  width: 100%;
  font-size: 13px;
}

.main {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}
.main h1 {
  font-size: 24px;
  margin-bottom: 24px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--brand);
}
.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Table */
.table-card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(74,125,255,0.03); }

.btn {
  padding: 6px 12px;
  font-size: 13px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  margin-right: 4px;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-muted   { background: var(--bg); color: var(--text); }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.badge-new      { background: #dbeafe; color: #1d4ed8; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-active   { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.filter-bar {
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
}
.filter-bar input,
.filter-bar select {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  outline: none;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  background: #1a1a1a;
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: fadeIn 0.2s;
  z-index: 999;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ================ MODAL ================ */

.modal-overlay {

  position: fixed;

  inset: 0;

  background: rgba(0,0,0,0.5);

  z-index: 1000;

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 20px;

}



.modal-sheet {

  background: #fff;

  border-radius: 14px;

  width: 100%;

  max-width: 520px;

  max-height: 90vh;

  overflow-y: auto;

  box-shadow: 0 8px 32px rgba(0,0,0,0.2);

}



.modal-header {

  position: relative;

  padding: 16px 20px;

  border-bottom: 1px solid var(--border);

}



.modal-title {

  font-size: 17px;

  font-weight: 700;

  text-align: center;

}



.modal-close {

  position: absolute;

  left: 12px;

  top: 50%;

  transform: translateY(-50%);

  width: 30px;

  height: 30px;

  border-radius: 50%;

  border: none;

  background: var(--bg);

  font-size: 18px;

  cursor: pointer;

  color: var(--text-muted);

}



.modal-body {

  padding: 20px;

}



.modal-info {

  padding: 10px 12px;

  background: var(--bg);

  border-radius: 8px;

  font-size: 13px;

  color: var(--text-muted);

  margin-bottom: 16px;

}



.form-field { margin-bottom: 14px; }

.form-label {

  display: block;

  font-size: 13px;

  font-weight: 600;

  color: var(--text-muted);

  margin-bottom: 6px;

}

.form-input {

  width: 100%;

  padding: 10px 12px;

  font-size: 14px;

  border: 1px solid var(--border);

  border-radius: 8px;

  background: var(--bg);

  outline: none;

  font-family: inherit;

}

.form-input:focus { border-color: var(--brand); background: #fff; }



.form-row { display: flex; gap: 12px; }

.form-row .form-field { flex: 1; }



.geocode-item {

  padding: 10px 12px;

  border: 1px solid var(--border);

  border-radius: 8px;

  margin-bottom: 8px;

  cursor: pointer;

  transition: background 0.1s;

}

.geocode-item:hover { background: var(--bg); }

.geocode-name { font-weight: 600; font-size: 14px; }

.geocode-detail { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.geocode-coords { font-size: 12px; color: var(--text-muted); margin-top: 4px; }



.modal-actions {

  display: flex;

  gap: 8px;

  margin-top: 16px;

}

.modal-actions .btn {

  flex: 1;

  padding: 12px;

  font-size: 14px;

}




/* ============ REPORT / USER MODAL ============ */

.modal-overlay {

  position: fixed;

  inset: 0;

  background: rgba(15, 18, 34, 0.6);

  z-index: 1000;

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 20px;

  animation: fadeIn 0.15s;

}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }



.modal-sheet {

  background: #fff;

  border-radius: 16px;

  width: 100%;

  max-width: 640px;

  max-height: 92vh;

  overflow-y: auto;

  box-shadow: 0 20px 60px rgba(0,0,0,0.25);

  animation: confirmPop 0.2s cubic-bezier(0.22, 1, 0.36, 1);

}

@keyframes confirmPop {

  from { opacity: 0; transform: scale(0.95) }

  to   { opacity: 1; transform: scale(1) }

}



.modal-header {

  position: sticky;

  top: 0;

  background: #fff;

  padding: 16px 20px;

  border-bottom: 1px solid var(--border);

  display: flex;

  align-items: center;

  z-index: 1;

}

.modal-title { font-size: 17px; font-weight: 700; flex: 1; }

.modal-close {

  width: 32px; height: 32px; border-radius: 50%;

  border: none; background: var(--bg);

  font-size: 20px; cursor: pointer; color: var(--text-muted);

}

.modal-close:hover { background: var(--border); }



.modal-body { padding: 20px; }



.report-block {

  background: var(--bg);

  border-radius: 12px;

  padding: 4px 16px;

  margin-bottom: 16px;

}



.report-row {

  display: flex;

  justify-content: space-between;

  align-items: flex-start;

  gap: 16px;

  padding: 12px 0;

  font-size: 14px;

}

.report-row + .report-row { border-top: 1px solid var(--border); }



.report-label { color: var(--text-muted); font-weight: 600; flex-shrink: 0; }

.report-value { text-align: right; max-width: 70%; word-break: break-word; }



.report-comment {

  text-align: left !important;

  max-width: 100% !important;

  white-space: pre-wrap;

  background: #fff;

  padding: 10px 12px;

  border-radius: 8px;

  margin-top: 4px;

}



.report-card-row {

  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 12px;

  margin-bottom: 16px;

}



.report-card {

  background: var(--bg);

  border-radius: 12px;

  padding: 14px;

  display: flex;

  flex-direction: column;

  gap: 6px;

}



.report-card-title {

  font-size: 11px;

  font-weight: 700;

  color: var(--text-muted);

  text-transform: uppercase;

  letter-spacing: 0.5px;

}

.report-card-name { font-size: 15px; font-weight: 700; }

.report-card-id { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }



.btn-block { width: 100%; padding: 8px 12px; font-size: 13px; }



.report-actions {

  display: flex;

  gap: 8px;

  flex-wrap: wrap;

  margin-top: 8px;

}

.report-actions .btn { flex: 1; min-width: 120px; padding: 12px; font-size: 14px; }



/* User card */

.user-card {

  display: flex;

  gap: 16px;

  padding: 16px;

  background: var(--bg);

  border-radius: 12px;

  margin-bottom: 8px;

}



.user-avatar {

  width: 72px;

  height: 72px;

  border-radius: 50%;

  background: linear-gradient(135deg, #ff8a8a, #dc2626);

  color: #fff;

  display: flex;

  align-items: center;

  justify-content: center;

  font-size: 28px;

  font-weight: 800;

  overflow: hidden;

  flex-shrink: 0;

}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }



.user-info { flex: 1; min-width: 0; }

.user-name { font-size: 17px; font-weight: 700; margin-bottom: 4px; }

.user-id { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.user-meta { font-size: 13px; color: var(--text); margin-bottom: 4px; }



.modal-section {

  font-size: 13px;

  font-weight: 700;

  color: var(--text-muted);

  text-transform: uppercase;

  letter-spacing: 0.5px;

  margin: 20px 0 10px;

}



.modal-empty {

  padding: 16px;

  text-align: center;

  color: var(--text-muted);

  font-size: 13px;

  background: var(--bg);

  border-radius: 10px;

}



.mini-list {

  display: flex;

  flex-direction: column;

  gap: 6px;

}



.mini-item {

  padding: 10px 12px;

  background: var(--bg);

  border-radius: 8px;

  font-size: 13px;

}

.mini-item-title { font-weight: 600; margin-bottom: 2px; }

.mini-item-sub { font-size: 12px; color: var(--text-muted); }




/* ============ USERS LIST ============ */

.user-totals {

  display: flex;

  gap: 16px;

  margin-bottom: 12px;

  font-size: 13px;

  color: var(--text-muted);

}

.user-total b { color: var(--text); }



/* ============ USER PAGE ============ */

.user-page-header {

  margin-bottom: 16px;

}



.user-hero {

  display: flex;

  align-items: center;

  gap: 20px;

  padding: 24px;

  background: #fff;

  border-radius: 16px;

  box-shadow: 0 2px 8px rgba(0,0,0,0.04);

  margin-bottom: 16px;

  flex-wrap: wrap;

}



.user-avatar.big {

  width: 88px;

  height: 88px;

  font-size: 34px;

}



.user-hero-info { flex: 1; min-width: 200px; }

.user-hero-name { font-size: 24px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.02em; }

.user-hero-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; }

.user-hero-badges { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.user-rating-hero { font-size: 14px; color: #dc2626; font-weight: 700; }



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



.user-stats-grid {

  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));

  gap: 12px;

  margin-bottom: 16px;

}

.stat-card-warn { border: 1px solid var(--danger); }

.stat-card-warn .stat-value { color: var(--danger); }



.user-form-card {

  background: #fff;

  border-radius: 16px;

  box-shadow: 0 2px 8px rgba(0,0,0,0.04);

  padding: 20px 24px;

  margin-bottom: 16px;

}

.user-form-head {

  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 16px;

}

.user-form-head h2 { font-size: 16px; margin: 0; }



.user-form-fields {

  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));

  gap: 14px;

}



.user-field-label {

  font-size: 11px;

  font-weight: 700;

  color: var(--text-muted);

  text-transform: uppercase;

  letter-spacing: 0.5px;

  margin-bottom: 6px;

}

.user-field-value {

  font-size: 15px;

  font-weight: 600;

  padding: 10px 0;

  color: var(--text);

}



.user-form-actions {

  grid-column: 1 / -1;

  display: flex;

  gap: 8px;

  justify-content: flex-end;

  margin-top: 8px;

}



.user-tabs {

  display: flex;

  gap: 4px;

  padding: 4px;

  background: var(--bg);

  border-radius: 12px;

  margin-bottom: 16px;

  border: 1px solid var(--border);

  overflow-x: auto;

  -webkit-overflow-scrolling: touch;

}



.user-tab {

  flex: 1;

  min-width: 120px;

  padding: 10px 14px;

  border: none;

  background: none;

  border-radius: 8px;

  font-size: 14px;

  font-weight: 700;

  color: var(--text-muted);

  cursor: pointer;

  font-family: inherit;

  white-space: nowrap;

  transition: background 0.2s, color 0.2s;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 6px;

}

.user-tab:hover { color: var(--text); }

.user-tab.active {

  background: #fff;

  color: var(--text);

  box-shadow: 0 1px 3px rgba(0,0,0,0.06);

}



.user-tab-count {

  display: inline-flex;

  align-items: center;

  justify-content: center;

  min-width: 20px;

  height: 20px;

  padding: 0 6px;

  border-radius: 10px;

  background: var(--border);

  color: var(--text-muted);

  font-size: 11px;

  font-weight: 800;

}

.user-tab-count.warn {

  background: #fee2e2;

  color: #991b1b;

}

.user-tab.active .user-tab-count {

  background: linear-gradient(135deg, #ff8a8a, #dc2626);

  color: #fff;

}



/* ============ GEOCODE ============ */

.geocode-item {

  padding: 10px 12px;

  border: 1px solid var(--border);

  border-radius: 8px;

  margin-bottom: 8px;

  cursor: pointer;

  transition: background 0.1s;

}

.geocode-item:hover { background: var(--bg); }

.geocode-name { font-weight: 600; font-size: 14px; }

.geocode-detail { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.geocode-coords { font-size: 12px; color: var(--text-muted); margin-top: 4px; }




/* ============ SUPPORT CHAT ============ */

.support-chat {

  max-height: 400px;

  overflow-y: auto;

  padding: 12px;

  background: var(--bg);

  border-radius: 12px;

  margin-bottom: 12px;

  display: flex;

  flex-direction: column;

  gap: 8px;

}



.support-msg {

  display: flex;

  flex-direction: column;

  max-width: 78%;

}

.support-msg.user { align-self: flex-start; align-items: flex-start; }

.support-msg.sup  { align-self: flex-end;   align-items: flex-end; }



.support-bubble {

  padding: 10px 14px;

  border-radius: 16px;

  font-size: 14px;

  line-height: 1.4;

  word-break: break-word;

  white-space: pre-wrap;

}

.support-msg.user .support-bubble {

  background: #fff;

  border: 1px solid var(--border);

  color: var(--text);

  border-bottom-left-radius: 4px;

}

.support-msg.sup .support-bubble {

  background: linear-gradient(135deg, #93c5fd 0%, #3b82f6 55%, #1d4ed8 100%);

  color: #fff;

  border-bottom-right-radius: 4px;

}



.support-time {

  font-size: 11px;

  color: var(--text-muted);

  margin-top: 3px;

  padding: 0 4px;

}



.support-input-bar {

  display: flex;

  gap: 8px;

  align-items: flex-end;

}

.support-input-bar textarea { flex: 1; resize: none; }

.support-input-bar button { flex-shrink: 0; padding: 10px 16px; }

.badge-resolved { background: #e0e7ff; color: #3730a3; }