@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap");
:root {
  --bg: #F6F7F9;
  --paper: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: rgba(0,0,0,.06);
  --line-strong: #e5e7eb;
  --sky: #0284c7;
  --sky-2: #38bdf8;
  --sidebar-w: 248px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 12px 32px -16px rgba(16,24,40,.12);
  --radius: 16px;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 14px rgba(2, 132, 199, .28); }
  50% { box-shadow: 0 8px 24px rgba(14, 165, 233, .42); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.fade-up { animation: fadeUp .7s cubic-bezier(.16,1,.3,1) both; }
.content .kpi { animation: fadeUp .7s cubic-bezier(.16,1,.3,1) both; }
.content .kpi:nth-child(1) { animation-delay: .04s; }
.content .kpi:nth-child(2) { animation-delay: .1s; }
.content .kpi:nth-child(3) { animation-delay: .16s; }
.content .kpi:nth-child(4) { animation-delay: .22s; }
.content .glass-card { animation: fadeUp .75s cubic-bezier(.16,1,.3,1) both; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body.app-body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(14,165,233,.10) 0%, transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: "Be Vietnam Pro", "Plus Jakarta Sans", Inter, system-ui, sans-serif;
}
button, input, select, textarea { font-family: inherit; }
.glass-card, .kpi, .table-wrap, .entity-card, .modal {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), box-shadow .28s cubic-bezier(.16,1,.3,1);
}
.glass-card:hover, .kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(16,24,40,.05), 0 16px 32px -16px rgba(14,165,233,.18);
}
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 18px 12px;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.brand-name { font-weight: 800; letter-spacing: -.03em; color: #111827; font-size: 13px; }
.sidebar .brand div div:last-child { color: #9ca3af !important; }
.nav-group { margin-top: 6px; }
.nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .14em;
  color: #9ca3af; padding: 10px 12px 6px; font-weight: 700;
}
.nav-item { transition: background .2s ease, color .2s ease, transform .2s ease;

  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  color: #4b5563; text-decoration: none; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent;
}
.nav-item i { width: 18px; text-align: center; color: #9ca3af; }
.nav-item:hover { background: #f3f4f6; color: #111827; }
.nav-item.active { background: #f0f9ff; color: #0369a1; border-color: #e0f2fe; }
.nav-item.active i { color: #0284c7; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.shop-card {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 14px; background: #fff; border: 1px solid var(--line-strong);
}
.shop-av {
  width: 34px; height: 34px; border-radius: 999px;
  background: #111827; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 11px;
  position: relative;
}
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -.04em; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.hamburger {
  display: none; width: 40px; height: 40px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  border-radius: 12px; cursor: pointer;
}
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.topbar-right .btn { margin: 0; }
.btn i { margin-right: 6px; }
.bot-chip, .admin-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 11px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: #fff; font-size: 12px; font-weight: 700;
}
.bot-dot { width: 8px; height: 8px; border-radius: 50%; background: #d1d5db; }
.bot-chip.online .bot-dot { background: #38bdf8; }
.bot-chip.offline .bot-dot { background: #f43f5e; }
.content { padding: 8px 24px 28px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.kpi { padding: 18px; border-radius: var(--radius); transition: transform .2s ease, box-shadow .2s ease; }
.kpi:hover { transform: translateY(-4px); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 8px 0 4px; }
.kpi-trend { font-size: 12px; color: var(--sky); font-weight: 650; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-left, .toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search, .input, .select, textarea.input {
  width: 100%; background: #FAFAFB; border: 1px solid var(--line-strong); color: var(--ink);
  border-radius: 12px; padding: 11px 12px; font-size: 14px; outline: none;
}
.search { min-width: 240px; width: auto; }
.search:focus, .input:focus, .select:focus, textarea.input:focus { border-color: var(--sky-2); box-shadow: 0 0 0 4px rgba(14,165,233,.14); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line-strong); background: #fff; color: #4b5563;
  border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.tab.active { background: #f0f9ff; border-color: #7dd3fc; color: #0369a1; }
.table-wrap { border-radius: var(--radius); overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
table.data th {
  text-align: left; color: #6b7280; font-weight: 700; padding: 13px 16px;
  background: #FAFAFB; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
table.data td { padding: 13px 16px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
table.data tr:hover td { background: #f9fafb; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 999px; }
.pill-ok { background: #e0f2fe; color: #0369a1; }
.pill-warn { background: #fef3c7; color: #b45309; }
.pill-blue { background: #f0f9ff; color: #0284c7; }
.pill-rose { background: #ffe4e6; color: #be123c; }
.pill-gray { background: #f3f4f6; color: #4b5563; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; text-decoration: none; font-weight: 700;
  border-radius: 12px; padding: 10px 16px; font-size: 13px;
}
.btn-primary {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(2,132,199,.40);
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), box-shadow .28s cubic-bezier(.16,1,.3,1), filter .2s ease;
}
.btn-primary:hover {
  animation: none;
  box-shadow: 0 16px 32px -10px rgba(56,189,248,.45);
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
}
.btn-primary:active { transform: translateY(0) scale(.98); }
.btn-primary:active { transform: scale(.98); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: #f9fafb; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 12px; }
.price-cell { cursor: pointer; font-weight: 800; white-space: nowrap; }
.price-editor { display: flex; gap: 6px; align-items: center; }
.price-editor input { width: 140px; padding: 7px 8px; border-radius: 10px; }
.icon-row { display: flex; gap: 6px; align-items: center; }
.muted { color: var(--muted); font-size: 12px; }
.card-list { display: none; }
.entity-card { border-radius: 16px; padding: 14px; display: grid; gap: 8px; }
.entity-card h4 { margin: 0; font-size: 15px; }
.overlay { display: none; position: fixed; inset: 0; background: rgba(17,24,39,.35); z-index: 30; }
.modal-back {
  display: none; position: fixed; inset: 0; background: rgba(17,24,39,.4);
  z-index: 50; align-items: center; justify-content: center; padding: 16px;
}
.modal-back.show { display: flex; }
.modal { width: min(520px, 100%); border-radius: 24px; padding: 22px; color: var(--ink); }
.modal h3 { margin: 0 0 14px; }
.form-grid { display: grid; gap: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 80; }
.toast { min-width: 240px; max-width: 360px; background: #0284c7; color: #fff; padding: 12px 14px; border-radius: 14px; font-size: 13px; font-weight: 700; }
.toast.error { background: #be123c; }
.toast.warn { background: #b45309; }
.sidebar-close { display: none; margin-left: auto; background: transparent; border: 0; color: #9ca3af; cursor: pointer; }
.qr-modal { width: min(380px,100%) !important; text-align: center; padding: 0 !important; border-radius: 28px !important; }
.qr-phone { padding: 28px 22px 20px; }
.qr-notch { width: 72px; height: 6px; border-radius: 999px; background: #e5e7eb; margin: 0 auto 16px; }
.qr-box { min-height: 240px; display: grid; place-items: center; margin: 14px 0; background: #FAFAFB; border: 1px solid var(--line-strong); border-radius: 18px; }
.dash-grid { display: grid; grid-template-columns: 1.35fr .75fr; gap: 16px; margin-top: 16px; }
.dash-stack { display: grid; gap: 16px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.bar-row b { width: 64px; font-weight: 700; color: var(--ink); }
.bar { flex: 1; height: 8px; background: #f3f4f6; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #38bdf8, #0284c7); border-radius: 99px; }
.feed-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-strong); font-size: 13px; }
.main.inbox-main { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }
.inbox-layout { flex: 1; display: grid; grid-template-columns: 320px minmax(0,1fr); min-height: 0; }
.thread-list { border-right: 1px solid var(--line-strong); overflow: auto; background: #fff; }
.thread {
  display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 10px; align-items: center;
  padding: 12px 14px; cursor: pointer; border-bottom: 1px solid #f3f4f6;
}
.thread:hover { background: #f9fafb; }
.thread.active { background: #f0f9ff; }
.av { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; }
.thread-name { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.thread-name strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #FAFAFB; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-strong); background: #fff; }
.msgs { flex: 1; overflow: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: min(72%,560px); padding: 10px 12px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.bubble.cus { align-self: flex-start; background: #F3F4F6; color: var(--ink); border-bottom-left-radius: 6px; }
.bubble.ai { align-self: flex-end; background: linear-gradient(180deg,#38bdf8,#0284c7); color: #fff; border-bottom-right-radius: 6px; }
.bubble .meta { margin-top: 6px; font-size: 11px; color: #e0f2fe; }
.bubble.cus .meta { color: #6b7280; }
.composer { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line-strong); background: #fff; }
.composer .input { flex: 1; }
@media (max-width: 1024px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 960px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .inbox-layout { grid-template-columns: 1fr; }
  .thread-list { max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--line-strong); }
}
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .hamburger, .sidebar-close { display: inline-grid; place-items: center; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(86vw, 300px); transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .overlay.show { display: block; }
  .content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .desk-table { display: none; }
  .card-list { display: grid; gap: 10px; }
  .search { min-width: 0; width: 100%; }
}
.btn:focus-visible, .nav-item:focus-visible, .tab:focus-visible {
  outline: 2px solid rgba(2,132,199,.55);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .fade-up, .content .kpi, .content .glass-card { animation: none; }
  .glass-card:hover, .kpi:hover, .btn-primary:hover { transform: none; }
}
