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

:root {
  --bg0: #0a0a0a;
  --bg1: #111111;
  --bg2: #1a1a1a;
  --bg3: #222222;
  --border: #2a2a2a;
  --red: #e11d48;
  --red-bright: #fb2d5a;
  --red-dim: #9f1239;
  --red-glow: rgba(225, 29, 72, 0.35);
  --text: #f1f1f1;
  --muted: #9ca3af;
  --muted2: #6b7280;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: radial-gradient(ellipse at 50% 0%, #1a0508 0%, var(--bg0) 55%);
  min-height: 100vh;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card {
  background: linear-gradient(180deg, #161616 0%, #0f0f0f 100%);
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 0 0 1px rgba(225, 29, 72, 0.15),
    0 25px 60px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(225, 29, 72, 0.08);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
}

.avatar {
  width: 56px;
  height: 56px;
  background: linear-gradient(145deg, #2a0a12, #1a0508);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  border: 1px solid rgba(225, 29, 72, 0.4);
  box-shadow: 0 0 20px rgba(225, 29, 72, 0.2);
}

.avatar svg { width: 28px; height: 28px; color: var(--red-bright); }

h1 {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(90deg, #fda4af, var(--red-bright), #fda4af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.subtitle {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 28px;
}

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-group label .req { color: var(--red-bright); }

.input-wrap { position: relative; }

.input-wrap .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted2);
  font-size: 1rem;
}

input, select, textarea {
  width: 100%;
  padding: 14px 14px 14px 42px;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15);
}

input::placeholder { color: #4b5563; }

.hint {
  font-size: 0.75rem;
  color: var(--muted2);
  margin-top: 6px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
  letter-spacing: 0.3px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red-dim), var(--red));
  color: white;
  box-shadow: 0 4px 24px var(--red-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(225, 29, 72, 0.5);
  background: linear-gradient(135deg, var(--red), var(--red-bright));
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-success {
  background: linear-gradient(135deg, #9f1239, var(--red));
  color: white;
  box-shadow: 0 4px 20px var(--red-glow);
}

.btn-danger {
  background: #450a0a;
  color: #fecaca;
  padding: 8px 14px;
  font-size: 0.85rem;
  width: auto;
  border: 1px solid #7f1d1d;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
  width: auto;
}

.footer-link {
  text-align: center;
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--muted2);
}

.footer-link a { color: var(--red); text-decoration: none; }

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--bg2);
  color: var(--text);
  padding: 14px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  z-index: 9999;
  transition: transform 0.3s;
  max-width: 90%;
  text-align: center;
}

.toast.show { transform: translateX(-50%) translateY(0); }

.toast.error {
  border-color: #7f1d1d;
  background: #1c0a0a;
  color: #fecaca;
}

.toast.success {
  border-color: var(--red-dim);
  background: #1a0508;
  color: #fda4af;
}

/* Steps customer */
.step { display: none; }
.step.active { display: block; }

.key-info {
  background: linear-gradient(145deg, #1a080c, #120508);
  border: 1px solid rgba(225, 29, 72, 0.35);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.key-info .days {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--red-bright);
}

.back-btn {
  background: transparent;
  border: none;
  color: var(--red);
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 12px;
  padding: 0;
}

.back-btn:hover { text-decoration: underline; }

/* Admin */
.admin-layout {
  max-width: 980px;
  width: 100%;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: linear-gradient(160deg, #1a1a1a, #121212);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 1px rgba(225, 29, 72, 0.05);
}

.stat-card .num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--red-bright);
}

.stat-card .label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.section {
  background: linear-gradient(180deg, #141414, #0f0f0f);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.section h2 {
  font-size: 1.05rem;
  margin-bottom: 16px;
  color: #fda4af;
}

.login-box { max-width: 360px; }

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

.form-row .form-group {
  flex: 1;
  min-width: 120px;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th {
  background: #1a0a0e;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid #1a1a1a;
  color: #d1d5db;
  vertical-align: middle;
}

tr:hover td { background: rgba(225, 29, 72, 0.04); }
tr:last-child td { border-bottom: none; }

.mono {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
  color: #fda4af;
}

.date-cell {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.uid-cell {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-pending {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.badge-done {
  background: rgba(225, 29, 72, 0.15);
  color: #fb7185;
  border: 1px solid rgba(225, 29, 72, 0.3);
}

.badge-cancel {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.days-pill {
  display: inline-block;
  background: #1a0a0e;
  border: 1px solid rgba(225, 29, 72, 0.3);
  color: #fda4af;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
}

.action-btns { display: flex; gap: 4px; flex-wrap: nowrap; }

.action-btns .btn-sm {
  padding: 5px 10px;
  font-size: 0.72rem;
  border-radius: 8px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted2);
}

.empty-state .icon { font-size: 2rem; margin-bottom: 8px; }

/* Admin toolbar / tabs */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

.toolbar input[type="text"], .toolbar select {
  padding: 10px 14px;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  min-width: 160px;
}

.toolbar input:focus, .toolbar select:focus {
  border-color: var(--red);
}

.check-col { width: 36px; text-align: center; }

.bulk-bar {
  display: none;
  background: #1a0a0e;
  border: 1px solid rgba(225, 29, 72, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.bulk-bar.show { display: flex; }

.keys-result {
  margin-top: 14px;
  padding: 12px;
  background: var(--bg0);
  border-radius: 10px;
  border: 1px solid rgba(225, 29, 72, 0.3);
  max-height: 180px;
  overflow-y: auto;
  display: none;
}

.keys-result code {
  display: block;
  color: #fda4af;
  font-size: 0.9rem;
  padding: 2px 0;
}

.tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-nav button {
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-nav button.active {
  background: linear-gradient(135deg, #3f0a18, #5c0f22);
  color: #fecdd3;
  border-color: var(--red);
  box-shadow: 0 0 16px rgba(225, 29, 72, 0.2);
}

.tab-nav button:hover:not(.active) {
  border-color: rgba(225, 29, 72, 0.4);
  color: #fda4af;
}

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

@media (max-width: 480px) {
  .card { padding: 28px 20px; }
  h1 { font-size: 1.15rem; }
}
