:root {
  --bg:#0F1115;
  --panel:#161A20;
  --card:#1B2027;
  --border:#2A3038;
  --text:#F5F5F5;
  --text2:#A0A7B2;
  --accent:#D4AF37;
  --accent2:#b8962e;
  --red:#E74C3C;
  --green:#2ECC71;
  --blue:#3498DB;
}

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

html, body {
  height:100%;
  font-family:'Plus Jakarta Sans', sans-serif;
  background:var(--bg);
  color:var(--text);
}

body { overflow:hidden; }

#app {
  height:100vh;
  overflow:auto;
  background:var(--bg);
}

::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:var(--panel); }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--text2); }

input, select, textarea {
  background:var(--bg);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:10px;
  padding:11px 14px;
  font-family:inherit;
  font-size:14px;
  transition:.2s;
}

input:focus, select:focus, textarea:focus {
  outline:none;
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(212,175,55,.08);
}

.glass {
  background:rgba(27,32,39,.9);
  border:1px solid var(--border);
  backdrop-filter:blur(14px);
}

.card {
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
}

.card-hover { transition:.2s; }

.card-hover:hover {
  transform:translateY(-2px);
  box-shadow:0 12px 30px rgba(0,0,0,.28);
}

.gold-glow {
  box-shadow:0 0 24px rgba(212,175,55,.14);
}

.btn-gold {
  background:var(--accent);
  color:#000;
  font-weight:700;
  border:none;
  border-radius:10px;
  padding:10px 18px;
  cursor:pointer;
  transition:.2s;
  font-family:inherit;
}

.btn-gold:hover {
  background:var(--accent2);
  transform:translateY(-1px);
}

.btn-outline {
  background:transparent;
  color:var(--text2);
  border:1px solid var(--border);
  border-radius:10px;
  padding:9px 14px;
  cursor:pointer;
  transition:.2s;
  font-family:inherit;
}

.btn-outline:hover {
  border-color:var(--accent);
  color:var(--accent);
}

.btn-danger {
  background:rgba(231,76,60,.14);
  color:var(--red);
  border:1px solid rgba(231,76,60,.28);
  border-radius:10px;
  padding:9px 14px;
  cursor:pointer;
  transition:.2s;
  font-family:inherit;
}

.btn-danger:hover {
  background:rgba(231,76,60,.24);
}

.badge {
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:4px 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.4px;
  white-space:nowrap;
}

.badge-active {
  background:rgba(46,204,113,.14);
  color:var(--green);
}

.badge-expired {
  background:rgba(231,76,60,.14);
  color:var(--red);
}

.badge-locked {
  background:rgba(160,167,178,.14);
  color:var(--text2);
}

.badge-empty {
  background:rgba(52,152,219,.12);
  color:var(--blue);
}

.badge-demo {
  background:rgba(212,175,55,.14);
  color:var(--accent);
}

.sidebar-item { transition:.15s; }

.sidebar-item:hover,
.sidebar-item.active {
  background:rgba(212,175,55,.1);
  color:var(--accent);
}

.email-row {
  transition:.15s;
  cursor:pointer;
  border-bottom:1px solid var(--border);
}

.email-row:hover {
  background:rgba(212,175,55,.05);
}

.fade-in {
  animation:fadeIn .3s ease;
}

@keyframes fadeIn {
  from { opacity:0; transform:translateY(8px); }
  to { opacity:1; transform:translateY(0); }
}

.toast {
  position:fixed;
  top:18px;
  right:18px;
  padding:14px 18px;
  border-radius:12px;
  font-size:14px;
  z-index:9999;
  animation:fadeIn .2s;
  max-width:360px;
}

.toast-success {
  background:rgba(46,204,113,.15);
  border:1px solid rgba(46,204,113,.3);
  color:var(--green);
}

.toast-error {
  background:rgba(231,76,60,.15);
  border:1px solid rgba(231,76,60,.3);
  color:var(--red);
}

.toast-info {
  background:rgba(52,152,219,.15);
  border:1px solid rgba(52,152,219,.3);
  color:var(--blue);
}

.table-wrap {
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
}

table {
  width:100%;
  border-collapse:collapse;
}

th {
  text-align:left;
  padding:13px 16px;
  font-size:12px;
  color:var(--text2);
  border-bottom:1px solid var(--border);
  font-weight:700;
}

td {
  padding:13px 16px;
  font-size:13px;
  border-bottom:1px solid var(--border);
}

tr:hover td {
  background:rgba(212,175,55,.03);
}

@media (max-width: 900px) {
  body { overflow:auto; }

  #app {
    height:auto;
    min-height:100vh;
  }

  .admin-layout { flex-direction:column; }

  .sidebar {
    width:100% !important;
    min-height:auto !important;
    border-right:none !important;
    border-bottom:1px solid var(--border);
  }

  .sidebar nav {
    display:flex;
    overflow-x:auto;
  }

  .sidebar-item {
    white-space:nowrap;
  }

  .customer-main {
    flex-direction:column;
  }

  .email-list {
    width:100% !important;
    max-height:340px;
    border-right:none !important;
    border-bottom:1px solid var(--border);
  }

  .stats-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }

  .slot-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
}

/* MOBILE CLEAN MODE - dùng chung với app.js mobile list/detail */
@media (max-width: 768px) {
  html,
  body {
    width:100%;
    min-height:100%;
    overflow-x:hidden;
    overflow-y:auto;
  }

  body {
    background:var(--bg);
  }

  #app {
    height:auto;
    min-height:100vh;
    overflow:visible;
  }

  .h-screen,
  .customer-shell {
    height:auto !important;
    min-height:100vh !important;
  }

  .customer-header,
  header {
    display:block !important;
    padding:14px 16px !important;
    border-bottom:1px solid var(--border) !important;
  }

  .customer-brand,
  header > div:first-child {
    width:100% !important;
    margin-bottom:12px !important;
    display:flex !important;
    align-items:center !important;
    gap:12px !important;
  }

  .customer-brand span,
  header > div:first-child span {
    font-size:28px !important;
    line-height:1 !important;
  }

  .customer-actions,
  header > div:last-child {
    width:100% !important;
    display:grid !important;
    grid-template-columns:repeat(4,minmax(0,1fr)) !important;
    gap:8px !important;
  }

  .customer-actions button,
  header button {
    width:100% !important;
    min-height:42px !important;
    justify-content:center !important;
    padding:8px 6px !important;
    font-size:12px !important;
    border-radius:12px !important;
  }

  .customer-actions svg,
  header button svg {
    display:none !important;
  }

  .customer-info-grid,
  section.grid {
    display:grid !important;
    grid-template-columns:1fr 1fr !important;
    padding:12px !important;
    gap:10px !important;
  }

  .customer-info-grid .card,
  section.grid .card {
    min-height:auto !important;
    padding:13px !important;
    border-radius:14px !important;
  }

  .customer-info-grid .card div:last-child,
  section.grid .card div:last-child {
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:unset !important;
    word-break:break-word !important;
    line-height:1.35 !important;
  }

  .customer-main {
    display:block !important;
    height:auto !important;
    overflow:visible !important;
  }

  .email-list {
    width:100% !important;
    max-height:none !important;
    overflow:visible !important;
    border-right:none !important;
    border-bottom:none !important;
    background:var(--bg) !important;
  }

  .email-list > .p-4:first-child {
    position:sticky;
    top:0;
    z-index:20;
    background:var(--panel);
    padding:14px 16px !important;
  }

  .email-row {
    margin:10px 12px !important;
    padding:16px !important;
    background:var(--card);
    border:1px solid var(--border) !important;
    border-radius:18px !important;
    box-shadow:0 8px 22px rgba(0,0,0,.14);
  }

  .email-row:hover {
    background:var(--card);
  }

  .email-row.border-l-4 {
    border-left:4px solid var(--accent) !important;
  }

  .email-row .truncate,
  .email-row-subject {
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:unset !important;
    line-height:1.35 !important;
    word-break:break-word !important;
  }

  .email-row .badge {
    font-size:10px !important;
    padding:4px 8px !important;
  }

  .mobile-hide {
    display:none !important;
  }

  #customerEmailDetail {
    padding:14px 14px 90px !important;
    overflow:visible !important;
  }

  #customerEmailDetail .max-w-3xl {
    max-width:100% !important;
  }

  #customerEmailDetail h2 {
    font-size:22px !important;
    line-height:1.24 !important;
    word-break:break-word !important;
  }

  #customerEmailDetail .card {
    padding:16px !important;
    border-radius:18px !important;
  }

  #customerEmailDetail .leading-7 {
    line-height:1.7 !important;
  }

  #customerEmailDetail .font-mono {
    font-size:28px !important;
    letter-spacing:4px !important;
    word-break:break-word !important;
  }

  .mobile-back-btn {
    position:sticky;
    top:10px;
    z-index:30;
    width:100%;
    min-height:46px;
    margin:0 0 14px;
    border:1px solid var(--border);
    background:rgba(27,32,39,.96);
    color:var(--text);
    border-radius:14px;
    font-size:14px;
    font-weight:800;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    box-shadow:0 10px 24px rgba(0,0,0,.25);
  }

  .toast {
    left:12px;
    right:12px;
    top:12px;
    max-width:none;
    text-align:center;
  }

  .admin-layout main {
    padding:14px !important;
  }

  .table-wrap {
    overflow-x:auto;
    border-radius:14px;
  }

  table {
    min-width:760px;
  }
}

@media (max-width: 430px) {
  .customer-actions,
  header > div:last-child {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }

  .customer-info-grid,
  section.grid {
    grid-template-columns:1fr !important;
  }

  #customerEmailDetail h2 {
    font-size:21px !important;
  }

  .email-row {
    margin:10px 10px !important;
    padding:15px !important;
  }
}
