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

body {
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  background: #0f0c29;
  color: #1a1a2e;
  -webkit-font-smoothing: antialiased;
}

.bg-gradient {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

.container {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}

/* ── Card ── */
.card {
  background: #fff;
  border-radius: 20px;
  width: 100%; max-width: 480px;
  padding: 2.5rem 2rem;
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
}

.card-header { margin-bottom: 2rem; text-align: center; }
.badge {
  display: inline-block;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff; font-size: .7rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  padding: .3rem .9rem; border-radius: 20px; margin-bottom: .9rem;
}
.card-header h1 { font-size: 1.5rem; font-weight: 800; color: #1a1a2e; margin-bottom: .35rem; }
.card-header p  { font-size: .88rem; color: #778; }
.card-hint { font-size: 1.1rem !important; color: #445 !important; font-weight: 500; }

/* ── Alert ── */
.alert {
  background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c;
  border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1.25rem;
  font-size: .85rem;
}

/* ── Fields ── */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: #445; margin-bottom: .4rem; }
.req { color: #e74c3c; }
.field input[type="text"],
.field input[type="tel"] {
  width: 100%; padding: .75rem 1rem;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: .95rem; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.field input:focus {
  border-color: #764ba2;
  box-shadow: 0 0 0 3px rgba(118,75,162,.15);
}

/* ── Search box ── */
.search-box-wrap {
  position: relative; display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: .85rem; font-size: 1rem; pointer-events: none; z-index: 1;
}
#search {
  width: 100%; padding: .75rem 2.6rem .75rem 2.5rem;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: .95rem; font-family: inherit; outline: none;
  background: #f8f9ff;
  transition: border-color .2s, box-shadow .2s;
}
#search:focus {
  border-color: #764ba2;
  box-shadow: 0 0 0 3px rgba(118,75,162,.15);
  background-color: #fff;
}
#search-clear {
  position: absolute; right: .75rem;
  background: none; border: none; cursor: pointer;
  color: #9ca3af; font-size: .85rem; display: none;
  align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
}
#search-clear:hover { background: #f0ecff; color: #764ba2; }

/* ── Names list ── */
.names-list {
  max-height: 320px; overflow-y: auto;
  border: 1.5px solid #e2e8f0; border-radius: 12px;
  margin-top: .5rem;
}
.names-list::-webkit-scrollbar { width: 4px; }
.names-list::-webkit-scrollbar-track { background: transparent; }
.names-list::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 4px; }

.name-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1rem; cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid #f4f4f8;
}
.name-item:last-child { border-bottom: none; }
.name-item:hover { background: #f5f0ff; }
.name-item:active { background: #ede9fe; }
.name-item-icon { font-size: .95rem; flex-shrink: 0; }
.name-item-text { flex: 1; font-size: .88rem; color: #1a1a2e; }
.name-item-text mark { background: #c4b5fd55; color: #5b21b6; border-radius: 2px; padding: 0 1px; }
.name-item-arrow { color: #c4b5fd; font-size: 1.1rem; font-weight: 700; }
.name-item--new { background: #fafaf5; }
.name-item--new .name-item-text { color: #764ba2; font-style: italic; }
.name-item--new .name-item-icon { color: #764ba2; }

/* ── Selected name bar ── */
.selected-name-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #f0ecff; border: 1.5px solid #c4b5fd;
  border-radius: 10px; padding: .65rem 1rem;
  font-size: .9rem; font-weight: 600; color: #5b21b6;
  margin-bottom: 1.1rem;
}
.selected-name-bar button {
  background: none; border: none; cursor: pointer;
  color: #9ca3af; font-size: .78rem; font-weight: 500;
  padding: .2rem .5rem; border-radius: 6px;
  transition: background .15s, color .15s;
}
.selected-name-bar button:hover { background: rgba(118,75,162,.15); color: #5b21b6; }

/* ── Submit button ── */
.btn-submit {
  width: 100%; margin-top: .5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff; border: none; border-radius: 12px;
  padding: .9rem 1.5rem; font-size: 1rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .6rem;
  transition: opacity .2s, transform .1s;
}
.btn-submit:hover { opacity: .92; }
.btn-submit:active { transform: scale(.98); }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; }

/* ── Success ── */
.card--success { text-align: center; }
.success-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.card--success h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: .5rem; }
.success-msg { font-size: 1rem; color: #556; margin-bottom: 1.25rem; }
.wa-notice {
  background: #dcf8c6; border-radius: 12px;
  padding: .9rem 1.1rem; display: flex; align-items: flex-start; gap: .75rem;
  font-size: .88rem; color: #1a472a; text-align: left; margin-bottom: 1.25rem;
}
.wa-icon { font-size: 1.3rem; flex-shrink: 0; }
.success-sub { font-size: .85rem; color: #99a; line-height: 1.6; }

/* ── Admin ── */
.admin-body { background: #0f0c29; color: #fff; }

.admin-header {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 1.25rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.admin-title { font-size: 1.2rem; font-weight: 800; }
.admin-sub   { font-size: .78rem; color: #8899bb; margin-top: .1rem; }

.counter-wrap { text-align: center; }
.counter {
  font-size: 2.5rem; font-weight: 900;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.counter-label { font-size: .7rem; color: #778; text-transform: uppercase; letter-spacing: .1em; }

.admin-stats {
  display: flex; gap: 1rem; padding: 1rem 2rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.stat-card {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; padding: .75rem 1.25rem; text-align: center; flex: 1;
}
.stat-val { font-size: 1.5rem; font-weight: 800; color: #a78bfa; }
.stat-lbl { font-size: .7rem; color: #778; text-transform: uppercase; letter-spacing: .08em; }

.admin-list { padding: 1rem 2rem 3rem; display: flex; flex-direction: column; gap: .65rem; }

.admin-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px; padding: .9rem 1.1rem;
  display: flex; align-items: center; gap: 1rem;
}
.admin-card--new {
  background: rgba(118,75,162,.18);
  border-color: rgba(118,75,162,.4);
}
.admin-card--animate {
  animation: slideIn .4s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ac-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.1); color: #a78bfa;
  font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ac-info { flex: 1; min-width: 0; }
.ac-name { font-size: .95rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-meta { font-size: .75rem; color: #8899bb; margin-top: .1rem; }
.ac-right { text-align: right; flex-shrink: 0; }
.ac-phone { font-size: .78rem; color: #a78bfa; font-weight: 600; }
.ac-time  { font-size: .72rem; color: #556; }
.ac-wa    { font-size: .7rem; background: rgba(37,211,102,.2); color: #25d366; border-radius: 20px; padding: .1rem .5rem; display: inline-block; margin-top: .2rem; }
.ac-del {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.2); font-size: .85rem;
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s, color .15s;
}
.ac-del:hover { background: rgba(239,68,68,.2); color: #ef4444; }
.ac-del:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 480px) {
  .card { padding: 2rem 1.25rem; border-radius: 16px; }
  .admin-header { padding: 1rem; }
  .admin-stats { padding: .75rem 1rem; }
  .admin-list { padding: .75rem 1rem 3rem; }
}
