:root {
  --bg: #0a0a0f;
  --bg-soft: #101018;
  --card: rgba(20, 20, 29, 0.92);
  --card-2: #171723;
  --text: #f2f2f5;
  --muted: #9c9cad;
  --line: rgba(255,255,255,0.08);
  --primary: #ffffff;
  --accent: #6d7cff;
  --success: #19b36b;
  --warning: #f3b43f;
  --danger: #ef5d5d;
  --shadow: 0 20px 50px rgba(0,0,0,0.35);
}

body.light {
  --bg: #f3f4f8;
  --bg-soft: #ffffff;
  --card: rgba(255,255,255,0.96);
  --card-2: #ffffff;
  --text: #111218;
  --muted: #64687a;
  --line: rgba(17,18,24,0.08);
  --primary: #111218;
  --shadow: 0 16px 40px rgba(17,18,24,0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, Arial, sans-serif; background: linear-gradient(180deg, var(--bg), #050507); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: .25;
  pointer-events: none;
}

.app-shell { display: flex; min-height: 100vh; position: relative; }
.sidebar {
  width: 285px;
  background:
    radial-gradient(circle at top left, rgba(255,204,51,.12), transparent 35%),
    radial-gradient(circle at bottom right, rgba(109,124,255,.12), transparent 35%),
    rgba(11,11,17,.94);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
}
.main-content { margin-left: 285px; width: calc(100% - 285px); padding: 20px; position: relative; }
.brand, .brand-lg { font-weight: 800; letter-spacing: 1px; color: #ffcc33; }
.brand {
  font-size: 30px;
  line-height: 1;
  text-shadow: 0 0 22px rgba(255,204,51,.25);
}
.brand-lg { font-size: 42px; }
.brand-row, .topbar, .topbar-left, .topbar-right, .user-chip, .row, .auth-top { display: flex; align-items: center; }
.brand-row, .topbar { justify-content: space-between; }
.topbar { gap: 16px; margin-bottom: 20px; }
.topbar-left, .topbar-right, .user-chip, .auth-top { gap: 12px; }
.nav-group {
  margin-top: 28px;
  display: grid;
  gap: 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: .2s ease;
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 2px;
  background: transparent;
}

.nav-link:hover {
  background: rgba(255, 255, 255, .06);
  border-color: var(--line);
  color: var(--text);
  transform: translateX(3px);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(109,124,255,.22), rgba(255,204,51,.10));
  border-color: rgba(255,255,255,.14);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}

.nav-link.active::before {
  background: #ffcc33;
}

.nav-icon {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255,255,255,.07);
  flex: 0 0 30px;
}

.nav-link.active .nav-icon {
  background: rgba(255,204,51,.18);
}

.nav-link.danger {
  margin-top: 8px;
}

.nav-link.danger:hover {
  color: #fff;
  background: rgba(239,93,93,.16);
  border-color: rgba(239,93,93,.22);
}
.icon-btn, .theme-toggle {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  cursor: pointer;
}
.theme-toggle { width: auto; padding: 0 14px; }
.headline { font-size: 26px; font-weight: 700; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #343c7b); color: #fff; font-weight: 700;
}
.user-chip { background: var(--card); border: 1px solid var(--line); padding: 6px 10px; border-radius: 18px; }
.grid { display: grid; gap: 18px; }
.grid.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)), var(--card);
  border: 1px solid var(--line); border-radius: 28px; padding: 22px; box-shadow: var(--shadow);
}
.card h3, .card h2 { margin: 0 0 10px; }
.kpi { font-size: 34px; font-weight: 800; margin-top: 12px; }
.hero {
  min-height: 220px; display: flex; flex-direction: column; justify-content: center;
  background: radial-gradient(circle at top right, rgba(109,124,255,.25), transparent 35%), var(--card);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  background: var(--primary); color: #111; font-weight: 700; cursor: pointer;
}
body.light .btn { color: #fff; background: #111; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn.warning { background: #f3b43f; color: #111; }
.btn.danger { background: #ef5d5d; color: #fff; }
.btn.success { background: #19b36b; color: #fff; }
.form-grid { display: grid; gap: 14px; }
.label { display: grid; gap: 8px; font-weight: 600; }
.input, .textarea, .select {
  width: 100%; min-height: 52px; border-radius: 18px; border: 1px solid var(--line);
  background: rgba(255,255,255,.03); color: var(--text); padding: 14px 16px; outline: none;
}
.textarea { min-height: 120px; resize: vertical; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.badge {
  display: inline-flex; padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--line);
}
.badge.pending { background: rgba(243,180,63,.12); color: #f3b43f; }
.badge.approved, .badge.completed, .badge.active { background: rgba(25,179,107,.12); color: #19b36b; }
.badge.rejected, .badge.cancelled, .badge.inactive { background: rgba(239,93,93,.12); color: #ef5d5d; }
.stack { display: grid; gap: 18px; }
.alert { margin-bottom: 16px; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--line); }
.alert-success { background: rgba(25,179,107,.12); color: #9af0c6; }
.alert-error { background: rgba(239,93,93,.13); color: #ffb1b1; }
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-shell { width: min(560px, 100%); position: relative; z-index: 1; }
.auth-card { padding: 28px; border-radius: 32px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 24px; }
.auth-tab { display: flex; justify-content: center; min-height: 50px; align-items: center; border-radius: 16px; background: rgba(255,255,255,.03); border: 1px solid var(--line); color: var(--muted); font-weight: 700; }
.auth-tab.active { background: rgba(255,255,255,.11); color: var(--text); }
.inline { display: flex; gap: 12px; flex-wrap: wrap; }
.justify-between { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.overlay { display: none; }
.mobile-only { display: none; }
.footer-note { text-align: center; color: var(--muted); margin-top: 16px; }

@media (max-width: 1100px) {
  .grid.cards-4, .grid.cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-102%); transition: .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; padding: 16px; }
  .overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 20; }
  .overlay.show { display: block; }
  .mobile-only { display: inline-grid; place-items: center; }
  .grid.cards-4, .grid.cards-3, .grid.cards-2 { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .headline { font-size: 22px; }
}
.nav-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-arrow.notify-count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: #ef5d5d;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    line-height: 22px;
    text-align: center;
    opacity: 1;
}
/* ===== DÒNG CHỮ CHẠY WEBSITE ===== */

.site-marquee {
    width: calc(100% - 16px);
    overflow: hidden;
    margin: 0 8px 12px;
    padding: 8px 0;

    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .07);

    background: rgba(20, 20, 24, .96);
    color: #e5e7eb;

    box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}

.site-marquee-inner {
    display: flex;
    width: max-content;
    gap: 70px;
    white-space: nowrap;

    animation-name: siteMarqueeRun;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.site-marquee-inner span {
    display: inline-flex;
    align-items: center;

    font-size: 14px;
    font-weight: 700;
    color: #e5e7eb;
}

.site-marquee-inner span::before {
    content: "●";
    margin: 0 10px;
    color: #ffcc33;
    font-size: 8px;
}

@keyframes siteMarqueeRun {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

@media (max-width: 860px) {
    .site-marquee {
        width: calc(100% - 16px);
        margin: 0 8px 10px;
        padding: 7px 0;
        border-radius: 12px;
    }

    .site-marquee-inner span {
        font-size: 13px;
    }
}
/* ===== CHAT TỔNG ===== */

.chat-page {
    padding: 0 8px 18px;
}

.chat-card {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;

    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(20,20,24,.96);
    box-shadow: 0 18px 42px rgba(0,0,0,.20);
    overflow: hidden;
}

.chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.chat-head h1 {
    margin: 0;
    font-size: 22px;
    color: #fff;
}

.chat-head p {
    margin: 4px 0 0;
    font-size: 13px;
    color: #aeb1bf;
}

.chat-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 8px 11px;
    border-radius: 999px;

    background: rgba(34,197,94,.10);
    color: #86efac;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 12px rgba(34,197,94,.8);
}

.chat-box {
    height: 520px;
    max-height: calc(100vh - 240px);
    overflow-y: auto;

    padding: 16px;
    background:
        radial-gradient(circle at top right, rgba(255,255,255,.05), transparent 28%),
        rgba(10,10,12,.70);

    -webkit-overflow-scrolling: touch;
}

.chat-loading,
.chat-empty {
    text-align: center;
    color: #aeb1bf;
    font-size: 14px;
    padding: 28px 10px;
}

.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    margin-bottom: 12px;
}

.chat-message.mine {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;

    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: rgba(255,255,255,.10);
    color: #fff;
    font-weight: 900;
    font-size: 13px;
}

.chat-message.mine .chat-avatar {
    background: rgba(255,204,51,.18);
    color: #ffcc33;
}

.chat-bubble {
    max-width: min(72%, 620px);

    padding: 10px 12px;
    border-radius: 16px;

    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.07);

    color: #f8fafc;
}

.chat-message.mine .chat-bubble {
    background: rgba(255,204,51,.16);
    border-color: rgba(255,204,51,.20);
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 5px;
}

.chat-meta strong {
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.chat-meta small {
    color: #9ca3af;
    font-size: 11px;
}

.chat-admin-badge {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(59,130,246,.18);
    color: #93c5fd;
    font-size: 10px;
    font-weight: 900;
}

.chat-text {
    color: #e5e7eb;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.chat-delete {
    border: 0;
    background: transparent;
    color: #fca5a5;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
}

.chat-form {
    display: flex;
    gap: 10px;
    padding: 13px;

    border-top: 1px solid rgba(255,255,255,.07);
    background: rgba(20,20,24,.98);
}

.chat-form input {
    flex: 1;

    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.08);
    outline: none;

    padding: 0 14px;

    background: rgba(255,255,255,.06);
    color: #fff;

    font-size: 14px;
}

.chat-form input::placeholder {
    color: #8d91a0;
}

.chat-form button {
    height: 44px;
    min-width: 78px;

    border: 0;
    border-radius: 14px;

    background: #ffcc33;
    color: #111;
    font-weight: 900;

    cursor: pointer;
}

@media (max-width: 860px) {
    .chat-page {
        padding: 0 8px 12px;
    }

    .chat-card {
        border-radius: 18px;
    }

    .chat-head {
        padding: 14px;
    }

    .chat-head h1 {
        font-size: 18px;
    }

    .chat-head p {
        font-size: 12px;
    }

    .chat-status {
        display: none;
    }

    .chat-box {
        height: calc(100vh - 220px);
        max-height: none;
        padding: 12px;
    }

    .chat-bubble {
        max-width: 82%;
        border-radius: 14px;
    }

    .chat-text {
        font-size: 13px;
    }

    .chat-form {
        padding: 10px;
        gap: 8px;
    }

    .chat-form input {
        height: 42px;
        border-radius: 13px;
    }

    .chat-form button {
        height: 42px;
        min-width: 66px;
        border-radius: 13px;
    }
}
.chat-bot-badge {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 204, 51, .16);
    color: #ffcc33;
    font-size: 10px;
    font-weight: 900;
}

.chat-message.other .chat-avatar {
    background: rgba(59, 130, 246, .16);
    color: #93c5fd;
}
/* ===== BOT CHAT ===== */

.chat-message.bot-message .chat-avatar {
    background: rgba(255, 204, 51, .18) !important;
    color: #ffcc33 !important;
}

.chat-message.bot-message .chat-bubble {
    background: rgba(255, 255, 255, .075) !important;
    border-color: rgba(255, 255, 255, .08) !important;
}

.chat-bot-badge {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 204, 51, .16);
    color: #ffcc33;
    font-size: 10px;
    font-weight: 900;
}
/* ===== ADMIN BOT CHAT ===== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.form-grid label {
    display: block;
    margin-bottom: 6px;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 800;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    background: rgba(255,255,255,.06);
    color: #fff;
    padding: 11px 12px;
    outline: none;
}

.form-grid textarea {
    resize: vertical;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    margin-top: 14px;
}

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

.table th,
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    text-align: left;
    color: #e5e7eb;
    font-size: 13px;
}

.table th {
    color: #94a3b8;
    font-size: 12px;
    text-transform: uppercase;
}

.btn-sm {
    padding: 7px 10px !important;
    font-size: 12px !important;
    border-radius: 10px !important;
}

.btn-danger {
    background: rgba(239,68,68,.18) !important;
    color: #fecaca !important;
}

@media (max-width: 860px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}