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

:root{
  --bg:#f3f6fb;
  --bg-2:#eef3f9;
  --card:#ffffff;
  --text:#162033;
  --muted:#6b768a;
  --line:#dce5f1;
  --soft:#f7faff;
  --primary:#3366ff;
  --primary-dark:#2554e8;
  --primary-soft:#edf3ff;
  --success:#16a34a;
  --warning:#d97706;
  --danger:#dc2626;
  --shadow:0 16px 44px rgba(19,33,68,.08);
  --shadow-soft:0 8px 24px rgba(19,33,68,.05);
  --radius:20px;
}
*{box-sizing:border-box}
html,body{
  min-height:100vh;
  display:flex;
  flex-direction:column;margin:0;padding:0;min-height:100%}
body{
  font-family:"Be Vietnam Pro",Inter,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--text);
  background:linear-gradient(180deg,var(--bg) 0%,var(--bg-2) 100%);
  letter-spacing:-0.01em;
}
a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:underline}
button,input,select,textarea{font:inherit}
textarea,input,select{
  width:100%;
  border:1px solid #cfdaea;
  border-radius:16px;
  background:#fff;
  color:var(--text);
  padding:15px 16px;
  outline:none;
  transition:border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
textarea:focus,input:focus,select:focus{
  border-color:#89a8ff;
  box-shadow:0 0 0 5px rgba(51,102,255,.09);
}
textarea{
  min-height:220px;
  resize:vertical;
  line-height:1.72;
  font-size:16px;
}
textarea::placeholder{color:#9ba8bc}
label{display:block;font-weight:800;margin:0 0 10px;font-size:15px}
select{appearance:none;background-image:linear-gradient(45deg,transparent 50%,#64748b 50%),linear-gradient(135deg,#64748b 50%,transparent 50%);background-position:calc(100% - 22px) 50%,calc(100% - 16px) 50%;background-size:6px 6px,6px 6px;background-repeat:no-repeat;padding-right:38px}

.app-shell{max-width:1640px;margin:0 auto;padding:18px;display:grid;grid-template-columns:280px minmax(0,1fr);gap:18px;align-items:start}
.card-lite{background:rgba(255,255,255,.88);backdrop-filter:blur(10px);border:1px solid rgba(216,226,241,.95);border-radius:28px;box-shadow:var(--shadow)}
.main-wrap{min-width:0}
.sidebar{padding:16px 14px;position:sticky;top:14px}
.sidebar-title{font-size:15px;font-weight:800;margin:4px 8px 14px}
.sidebar-chips{display:flex;flex-wrap:wrap;gap:10px;padding:0 4px 16px}
.sidebar-chip{background:#f3f7fd;border:1px solid #e0e8f4;color:#22314f;border-radius:999px;padding:10px 15px;font-weight:700;cursor:pointer;transition:.2s ease}
.sidebar-chip:hover{background:#eaf1ff;transform:translateY(-1px)}
.sidebar-links{display:flex;flex-direction:column;gap:10px}
.side-link{display:block;padding:15px 14px;border-radius:18px;background:linear-gradient(180deg,#f6f9fd 0%,#eef3f9 100%);color:#12213e;font-weight:800;line-height:1.45;border:1px solid #e2e9f3;transition:.2s ease}
.side-link.active,.side-link:hover{background:linear-gradient(180deg,#edf3ff 0%,#e5efff 100%);border-color:#bfd0ff;text-decoration:none;transform:translateY(-1px)}

.hero{padding:14px 20px 24px}
.brand-row{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:2px 4px 12px}
.brand-box{display:flex;align-items:center;gap:14px}
.brand-icon{width:48px;height:48px;border-radius:16px;display:flex;align-items:center;justify-content:center;background:linear-gradient(180deg,#fff3f5,#eef4ff);font-size:26px;border:1px solid #dde6f3;box-shadow:var(--shadow-soft)}
.brand-name{font-size:25px;font-weight:800;line-height:1.1}
.brand-sub{font-size:15px;color:var(--muted);margin-top:4px}
.brand-badge{display:inline-flex;align-items:center;justify-content:center;padding:10px 18px;border-radius:999px;background:var(--primary-soft);border:1px solid #d6e2ff;font-weight:800;color:var(--primary)}
.brand-badge:hover{text-decoration:none;background:#e6eeff}

.top-tabs{display:flex;gap:10px;flex-wrap:wrap;padding:0 4px 14px;border-bottom:1px solid var(--line);margin-bottom:16px}
.resource-tab-btn{border:0;background:transparent;color:#63718a;padding:12px 12px 14px;font-weight:800;cursor:pointer;border-bottom:3px solid transparent;transition:.2s ease}
.resource-tab-btn.active{color:#13213b;border-bottom-color:var(--primary)}
.resource-tab-btn:hover{color:#13213b}
.hero-panels{min-height:500px}
.resource-panel{display:none;padding:4px 4px 0}
.resource-panel.active{display:block}
.section-title{font-size:18px;font-weight:800;margin-bottom:12px}
.editor-intro{margin-bottom:12px;padding:14px 16px;border-radius:18px;background:linear-gradient(180deg,#f8fbff 0%,#f2f7ff 100%);border:1px solid #dce7f5;color:#4a5972;line-height:1.65}
.editor-intro b{color:#243451}

.char-counter{
  margin-top:14px;
  display:flex;
  flex-wrap:wrap;
  gap:8px 10px;
  padding:14px 16px;
  border-radius:18px;
  background:#f8fbff;
  border:1px solid #dce5f2;
  color:#22314b;
  font-size:15px;
}
.char-counter.warn{border-color:#fed7aa;background:#fff7ed}
.char-counter.danger{border-color:#fecaca;background:#fef2f2;color:#991b1b}
.char-counter.simple{background:#f8fbff}
.warn-line{font-weight:700;color:#b45309}

.grid{display:grid;gap:16px}
.controls-grid{grid-template-columns:repeat(3,minmax(0,1fr));margin-top:18px}
.key-grid.two-col{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
.key-grid{margin-top:14px}
.key-card,.embed-card,.support-box,.chat-card,.job{background:#fff;border:1px solid var(--line);border-radius:22px;box-shadow:var(--shadow-soft)}
.key-card{padding:18px}
.key-card-title{font-size:18px;font-weight:800;margin-bottom:8px}
.key-card-sub{margin:0 0 12px;color:var(--muted);line-height:1.6}
.key-panel-block{display:grid;gap:12px}
.key-button-row{display:flex;gap:10px;flex-wrap:wrap}
.key-links{display:flex;flex-wrap:wrap;gap:10px;align-items:center;font-size:14px}

.soft-note,.soft-banner,.top-key-status,.status-box,.key-toast{
  border-radius:18px;
  padding:14px 16px;
  border:1px solid #dce5f2;
  background:#f8fbff;
}
.soft-note{color:#334155}
.summary-note{margin-top:14px}
.soft-banner{background:linear-gradient(180deg,#f3f7ff 0%,#eef4ff 100%);font-weight:700;margin-bottom:14px}
.top-key-status,.key-active{background:#effaf2;border-color:#b7e0c1;color:#166534;font-weight:700}
.key-active{margin-bottom:12px}
.status-box{margin-top:12px;min-height:52px}
.key-toast{position:fixed;right:18px;bottom:18px;max-width:420px;z-index:1000;background:#effaf2;border-color:#b7e0c1;color:#166534;box-shadow:var(--shadow)}
.key-toast.show{display:block}

.action-row{margin-top:18px;display:flex;gap:12px;align-items:center}
#createBtn,.primary-link-btn,.smallbtn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  border-radius:16px;padding:12px 18px;border:0;cursor:pointer;font-weight:800;transition:.2s ease
}
#createBtn,.primary-link-btn,.smallbtn:not(.ghost){background:linear-gradient(180deg,#4b7bff 0%,#3366ff 100%);color:#fff;box-shadow:0 10px 20px rgba(51,102,255,.18)}
#createBtn:hover,.primary-link-btn:hover,.smallbtn:not(.ghost):hover{background:linear-gradient(180deg,#3e6ef3 0%,#2554e8 100%);text-decoration:none;transform:translateY(-1px)}
.smallbtn{padding:11px 16px;font-size:14px}
.smallbtn.ghost,.download{background:#fff;color:#1e293b;border:1px solid #d7e1ef;box-shadow:none}
.smallbtn.ghost:hover,.download:hover{text-decoration:none;background:#f8fbff}
.primary-link-btn.alt{background:linear-gradient(180deg,#22324f 0%,#13213b 100%)}
.primary-link-btn.alt:hover{background:linear-gradient(180deg,#182640 0%,#0f172a 100%)}

.audio-box{margin-top:14px}
.audio-box audio{width:100%}
.divider{height:1px;background:var(--line);margin:22px 0}
.list-head{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-bottom:8px}
.list-head h2{margin:0;font-size:20px}
.list-actions{display:flex;gap:10px;flex-wrap:wrap}
.hint{color:var(--muted);margin-bottom:14px;line-height:1.6}
.jobs{display:grid;gap:14px}
.job{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:16px;align-items:center;padding:18px}
.job-title{font-weight:800;margin-bottom:6px;line-height:1.45;font-size:16px}
.job-meta{font-size:14px;color:var(--muted);line-height:1.5}
.job-actions{display:flex;flex-wrap:wrap;align-items:center;gap:10px;justify-content:flex-end}
.job audio{width:280px;max-width:100%}
.ok{color:var(--success);font-weight:700}
.wait{color:var(--warning);font-weight:700}
.empty{padding:18px;border:1px dashed #cdd8e7;border-radius:18px;background:#fafcff;color:var(--muted)}
.download{padding:10px 14px;border-radius:14px;font-weight:700}

.embed-card,.support-box,.chat-card{padding:18px}
.quick-link-card{line-height:1.85}
.quick-link-card a{display:block;margin:6px 0}
.support-box h3,.chat-card h3{margin:0 0 10px;font-size:20px}
.support-list{margin:10px 0 0;padding-left:20px;line-height:1.9}
.chat-panel{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.chat-card p{margin:0 0 14px;color:var(--muted);line-height:1.65}

.app-shell{flex:1 0 auto}
.site-footer{
  width:100%;
  max-width:1640px;
  margin:auto auto 0;
  padding:18px 16px 24px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  color:var(--muted);
  font-size:14px;
  text-align:center;
}
.footer-main-text{line-height:1.5}
.footer-legal-note{line-height:1.55;color:#6b768a}
.footer-legal-note a{font-weight:800;color:#0f172a}
.footer-links{display:flex;gap:16px;flex-wrap:wrap;justify-content:center}
.footer-links a{font-weight:700}

.watch-modal{position:fixed;inset:0;background:rgba(15,23,42,.55);display:flex;align-items:center;justify-content:center;padding:16px;z-index:9999}
.watch-box{width:min(760px,100%);background:#fff;border-radius:24px;padding:22px;border:1px solid var(--line);box-shadow:var(--shadow)}
.watch-box h2{margin:0 0 8px}
.watch-box p{margin:0 0 14px;color:var(--muted)}
.watch-video iframe,.watch-video video{width:100%;border:0;border-radius:16px;min-height:280px;background:#000}
.watch-count{margin-top:12px;padding:12px 14px;border-radius:14px;background:#f5f8fd;border:1px solid #dce5f2;font-weight:700}
.watch-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:14px;flex-wrap:wrap}

@media (max-width:1200px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{position:static}
}
@media (max-width:900px){
  .controls-grid,.key-grid.two-col,.chat-panel{grid-template-columns:1fr}
  .job{grid-template-columns:1fr}
  .job-actions{justify-content:flex-start}
}
@media (max-width:640px){
  .app-shell{padding:10px}
  .hero{padding:12px}
  .brand-row,.list-head{flex-direction:column;align-items:flex-start}
  .brand-name{font-size:22px}
  .top-tabs{gap:4px}
  .resource-tab-btn{padding:10px 8px 12px;font-size:14px}
  .sidebar-links{gap:10px}
  .side-link{padding:14px 12px}
  .key-button-row,.list-actions{width:100%}
  .key-button-row .smallbtn,.list-actions .smallbtn,#createBtn{width:100%}
}

/* Admin compatibility */
.app{max-width:1180px;margin:0 auto;padding:16px}
.card{background:#fff;border:1px solid var(--line);border-radius:24px;box-shadow:var(--shadow);padding:20px}
.topbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px}
.badge{display:inline-flex;align-items:center;padding:8px 12px;border-radius:999px;background:#eff6ff;color:#1d4ed8;font-weight:800;border:1px solid #dbeafe}
.admin-link{font-weight:700}
.sub{color:var(--muted);line-height:1.6}
.note{background:#f8fbff;border:1px solid #dce5f2;border-radius:16px;padding:12px 14px;margin:10px 0;color:#334155;line-height:1.55}
.success{background:#effaf2;border:1px solid #b7e0c1;color:#166534;border-radius:16px;padding:12px 14px;margin:10px 0;font-weight:700}
.error{background:#fef2f2;border:1px solid #fecaca;color:#991b1b;border-radius:16px;padding:12px 14px;margin:10px 0;font-weight:700}
.input{width:100%}
.tall{min-height:170px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}
form h2{margin-top:26px}
form button[type="submit"]{margin-top:18px;background:linear-gradient(180deg,#4b7bff 0%,#3366ff 100%);color:#fff;border:0;border-radius:14px;padding:13px 20px;font-weight:800;cursor:pointer}
form button[type="submit"]:hover{background:linear-gradient(180deg,#3e6ef3 0%,#2554e8 100%)}

/* V4 layout refinement: sidebar sát mép trái, menu gọn vừa như ảnh mẫu */
body{
  background:#eef3f9;
}
.app-shell{
  max-width:none;
  width:100%;
  margin:0;
  padding:0;
  gap:0;
  grid-template-columns:275px minmax(0,1fr);
  align-items:stretch;
  min-height:100vh;
}
.sidebar.card-lite{
  border-radius:0;
  border-top:0;
  border-left:0;
  border-bottom:0;
  box-shadow:none;
  background:#ffffff;
  min-height:100vh;
  padding:22px 14px 28px;
  position:sticky;
  top:0;
}
.sidebar-title{
  font-size:16px;
  margin:0 0 14px 0;
  padding-left:0;
}
.sidebar-chips{
  padding:0 0 16px;
  gap:8px;
}
.sidebar-chip{
  font-size:13px;
  padding:9px 13px;
  border-radius:999px;
  background:#f1f5f9;
  border-color:#e7edf5;
}
.sidebar-links{
  gap:8px;
}
.side-link{
  font-size:15px;
  padding:14px 13px;
  border-radius:14px;
  background:#f1f5f9;
  border-color:#e8eef6;
  line-height:1.35;
}
.side-link.active,.side-link:hover{
  background:#eaf1fb;
  border-color:#d8e3f2;
  transform:none;
}
.main-wrap{
  width:100%;
  min-height:100vh;
  background:#eef3f9;
}
.hero.card-lite{
  border-radius:0;
  border-top:0;
  border-right:0;
  border-bottom:0;
  box-shadow:none;
  background:transparent;
  padding:0;
}
.brand-row{
  background:#fff;
  border-bottom:1px solid #dce5f1;
  padding:16px 24px;
}
.brand-icon{
  width:44px;
  height:44px;
  border-radius:13px;
  font-size:24px;
}
.brand-name{
  font-size:25px;
}
.brand-sub{
  font-size:13px;
}
.brand-badge{
  padding:9px 16px;
  font-size:14px;
}
.top-tabs{
  max-width:1088px;
  margin:0 auto 12px;
  padding:14px 0 0;
  border-bottom:1px solid #d6e0ec;
  gap:16px;
}
.resource-tab-btn{
  font-size:15px;
  padding:0 0 12px;
}
.hero-panels{
  max-width:1088px;
  margin:0 auto;
  padding:0 0 40px;
}
.resource-panel{
  padding:0;
}
textarea#text{
  min-height:216px;
  border-radius:14px;
  padding:15px 16px;
  font-size:15px;
  line-height:1.6;
}
textarea#text::placeholder{
  color:#94a3b8;
  opacity:1;
}
.editor-intro{
  display:none!important;
}
.char-counter{
  margin-top:12px;
  border-radius:14px;
  padding:13px 15px;
  font-size:14px;
  background:#fff;
  box-shadow:0 8px 22px rgba(19,33,68,.04);
}
.controls-grid{
  margin-top:18px;
  gap:16px;
}
.controls-grid label{
  font-size:14px;
  margin-bottom:8px;
}
.controls-grid select{
  border-radius:13px;
  padding:13px 16px;
  font-size:14px;
}
.action-row{
  margin-top:18px;
}
#createBtn{
  border-radius:13px;
  padding:13px 20px;
  font-size:14px;
}
.divider{
  margin:24px 0;
}
.list-head h2{
  font-size:21px;
}
.hint{
  font-size:14px;
}
.job{
  border-radius:16px;
  padding:15px 16px;
}
.job-title{
  font-size:15px;
}
.job-meta{
  font-size:13px;
}
.download{
  background:#eef3ff;
  border-color:#e4ebff;
  color:#2563eb;
}
.key-card,.embed-card,.support-box,.chat-card{
  border-radius:16px;
}

@media (max-width:1200px){
  .app-shell{grid-template-columns:260px minmax(0,1fr)}
  .hero-panels,.top-tabs{max-width:calc(100% - 48px)}
}
@media (max-width:900px){
  .app-shell{grid-template-columns:1fr}
  .sidebar.card-lite{position:static;min-height:auto;border-right:0;border-bottom:1px solid #dce5f1}
  .brand-row{padding:14px 16px}
  .hero-panels,.top-tabs{max-width:calc(100% - 24px)}
}

/* V5 cleanup: bỏ dòng trạng thái lặp, bỏ khoảng trống dư, chỉ giữ Mẫu ngắn */
.summary-note:empty,
#quotaBox:empty{
  display:none!important;
}
.status-box{
  display:none;
  min-height:0;
  margin-top:0;
}
.status-box:not(:empty){
  display:block;
  min-height:auto;
  margin-top:12px;
}
.sidebar-chips .sidebar-chip:not(:first-child){
  display:none;
}
.mobile-menu-btn{
  display:none;
  width:46px;
  height:46px;
  border:0;
  border-radius:50%;
  background:#f2f6fb;
  color:#111827;
  font-size:22px;
  font-weight:800;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.sidebar-backdrop{
  display:none;
}

@media (max-width:900px){
  body{
    background:#f7f9fd;
  }
  .app-shell{
    display:block;
    min-height:100vh;
    background:#f7f9fd;
  }
  .sidebar.card-lite{
    position:fixed;
    inset:0 auto 0 0;
    width:min(86vw,320px);
    min-height:100vh;
    z-index:1002;
    transform:translateX(-105%);
    transition:transform .24s ease;
    box-shadow:22px 0 50px rgba(15,23,42,.18);
    overflow-y:auto;
  }
  body.audio-sidebar-open .sidebar.card-lite{
    transform:translateX(0);
  }
  .sidebar-backdrop{
    position:fixed;
    inset:0;
    background:rgba(15,23,42,.35);
    z-index:1001;
  }
  body.audio-sidebar-open .sidebar-backdrop{
    display:block;
  }
  .main-wrap{
    min-height:100vh;
    width:100%;
  }
  .brand-row{
    position:sticky;
    top:0;
    z-index:900;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    padding:18px 16px 14px;
    background:#fff;
    border-bottom:1px solid #e3eaf4;
  }
  .mobile-menu-btn{
    display:flex;
    flex:0 0 auto;
  }
  .brand-box{
    flex:1 1 auto;
    min-width:0;
    justify-content:flex-start;
  }
  .brand-icon{
    width:52px;
    height:52px;
    border-radius:17px;
    font-size:28px;
  }
  .brand-name{
    font-size:28px;
    letter-spacing:-.03em;
  }
  .brand-sub{
    font-size:16px;
  }
  .brand-badge{
    flex:0 0 auto;
    width:52px;
    height:52px;
    padding:0;
    border-radius:50%;
    font-size:0;
    background:#f2f6fb;
    border:1px solid #e8eef6;
  }
  .brand-badge::after{
    content:'🌙';
    font-size:22px;
    line-height:1;
  }
  .top-tabs{
    max-width:none;
    margin:0;
    padding:0 16px;
    gap:26px;
    flex-wrap:nowrap;
    overflow-x:auto;
    scrollbar-width:none;
    background:#fff;
    border-bottom:1px solid #dbe4ef;
  }
  .top-tabs::-webkit-scrollbar{display:none}
  .resource-tab-btn{
    flex:0 0 auto;
    font-size:20px;
    font-weight:600;
    padding:14px 0 12px;
    color:#6b7280;
    white-space:nowrap;
  }
  .resource-tab-btn.active{
    color:#111827;
    border-bottom-color:#111827;
  }
  .hero-panels{
    max-width:none;
    margin:0;
    padding:18px 16px 110px;
  }
  textarea#text{
    min-height:240px;
    font-size:16px;
    line-height:1.7;
    border-radius:18px;
  }
  .char-counter{
    border-radius:18px;
    font-size:14px;
    line-height:1.55;
  }
  .controls-grid{
    grid-template-columns:1fr;
    gap:13px;
  }
  .controls-grid select{
    border-radius:16px;
    min-height:52px;
  }
  .action-row{
    margin-top:16px;
  }
  #createBtn{
    min-height:50px;
    border-radius:15px;
    padding:13px 20px;
  }
  .divider{
    margin:22px 0;
  }
  .list-head{
    align-items:center;
  }
  .list-head h2{
    font-size:20px;
  }
  .list-actions{
    gap:8px;
  }
  .smallbtn{
    border-radius:15px;
  }
}

@media (max-width:560px){
  .brand-row{
    padding:16px 14px 12px;
  }
  .mobile-menu-btn,
  .brand-badge{
    width:48px;
    height:48px;
  }
  .brand-icon{
    width:48px;
    height:48px;
  }
  .brand-name{
    font-size:24px;
  }
  .brand-sub{
    font-size:14px;
  }
  .top-tabs{
    gap:24px;
    padding:0 14px;
  }
  .resource-tab-btn{
    font-size:18px;
  }
  .hero-panels{
    padding:16px 14px 105px;
  }
  .list-head{
    flex-direction:row;
    justify-content:space-between;
  }
  .list-actions .smallbtn{
    width:auto;
    padding:10px 12px;
  }
  .job{
    border-radius:18px;
  }
}

/* V6 mobile header/tab tối ưu theo mẫu Chat AGI */
.tab-label-mobile{display:none}
@media (max-width:900px){
  .hero.card-lite{
    background:#f7f9fd;
  }
  .brand-row{
    flex-direction:row!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:12px!important;
    min-height:112px;
    padding:24px 24px 18px!important;
    background:#fff!important;
    border-bottom:0!important;
    box-shadow:none!important;
  }
  .mobile-menu-btn{
    display:flex!important;
    width:50px!important;
    height:50px!important;
    min-width:50px!important;
    border-radius:999px!important;
    font-size:24px!important;
    background:#f2f6fb!important;
    color:#142033!important;
    box-shadow:none!important;
  }
  .brand-box{
    flex:1 1 auto!important;
    min-width:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:14px!important;
  }
  .brand-icon{
    width:54px!important;
    height:54px!important;
    min-width:54px!important;
    border-radius:18px!important;
    font-size:30px!important;
  }
  .brand-name{
    font-size:27px!important;
    line-height:1.05!important;
    font-weight:800!important;
    letter-spacing:-.035em!important;
  }
  .brand-sub{
    font-size:15px!important;
    line-height:1.3!important;
    margin-top:4px!important;
    color:#7b8496!important;
  }
  .brand-badge{
    width:50px!important;
    height:50px!important;
    min-width:50px!important;
    border-radius:999px!important;
    padding:0!important;
    font-size:0!important;
    display:flex!important;
    background:#f2f6fb!important;
    border:0!important;
    box-shadow:none!important;
  }
  .brand-badge::after{
    content:'🌙';
    font-size:23px;
    line-height:1;
  }
  .top-tabs{
    max-width:none!important;
    margin:0!important;
    padding:0 24px!important;
    height:58px!important;
    display:flex!important;
    align-items:flex-end!important;
    flex-wrap:nowrap!important;
    gap:34px!important;
    overflow-x:auto!important;
    background:#fff!important;
    border-top:0!important;
    border-bottom:1px solid #dfe7f2!important;
    scrollbar-width:none!important;
  }
  .top-tabs::-webkit-scrollbar{display:none!important}
  .resource-tab-btn{
    flex:0 0 auto!important;
    display:flex!important;
    align-items:flex-end!important;
    height:58px!important;
    padding:0 0 12px!important;
    border-bottom:4px solid transparent!important;
    color:#707584!important;
    font-size:20px!important;
    font-weight:600!important;
    line-height:1!important;
    white-space:nowrap!important;
    letter-spacing:-.025em!important;
  }
  .resource-tab-btn.active{
    color:#111827!important;
    border-bottom-color:#111827!important;
  }
  .tab-label-desktop{display:none!important}
  .tab-label-mobile{display:inline!important}
  .hero-panels{
    padding:18px 24px 118px!important;
    background:#f7f9fd!important;
  }
  textarea#text{
    min-height:230px!important;
    border-radius:24px!important;
    padding:24px 26px!important;
    font-size:18px!important;
    line-height:1.65!important;
  }
  textarea#text::placeholder{
    color:#a2aec2!important;
    opacity:1!important;
  }
  .char-counter{
    margin-top:18px!important;
    border-radius:24px!important;
    padding:18px 24px!important;
    font-size:16px!important;
    line-height:1.75!important;
    display:block!important;
  }
  .char-counter span{display:inline!important}
  .char-counter span:nth-child(3){display:block!important;margin-top:6px!important}
  .controls-grid{
    margin-top:26px!important;
    gap:20px!important;
  }
  .controls-grid label{
    font-size:18px!important;
    margin-bottom:12px!important;
  }
  .controls-grid select{
    min-height:58px!important;
    border-radius:18px!important;
    padding:16px 20px!important;
    font-size:17px!important;
  }
  .action-row{margin-top:22px!important}
  #createBtn{
    min-height:54px!important;
    border-radius:16px!important;
    padding:15px 22px!important;
    font-size:16px!important;
  }
  .divider{margin:24px 0!important}
  .list-head h2{font-size:21px!important}
  .hint{font-size:14px!important}
}
@media (max-width:520px){
  .brand-row{
    min-height:104px;
    padding:22px 14px 16px!important;
    gap:10px!important;
  }
  .mobile-menu-btn,
  .brand-badge{
    width:46px!important;
    height:46px!important;
    min-width:46px!important;
  }
  .brand-icon{
    width:48px!important;
    height:48px!important;
    min-width:48px!important;
    border-radius:16px!important;
    font-size:27px!important;
  }
  .brand-box{gap:12px!important}
  .brand-name{font-size:24px!important}
  .brand-sub{font-size:14px!important}
  .top-tabs{
    padding:0 14px!important;
    gap:29px!important;
    height:56px!important;
  }
  .resource-tab-btn{
    height:56px!important;
    font-size:19px!important;
    padding-bottom:12px!important;
  }
  .hero-panels{
    padding:18px 14px 112px!important;
  }
  textarea#text{
    min-height:232px!important;
    border-radius:22px!important;
    padding:22px 24px!important;
    font-size:17px!important;
    line-height:1.65!important;
  }
  .char-counter{
    border-radius:22px!important;
    padding:18px 22px!important;
    font-size:16px!important;
  }
}
@media (max-width:390px){
  .top-tabs{gap:24px!important}
  .resource-tab-btn{font-size:18px!important}
  .brand-name{font-size:22px!important}
  .brand-sub{font-size:13px!important}
  textarea#text{font-size:16px!important;padding:20px!important}
}

/* V7: real light/dark theme toggle */
.mobile-theme-toggle{
  display:none;
  align-items:center;
  justify-content:center;
  width:50px;
  height:50px;
  min-width:50px;
  border:0;
  border-radius:999px;
  background:#f2f6fb;
  color:#111827;
  font-size:23px;
  cursor:pointer;
  box-shadow:none;
}
.mobile-theme-toggle:hover{background:#eaf1fb}
body.theme-dark{
  --bg:#0f172a;
  --bg-2:#111827;
  --card:#182235;
  --text:#e5edf8;
  --muted:#9aa8bd;
  --line:#2a3a52;
  --soft:#162235;
  background:#0f172a;
  color:#e5edf8;
}
body.theme-dark .app-shell,
body.theme-dark .main-wrap,
body.theme-dark .hero,
body.theme-dark .brand-row,
body.theme-dark .top-tabs{
  background:#0f172a!important;
}
body.theme-dark .card-lite,
body.theme-dark .key-card,
body.theme-dark .embed-card,
body.theme-dark .support-box,
body.theme-dark .chat-card,
body.theme-dark .job,
body.theme-dark .sidebar,
body.theme-dark .soft-note,
body.theme-dark .soft-banner,
body.theme-dark .char-counter,
body.theme-dark .status-box{
  background:#172033!important;
  border-color:#2b3b55!important;
  color:#e5edf8!important;
}
body.theme-dark textarea,
body.theme-dark input,
body.theme-dark select{
  background:#111827!important;
  border-color:#33445f!important;
  color:#f1f5f9!important;
}
body.theme-dark textarea::placeholder{color:#8997ad!important}
body.theme-dark .brand-name,
body.theme-dark .resource-tab-btn.active,
body.theme-dark label,
body.theme-dark .list-head h2,
body.theme-dark .job-title{color:#f8fafc!important}
body.theme-dark .brand-sub,
body.theme-dark .hint,
body.theme-dark .job-meta,
body.theme-dark .key-card-sub{color:#aab6ca!important}
body.theme-dark .side-link,
body.theme-dark .sidebar-chip,
body.theme-dark .mobile-menu-btn,
body.theme-dark .mobile-theme-toggle{
  background:#1d2a40!important;
  color:#f8fafc!important;
  border-color:#30435f!important;
}
body.theme-dark .top-tabs{border-bottom-color:#2a3a52!important}
body.theme-dark .resource-tab-btn{color:#aab6ca!important}
body.theme-dark .resource-tab-btn.active{color:#f8fafc!important;border-bottom-color:#f8fafc!important}
body.theme-dark .empty{background:#111827!important;border-color:#33445f!important;color:#aab6ca!important}

@media (max-width:900px){
  .desktop-brand-badge{display:none!important}
  .mobile-theme-toggle{display:flex!important}
  .brand-badge::after{content:none!important}
  .brand-row{
    flex-direction:row!important;
    align-items:center!important;
    justify-content:space-between!important;
  }
  .brand-box{
    display:flex!important;
    flex:1 1 auto!important;
    min-width:0!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:12px!important;
  }
}

/* V8: desktop theme button + admin cleanup polish */
.brand-actions{display:flex;align-items:center;gap:10px;flex:0 0 auto}
.desktop-theme-toggle{
  display:flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  min-width:44px;
  border:0;
  border-radius:999px;
  background:#f2f6fb;
  color:#111827;
  font-size:20px;
  cursor:pointer;
  box-shadow:none;
}
.desktop-theme-toggle:hover{background:#eaf1fb}
body.theme-dark .desktop-theme-toggle{background:#1d2a40!important;color:#f8fafc!important;border-color:#30435f!important}
@media (max-width:900px){
  .brand-actions{display:none!important}
  .desktop-theme-toggle{display:none!important}
}


/* V58 embed mode: khi nhúng vào Chat AGI thì bỏ sidebar, chiếm full khung iframe */
body.is-embedded{
  background:#f5f7fb;
  overflow:auto;
}
body.is-embedded .app-shell{
  max-width:none!important;
  width:100%!important;
  min-height:100vh!important;
  padding:12px!important;
  margin:0!important;
  display:block!important;
  grid-template-columns:1fr!important;
}
body.is-embedded .sidebar.card-lite,
body.is-embedded .sidebar,
body.is-embedded .sidebar-backdrop,
body.is-embedded footer.site-footer{
  display:none!important;
}
body.is-embedded .main-wrap{
  width:100%!important;
  max-width:none!important;
  min-height:0!important;
  padding:0!important;
  margin:0!important;
}
body.is-embedded .hero.card-lite{
  margin:0!important;
  border-radius:20px!important;
  box-shadow:none!important;
}
body.is-embedded .brand-row{
  padding-top:0!important;
}
body.is-embedded .hero-panels{
  min-height:0!important;
}
body.is-embedded textarea#text{
  min-height:220px!important;
}
body.is-embedded .resource-tabs{
  position:sticky;
  top:0;
  z-index:15;
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(10px);
  border-radius:14px;
}
@media(max-width:768px){
  body.is-embedded .app-shell{padding:8px!important;}
  body.is-embedded .hero.card-lite{border-radius:16px!important;}
  body.is-embedded textarea#text{min-height:190px!important;}
}


/* V59 embed trong Chat AGI: bỏ tab/menu nội bộ vì tab chính đã có ở ngoài */
body.is-embedded .sidebar.card-lite,
body.is-embedded .sidebar,
body.is-embedded .sidebar-links,
body.is-embedded .sidebar-chips,
body.is-embedded .resource-tabs,
body.is-embedded .brand-actions,
body.is-embedded .mobile-menu-btn{
  display:none!important;
}
body.is-embedded .app-shell{padding:0!important;background:transparent!important;}
body.is-embedded .main-wrap{padding:0!important;}
body.is-embedded .hero.card-lite{margin:0!important;border-radius:0!important;border:0!important;box-shadow:none!important;background:transparent!important;}
body.is-embedded .brand-row{display:none!important;}
body.is-embedded .resource-panels{padding:0!important;margin:0!important;}
body.is-embedded .resource-panel{display:none!important;}
body.is-embedded #resource-editor{display:block!important;}
body.is-embedded #resource-editor.active{display:block!important;}
body.is-embedded textarea#text{min-height:260px!important;}
body.is-embedded .hero-panels{min-height:0!important;}


/* V60: key-only embed dùng trong tab Key chung của Chat AGI */
body.is-key-only{
  background:transparent!important;
  overflow:auto!important;
}
body.is-key-only .sidebar,
body.is-key-only .topbar,
body.is-key-only .resource-tabs,
body.is-key-only footer,
body.is-key-only #resource-editor,
body.is-key-only #resource-link,
body.is-key-only #resource-support,
body.is-key-only #resource-chat,
body.is-key-only .status-box,
body.is-key-only .audio-box,
body.is-key-only .jobs{
  display:none!important;
}
body.is-key-only .app-shell,
body.is-key-only .main-panel,
body.is-key-only .hero-panels{
  display:block!important;
  width:100%!important;
  max-width:none!important;
  min-height:auto!important;
  padding:0!important;
  margin:0!important;
  background:transparent!important;
}
body.is-key-only #resource-key{
  display:block!important;
  opacity:1!important;
  visibility:visible!important;
  transform:none!important;
  width:100%!important;
  max-width:none!important;
  margin:0!important;
}
body.is-key-only #resource-key.resource-panel{display:block!important}
body.is-key-only #resource-key .section-title{display:none!important}
body.is-key-only .key-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
@media(max-width:768px){
  body.is-key-only .key-grid{grid-template-columns:1fr!important}
}

/* V61: modal xem video co gọn trong iframe Audio, không tràn màn hình */
body.is-embedded .watch-modal,
body.is-key-only .watch-modal{
  position:fixed!important;
  inset:0!important;
  padding:10px!important;
  overflow:auto!important;
  align-items:center!important;
  justify-content:center!important;
}
body.is-embedded .watch-box,
body.is-key-only .watch-box{
  width:min(720px, calc(100vw - 20px))!important;
  max-width:calc(100vw - 20px)!important;
  max-height:calc(100vh - 20px)!important;
  overflow:auto!important;
  margin:auto!important;
  padding:16px!important;
  border-radius:20px!important;
}
body.is-embedded .watch-video,
body.is-key-only .watch-video{
  width:100%!important;
  aspect-ratio:16/9!important;
  min-height:0!important;
  max-height:min(52vh, 380px)!important;
  border-radius:16px!important;
  overflow:hidden!important;
}
body.is-embedded .watch-video iframe,
body.is-embedded .watch-video video,
body.is-key-only .watch-video iframe,
body.is-key-only .watch-video video{
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  max-height:none!important;
  display:block!important;
  border:0!important;
}
body.is-embedded .watch-count,
body.is-key-only .watch-count{font-size:14px!important;padding:10px 12px!important;margin-top:10px!important;}
body.is-embedded .watch-actions,
body.is-key-only .watch-actions{gap:8px!important;margin-top:10px!important;}
@media(max-width:720px){
  body.is-embedded .watch-box,
  body.is-key-only .watch-box{padding:12px!important;border-radius:16px!important;}
  body.is-embedded .watch-box h2,
  body.is-key-only .watch-box h2{font-size:18px!important;line-height:1.2!important;}
  body.is-embedded .watch-box p,
  body.is-key-only .watch-box p{font-size:13px!important;line-height:1.35!important;margin-bottom:10px!important;}
  body.is-embedded .watch-video,
  body.is-key-only .watch-video{max-height:38vh!important;}
}


/* V63: làm popup xem video Audio co gọn hơn trong iframe Chat AGI */
body.is-embedded .watch-modal.hidden,
body.is-key-only .watch-modal.hidden,
.watch-modal.hidden{display:none!important}
body.is-embedded .watch-box,
body.is-key-only .watch-box{
  width:min(680px, calc(100vw - 28px))!important;
  max-height:calc(100vh - 28px)!important;
  overflow:auto!important;
}
body.is-embedded .watch-video,
body.is-key-only .watch-video{
  aspect-ratio:16/9!important;
  height:auto!important;
  min-height:0!important;
  max-height:min(44vh, 330px)!important;
}
body.is-embedded .watch-video iframe,
body.is-key-only .watch-video iframe{height:100%!important;min-height:0!important}
body.is-embedded .watch-video>div,
body.is-key-only .watch-video>div{height:100%!important;min-height:0!important;width:100%!important}

/* V66: nút xem xong video mờ khi chưa đủ thời gian + video modal co gọn */
.watch-actions button:disabled,
.watch-actions .smallbtn:disabled,
#confirmWatchBtn:disabled{
  opacity:.45!important;
  filter:grayscale(.35);
  cursor:not-allowed!important;
  box-shadow:none!important;
}
.watch-box{width:min(760px,calc(100vw - 32px))!important;max-height:92vh!important;overflow:auto!important;}
.watch-video{position:relative;width:100%;aspect-ratio:16/9;min-height:0!important;}
.watch-video iframe,.watch-video video{width:100%!important;height:100%!important;min-height:0!important;display:block!important;}
