@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root{
  --bg:#060b1a;
  --bg2:#0a1226;
  --glass:rgba(12,21,42,.62);
  --glass-strong:rgba(14,26,53,.86);
  --line:rgba(130,170,255,.16);
  --line-soft:rgba(130,170,255,.10);
  --text:#edf5ff;
  --muted:#96a9c8;
  --blue:#16a8ff;
  --blue2:#0ea5e9;
  --cyan:#3de4ff;
  --ok:#18d3a0;
  --danger:#ff6f91;
  --shadow:0 24px 70px rgba(0,0,0,.5);
}

*{box-sizing:border-box}
html,body{
  width:100%;
  height:100%;
  margin:0;
  font-family:'Inter',system-ui,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(1000px 560px at 15% -15%, #2b56c955, transparent 62%),
    radial-gradient(900px 500px at 95% -5%, #07b3ff33, transparent 60%),
    radial-gradient(700px 420px at 50% 110%, #1a2f5a77, transparent 60%),
    linear-gradient(130deg,var(--bg),var(--bg2));
}

/* Hiệu ứng nhấp nháy (Pulse) */
@keyframes pulse-animation {
  0% {
    box-shadow: 0 0 0 0px rgba(24, 211, 160, 0.7);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(24, 211, 160, 0);
  }
  100% {
    box-shadow: 0 0 0 0px rgba(24, 211, 160, 0);
  }
}

/* Áp dụng vào class success-icon */
.success-icon {
  animation: pulse-animation 2s infinite; /* Nhấp nháy liên tục mỗi 2 giây */
  display: flex;
  align-items: center;
  justify-content: center;
  /* Giữ nguyên các style cũ của bạn bên dưới */
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(24, 211, 160, 0.1);
  border: 1px solid rgba(24, 211, 160, 0.35);
}

.app{
  min-height:100vh;
  display:flex;
  gap:20px;
  padding:20px;
}

/* shared glass */
.sidebar,.content,.card,.panel,.search,.cat,.login-btn,.user-box{
  border:1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* sidebar */
.sidebar{
  width:288px;
  border-radius:26px;
  background:linear-gradient(180deg,rgba(10,19,40,.85),rgba(8,16,33,.84));
  box-shadow:var(--shadow);
  padding:16px;
  display:flex;
  flex-direction:column;
  position:relative;
  overflow:hidden;
}
.sidebar::before{
  content:"";
  position:absolute;
  inset:-1px -1px auto -1px;
  height:120px;
  background:radial-gradient(420px 120px at 50% -40%, rgba(56,189,248,.25), transparent 70%);
  pointer-events:none;
}


.cat{
  margin-top:13px;
  width:100%;
  text-align:center;
  border-radius:14px;
  background:rgba(12,26,54,.45);   /* tối mặc định */
  color:#9db7de;
  font-weight:700;
  letter-spacing:.2px;
  padding:12px 13px;
  cursor:pointer;
  transition:.22s ease;
  border:1px solid rgba(130,170,255,.14);
}

.cat:hover,
.cat:focus-visible{
  background:linear-gradient(94deg,#14b1ff,#2f8dff); /* sáng khi trỏ */
  border-color:rgba(125,210,255,.48);
  color:#fff;
  box-shadow:0 10px 25px rgba(20,177,255,.35);
  transform:translateY(-1px);
  outline:none;
}

/* sáng khi click giữ chuột */
.cat:active{
  filter:brightness(1.06);
}


.login-btn{
  margin-top:auto;
  border-radius:14px;
  background:rgba(16,38,77,.82);
  color:#eaf4ff;
  padding:12px;
  font-weight:800;
  letter-spacing:.3px;
  cursor:pointer;
  transition:.2s ease;
}
.login-btn:hover{
  border-color:rgba(89,174,255,.5);
  background:rgba(20,48,97,.9);
  transform:translateY(-1px);
}

.user-box{
  margin-top:auto;
  border-radius:14px;
  background:rgba(13,31,64,.75);
  padding:12px;
}
.user-name{
  font-size:14px;
  font-weight:800;
  margin-bottom:4px;
}
.user-email{
  color:var(--muted);
  font-size:12px;
  margin-bottom:10px;
  word-break:break-all;
}
.user-mini-card .mini-left{
  display:flex;
  align-items:center;
  gap:10px;
  flex:1;
  min-width:0;
  background:transparent !important;
  padding:0 !important;
  border:none !important;
}
.user-mini-card .mini-left > .mini-avatar {
  flex: 0 0 46px;
}
.user-mini-card .mini-status{
  margin-top:3px;
  color:#17d39f;
  font-size:11px;
  font-weight:900;
  letter-spacing:.08em;
  white-space:nowrap;
}
.user-mini-card .mini-arrow{
  color:#95adcf;
  font-size:24px;
  line-height:1;
}

/* content */
.content{
  flex:1;
  min-width:0;
  border-radius:28px;
  background:linear-gradient(180deg,rgba(10,20,43,.72),rgba(8,18,39,.72));
  box-shadow:var(--shadow);
  padding:24px;
  position:relative;
  overflow:hidden;
}
.content::before{
  content:"";
  position:absolute;
  right:-120px;
  top:-160px;
  width:360px;
  height:360px;
  border-radius:50%;
  background:radial-gradient(circle,rgba(56,189,248,.25),transparent 70%);
  pointer-events:none;
}
.top-title{
  position:relative;
  z-index:1;
}
.top-title h1{
  margin:0;
  font-size:30px;
  line-height:1.15;
  font-weight:900;
  letter-spacing:.2px;
}
.top-title p{
  margin:10px 0 20px;
  color:var(--muted);
  font-size:14px;
}

/* grid/card */
.grid{
  position:relative;
  z-index:1;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:16px;
}
.card{
  border-radius:22px;
  background:linear-gradient(180deg,rgba(14,29,61,.84),rgba(13,26,55,.68));
  padding:16px;
  min-height:185px;
  display:flex;
  flex-direction:column;
  transition:.22s ease;
  box-shadow:0 12px 30px rgba(2,8,20,.35);
}
.card:hover{
  transform:translateY(-4px);
  border-color:rgba(88,178,255,.42);
  box-shadow:0 18px 45px rgba(5,15,35,.48);
}
.card-head{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:8px;
}
.logo-dot{
  width:34px;
  height:34px;
  border-radius:12px;
  background:linear-gradient(130deg,#17b8ff,#317cff);
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 10px 20px rgba(33,152,255,.35);
}
.card h3{
  margin:0;
  font-size:14px;
  line-height:1.35;
  font-weight:800;
  letter-spacing:.18px;
}
.card p{
  margin:2px 0 14px;
  color:var(--muted);
  font-size:12.8px;
  line-height:1.5;
  flex:1;
}
.card button{
  border:none;
  border-radius:12px;
  padding:10px 12px;
  background:linear-gradient(90deg,#0c87c4,#14b1ff);
  color:#e8f9ff;
  font-size:11px;
  font-weight:900;
  letter-spacing:.18em;
  cursor:pointer;
  transition:.2s ease;
}
.card button:hover{
  filter:brightness(1.08);
  box-shadow:0 10px 24px rgba(20,177,255,.35);
}
.meta span{
  font-size:11px;
  color:#b8c9e8;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(130,170,255,.2);
  background:rgba(11,24,50,.5);
}
.badge{
  display:inline-block;
  width:max-content;
  font-size:10px;
  font-weight:800;
  letter-spacing:.08em;
  padding:5px 9px;
  border-radius:999px;
  border:1px solid rgba(61,228,255,.35);
  color:#9defff;
  background:rgba(19,79,104,.35);
  margin-bottom:12px;
}
.mini-badge{
  font-size:10px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(130,170,255,.2);
  color:#cfe7ff;
  background:rgba(11,24,50,.5);
  font-weight:700;
  letter-spacing:.05em;
}

/* details page */
.details-page{ margin-top:10px; }
.back-btn{
  border:1px solid var(--line);
  background:rgba(11,24,50,.55);
  color:#cfe4ff;
  border-radius:12px;
  padding:10px 14px;
  font-weight:800;
  font-size:12px;
  letter-spacing:.08em;
  cursor:pointer;
  margin-bottom:14px;
}
.details-layout{
  display:grid;
  grid-template-columns:2fr 1fr;
  gap:16px;
}
.hero-card,.feature-card,.side-card{
  border:1px solid var(--line);
  background:linear-gradient(180deg,rgba(14,29,61,.84),rgba(13,26,55,.68));
  border-radius:20px;
  padding:18px;
}
.hero-icon{
width:56px;height:56px;border-radius:16px;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(130deg,#17b8ff,#317cff);
  margin-bottom:14px;font-size:24px;
}
.hero-card h1{margin:0 0 8px;font-size:42px;line-height:1.1;font-weight:900;}
.hero-card p{margin:0;color:var(--muted);}
.hero-badges{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px;}
.hero-badges span{
  padding:6px 10px;border-radius:999px;
  border:1px solid rgba(130,170,255,.2);
  background:rgba(11,24,50,.5);font-size:12px;
}
.hero-bottom{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:16px;}
.feature-card h3{margin:0 0 10px;font-size:16px}
.feature-card ul{margin:0;padding-left:18px;color:var(--muted)}
.feature-card li{margin-bottom:6px}
.side-card + .side-card{margin-top:16px}
.small-label{font-size:11px;letter-spacing:.08em;color:var(--muted);text-transform:uppercase}
.price{font-size:34px;font-weight:900;margin:8px 0 14px}
.price span{font-size:14px;color:var(--muted);font-weight:600}
.gen-btn{
  width:100%;
  border:none;
  border-radius:12px;
  padding:12px;
  background:linear-gradient(90deg,#15b2ff,#2d8fff);
  color:#fff;
  font-weight:800;
  cursor:pointer;
}
.meta-list{margin-top:12px}
.meta-list > div{
  display:flex;
  justify-content:space-between;
  font-size:13px;
  color:var(--muted);
  margin:8px 0;
}
.meta-list b{color:#dff0ff;font-weight:700}
.link-btn{
  width:100%;
  margin-top:10px;
  border:1px solid var(--line);
  background:rgba(11,24,50,.55);
  color:#d8ebff;
  border-radius:12px;
  padding:10px;
  text-align:left;
  cursor:pointer;
}

/* modal */
.modal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(3,8,20,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index:100;
  align-items:center;
  justify-content:center;
  padding:18px;
}
.panel{
  width:100%;
  max-width:440px;
  border-radius:24px;
  background:linear-gradient(180deg,rgba(12,24,49,.95),rgba(10,19,40,.93));
  box-shadow:0 26px 70px rgba(0,0,0,.55);
  padding:18px;
}
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:8px;
}
.panel h2{
  margin:0;
  font-size:28px;
  font-weight:900;
}
.close-x{
  width:36px;
  height:36px;
  border:none;
  border-radius:11px;
  background:rgba(24,44,85,.9);
  color:#dceaff;
  cursor:pointer;
  transition:.2s ease;
}
.close-x:hover{ background:rgba(33,60,112,.95); }

.err{
  min-height:19px;
  margin:4px 0 10px;
  color:var(--danger);
  font-size:13px;
  font-weight:600;
}
#authForm input,#authForm button{
  width:100%;
  border-radius:14px;
}
#authForm input{
  border:1px solid rgba(112,154,220,.24);
  background:rgba(11,24,50,.8);
  color:var(--text);
  outline:none;
  padding:12px 13px;
  margin-bottom:10px;
  transition:.2s ease;
}
#authForm input::placeholder{ color:#7891b8; }
#authForm input:focus{
  border-color:rgba(73,177,255,.55);
  box-shadow:0 0 0 4px rgba(56,189,248,.12);
}
#authForm button{
  border:none;
  background:linear-gradient(90deg,#15b2ff,#2d8fff);
  color:#fff;
  padding:12px;
  font-weight:900;
  letter-spacing:.08em;
  cursor:pointer;
  transition:.2s ease;
}
#authForm button:hover{
  filter:brightness(1.08);
  box-shadow:0 10px 24px rgba(20,177,255,.34);
}

.switch{
  margin:12px 0 0;
  text-align:center;
  font-size:13px;
  color:var(--muted);
}
.switch a{
  color:#79d2ff;
  text-decoration:none;
  font-weight:800;
}
.switch a:hover{ text-decoration:underline; }

/* forgot + reset */
.forgot-wrap{
  margin:10px 0 0;
  text-align:right;
}
#forgotPasswordLink{
  color:#79d2ff;
  font-size:12px;
  font-weight:700;
  text-decoration:none;
}
#forgotPasswordLink:hover{ text-decoration:underline; }

.reset-panel{
  max-width:520px;
  border-radius:28px;
  padding:22px;
}
.reset-desc{
  margin:14px 0 16px;
  color:var(--muted);
  line-height:1.5;
  font-size:14px;
}
.reset-label{
  display:block;
  margin:2px 0 8px;
  color:#8eb2dc;
  font-size:11px;
  letter-spacing:.08em;
font-weight:800;
}
#resetForm input{
  width:100%;
  border-radius:14px;
  border:1px solid rgba(112,154,220,.24);
  background:rgba(11,24,50,.8);
  color:var(--text);
  outline:none;
  padding:12px 13px;
  margin-bottom:12px;
}
#resetForm input::placeholder{ color:#7891b8; }
#resetForm input:focus{
  border-color:rgba(73,177,255,.55);
  box-shadow:0 0 0 4px rgba(56,189,248,.12);
}
.back-signin-btn{
  width:100%;
  margin-top:10px;
  border:none;
  background:transparent;
  color:#9fb8d8;
  font-size:12px;
  font-weight:800;
  letter-spacing:.06em;
  cursor:pointer;
}
.back-signin-btn:hover{ color:#cde4ff; }

/* success/profile/email-sent */
.subline{
  margin:4px 0 0;
  color:#18b7ff;
  font-weight:800;
  font-size:12px;
  letter-spacing:.11em;
}
.success-panel{
  max-width:500px;
  border-radius:30px;
  padding:22px;
}
.success-icon-wrap{
  display:flex;
  justify-content:center;
  margin:28px 0 18px;
}
.success-icon{
  width:88px;
  height:88px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:34px;
  color:#19d7a6;
  background:radial-gradient(circle at 40% 30%, rgba(24,211,160,.18), rgba(24,211,160,.06));
  border:1px solid rgba(24,211,160,.35);
  box-shadow:0 10px 35px rgba(24,211,160,.2);
}
.success-title{
  text-align:center;
  font-size:40px;
  font-weight:900;
  margin:0 0 8px;
}
.success-text{
  text-align:center;
  margin:0 auto 18px;
  color:var(--muted);
  max-width:420px;
  line-height:1.5;
}
.primary-wide-btn{
  width:100%;
  border:1px solid rgba(130,170,255,.2);
  border-radius:16px;
  padding:14px;
  background:linear-gradient(180deg,rgba(16,34,70,.95),rgba(12,27,56,.95));
  color:#fff;
  font-weight:900;
  letter-spacing:.12em;
  cursor:pointer;
}
.primary-wide-btn:hover{ filter:brightness(1.08); }

.profile-panel{
  max-width:520px;
  border-radius:30px;
  padding:22px;
}
.profile-header{
  display:flex;
  align-items:center;
  gap:14px;
  margin-top:12px;
  margin-bottom:16px;
  padding:14px;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(18,33,66,.65);
}
.profile-header .avatar.profile-avatar{
  flex-shrink:0;
}
.profile-name{
  font-size:30px;
  font-weight:900;
}
.profile-role{
  color:var(--muted);
  font-size:13px;
}
.profile-item{
  width:100%;
  margin-bottom:10px;
  border:1px solid var(--line);
  border-radius:14px;
  padding:13px 14px;
  text-align:left;
  background:rgba(17,31,61,.7);
  color:#d9e9ff;
  font-weight:800;
  display:flex;
  justify-content:space-between;
  align-items:center;
  cursor:pointer;
}
.profile-item.logout{
  color:#ff5f7d;
  border-color:rgba(255,111,145,.28);
  background:rgba(56,18,32,.35);
  margin-top:14px !important; /* 👈 ÉP KHOẢNG CÁCH PHÍA TRÊN CHO NÚT LOGOUT */
}

.profile-item:hover{ filter:brightness(1.08); }

.email-sent-panel{
  max-width:520px;
  border-radius:30px;
  padding:22px;
}
#emailSentModal .success-title{
  font-size:42px;
  text-align:center;
  margin:0 0 8px;
  font-weight:900;
}
#emailSentModal .success-text{
  text-align:center;
  max-width:420px;
  margin:0 auto 18px;
  color:var(--muted);
  line-height:1.5;
}

/* z-index */
#authModal{ z-index:100; }
#registerSuccessModal, #loginSuccessModal, #profileModal{ z-index:130; }
#emailSentModal{ z-index:140; }

/* color variants */
.card-blue .logo-dot{background:linear-gradient(130deg,#17b8ff,#317cff)}
.card-cyan .logo-dot{background:linear-gradient(130deg,#06b6d4,#0ea5e9)}
.card-violet .logo-dot{background:linear-gradient(130deg,#7c3aed,#6366f1)}
.card-green .logo-dot{background:linear-gradient(130deg,#22c55e,#14b8a6)}
.card-indigo .logo-dot{background:linear-gradient(130deg,#4f46e5,#2563eb)}
.card-white .logo-dot{background:linear-gradient(130deg, #fff, #fff)}

/* responsive */
@media (max-width:1180px){
  .grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:980px){
  .details-layout{grid-template-columns:1fr}
  .hero-bottom{grid-template-columns:1fr}
.hero-card h1{font-size:30px}
}
@media (max-width:860px){
  .app{
    flex-direction:column;
    gap:12px;
    padding:12px;
  }
  .sidebar{ width:100%; border-radius:20px; }
  .content{ border-radius:20px; padding:16px; }
  .grid{ grid-template-columns:1fr; }
  .top-title h1{ font-size:24px; }
  .success-title{ font-size:30px; }
  .profile-name{ font-size:22px; }
}
.copy-line{
border:1px solid rgba(130,170,255,.2);
  background:rgba(11,24,50,.55);
  border-radius:10px;
  padding:10px 12px;
  font-size:12px;
  color:#d8ebff;
  word-break:break-all;
}

.history-item{
  border:1px solid rgba(130,170,255,.2);
  background:rgba(11,24,50,.45);
  border-radius:12px;
  padding:10px;
  margin-bottom:10px;
}
.h-title{
  color:#22b6ff;
  font-weight:900;
  margin-bottom:4px;
}
.h-time{
  color:#89a8cf;
  font-size:12px;
  margin-bottom:6px;
}
.h-label{
  color:#8eb2dc;
  font-size:11px;
  letter-spacing:.07em;
  margin-top:5px;
}
.h-value{
  color:#d9ecff;
  font-size:12px;
  word-break:break-all;
}
.gen-btn:disabled{
  opacity:.75;
  cursor:not-allowed;
  filter:grayscale(.08);
}
#generatedBox{
  margin-top:14px;
}
.copy-row{
  display:grid;
  grid-template-columns:1fr 44px;
  gap:8px;
  align-items:stretch;
  margin-bottom:6px;
}

.copy-line{
  border:1px solid rgba(130,170,255,.2);
  background:rgba(11,24,50,.55);
  border-radius:10px;
  padding:10px 12px;
  font-size:12px;
  color:#d8ebff;
  word-break:break-all;
}

.copy-btn{
  border:1px solid rgba(130,170,255,.25);
  background:linear-gradient(180deg,rgba(18,36,72,.95),rgba(12,27,56,.95));
  color:#cfe7ff;
  border-radius:10px;
  cursor:pointer;
  font-size:16px;
  font-weight:900;
}
.copy-btn:hover{
  filter:brightness(1.08);
}
.copy-btn.copied{
  color:#18d3a0;
  border-color:rgba(24,211,160,.5);
}
/* ===== Sidebar mini card like reference ===== */
.user-mini-card{
  margin-top:auto;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border-radius:18px;
  border:1px solid rgba(130,170,255,.14);
  background:linear-gradient(180deg,rgba(22,40,74,.78),rgba(16,31,60,.78));
  padding:12px 14px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04), 0 8px 20px rgba(2,8,20,.25);
  min-width:0;
}
.user-mini-card .mini-left{
  display:flex;
  align-items:center;
  gap:10px;
  flex:1;
  min-width:0;
}
.mini-avatar,
.profile-avatar{
  position:relative;
  width:46px;
  height:46px;
  min-width:46px;
  min-height:46px;
  border-radius:15px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  background:
    radial-gradient(90% 80% at 28% 12%, rgba(0,210,255,.22), transparent 55%),
    linear-gradient(155deg,#0a1426 0%,#0f2240 52%,#132d52 100%);
  border:1px solid rgba(56,189,248,.38);
  box-shadow:
    0 4px 16px rgba(0,140,255,.22),
    inset 0 1px 0 rgba(126,231,255,.18);
  overflow:visible;
  transition:transform .22s ease,box-shadow .22s ease,border-color .22s ease;
}
.profile-avatar{
  width:58px;
  height:58px;
  min-width:58px;
  min-height:58px;
  border-radius:17px;
}
.mini-avatar__icon{
  position:relative;
  z-index:2;
  width:30px;
  height:30px;
  display:block;
  object-fit:contain;
  filter:drop-shadow(0 2px 6px rgba(0,180,255,.35));
  pointer-events:none;
}
.mini-avatar__icon--lg{
  width:36px;
  height:36px;
}
.mini-avatar__shine{
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:linear-gradient(135deg,rgba(255,255,255,.14) 0%,transparent 42%,transparent 100%);
  pointer-events:none;
  z-index:1;
}
.mini-avatar__dot{
  position:absolute;
  right:-2px;
  bottom:-2px;
  width:12px;
  height:12px;
  border-radius:50%;
  background:linear-gradient(145deg,#4ade80,#10b981);
  border:2.5px solid #0c1628;
  box-shadow:0 0 10px rgba(16,185,129,.55);
  z-index:4;
}
.user-mini-card:hover .mini-avatar,
.user-mini-card:focus-visible .mini-avatar{
  transform:scale(1.05);
  border-color:rgba(125,211,252,.65);
  box-shadow:
    0 8px 22px rgba(0,160,255,.32),
    inset 0 1px 0 rgba(180,235,255,.25);
}
.user-mini-card:hover .mini-avatar__icon,
.user-mini-card:focus-visible .mini-avatar__icon{
  filter:drop-shadow(0 0 10px rgba(0,210,255,.55));
}
.user-mini-card .mini-status{
  margin-top:5px;
  color:#1fe3a8;
  font-size:14px;
  font-weight:900;
  letter-spacing:.08em;
}
.user-mini-card .mini-arrow{
  color:#8ea8cd;
  font-size:28px;
  line-height:1;
}

/* ===== Key History modal like reference ===== */
.keyhistory-panel{
  max-width:760px;
  border-radius:34px;
  padding:26px;
  background:
    radial-gradient(700px 260px at 0% 0%, rgba(56,189,248,.12), transparent 55%),
    linear-gradient(180deg,rgba(10,22,47,.95),rgba(9,18,39,.95));
  border:1px solid rgba(130,170,255,.16);
}
.keyhistory-head h2{
  margin:0;
  font-size:58px;
  line-height:1;
  font-weight:900;
  letter-spacing:.2px;
}
.keyhistory-head .subline{
  margin-top:8px;
  font-size:29px;
  letter-spacing:.09em;
  color:#12b7ff;
  font-weight:900;
}
.keyhistory-head .close-x{
  width:46px;
  height:46px;
  border-radius:14px;
  background:rgba(22,40,78,.7);
  border:1px solid rgba(130,170,255,.18);
}

.keyhistory-list{
  margin-top:18px;
  max-height:420px;
  overflow:auto;
  padding-right:2px;
}

.history-item{
  border:1px solid rgba(130,170,255,.16);
  background:linear-gradient(180deg,rgba(25,44,82,.62),rgba(17,33,64,.62));
  border-radius:20px;
  padding:16px;
  margin-bottom:12px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}
.h-top{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.h-title{
  color:#1ab7ff;
  font-size:24px;
  font-weight:900;
  letter-spacing:.04em;
}
.h-time{
  color:#9ab2d4;
  font-size:18px;
  white-space:nowrap;
}
.h-label{
  color:#91a9ce;
  font-size:14px;
  letter-spacing:.08em;
  font-weight:800;
margin-top:8px;
}
.h-row{
  display:grid;
  grid-template-columns:1fr 42px;
  gap:8px;
  align-items:center;
  margin-top:4px;
}
.h-value{
  color:#cfe3ff;
  font-size:17px;
  word-break:break-all;
  border:1px solid rgba(130,170,255,.16);
  border-radius:12px;
  background:rgba(9,20,43,.45);
  padding:9px 11px;
}
.h-value.key{
  color:#19d3a0;
  font-weight:800;
}
.h-copy{
  width:42px;
  height:42px;
  border-radius:12px;
  border:1px solid rgba(130,170,255,.2);
  background:rgba(17,33,64,.8);
  color:#cfe3ff;
  cursor:pointer;
  font-size:17px;
}
.h-copy:hover{ filter:brightness(1.08); }

.keyhistory-back-btn{
  width:100%;
  margin-top:14px;
  border:1px solid rgba(130,170,255,.2);
  border-radius:18px;
  padding:16px;
  background:linear-gradient(180deg,rgba(18,35,70,.95),rgba(12,27,56,.95));
  color:#dbe9ff;
  font-size:20px;
  font-weight:900;
  letter-spacing:.1em;
  cursor:pointer;
}

@media (max-width:860px){
  .keyhistory-panel{ max-width:95vw; padding:16px; border-radius:22px; }
  .keyhistory-head h2{ font-size:36px; }
  .keyhistory-head .subline{ font-size:16px; }
  .h-title{ font-size:16px; }
  .h-time{ font-size:13px; }
  .h-value{ font-size:12px; }
  .keyhistory-back-btn{ font-size:13px; padding:12px; }
  .user-mini-card .user-name{ font-size:18px; }
  .user-mini-card .mini-status{ font-size:11px; }
}
.user-name {
    font-size: 14px;
    font-weight: 600;
    max-width: 120px; /* Giới hạn độ dài tên */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-mini-card .user-name {
    font-size: 14px !important; 
    font-weight: 800 !important;
    color: #f2f7ff !important;
    margin: 0;
    max-width: 130px; /* Tên dài quá 130px sẽ tự hiện dấu ... */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.security-panel{
  max-width:520px;
  border-radius:28px;
  padding:22px;
  background:
    radial-gradient(600px 220px at 0% 0%, rgba(56,189,248,.10), transparent 60%),
    linear-gradient(180deg,rgba(10,22,47,.95),rgba(9,18,39,.95));
}
#changePasswordForm input{
  width:100%;
  border-radius:14px;
  border:1px solid rgba(112,154,220,.24);
  background:rgba(11,24,50,.8);
  color:var(--text);
  outline:none;
  padding:12px 13px;
  margin-bottom:12px;
}
#changePasswordForm input::placeholder{ color:#7891b8; }
#changePasswordForm input:focus{
  border-color:rgba(73,177,255,.55);
  box-shadow:0 0 0 4px rgba(56,189,248,.12);
}

.cancel-btn{
  width:100%;
border:1px solid rgba(130,170,255,.2);
  border-radius:14px;
  padding:12px;
  background:linear-gradient(180deg,rgba(18,35,70,.95),rgba(12,27,56,.95));
  color:#dbe9ff;
  font-weight:800;
  letter-spacing:.06em;
  cursor:pointer;
  margin-bottom:10px;
}
.cancel-btn:hover{ filter:brightness(1.06); }

.update-password-btn{
  width:100%;
  border:none;
  border-radius:14px;
  padding:12px;
  background:linear-gradient(90deg,#15b2ff,#2d8fff);
  color:#fff;
  font-weight:900;
  letter-spacing:.08em;
  cursor:pointer;
}
.update-password-btn:hover{
  filter:brightness(1.08);
  box-shadow:0 10px 24px rgba(20,177,255,.34);
}
.update-password-btn:disabled{
  opacity:.75;
  cursor:not-allowed;
}

#changePasswordModal{ z-index:145; }
.success-password-panel{
  max-width:520px;
  border-radius:28px;
  padding:22px;
  background:
    radial-gradient(600px 220px at 0% 0%, rgba(56,189,248,.10), transparent 60%),
    linear-gradient(180deg,rgba(10,22,47,.95),rgba(9,18,39,.95));
}

.success-title2{
  text-align:center;
  font-size:34px;
  font-weight:900;
  margin:0 0 8px;
  color:#f4f8ff;
}
.success-text2{
  text-align:center;
  margin:0 auto 18px;
  color:var(--muted);
  max-width:420px;
  line-height:1.5;
}

#changePasswordSuccessModal{ z-index:146; }

@media (max-width:860px){
  .success-title2{ font-size:26px; }
}


/* FIX align icon + title in detail hero */
.hero-top{
  display:flex;
  align-items:center !important;   /* căn giữa icon với title */
  gap:16px;
  margin-bottom:14px;
}

.hero-top #detailIcon,
.hero-top .hero-icon{
  width:64px;
  height:64px;
  min-width:64px;
  min-height:64px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:18px;
  flex-shrink:0;
  margin:0 !important;
}

.hero-title-wrap{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.hero-title-wrap #detailTitle,
.hero-title-wrap h1{
  margin:0 !important;
  font-size:56px !important;
  line-height:1 !important;
  display:flex;
  align-items:center;
}

.hero-title-wrap #detailDesc,
.hero-title-wrap p{
  margin:8px 0 0 !important;
  line-height:1.45;
}
.hero-title-wrap h1{
  transform: translateY(-2px);
}
/* ===== DETAIL HERO PERFECT ALIGN FIX ===== */

.hero-top{
  display:flex !important;
  align-items:flex-start !important;
  gap:18px !important;
}

.hero-icon{
  width:68px !important;
  height:68px !important;
  min-width:68px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  font-size:34px !important;
  line-height:1 !important;
  flex-shrink:0 !important;
  margin-top:4px !important;
}

.hero-title-wrap{
  flex:1 !important;
  min-width:0 !important;
}

#detailTitle{
  margin:0 !important;
  padding:0 !important;
  font-size:52px !important;
  line-height:0.95 !important;
  font-weight:800 !important;
  display:block !important;
  word-break:break-word !important;
}

#detailDesc{
  margin-top:10px !important;
  line-height:1.5 !important;
}
/* ===== Generate Key Success Modal ===== */
#keyGeneratedModal{ z-index:150; }

.keygen-panel{
  max-width:680px;
  border-radius:34px;
  padding:26px;
  background:
    radial-gradient(700px 260px at 0% 0%, rgba(56,189,248,.12), transparent 55%),
    linear-gradient(180deg,rgba(10,22,47,.96),rgba(9,18,39,.96));
  border:1px solid rgba(130,170,255,.16);
}

.keygen-top-icon{
  width:72px;height:72px;border-radius:20px;
  display:flex;align-items:center;justify-content:center;
  margin:0 auto 14px;
  font-size:30px;
  color:#12d3a0;
  border:1px solid rgba(18,211,160,.35);
  background:radial-gradient(circle at 40% 30%, rgba(24,211,160,.18), rgba(24,211,160,.06));
}
.keygen-title{
  margin:0;
  text-align:center;
  font-size:44px;
  line-height:1.05;
  font-weight:900;
}
.keygen-sub{
  margin:8px 0 20px;
  text-align:center;
  color:#14d6a2;
  font-size:14px;
  letter-spacing:.14em;
  font-weight:900;
}

.keygen-group{ margin-bottom:12px; }
.keygen-group label{
  display:block;
  color:#8ea9ce;
  font-size:12px;
  letter-spacing:.09em;
  font-weight:800;
  margin-bottom:6px;
}
.keygen-row{
  display:grid;
  grid-template-columns:1fr 46px;
  gap:8px;
  align-items:center;
}
.keygen-value{
  border:1px solid rgba(130,170,255,.2);
  background:rgba(11,24,50,.55);
  border-radius:12px;
  padding:12px 14px;
  color:#d7ebff;
  font-size:14px;
  word-break:break-all;
}
.keygen-value.key{ color:#19d3a0; font-weight:800; }

.keygen-copy{
  width:46px;height:46px;
  border-radius:12px;
  border:1px solid rgba(130,170,255,.22);
  background:rgba(17,33,64,.85);
  color:#cfe3ff;
  cursor:pointer;
  font-size:18px;
}
.keygen-copy:hover{ filter:brightness(1.08); }

.keygen-note{
  margin:12px 2px 16px;
  color:#9bb1d0;
  font-size:13px;
  line-height:1.5;
  text-align:center;
}

.keygen-close-btn{
  width:100%;
  border:none;
  border-radius:16px;
  padding:14px;
  background:linear-gradient(90deg,#12d39f,#11b8ff);
  color:#fff;
  font-weight:900;
  letter-spacing:.08em;
  cursor:pointer;
}
.keygen-close-btn:hover{ filter:brightness(1.06); }

@media (max-width:860px){
  .keygen-panel{ max-width:95vw; padding:16px; border-radius:22px; }
  .keygen-title{ font-size:30px; }
}

/* FORCE HOVER/CHECK FOR SIDEBAR CAT BUTTON */
.sidebar .cat{
  background: rgba(12,26,54,.45) !important;
  color: #9db7de !important;
  border: 1px solid rgba(130,170,255,.14) !important;
  box-shadow: none !important;
  transform: none !important;
}

.sidebar .cat:hover,
.sidebar .cat:focus,
.sidebar .cat:focus-visible,
.sidebar .cat:active{
  background: linear-gradient(94deg,#14b1ff,#2f8dff) !important;
  color: #fff !important;
  border-color: rgba(125,210,255,.48) !important;
  box-shadow: 0 10px 25px rgba(20,177,255,.35) !important;
  transform: translateY(-1px) !important;
  outline: none !important;
}
/* FIX logo not overflow */
.logo-dot{
  width:34px !important;
  height:34px !important;
  min-width:34px !important;
  min-height:34px !important;
  border-radius:10px !important;
  overflow:hidden !important;
  position:relative !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  flex:0 0 34px !important;
}

.logo-dot .logo-img{
  width:22px !important;       /* nhỏ lại vừa khung */
  height:22px !important;
  max-width:22px !important;
  max-height:22px !important;
  object-fit:contain !important;
  display:block !important;
  position:static !important;
  transform:none !important;
}
/* FIX card layout: keep GET FREE at bottom */
#apiGrid .card{
  display:flex !important;
  flex-direction:column !important;
  min-height:190px !important;
}

#apiGrid .card .card-head{
  margin-bottom:8px;
}

#apiGrid .card .meta{
  margin:4px 0 10px;
}

#apiGrid .card p{
  flex:1 1 auto !important;    /* đoạn mô tả chiếm phần giữa */
  margin:2px 0 10px !important;
}

#apiGrid .card .badge{
  margin-bottom:10px;
}

#apiGrid .card .get-free-btn{
  margin-top:auto !important;   /* đẩy nút xuống đáy card */
  align-self:flex-start;        /* nằm bên trái như trước */
}
/* ===== FORCE HOMEPAGE CARD LAYOUT LIKE REFERENCE ===== */

/* Chỉ khi ở trang danh sách thì mới chia Grid */
#apiGrid.active-view {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px !important;
}

/* Khi vào trang chi tiết, chúng ta sẽ ẩn apiGrid đi */
#apiGrid.hidden {
    display: none !important;
}

/* Đảm bảo Details Page luôn chiếm trọn 100% chiều rộng, không bị bóp bởi Grid */
.details-page {
    display: block !important;
    width: 100% !important;
    clear: both;
}

/* card cao hơn, đúng bố cục dọc */
#apiGrid .card{
  min-height:176px !important;
  border-radius:16px !important;
  padding:14px 14px 12px !important;
  display:flex !important;
  flex-direction:column !important;
  justify-content:flex-start !important;
  overflow:hidden !important;
}

/* hàng đầu: icon + title */
#apiGrid .card .card-head{
  display:flex !important;
  align-items:center !important;
  gap:10px !important;
  margin-bottom:6px !important;
}

/* icon vừa phải, không phóng to */
#apiGrid .card .logo-dot{
  width:28px !important;
  height:28px !important;
  min-width:28px !important;
  min-height:28px !important;
  border-radius:8px !important;
  overflow:hidden !important;
  flex:0 0 28px !important;
}
#apiGrid .card .logo-dot .logo-img{
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
  display:block !important;
}

/* tiêu đề */
#apiGrid .card h3{
  margin:0 !important;
  font-size:20px !important;
  line-height:1.1 !important;
  font-weight:900 !important;
  letter-spacing:.1px !important;
  color:#f1f7ff !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

/* meta */
#apiGrid .card .meta{
  display:flex !important;
  gap:8px !important;
  margin:2px 0 8px !important;
}
#apiGrid .card .meta span{
  font-size:10px !important;
  padding:3px 7px !important;
  border-radius:999px !important;
}

/* mô tả dễ đọc hơn */
#apiGrid .card p{
  margin:0 0 10px !important;
  font-size:13px !important;
  line-height:1.45 !important;
  color:#9db2cf !important;
  display:-webkit-box !important;
  -webkit-line-clamp:2 !important;
  -webkit-box-orient:vertical !important;
  overflow:hidden !important;
  flex:1 1 auto !important;
}

/* badge nằm trên nút */
#apiGrid .card .badge{
  font-size:10px !important;
  padding:4px 8px !important;
  margin:0 0 10px !important;
  width:max-content !important;
}

/* NÚT GET FREE LUÔN NẰM DƯỚI, FULL WIDTH */
#apiGrid .card .get-free-btn{
  margin-top:auto !important;
  width:100% !important;
  min-height:30px !important;
  border-radius:9px !important;
  padding:7px 10px !important;
  font-size:11px !important;
  line-height:1 !important;
  letter-spacing:.18em !important;
  font-weight:900 !important;
  align-self:stretch !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
}

/* responsive giống mẫu */
@media (max-width:1180px){
  #apiGrid{ grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
}
@media (max-width:860px){
  #apiGrid{ grid-template-columns:1fr !important; }
}
#apiDetailsPage{
  display:none;
}
#apiDetailsPage.show{
  display:block;
}
#apiDetailsPage{
  display:none !important;
}
#apiDetailsPage.show{
  display:block !important;
}
/* ===== FIX: details không hiện ở homepage ===== */
.hidden-details{
  display:none !important;
}
.hidden-details.show{
  display:block !important;
}
/* GET FREE: mặc định tối, hover sáng */
#apiGrid .get-free-btn{
  background: linear-gradient(90deg, #0b2c45, #103b5b) !important; /* tối */
  color: #8fd9ff !important;
  border: 1px solid rgba(70, 150, 210, .22) !important;
  box-shadow: none !important;
  transition: all .22s ease !important;
}

#apiGrid .get-free-btn:hover{
  background: linear-gradient(90deg, #0c87c4, #14b1ff) !important; /* sáng */
  color: #eaffff !important;
  border-color: rgba(120, 220, 255, .55) !important;
  box-shadow: 0 10px 24px rgba(20,177,255,.35) !important;
  transform: translateY(-1px);
}

#apiGrid .get-free-btn:active{
  transform: translateY(0);
  filter: brightness(1.05);
}
/* Sidebar category: mặc định tối */
.sidebar .cat{
  background: rgba(12,26,54,.45);
  color:#9db7de;
  border:1px solid rgba(130,170,255,.14);
  box-shadow:none;
}

/* hover sáng tạm */
.sidebar .cat:hover{
  background:linear-gradient(94deg,#14b1ff,#2f8dff);
  color:#fff;
  border-color:rgba(125,210,255,.48);
  box-shadow:0 10px 25px rgba(20,177,255,.35);
}

/* active giữ sáng cố định */
.sidebar .cat.active{
  background:linear-gradient(94deg,#14b1ff,#2f8dff) !important;
  color:#fff !important;
  border-color:rgba(125,210,255,.48) !important;
  box-shadow:0 10px 25px rgba(20,177,255,.35) !important;
}

.sidebar .cat:focus,
.sidebar .cat:focus-visible{
  outline:none;
}
.hero-icon{
  width:56px;
  height:56px;
  border-radius:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(130deg,#17b8ff,#317cff);
  overflow:hidden;
}

#detailIconImg{
  width:34px;
  height:34px;
  object-fit:contain;
  display:block;
}

#detailIconEmoji{
  font-size:24px;
  line-height:1;
}
.hero-icon{
  width:56px;height:56px;border-radius:16px;
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
}
#detailIconImg{
  width:34px;height:34px;object-fit:contain;display:block;
}
#detailIconEmoji{
  font-size:24px;line-height:1;
}
#detailIcon{
  width:56px;height:56px;border-radius:16px;
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
}
#detailIconImg{
  width:34px;height:34px;object-fit:contain;display:block;
}
#detailIconEmoji{
  font-size:24px;line-height:1;
}
/* icon details nền mặc định */
.hero-icon{
  width:56px;height:56px;border-radius:16px;
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
  background:linear-gradient(130deg,#17b8ff,#317cff);
}

/* map theo color card */
.hero-icon.theme-orange { background: linear-gradient(130deg,#ff9a3d,#ff6a00); }
.hero-icon.theme-blue   { background: linear-gradient(130deg,#1fb6ff,#2563ff); }
.hero-icon.theme-cyan   { background: linear-gradient(130deg,#22d3ee,#0ea5e9); }
.hero-icon.theme-violet { background: linear-gradient(130deg,#8b5cf6,#6d28d9); }
.hero-icon.theme-green  { background: linear-gradient(130deg,#34d399,#059669); }
.hero-icon.theme-indigo { background: linear-gradient(130deg,#6366f1,#4338ca); }

/* OTP row fix: email + button cùng hàng */
.otp-row{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  margin-bottom:10px;
}

.otp-row #emailInput{
  flex:1 1 auto !important;
  width:auto !important;
  min-width:0 !important;
  margin-bottom:0 !important;
}

.otp-row #getOtpBtn{
  flex:0 0 120px !important;
  width:120px !important;
  min-width:120px !important;
  height:44px !important;
  border:none;
  border-radius:12px;
  background:linear-gradient(90deg,#0c87c4,#14b1ff);
  color:#fff;
  font-weight:800;
  cursor:pointer;
}
/* Thiết lập phân lớp mới chặn hoàn toàn các nút xuyên thấu */
#profileModal { 
  z-index: 999990 !important; 
}

#changePasswordModal,
#noticeModal,
#changePasswordSuccessModal,
#keyGeneratedModal,
#emailSentModal,
#keyHistoryModal,
#authModal,
#resetModal,
#registerSuccessModal,
#loginSuccessModal,
#createKeyModal,
#redeemModal,
#redeemSuccessModal {
  z-index: 999999 !important; /* Lớp cao nhất tuyệt đối để che phủ mọi nút bấm */
}
#resetError{
  min-height:18px;
  margin:6px 0 10px;
  color:#ff5f7d;
  font-size:13px;
  font-weight:700;
}
.history-item{
  border:1px solid rgba(255,255,255,.12);
  border-radius:12px;
  padding:10px;
  margin-bottom:10px;
  background:rgba(255,255,255,.03);
}
.history-item small{opacity:.75}
/* profile action rows giống Change Password/API Key */
.profile-action{
  width:100%;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 16px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  color:#eaf4ff;
  font-weight:700;
  margin-top:10px;
  cursor:pointer;
}
.profile-action:hover{
  border-color:rgba(0,191,255,.45);
  transform:translateY(-1px);
}
.profile-action b{opacity:.8}

/* --- Guide panel (Hướng Dẫn) --- */
.guide-list-view{
  max-width:820px;
  margin:0 auto;
  padding:8px 4px 24px;
}
.guide-page-header{
  display:flex;
  align-items:flex-start;
  gap:16px;
  margin-bottom:28px;
  padding-bottom:20px;
  border-bottom:1px solid rgba(130,170,255,.12);
}
.guide-page-header__icon{
  width:52px;
  height:52px;
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:26px;
  border-radius:14px;
  background:linear-gradient(135deg,rgba(20,177,255,.22),rgba(47,141,255,.1));
  border:1px solid rgba(125,210,255,.25);
  box-shadow:0 8px 24px rgba(20,177,255,.15);
}
.guide-page-header__title{
  margin:0 0 6px;
  font-size:22px;
  font-weight:800;
  color:#f8fafc;
  letter-spacing:-.02em;
}
.guide-page-header__desc{
  margin:0;
  font-size:13.5px;
  color:#94a3b8;
  line-height:1.5;
}
.guide-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.guide-section-label{
  grid-column:1 / -1;
  margin:8px 0 0;
  font-size:11px;
  font-weight:700;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:#64748b;
}
.guide-card{
  position:relative;
  display:flex;
  align-items:center;
  gap:16px;
  width:100%;
  padding:18px 20px;
  border-radius:16px;
  border:1px solid rgba(130,170,255,.18);
  background:rgba(11,24,50,.55);
  cursor:pointer;
  transition:transform .22s ease,border-color .22s ease,box-shadow .22s ease,background .22s ease;
  box-sizing:border-box;
  overflow:hidden;
}
.guide-card::before{
  content:'';
  position:absolute;
  inset:0;
  border-radius:inherit;
  opacity:0;
  transition:opacity .22s ease;
  pointer-events:none;
}
.guide-card--featured::before{
  background:linear-gradient(135deg,rgba(20,177,255,.12),transparent 55%);
}
.guide-card--openclaw::before{
  background:linear-gradient(135deg,rgba(14,165,233,.1),transparent 50%);
}
.guide-card--cursor::before{
  background:linear-gradient(135deg,rgba(120,120,120,.14),transparent 50%);
}
.guide-card--windsurf::before{
  background:linear-gradient(135deg,rgba(45,212,191,.14),transparent 50%);
}
.guide-card__icon--windsurf{
  background:linear-gradient(145deg,rgba(13,47,44,.95),rgba(8,32,30,.9));
  border:1px solid rgba(45,212,191,.32);
}
.guide-article-card__icon--windsurf{
  background:linear-gradient(145deg,rgba(13,47,44,.95),rgba(8,32,30,.9));
  border:1px solid rgba(45,212,191,.32);
}
.guide-card__badge--teal{
  color:#5eead4;
  background:rgba(20,184,166,.14);
  border:1px solid rgba(45,212,191,.3);
}
.guide-card--cline::before{
  background:linear-gradient(135deg,rgba(94,234,212,.13),transparent 50%);
}
.guide-card--vscode::before{
  background:linear-gradient(135deg,rgba(59,130,246,.14),transparent 50%);
}
.guide-card--opencode::before{
  background:linear-gradient(135deg,rgba(168,85,247,.12),transparent 50%);
}
.guide-card__icon--opencode{
  background:linear-gradient(145deg,rgba(33,30,30,.9),rgba(15,14,14,.85));
  border:1px solid rgba(241,236,236,.15);
}
.guide-article-card__icon--opencode{
  background:linear-gradient(145deg,rgba(33,30,30,.9),rgba(15,14,14,.85));
  border:1px solid rgba(241,236,236,.15);
}
.guide-card__badge--violet{
  color:#c4b5fd;
  background:rgba(139,92,246,.14);
  border:1px solid rgba(167,139,250,.3);
}
.guide-card--claude::before{
  background:linear-gradient(135deg,rgba(251,191,36,.1),transparent 50%);
}
.guide-card__icon--claude{
  background:linear-gradient(145deg,rgba(251,191,36,.2),rgba(217,119,6,.1));
  border:1px solid rgba(251,191,36,.28);
}
.guide-card__badge--amber{
  color:#fcd34d;
  background:rgba(245,158,11,.14);
  border:1px solid rgba(251,191,36,.3);
}
.guide-card--codex::before{
  background:linear-gradient(135deg,rgba(99,102,241,.12),transparent 50%);
}
.guide-card__icon--codex{
  background:linear-gradient(145deg,rgba(99,102,241,.18),rgba(57,65,255,.08));
  border:1px solid rgba(129,140,248,.28);
}
.guide-card__icon-img{
  width:32px;
  height:32px;
  display:block;
  object-fit:contain;
}
.guide-article-card__icon-img{
  width:28px;
  height:28px;
  display:block;
  object-fit:contain;
}
.guide-card__badge--indigo{
  color:#a5b4fc;
  background:rgba(99,102,241,.14);
  border:1px solid rgba(129,140,248,.3);
}
.guide-card:hover,
.guide-card:focus-visible{
  outline:none;
  transform:translateY(-2px);
  border-color:rgba(56,189,248,.45);
  box-shadow:0 12px 32px rgba(0,0,0,.35),0 0 0 1px rgba(56,189,248,.12);
}
.guide-card:hover::before,
.guide-card:focus-visible::before{
  opacity:1;
}
.guide-card--featured{
  grid-column:1 / -1;
  border-color:rgba(56,189,248,.32);
  background:linear-gradient(135deg,rgba(14,165,233,.14),rgba(11,24,50,.7));
  box-shadow:0 8px 28px rgba(20,177,255,.12);
}
.guide-card__icon{
  flex-shrink:0;
  width:52px;
  height:52px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:26px;
  border-radius:14px;
  position:relative;
  z-index:1;
}
.guide-card__icon--intro{
  background:linear-gradient(145deg,rgba(20,177,255,.25),rgba(47,141,255,.12));
  border:1px solid rgba(125,210,255,.3);
  box-shadow:0 6px 18px rgba(20,177,255,.2);
}
.guide-card__icon--openclaw{
  background:linear-gradient(145deg,rgba(14,165,233,.2),rgba(6,182,212,.08));
  border:1px solid rgba(56,189,248,.22);
}
.guide-card__icon--exclamation,
.guide-card__icon--book,
.guide-card__icon--key,
.guide-card__icon--question{
  background:linear-gradient(145deg,rgba(14,165,233,.2),rgba(6,182,212,.08));
  border:1px solid rgba(56,189,248,.22);
  box-shadow:0 6px 18px rgba(8,145,178,.16);
}
.guide-card__icon--cursor{
  background:linear-gradient(145deg,rgba(30,30,30,.55),rgba(10,10,10,.35));
  border:1px solid rgba(255,255,255,.12);
}
.guide-article-card__icon--cursor{
  background:linear-gradient(145deg,rgba(30,30,30,.55),rgba(10,10,10,.35));
  border:1px solid rgba(255,255,255,.12);
}
.guide-article-card__icon--openclaw{
  background:linear-gradient(145deg,rgba(14,165,233,.18),rgba(6,182,212,.08));
  border:1px solid rgba(56,189,248,.22);
}
.guide-article-card__icon--exclamation,
.guide-article-card__icon--book,
.guide-article-card__icon--key,
.guide-article-card__icon--question{
  background:linear-gradient(145deg,rgba(14,165,233,.18),rgba(6,182,212,.08));
  border:1px solid rgba(56,189,248,.22);
  box-shadow:0 6px 18px rgba(8,145,178,.16);
}
.guide-card__icon--cline{
  background:linear-gradient(145deg,rgba(48,54,61,.95),rgba(30,36,44,.9));
  border:1px solid rgba(148,163,184,.2);
}
.guide-article-card__icon--cline{
  background:linear-gradient(145deg,rgba(48,54,61,.95),rgba(30,36,44,.9));
  border:1px solid rgba(148,163,184,.2);
}
.guide-card__icon--vscode{
  background:linear-gradient(145deg,rgba(59,130,246,.22),rgba(37,99,235,.1));
  border:1px solid rgba(96,165,250,.32);
}
.guide-card__body{
  flex:1;
  min-width:0;
  position:relative;
  z-index:1;
}
.guide-card__badge{
  display:inline-block;
  margin-bottom:8px;
  padding:3px 10px;
  border-radius:999px;
  font-size:10px;
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.guide-card__badge--cyan{
  color:#67e8f9;
  background:rgba(34,211,238,.12);
  border:1px solid rgba(34,211,238,.25);
}
.guide-card__badge--sky{
  color:#7dd3fc;
  background:rgba(14,165,233,.12);
  border:1px solid rgba(14,165,233,.28);
}
.guide-card__title{
  margin:0 0 4px;
  font-size:16px;
  font-weight:800;
  color:#f8fafc;
  line-height:1.3;
}
.guide-card__desc{
  margin:0;
  font-size:13px;
  color:#94a3b8;
  line-height:1.45;
}
.guide-card__arrow{
  flex-shrink:0;
  width:36px;
  height:36px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  font-size:18px;
  font-weight:700;
  color:#38bdf8;
  background:rgba(14,165,233,.1);
  border:1px solid rgba(56,189,248,.2);
  transition:transform .22s ease,background .22s ease;
  position:relative;
  z-index:1;
}
.guide-card:hover .guide-card__arrow{
  transform:translateX(4px);
  background:rgba(20,177,255,.22);
}
.guide-detail-view{
  max-width:860px;
  margin:0 auto;
  padding:8px 4px 32px;
}
.guide-back-btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-bottom:20px;
  padding:8px 16px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.1);
  background:rgba(255,255,255,.05);
  color:#cbd5e1;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
  transition:background .2s ease,border-color .2s ease;
}
.guide-back-btn:hover{
  background:rgba(255,255,255,.1);
  border-color:rgba(130,170,255,.25);
}
.guide-article-card{
  background:rgba(12,21,42,.55);
  border:1px solid rgba(130,170,255,.16);
  border-radius:18px;
  padding:28px;
  box-shadow:0 16px 48px rgba(0,0,0,.28);
}
.guide-article-card__head{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:22px;
  padding-bottom:16px;
  border-bottom:1px solid rgba(130,170,255,.12);
}
.guide-article-card__icon{
  font-size:28px;
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  background:rgba(14,165,233,.12);
  border:1px solid rgba(56,189,248,.2);
}
.guide-article-card__title{
  margin:0;
  font-size:22px;
  font-weight:800;
  color:#f8fafc;
  letter-spacing:-.02em;
}
.guide-article-card__content{
  color:#cbd5e1;
  font-size:14.5px;
  line-height:1.75;
}
.guide-article-card__content img{
  max-width:100%;
  border-radius:10px;
}
@media screen and (max-width:640px){
  .guide-grid{
    grid-template-columns:1fr;
  }
  .guide-list-view,
  .guide-detail-view{
    padding-left:0;
    padding-right:0;
  }
  .guide-page-header{
    flex-direction:column;
    gap:12px;
  }
  .guide-card{
    padding:16px;
    gap:12px;
  }
  .guide-card__icon{
    width:46px;
    height:46px;
    font-size:22px;
  }
  .guide-card__arrow{
    width:32px;
    height:32px;
    font-size:16px;
  }
  .guide-article-card{
    padding:18px 16px;
  }
}

/* support textarea cao đẹp hơn */
#supportMessage{
  min-height:120px;
  resize:vertical;
}

/* support history item */
.history-item{
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  padding:12px;
  margin-bottom:10px;
  background:rgba(255,255,255,.03);
}
.history-item .status{
  font-size:12px;
  opacity:.85;
}
/* ONLY Help & Support + Support History */
.profile-row.profile-support{
  width:100%;
  height:54px;
  margin-top:12px;
  border-radius:16px;
  border:1px solid rgba(130,165,230,.18);
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  color:#dce8ff;
  font-weight:800;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
  cursor:pointer;
}

.profile-row.profile-support .left{
  display:flex;
  align-items:center;
  gap:10px;
}

.profile-row.profile-support .arrow{
  opacity:.6;
  font-size:18px;
}

.profile-row.profile-support:hover{
  border-color:rgba(0,194,255,.5);
  transform:translateY(-1px);
}
/* force style ONLY 2 support buttons */
#helpSupportBtn.profile-support,
#supportHistoryBtn.profile-support{
  -webkit-appearance:none !important;
  appearance:none !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  width:100% !important;
  height:54px !important;
  margin-top:12px !important;
  margin-bottom:12px !important; /* 👈 THÊM DÒNG NÀY ĐỂ ĐẨY NÚT LOGOUT XUỐNG DƯỚI */
  padding:0 16px !important;
  border-radius:16px !important;
  border:1px solid rgba(130,165,230,.18) !important;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)) !important;
  color:#dce8ff !important;
  font-weight:800 !important;
  cursor:pointer !important;
  box-sizing:border-box !important;
}

#helpSupportBtn.profile-support:hover,
#supportHistoryBtn.profile-support:hover{
  border-color:rgba(0,194,255,.5) !important;
  transform:translateY(-1px);
}

#helpSupportBtn.profile-support .left,
#supportHistoryBtn.profile-support .left{
  display:flex;
  align-items:center;
  gap:10px;
}

#helpSupportBtn.profile-support .arrow,
#supportHistoryBtn.profile-support .arrow{
  opacity:.6;
  font-size:18px;
}
/* SUPPORT MODAL FIX */
.support-panel{
  width:min(92vw,560px);
  border-radius:28px;
  padding:24px;
}

.support-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}
.field-col.full{grid-column:1/-1}

.s-label{
  display:block;
  margin:0 0 8px;
  font-size:12px;
  font-weight:800;
  letter-spacing:1.4px;
  color:#d8e7ff;
}

.s-input,.s-textarea{
  width:100%;
  box-sizing:border-box;
  border-radius:14px;
  border:1px solid rgba(140,175,230,.25);
  background:rgba(12,24,48,.55);
  color:#ecf4ff;
  padding:13px 14px;
  outline:none;
}

.s-input{
  height:46px;
}

.s-textarea{
  min-height:130px;
  resize:vertical;
}

.s-input::placeholder,.s-textarea::placeholder{
  color:rgba(210,225,245,.45);
}

.s-input:focus,.s-textarea:focus{
  border-color:rgba(0,195,255,.65);
  box-shadow:0 0 0 3px rgba(0,195,255,.12);
}

.support-actions{
  margin-top:14px;
  display:flex;
  gap:10px;
}

.btn-cancel{
  width:36%;
  height:48px;
  border-radius:14px;
  border:1px solid rgba(140,170,220,.28);
  background:linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  color:#dce9ff;
  font-weight:800;
  cursor:pointer;
}

.btn-send{
  width:64%;
  height:48px;
  border:0;
  border-radius:14px;
  background:linear-gradient(180deg,#1bc4ff,#0aa7f3);
  color:#fff;
  font-weight:900;
  letter-spacing:.8px;
  cursor:pointer;
  box-shadow:0 10px 22px rgba(10,167,243,.35);
}

#supportError{
  min-height:18px;
  margin:0 0 8px;
  color:#ff7398;
  font-size:13px;
  font-weight:700;
}
/* Support close button - top right đẹp hơn */
#supportModal .support-panel{
  position: relative;
}

#supportModal .support-close{
  position: absolute;
  top: 14px;
  right: 14px;      /* chuyển sang phải */
  left: auto !important;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(140,170,230,.28);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  color: #cfe2ff;
  font-size: 22px;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
  transition: .18s ease;
  z-index: 5;
}

#supportModal .support-close:hover{
  transform: translateY(-1px);
  border-color: rgba(0,194,255,.55);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(0,194,255,.22);
}


/* Support History close button */
#supportHistoryModal .panel{
  position: relative;
}

#supportHistoryModal .support-history-close{
  position: absolute;
  top: 14px;
  right: 14px;
  left: auto !important;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(140,170,230,.28);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  color: #cfe2ff;
  font-size: 22px;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
  transition: .18s ease;
  z-index: 5;
}

#supportHistoryModal .support-history-close:hover{
  transform: translateY(-1px);
  border-color: rgba(0,194,255,.55);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0,194,255,.22);
}
/* Message Sent close button */
#supportSuccessModal .panel{
  position: relative;
}

#supportSuccessModal .support-success-close{
  position: absolute;
  top: 14px;
  right: 14px;
  left: auto !important;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(140,170,230,.28);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  color: #cfe2ff;
  font-size: 22px;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
  transition: .18s ease;
  z-index: 5;
}

#supportSuccessModal .support-success-close:hover{
  transform: translateY(-1px);
  border-color: rgba(0,194,255,.55);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0,194,255,.22);
}

/* làm popup Message Sent đẹp hơn */
#supportSuccessModal .panel h2{
  margin-top: 6px;
  margin-bottom: 8px;
}

#supportSuccessModal .panel .sub{
  color:#93dbff;
  font-size: 22px;
  font-weight: 800;
  margin: 8px 0 14px;
  text-transform:none;
  letter-spacing: .2px;
}

#supportSuccessModal .panel p{
  color:#d9e7ff;
  font-size: 18px;
  line-height: 1.45;
}
/* 1) Layout full height */
html, body {
  height: 100%;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;          /* quan trọng */
  overflow: hidden;       /* không cho cả trang kéo dài */
}

/* 2) Sidebar đứng yên, có vùng cuộn riêng */
.sidebar {
  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
}

/* nếu có khối login/user ở cuối sidebar */
.sidebar .bottom,
.sidebar .user-mini-card,
.sidebar .auth-box {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: inherit;
}

/* 3) Nội dung card cuộn riêng */
.main,
.content,
#apiGrid {
  min-height: 0;
}

.main {
  height: 100vh;
  overflow-y: auto;
}
/* ===== LAYOUT SCROLL FIX cho cấu trúc hiện tại ===== */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* không cuộn toàn trang */
}

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
}

/* Sidebar cố định, tự cuộn nếu dài */
.sidebar {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Cột phải (cards) cuộn riêng */
.content {
  height: 100vh;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 20px;
}

/* grid card */
#apiGrid {
  min-height: 0;
}
.sidebar{
  display:flex;
  flex-direction:column;
}

.sidebar .search,
.sidebar .cat{
  flex: 0 0 auto;
}

.sidebar .login-btn,
.sidebar .user-mini-card{
  margin-top:auto;
  margin-bottom:14px;   /* nâng lên một chút */
}
.brand{
  margin-bottom:14px;
}
.brand-logo{
  width:100%;
  max-width:260px;
  height:auto;
  display:block;
}
.brand, .brand-logo {
  pointer-events: none;   /* logo không bắt chuột */
}
.sidebar {
  position: relative;
}

.search {
  position: relative;
  z-index: 5;
}
.brand{
  position: relative;
  z-index: 1;
  margin-bottom: 12px;
}

/* ===== HOTFIX: sidebar logo không chặn search ===== */

/* Sidebar layout rõ ràng */
.sidebar{
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  overflow-x: hidden !important;
}

/* Logo chỉ hiển thị, không chặn chuột */
.brand{
  position: relative !important;
  z-index: 1 !important;
  pointer-events: none !important;
  margin-bottom: 8px !important;
}
.brand-logo{
  display: block !important;
  width: 100% !important;
  max-width: 220px !important;
  height: auto !important;
  pointer-events: none !important;
}

/* Search luôn click được */
.sidebar .search{
  position: relative !important;
  z-index: 20 !important;
  pointer-events: auto !important;
}

/* Nút cat dưới search */
.sidebar .cat{
  position: relative !important;
  z-index: 10 !important;
}

/* Login/User ở cuối nhưng không đè lên search */
.sidebar .login-btn,
.sidebar .user-mini-card{
  margin-top: auto !important;
  margin-bottom: 14px !important;
  position: relative !important;   /* bỏ sticky gây đè lớp */
  bottom: auto !important;
  z-index: 5 !important;
}
/* ===== SIDEBAR FINAL FIX for current HTML ===== */
.sidebar{
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  height: 100vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* logo chỉ hiển thị */
.sidebar .brand,
.sidebar .brand-logo{
  pointer-events: none !important;
}
.sidebar .brand{
  position: relative !important;
  z-index: 1 !important;
  margin-bottom: 6px !important;
}
.sidebar .brand-logo{
  display: block !important;
  width: 100% !important;
  max-width: 220px !important;
  height: auto !important;
}

/* search luôn click được */
.sidebar .search{
  position: relative !important;
  z-index: 50 !important;
  pointer-events: auto !important;
}

/* category không đè search */
.sidebar .cat{
  position: relative !important;
  z-index: 20 !important;
}

/* user/login ở đáy nhưng KHÔNG sticky (tránh đè lớp) */
.sidebar .login-btn,
.sidebar .user-mini-card{
  margin-top: auto !important;
  margin-bottom: 14px !important;
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  z-index: 5 !important;
}

/* hủy rule sticky cũ nếu có */
.sidebar .bottom,
.sidebar .auth-box{
  position: static !important;
}


/* ===== MOBILE FIX ===== */
@media (max-width: 860px){
  html, body{
    width:100%;
    max-width:100%;
    overflow-x:hidden !important;
  }

  .app{
    display:flex !important;
    flex-direction:column !important;
    height:auto !important;
    min-height:100vh;
    overflow:visible !important;
    padding:10px !important;
    gap:10px !important;
  }

  .sidebar{
    width:100% !important;
    height:auto !important;
    position:relative !important;
    top:auto !important;
    overflow:visible !important;
    margin:0 !important;
  }

  .content{
    width:100% !important;
    height:auto !important;
    overflow:visible !important;
    min-height:0 !important;
    padding:12px !important;
  }

  #apiGrid,
  #apiGrid.active-view{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:10px !important;
  }

  .details-layout{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:10px !important;
  }

  .hero-card h1,
  #detailTitle{
    font-size:34px !important;
    line-height:1.05 !important;
  }

  .hero-top{
    align-items:center !important;
    gap:12px !important;
  }

  .hero-icon{
    width:52px !important;
    height:52px !important;
    min-width:52px !important;
  }
}
/* ===== MOBILE CLICK + SCROLL HOTFIX ===== */
@media (max-width: 860px){
  html, body{
    height:auto !important;
    min-height:100% !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    touch-action:auto !important;
  }

  .app{
    height:auto !important;
    min-height:100vh !important;
    overflow:visible !important;
    display:flex !important;
    flex-direction:column !important;
  }

  .sidebar,
  .content{
    position:relative !important;
    height:auto !important;
    max-height:none !important;
    overflow:visible !important;
  }

  .content{
    z-index:5 !important;
    pointer-events:auto !important;
  }

  #apiGrid,
  .grid{
    overflow:visible !important;
  }

  #apiGrid .card,
  #apiGrid .get-free-btn{
    pointer-events:auto !important;
    position:relative !important;
    z-index:6 !important;
  }

  /* bỏ các lớp phủ gây chặn click */
  .content::before,
  .sidebar::before{
    pointer-events:none !important;
  }

  /* user box không đè lên cards */
  .sidebar .user-mini-card,
  .sidebar .login-btn{
    position:relative !important;
    bottom:auto !important;
    z-index:1 !important;
  }
}
#redeemModal{ z-index: 1200 !important; }
#redeemSuccessModal{ z-index: 1201 !important; }
#apiGrid.hidden{
  display:none !important;
}

#apiDetailsPage{
  display:none !important;
}

#apiDetailsPage.show{
  display:block !important;
}



#apiGrid .card.menu-hidden {
  display: none !important;
}
.get-free-btn.out-of-key {
  background: #3b4252 !important;
  border-color: #596275 !important;
  color: #cbd5e1 !important;
  cursor: not-allowed !important;
  opacity: 0.9;
}
.kpi-grid { display:grid; grid-template-columns:repeat(4,minmax(160px,1fr)); gap:12px; margin:12px 0 20px; }
.kpi-card { background:#0f172a; border:1px solid #22314f; border-radius:12px; padding:12px; }
.kpi-label { color:#9fb3d9; font-size:12px; }
.kpi-value { color:#fff; font-size:24px; font-weight:700; margin-top:6px; }
.table-wrap { margin-top:16px; }
.table-wrap table { width:100%; border-collapse:collapse; }
.table-wrap th,.table-wrap td { border-bottom:1px solid #22314f; padding:10px; text-align:left; }
.hidden { display: none !important; }
.show { display: block !important; }


.keys-light-card{
  background:#fff;
  border:1px solid #edf0f5;
  border-radius:14px;
  box-shadow:0 4px 18px rgba(14,23,38,.06);
  padding:16px 18px;
}
.keys-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  margin-bottom:12px;
}
.keys-head h2{
  margin:0 0 6px;
  color:#0f172a;
  font-size:28px;
  font-weight:800;
}
.keys-note{
  margin:0;
  padding-left:18px;
  color:#5b6473;
  font-size:13px;
  line-height:1.55;
}
.keys-create-btn{
  background:#05070b;
  color:#fff;
  border:0;
  border-radius:999px;
  padding:10px 14px;
  font-weight:700;
  cursor:pointer;
  box-shadow:0 4px 10px rgba(0,0,0,.2);
}
.keys-create-btn:hover{filter:brightness(1.06)}

.keys-table{
  width:100%;
  border-collapse:collapse;
}
.keys-table th,.keys-table td{
  border-bottom:1px solid #edf0f5;
  padding:12px 10px;
  color:#1f2937;
  font-size:14px;
}
.keys-table th{
  color:#6b7280;
  font-weight:700;
  text-align:left;
  background:#fff;
}
.keys-table code{
  font-family:ui-monospace,Consolas,monospace;
  background:#f3f4f6;
  padding:3px 6px;
  border-radius:6px;
}

/* modal */
.keys-modal{
  width:min(520px,92vw);
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  box-shadow:0 16px 40px rgba(15,23,42,.25);
  padding:14px;
}
.keys-modal-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}
.keys-modal-head h3{
  margin:0;
  color:#111827;
}
.keys-modal-head p{
  margin:2px 0 0;
  color:#6b7280;
  font-size:13px;
}
.keys-x{
  border:0;background:transparent;font-size:20px;cursor:pointer;color:#6b7280;
}
.keys-label{
  display:block;
  margin:12px 0 6px;
  color:#374151;
  font-weight:600;
  font-size:13px;
}
.keys-input{
  width:100%;
  border:1px solid #d1d5db;
  border-radius:999px;
  padding:10px 12px;
  outline:none;
}
.keys-input:focus{border-color:#9ca3af}
.keys-actions{
  margin-top:12px;
  display:flex;
  justify-content:flex-end;
  gap:8px;
}
.keys-cancel-btn{
  border:1px solid #d1d5db;
  background:#f3f4f6;
  color:#374151;
  border-radius:999px;
  padding:8px 14px;
  cursor:pointer;
}
.keys-submit-btn{
  border:0;
  background:#4b5563;
  color:#fff;
  border-radius:999px;
  padding:8px 14px;
  cursor:pointer;
}
.keys-submit-btn:hover{filter:brightness(1.08)}
.keys-light-card{
  background: rgba(12,21,42,.78);
  border: 1px solid rgba(130,170,255,.16);
  color: #edf5ff;
}
.keys-head h2{ color:#edf5ff; }
.keys-note{ color:#96a9c8; }
.keys-table th{ color:#9fd8ff; background: transparent; }
.keys-table td{ color:#d8ebff; border-bottom:1px solid rgba(130,170,255,.12); }
.keys-table code{ background: rgba(11,24,50,.55); color:#d8ebff; }

/* Overlay giữ cùng vibe web */
#createKeyModal {
  background: rgba(3, 10, 28, 0.62);
  backdrop-filter: blur(4px);
}

/* Panel cùng tông web */
#createKeyModal .keys-modal {
  background: rgba(12, 21, 42, 0.92) !important;
  border: 1px solid rgba(130, 170, 255, 0.22) !important;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45) !important;
  color: #edf5ff !important;
}

/* Header / text */
#createKeyModal .keys-modal-head h3 {
  color: #edf5ff !important;
}
#createKeyModal .keys-modal-head p {
  color: #9fb3d9 !important;
}
#createKeyModal .keys-x {
  color: #cfe4ff !important;
}

/* Label + input */
#createKeyModal .keys-label {
  color: #cfe4ff !important;
}
#createKeyModal .keys-input {
  background: rgba(10, 22, 47, 0.75) !important;
  border: 1px solid rgba(130, 170, 255, 0.22) !important;
  color: #edf5ff !important;
}
#createKeyModal .keys-input::placeholder {
  color: #93a4c3 !important;
}
#createKeyModal .keys-input:focus {
  border-color: #4aa3ff !important;
  box-shadow: 0 0 0 2px rgba(74,163,255,.2) !important;
}

/* Buttons */
#createKeyModal .keys-cancel-btn {
  background: rgba(11, 24, 50, .65) !important;
  border: 1px solid rgba(130,170,255,.2) !important;
  color: #d8ebff !important;
}
#createKeyModal .keys-submit-btn {
  background: linear-gradient(135deg, #168dff, #3ea0ff) !important;
  border: 0 !important;
  color: #fff !important;
}
.key-cell{
  display:flex;
  align-items:center;
  gap:10px;
}

.full-key{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
  overflow-x: auto;
  max-width: 520px;
  display: inline-block;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(10,22,47,.55);
  color: #d8ebff;
}

.copy-key-btn{
  border: 1px solid rgba(130,170,255,.3);
  background: rgba(11,24,50,.65);
  color: #d8ebff;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.copy-key-btn:hover{
  filter: brightness(1.08);
}
.copy-key-btn:disabled{
  opacity: .75;
  cursor: default;
}

/* ===== CARD THEO TÔNG WEBSITE DARK ===== */
.api-card{
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.api-card-inner{
  background: linear-gradient(180deg, rgba(9,20,45,.86), rgba(6,14,34,.92)) !important;
  border: 1px solid rgba(131,174,255,.16) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 20px rgba(0,0,0,.28) !important;
  padding: 14px 14px 12px !important;
  overflow: hidden;
  display: flex !important;          /* 👈 Chuyển card thành flexbox */
  flex-direction: column !important; /* 👈 Xếp các hàng theo chiều dọc */
  min-height: 240px !important;       /* 👈 Đặt chiều cao tối thiểu cho card cân đối */
}

/* Đẩy phần meta và nút bấm bám chắc xuống đáy card */
.api-card-inner .api-meta2 {
  margin-top: auto !important; 
  margin-bottom: 12px !important;
}

.api-title-row{
  display:flex;
  align-items:center;
  gap:8px;
}

.api-card .api-mini-logo{
  width:26px !important;
  height:26px !important;
  max-width:26px !important;
  max-height:26px !important;
  object-fit:contain !important;
  display:block;
}

.api-card h3{
  margin:0 !important;
  font-size:34px !important;
  font-weight:800 !important;
  line-height:1.15 !important;
  color:#f2f7ff !important;
}

.api-desc{
  margin:8px 0 10px !important;
  color:#9eb3d5 !important;
  font-size:13px !important;
  line-height:1.35 !important;
}

.api-meta2{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  margin-bottom:10px;
}

.api-meta2 .left div{
  color:#9eb3d5 !important;
  font-size:16px !important;
  line-height:1.25 !important;
}
.api-meta2 .left b{
  color:#e6f0ff !important;
  font-weight:700 !important;
}

.api-meta2 .right{
  text-align:right;
}
.api-meta2 .right div{
  color:#9eb3d5 !important;
  font-size:14px !important;
  line-height:1.2 !important;
}
.api-meta2 .right b{
  color:#ffffff !important;
  font-size:40px !important;
  font-weight:800 !important;
}

/* nút model */
.api-model-btn{
  width:100% !important;
  height:46px !important;
  border-radius:999px !important;
  border:1px solid rgba(122,166,255,.35) !important;
  background: linear-gradient(180deg, rgba(16,62,110,.95), rgba(11,43,82,.95)) !important;
  color:#9fd8ff !important;
  font-size:34px !important;
  font-weight:800 !important;
  letter-spacing:.2px;
}
.api-model-btn:hover{
  filter:brightness(1.08);
}
/* Thu nhỏ chữ + giá trong card */
.api-card h3{
  font-size: 14px !important;
  line-height: 1.2 !important;
}

.api-desc{
  font-size: 10px !important;
  line-height: 1.3 !important;
  margin: 6px 0 8px !important;
}

.api-meta2 .left div{
  font-size: 11px !important;
  line-height: 1.25 !important;
}

.api-meta2 .right div{
  font-size: 11px !important;
  line-height: 1.15 !important;
}

.api-meta2 .right b{
  font-size: 13px !important;   /* số $30, $180 */
  font-weight: 800 !important;
}

.api-model-btn{
  height: 32px !important;
  font-size: 10px !important;
  font-weight: 700 !important;
}
/* Scale vừa - dễ đọc */
.api-card h3{
  font-size: 26px !important;
  line-height: 1.2 !important;
}

.api-desc{
  font-size: 15px !important;
  line-height: 1.4 !important;
  margin: 8px 0 10px !important;
}

.api-meta2 .left div{
  font-size: 14px !important;
  line-height: 1.25 !important;
}

.api-meta2 .right div{
  font-size: 17px !important;
  line-height: 1.2 !important;
}

.api-meta2 .right b{
  font-size: 16px !important; /* số tiền */
  font-weight: 800 !important;
}

.api-model-btn{
  height: 48px !important;
  font-size: 20px !important;
  font-weight: 800 !important;
}

/* mô tả không bị quá dài */
.api-desc{
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Overlay mặc định không được chặn click khi đang ẩn */
.modal {
  pointer-events: none;
}

.modal[style*="display: flex"],
.modal.show,
.modal.is-open {
  pointer-events: auto;
}

/* đảm bảo header/sidebar luôn nhận click */
.topbar, .sidebar, .top-actions, .user-chip, .login-btn {
  position: relative;
  z-index: 20;
}
/* Hiện icon bàn tay khi hover nút */
.api-model-btn,
.get-free-btn,
button,
.login-btn,
.cat,
.copy-key-btn {
  cursor: pointer !important;
}

/* nếu nút bị disable thì trở lại not-allowed */
button:disabled,
.api-model-btn:disabled,
.get-free-btn:disabled {
  cursor: not-allowed !important;
}
.out-key-red{
  color:#ff4d4f !important;
  font-weight:700;
}
.out-key-red{
  color:#ff4d4f !important;
  font-weight:700;
}

/* Sidebar làm cột dọc để dễ đặt vị trí */
.sidebar{
  display: flex;
  flex-direction: column;
}




.user-box.user-mini-card{
  margin: 0 10px 14px !important; /* Cố định khoảng cách 14px dưới đáy Sidebar */
  margin-top: 10px !important;     /* 👈 Giữ khoảng cách 10px ngăn cách với ví tiền phía trên */
  position: relative;
  z-index: 10;
}


/* ===== MENU TITLE PRO ===== */
.menu-title-pro{
  margin: 14px 10px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(120,170,255,.22);
  background:
    linear-gradient(180deg, rgba(13,31,66,.75), rgba(9,22,48,.85));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 6px 14px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d7e9ff;
  letter-spacing: .8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.menu-title-pro .menu-title-dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #41d1ff, #2f7bff);
  box-shadow: 0 0 10px rgba(65,209,255,.8);
  flex: 0 0 8px;
}

/* đường line mềm dưới title */
.menu-title-pro::after{
  content: "";
  margin-left: auto;
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, rgba(95,165,255,.7), rgba(95,165,255,0));
}
.menu-title-api{
  margin-top: 8px;
  border-color: rgba(77, 193, 255, .28);
  background: linear-gradient(180deg, rgba(10,36,74,.75), rgba(7,26,58,.88));
}
.menu-title-api .menu-title-dot{
  background: linear-gradient(135deg, #52e5ff, #2ca0ff);
}
.supported-line{
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.3;
  color: #9fb3d9;
}
.supported-line b{
  color: #dff0ff;
  font-weight: 700;
}
.wallet-card{
  margin: 10px;
  margin-top: auto !important;  /* 👈 ĐIỂM QUAN TRỌNG: Chỉ một mình thằng này nhận auto để đẩy cả cụm xuống đáy */
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(103,170,255,.25);
  background: linear-gradient(180deg, rgba(12,34,70,.7), rgba(8,22,49,.82));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 8px 18px rgba(0,0,0,.25);
  position: relative;
  z-index: 10;
}
.wallet-label{
  font-size: 11px;
  color: #9db5dc;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 4px;
}
.wallet-amount{
  font-size: 24px;
  font-weight: 900;
  color: #66e0ff;
  line-height: 1.1;
}
.delete-key-btn{
  margin-left:8px;
  padding:6px 10px;
  border:none;
  border-radius:8px;
  background:#ff4d4f;
  color:#fff;
  font-weight:700;
  cursor:pointer;
}
.delete-key-btn:hover{ filter:brightness(1.06); }
.ghost-btn{
  border:1px solid rgba(150,180,255,.32);
  background:rgba(18,34,63,.65);
  color:#dbe8ff;
  border-radius:10px;
  padding:10px 14px;
  font-weight:700;
  cursor:pointer;
}
.danger-btn{
  border:none;
  background:linear-gradient(90deg,#ff4d4f,#ff2d55);
  color:#fff;
  border-radius:10px;
  padding:10px 14px;
  font-weight:800;
  cursor:pointer;
}
.keys-table td, .keys-table th, .keys-table tr {
  pointer-events: auto !important;
}
.copy-key-btn, .delete-key-btn {
  pointer-events: auto !important;
  position: relative !important;
  z-index: 5 !important;
}

/* Đảm bảo khung chứa bảng dữ liệu luôn nằm ở tầng thấp */
.keys-table-wrap, .keys-light-card {
  position: relative !important;
  z-index: 1 !important;
}

#userKeysTable, #userKeysTable * {
  pointer-events: auto !important;
}
.delete-key-btn {
  position: relative !important;
  z-index: 5 !important;
  pointer-events: auto !important;
}
.keys-table-wrap::before,
.keys-table-wrap::after,
.keys-light-card::before,
.keys-light-card::after {
  pointer-events: none !important;
}
/* Khung chứa ID copy phong cách gọn gàng */
.api-id-copy-row {
  width: 100% !important;
  height: 38px !important;
  margin-top: auto !important;
  border: 1px solid rgba(130, 170, 255, 0.15) !important; /* Viền xanh mảnh nhẹ */
  background: rgba(10, 19, 42, 0.75) !important;        /* Nền tối sâu trùng tông Card blend với nền */
  border-radius: 999px !important;                       /* Bo tròn viên thuốc */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease-in-out !important;
  user-select: none !important;
}

/* Hiệu ứng khi di chuột vào (Hover) */
.api-id-copy-row:hover {
  background: rgba(22, 38, 77, 0.85) !important;        /* Nền sáng lên một chút thành màu xanh tím tối */
  border-color: rgba(131, 174, 255, 0.35) !important;    /* Viền phát sáng nhẹ */
}

/* Trạng thái sau khi click đã copy thành công */
.api-id-copy-row.copied-active {
  border-color: rgba(31, 227, 168, 0.4) !important;
  background: rgba(31, 227, 168, 0.06) !important;
}

/* Định dạng chữ bên trong */
.api-id-text {
  font-size: 12px !important;
  color: #7b93b3 !important;                            /* Màu chữ label hơi trầm xuống */
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* Định dạng phần text ID */
.api-id-text .id-val {
  color: #cce0ff !important;                            /* Màu text ID sáng rõ ràng */
  font-weight: 500 !important;
}

/* Icon copy nhỏ */
.copy-mini-icon {
  color: #7b93b3 !important;
  margin-right: 2px;
}

/* Hiệu ứng sóng lan tỏa cho bong bóng Zalo */
@keyframes zalo-pulse {
  0% {
    box-shadow: 0 0 0 0px rgba(0, 104, 255, 0.6), 0 8px 20px rgba(0, 0, 0, 0.3);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(0, 104, 255, 0), 0 8px 20px rgba(0, 0, 0, 0.3);
  }
  100% {
    box-shadow: 0 0 0 0px rgba(0, 104, 255, 0), 0 8px 20px rgba(0, 0, 0, 0.3);
  }
}

/* Khối bọc cố định ở góc dưới bên phải màn hình */
.zalo-floating-wrap {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  z-index: 2000 !important; /* Đảm bảo nổi lên trên tất cả các lớp modal và card */
  pointer-events: auto !important;
}

/* Định dạng nút tròn Zalo */
.zalo-floating-btn {
  width: 52px !important;
  height: 52px !important;
  border-radius: 50% !important; /* Bo tròn xoe tuyệt đối */
  background: linear-gradient(135deg, #007aff, #0055d4) !important; /* Tông màu xanh Zalo chuẩn công nghệ */
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  animation: zalo-pulse 2s infinite; /* Gán hiệu ứng sóng nhấp nháy liên tục */
}

/* Icon Zalo bên trong */
.zalo-floating-btn img {
  width: 30px !important;
  height: 30px !important;
  object-fit: contain !important;
  transition: transform 0.25s ease !important;
}

/* Hiệu ứng Hover phóng to nhẹ phóng khoáng */
.zalo-floating-btn:hover {
  transform: scale(1.08) translateY(-2px) !important;
  filter: brightness(1.08) !important;
}

.zalo-floating-btn:hover img {
  transform: rotate(8deg); /* Xoay nhẹ icon khi di chuột vào tạo điểm nhấn */
}

/* Khi bấm chuột giữ vào nút */
.zalo-floating-btn:active {
  transform: scale(0.96) translateY(0) !important;
}

/* Ẩn hoàn toàn khối Zalo thừa trong sidebar cũ nếu còn sót layout */
.sidebar .zalo-in-sidebar {
  display: none !important;
}
.usage-kpis{display:grid;grid-template-columns:repeat(5,minmax(140px,1fr));gap:12px;margin-bottom:14px}
.kpi{background:rgba(11,24,50,.55);border:1px solid rgba(130,170,255,.16);border-radius:14px;padding:12px}
.kpi-label{font-size:12px;color:#96a9c8}
.kpi-val{margin-top:6px;font-weight:900;color:#eaf2ff}
.kpi-val.ok{color:#28d89b}.kpi-val.bad{color:#ff7d97}
.usage-card{background:rgba(11,24,50,.55);border:1px solid rgba(130,170,255,.16);border-radius:14px;padding:12px;margin-bottom:14px}
.usage-title{font-weight:800;margin-bottom:8px;color:#dcecff}
/* Segmented range filter — Biểu Đồ Sử Dụng */
.usage-chart-range{
  display:inline-flex;
  align-items:stretch;
  flex-wrap:wrap;
  gap:3px;
  padding:4px;
  border-radius:12px;
  background:rgba(11,24,50,.78);
  border:1px solid rgba(130,170,255,.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 6px 20px rgba(0,0,0,.28);
  backdrop-filter:blur(10px);
}
.usage-chart-range .usage-range-btn{
  appearance:none;
  -webkit-appearance:none;
  border:none;
  outline:none;
  margin:0;
  background:transparent;
  color:var(--muted);
  font-family:inherit;
  font-size:11px;
  font-weight:700;
  letter-spacing:.03em;
  text-transform:none;
  padding:8px 14px;
  min-height:34px;
  border-radius:9px;
  cursor:pointer;
  white-space:nowrap;
  line-height:1.2;
  transition:color .2s ease,background .2s ease,box-shadow .2s ease,transform .15s ease;
}
.usage-chart-range .usage-range-btn[data-range="today"]{
  padding-left:12px;
  padding-right:12px;
}
.usage-chart-range .usage-range-btn[data-range="7d"],
.usage-chart-range .usage-range-btn[data-range="30d"],
.usage-chart-range .usage-range-btn[data-range="90d"]{
  min-width:42px;
  text-align:center;
}
.usage-chart-range .usage-range-btn:hover:not(.active){
  color:#dcecff;
  background:rgba(130,170,255,.1);
}
.usage-chart-range .usage-range-btn:active:not(.active){
  transform:scale(.97);
}
.usage-chart-range .usage-range-btn.active{
  color:#fff !important;
  background:linear-gradient(94deg,#14b1ff,#2f8dff) !important;
  box-shadow:
    0 8px 22px rgba(20,177,255,.38),
    inset 0 1px 0 rgba(255,255,255,.22) !important;
  border:none !important;
}
.usage-chart-range .usage-range-btn:focus-visible{
  outline:2px solid rgba(61,228,255,.55);
  outline-offset:2px;
}
#manageUsagePanel.usage-panel-loading{
  opacity:.92;
  pointer-events:none;
}
#manageUsagePanel.usage-panel-loading .usage-chart-range{
  pointer-events:auto;
  opacity:1;
}
@media (max-width:640px){
  .usage-chart-range{
    width:100%;
    justify-content:stretch;
  }
  .usage-chart-range .usage-range-btn{
    flex:1 1 auto;
    padding-left:8px;
    padding-right:8px;
    font-size:10px;
  }
}
@media (max-width:1100px){.usage-kpis{grid-template-columns:repeat(2,minmax(140px,1fr));}}
/* Thu nhỏ khu Daily Spend */
#manageUsagePanel .usage-card:first-of-type {
  max-width: 760px;   /* chỉnh 680-820 tùy mắt */
  margin-bottom: 14px;
}

#dailySpendChart {
  width: 100% !important;
  height: 220px !important;  /* trước đang quá cao */
  display: block;
}
#dailySpendChart{
  width:100% !important;
  height:220px !important;
  display:block;
}
#usageTable tbody tr {
    transition: background-color 0.2s ease;
}
#usageTable tbody tr:hover {
    background-color: rgba(148, 163, 184, 0.05) !important;
}
#usageTable tbody td {
    padding: 12px 16px !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.06) !important;
    vertical-align: middle;
}
#usageTable tbody tr:last-child td {
    border-bottom: none !important;
}
@media screen and (max-width: 768px) {
  .col-base-url, 
  .col-date {
    display: none !important;
  }
  
  /* Đảm bảo bảng co giãn khít vừa vặn màn hình điện thoại */
  .keys-table {
    width: 100% !important;
    table-layout: fixed;
  }
  
  .keys-table td {
    word-break: break-all; /* Tránh việc chuỗi sk-... làm tràn viền */
  }
}
/* Thiết lập chung để bảo vệ cấu trúc bảng */
.keys-table {
  width: 100% !important;
  border-collapse: collapse;
}

.keys-table td, .keys-table th {
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

/* 📱 BỘ LỌC ĐIỀU CHỈNH RIÊNG CHO ĐIỆN THOẠI */
@media screen and (max-width: 768px) {
  /* Ẩn hoàn toàn 2 cột cồng kềnh là Base URL và Ngày tạo trên điện thoại */
  .col-base-url, 
  .col-date {
    display: none !important;
  }

  /* Bảng Quản lý API Keys (không áp dụng cho #usageTable) */
  #userKeysTable {
    table-layout: fixed;
    width: 100% !important;
  }

  #manageKeysPanel .keys-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #userKeysTable th:nth-child(4), #userKeysTable td:nth-child(4) { display: none !important; }

  #userKeysTable th:nth-child(1), #userKeysTable td:nth-child(1) { width: 28%; }
  #userKeysTable th:nth-child(2), #userKeysTable td:nth-child(2) { width: 52%; }
  #userKeysTable th:nth-child(6), #userKeysTable td:nth-child(6) { width: 20%; }

  #userKeysTable td {
    word-break: break-word;
    font-size: 13px;
  }

  #userKeysTable td:nth-child(2) span {
    display: block;
    margin: 0 0 6px 0 !important;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Định hình lại nút copy trên điện thoại để không chiếm diện tích */
  .copy-key-btn {
    padding: 2px 6px !important;
    font-size: 11px !important;
    margin-left: 0;
  }

  /* Định hình lại nút Delete cho khít khung di động */
  .delete-key-btn {
    padding: 4px 8px !important;
    font-size: 12px !important;
    width: 100%;
    text-align: center;
  }
}
@media screen and (max-width: 768px) {
  
  /* 1. KHỐI KPI TRÊN CÙNG */
  .usage-kpis {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }

  /* 🌟 BỔ SUNG: Ẩn tuyệt đối các kpi card có class hidden hoặc bị rỗng */
  .usage-kpis .kpi.hidden,
  .usage-kpis .hidden {
    display: none !important;
  }

  .usage-kpis .kpi {
    /* Chỉ hiển thị những card nào thực sự không có class hidden */
    display: flex !important; 
    width: 100% !important;
    min-width: 100% !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 14px !important;
    padding: 12px 16px !important;
    box-sizing: border-box !important;
  }

  .usage-kpis .kpi > div:first-child {
    margin: 0 !important;
    flex-shrink: 0 !important;
  }

  .usage-kpis .kpi-val {
    font-size: 18px !important;
    margin-top: 0 !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
  }
  
  .usage-kpis .kpi-label {
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  /* 2. BẢNG USAGE THEO API KEY — 4 cột: Key | Models | Spend | Tokens */
  #manageUsagePanel .usage-card .keys-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #usageTable {
    table-layout: fixed !important;
    width: 100% !important;
    min-width: 480px !important;
  }

  #usageTable th,
  #usageTable td {
    font-size: 11px !important;
    padding: 10px 8px !important;
    vertical-align: top !important;
  }

  #usageTable th:nth-child(1),
  #usageTable td:nth-child(1) {
    width: 18% !important;
    min-width: 56px !important;
    word-break: break-word !important;
  }

  #usageTable th:nth-child(2),
  #usageTable td:nth-child(2) {
    width: 34% !important;
    min-width: 120px !important;
    word-break: break-word !important;
    white-space: normal !important;
  }

  #usageTable th:nth-child(3),
  #usageTable td:nth-child(3) {
    width: 24% !important;
    min-width: 88px !important;
    white-space: nowrap !important;
  }

  #usageTable th:nth-child(4),
  #usageTable td:nth-child(4) {
    width: 24% !important;
    min-width: 80px !important;
    white-space: nowrap !important;
    text-align: right !important;
  }

  #usageTable thead th:nth-child(4) {
    text-align: right !important;
  }
}

/* API Keys mobile: giữ đủ cột, cho phép cuộn ngang thay vì ẩn cột */
@media screen and (max-width: 768px) {
  #manageKeysPanel .keys-table-wrap {
    overflow-x: scroll !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
  }

  #userKeysTable {
    width: 100% !important;
    min-width: 860px !important;
    table-layout: auto !important;
  }

  #userKeysTable th,
  #userKeysTable td {
    white-space: nowrap;
    word-break: normal !important;
  }

  /* Hiện lại các cột bị ẩn trên mobile */
  #userKeysTable .col-base-url,
  #userKeysTable .col-date,
  #userKeysTable th:nth-child(4),
  #userKeysTable td:nth-child(4) {
    display: table-cell !important;
  }

  /* API key không ellipsis để dễ copy khi kéo ngang */
  #userKeysTable td:nth-child(2) span {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
  }

  #userKeysTable td:nth-child(2) .copy-key-btn {
    margin-left: 6px !important;
  }

  /* Sửa nút Delete lệch chữ */
  #userKeysTable .delete-key-btn {
    width: auto !important;
    min-width: 72px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    padding: 6px 10px !important;
    text-align: center !important;
  }

  #manageKeysPanel .keys-table-wrap::-webkit-scrollbar {
    height: 8px;
  }
  #manageKeysPanel .keys-table-wrap::-webkit-scrollbar-track {
    background: rgba(130, 170, 255, 0.12);
    border-radius: 999px;
  }
  #manageKeysPanel .keys-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(96, 165, 250, 0.8);
    border-radius: 999px;
  }
  #manageKeysPanel .keys-table-wrap {
    scrollbar-color: rgba(96, 165, 250, 0.9) rgba(130, 170, 255, 0.14);
    scrollbar-width: thin;
  }

  .keys-scroll-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #9fb3d9;
    text-align: center;
    letter-spacing: .02em;
  }
}
/* 🌟 ÉP ẨN TUYỆT ĐỐI 2 Ô SỐ 0 TRÊN CẢ MOBILE VÀ DESKTOP BẤT CHẤP JAVASCRIPT */
.usage-kpis .kpi:has(#kpiOk),
.usage-kpis .kpi:has(#kpiFail) {
    display: none !important;
}

/* --- 1. ĐỐI VỚI SIDEBAR (BÊN TRÁI - ĐÃ HOẠT ĐỘNG) --- */
.sidebar::-webkit-scrollbar {
  width: 6px !important;
}
.sidebar::-webkit-scrollbar-track {
  background: #0b1329 !important;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.4) !important;
  border-radius: 10px !important;
}

/* --- 2. ĐỐI VỚI VÙNG NỘI DUNG (BÊN PHẢI - BỔ SUNG NGAY) --- */
/* Áp dụng cho cả thẻ content, html, body để không lọt đi đâu được */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.content::-webkit-scrollbar,
main::-webkit-scrollbar {
  width: 8px !important; /* Độ rộng thanh cuộn bên phải */
  height: 8px !important;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track,
main::-webkit-scrollbar-track {
  background: #0b1329 !important; /* Trùng màu nền tối hệ thống */
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb,
main::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.4) !important; /* Màu xanh mờ như sidebar */
  border-radius: 10px !important;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover,
main::-webkit-scrollbar-thumb:hover {
  background: #0ea5e9 !important; /* Rê chuột vào sẽ sáng rực lên */
}

/* Ép cấu hình hiển thị cho các trình duyệt khác như Firefox */
.content, html, body {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(14, 165, 233, 0.4) #0b1329 !important;
}

/* ===== Notification bell ===== */
.top-title{
  position:relative;
  z-index:120;
  min-height:52px;
  margin:-10px 0 8px;
  padding:0;
  pointer-events:none;
}
.top-title__row{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:12px;
  min-height:44px;
  margin:0;
  padding:0;
  pointer-events:none;
}
.top-title__row .content-search-wrap{
  flex:1;
  min-width:0;
  display:block;
  pointer-events:auto;
}
.content-search-wrap--hidden{
  display:none !important;
}
.top-title--models-api .top-title__row{
  padding-right:56px;
}
.top-title:not(.top-title--models-api) .top-title__row{
  padding-right:56px;
  justify-content:flex-end;
}
.top-title:not(.top-title--models-api){
  min-height:48px;
}
.site-search{
  position:relative;
  width:100%;
  max-width:520px;
}
.site-search__icon{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  color:#7dd3fc;
  opacity:.85;
  pointer-events:none;
  z-index:2;
}
.site-search__input{
  width:100%;
  height:44px;
  padding:0 40px 0 42px;
  border-radius:14px;
  border:1px solid rgba(130,170,255,.28);
  background:linear-gradient(145deg,rgba(14,32,64,.92),rgba(9,20,44,.9));
  color:#f1f5f9;
  font-size:14px;
  outline:none;
  transition:border-color .2s ease,box-shadow .2s ease;
}
.site-search__input::placeholder{
  color:#64748b;
}
.site-search__input:hover{
  border-color:rgba(56,189,248,.4);
}
.site-search__input:focus{
  border-color:rgba(56,189,248,.62);
  box-shadow:0 0 0 3px rgba(14,165,233,.18);
}
.site-search__clear{
  position:absolute;
  right:8px;
  top:50%;
  transform:translateY(-50%);
  width:28px;
  height:28px;
  border:none;
  border-radius:8px;
  background:rgba(148,163,184,.12);
  color:#cbd5e1;
  font-size:18px;
  line-height:1;
  cursor:pointer;
  z-index:2;
}
.site-search__clear:hover{
  background:rgba(148,163,184,.22);
  color:#f8fafc;
}
.site-search__clear--hidden{
  display:none;
}
.site-search-empty{
  margin:0 0 12px;
  padding:14px 16px;
  border-radius:12px;
  border:1px dashed rgba(130,170,255,.28);
  background:rgba(14,32,64,.45);
  color:#94a3b8;
  font-size:14px;
  text-align:center;
}
.notif-bell-wrap{
  position:absolute;
  top:0;
  right:0;
  flex-shrink:0;
  pointer-events:auto;
  z-index:121;
}
.notif-bell-btn{
  position:relative;
  width:46px;
  height:46px;
  border-radius:14px;
  border:1px solid rgba(130,170,255,.28);
  background:linear-gradient(145deg,rgba(16,38,77,.92),rgba(10,22,48,.88));
  color:#e2e8f0;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease;
}
.notif-bell-btn:hover,
.notif-bell-btn:focus-visible{
  outline:none;
  transform:translateY(-1px);
  border-color:rgba(56,189,248,.55);
  box-shadow:0 8px 22px rgba(14,165,233,.25);
}
.notif-bell-btn[aria-expanded="true"]{
  border-color:rgba(56,189,248,.65);
  background:linear-gradient(145deg,rgba(20,48,97,.95),rgba(12,28,58,.9));
}
.notif-badge{
  position:absolute;
  top:4px;
  right:4px;
  min-width:18px;
  height:18px;
  padding:0 5px;
  border-radius:999px;
  background:linear-gradient(135deg,#f43f5e,#e11d48);
  color:#fff;
  font-size:10px;
  font-weight:800;
  line-height:18px;
  text-align:center;
  box-shadow:0 2px 8px rgba(244,63,94,.45);
}
.notif-badge--hidden{
  display:none;
}
.notif-dropdown{
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  width:min(380px,calc(100vw - 32px));
  max-height:min(420px,70vh);
  display:flex;
  flex-direction:column;
  border-radius:16px;
  border:1px solid rgba(130,170,255,.22);
  background:linear-gradient(180deg,rgba(12,26,54,.98),rgba(8,16,33,.98));
  box-shadow:0 20px 50px rgba(0,0,0,.45),0 0 0 1px rgba(56,189,248,.08);
  overflow:hidden;
}
.notif-dropdown--hidden{
  display:none;
}
.notif-dropdown__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:14px 16px;
  border-bottom:1px solid rgba(130,170,255,.12);
}
.notif-dropdown__title{
  margin:0;
  font-size:15px;
  font-weight:800;
  color:#f8fafc;
}
.notif-head-actions{
  display:flex;
  align-items:center;
  gap:6px;
}
.notif-mark-all{
  border:none;
  background:transparent;
  color:#7dd3fc;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  padding:4px 8px;
  border-radius:8px;
}
.notif-mark-all:hover{
  background:rgba(14,165,233,.12);
}
.notif-clear-all{
  border:none;
  background:transparent;
  color:#fda4af;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  padding:4px 8px;
  border-radius:8px;
}
.notif-clear-all:hover{
  background:rgba(244,63,94,.14);
}
.notif-dropdown__list{
  overflow-y:auto;
  max-height:340px;
  padding:8px;
}
.notif-empty{
  margin:0;
  padding:24px 12px;
  text-align:center;
  color:#94a3b8;
  font-size:13px;
}
.notif-item{
  display:flex;
  align-items:flex-start;
  gap:8px;
  width:100%;
  border-radius:12px;
  padding:8px;
  margin-bottom:6px;
  background:rgba(15,30,62,.55);
  border:1px solid rgba(130,170,255,.08);
  transition:background .15s ease,border-color .15s ease;
}
.notif-item:hover,
.notif-item:focus-within{
  background:rgba(20,48,97,.65);
  border-color:rgba(56,189,248,.25);
}
.notif-item__open{
  flex:1;
  min-width:0;
  display:block;
  width:100%;
  text-align:left;
  border:none;
  background:transparent;
  padding:4px 4px 4px 6px;
  cursor:pointer;
  font:inherit;
  color:inherit;
  line-height:1.4;
  appearance:none;
  -webkit-appearance:none;
}
.notif-item__open:focus{
  outline:none;
}
.notif-item__open:focus-visible{
  outline:1px solid rgba(56,189,248,.4);
  border-radius:8px;
}
.notif-item__delete{
  border:none;
  background:transparent;
  color:#fda4af;
  width:26px;
  height:26px;
  border-radius:8px;
  cursor:pointer;
  font-weight:700;
  line-height:1;
  margin-top:2px;
}
.notif-item__delete:hover{
  background:rgba(244,63,94,.14);
  color:#fecdd3;
}
.notif-item--unread{
  border-left:3px solid #38bdf8;
  background:rgba(14,165,233,.1);
}
.notif-item__title{
  margin:0 0 4px;
  font-size:13px;
  font-weight:800;
  color:#f1f5f9;
}
.notif-item__msg{
  margin:0 0 6px;
  font-size:12px;
  line-height:1.45;
  color:#94a3b8;
  white-space:normal;
  word-break:break-word;
}
.notif-item__time{
  font-size:11px;
  color:#64748b;
}
.notif-item__type{
  display:inline-block;
  margin-bottom:6px;
  padding:2px 8px;
  border-radius:999px;
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.notif-item__type--success{
  color:#4ade80;
  background:rgba(34,197,94,.12);
  border:1px solid rgba(74,222,128,.25);
}
.notif-item__type--warning{
  color:#fbbf24;
  background:rgba(251,191,36,.1);
  border:1px solid rgba(251,191,36,.28);
}
.notif-item__type--system{
  color:#a5b4fc;
  background:rgba(99,102,241,.12);
  border:1px solid rgba(129,140,248,.28);
}
.notif-item__type--info{
  color:#7dd3fc;
  background:rgba(14,165,233,.1);
  border:1px solid rgba(56,189,248,.22);
}
@media (max-width:640px){
  .top-title{
    margin-top:-6px;
    min-height:48px;
  }
  .top-title__row{
    padding-right:50px;
  }
  .site-search{
    max-width:none;
  }
  .site-search__input{
    height:40px;
    font-size:13px;
    padding-left:38px;
    padding-right:36px;
  }
  .notif-dropdown{
    right:-8px;
    width:min(340px,calc(100vw - 24px));
  }
}
