/* ============================================================
   VSChats Design System — vs.css
   Source of truth: owner's UI prototype (vschats_ui_unpacked.html)
   Every value below was extracted from the prototype's inline styles.
   Light theme only · Desktop-first.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* brand */
  --accent: #3B49DF;
  --accent-hover: #2A36B8;          /* prototype hover for accent buttons/links */
  --accent-soft: #EEF0FE;
  --accent-disabled: #C3C8FA;       /* disabled primary button bg */

  /* neutrals */
  --ink: #14161A;
  --ink-soft: #4B5158;              /* secondary text / icon color */
  --ink-nav: #3F444C;               /* nav item resting color */
  --muted: #6B7280;
  --line: #E3E6EA;
  --line-faint: #F1F2F5;            /* inner row separators */
  --line-dashed: #DDE0E5;           /* sysline dashes */
  --line-dash-box: #C9CDD4;         /* dashed upload borders, off checkbox border */
  --canvas: #F4F5F7;
  --hover: #F1F2F5;                 /* icon/menu hover */
  --hover-soft: #F4F5F7;            /* dropdown item hover */
  --hover-btn: #F7F8FA;             /* white button hover */
  --bg-faint: #FAFBFC;              /* table row hover / sub-panel */
  --toggle-off: #D5D8DE;

  /* semantic */
  --ok: #1DA660;      --ok-text: #21603A;   --ok-deep: #12805C;  --ok-soft: #E8F4EC;
  --warn: #9C7B2E;    --warn-soft: #FFF6E0;
  --danger: #B4173C;  --danger-hover: #96102F; --danger-soft: #FDF2F4; --danger-line: #EBD2D8;
  --orange: #A6420F;  --orange-soft: #FDF0E7;  --orange-dot: #D9480F;
  --note-bg: #FDEEDC; --note-text: #6E5518;    /* internal note bubble */

  /* channel brands */
  --ch-instagram: #C837AB;
  --ch-whatsapp: #25D366;
  --ch-tiktok: #14161A;
  --ch-facebook: #1877F2;
  --ch-telegram: #229ED9;
  --ch-marketplace: #E8830C;

  /* radius scale (from prototype) */
  --r-5: 5px;   /* status pills */
  --r-7: 7px;   /* small icon buttons */
  --r-9: 9px;   /* buttons, inputs */
  --r-12: 12px; /* radio cards, note panels */
  --r-14: 14px; /* cards, dropdown/popover panels */
  --r-16: 16px; /* modal panels */
  --r-18: 18px; /* large floating panels / empty icon */
  --r-30: 30px; /* segmented pill */

  /* shadow scale (from prototype) */
  --sh-1: 0 2px 10px rgba(20,22,26,0.05);        /* resting card */
  --sh-1-hover: 0 8px 24px rgba(20,22,26,0.1);   /* card hover */
  --sh-2: 0 14px 36px rgba(20,22,26,0.16);       /* dropdown menus */
  --sh-2-pop: 0 20px 50px rgba(20,22,26,0.18);   /* popovers */
  --sh-3: 0 26px 60px rgba(20,22,26,0.26);       /* modals */
  --sh-drawer: -20px 0 50px rgba(20,22,26,0.16); /* right drawer */

  /* overlays */
  --overlay: rgba(20,22,26,0.42);        /* modal overlay */
  --overlay-drawer: rgba(20,22,26,0.32); /* drawer overlay */

  /* spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;

  --font-sys: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Sukhumvit Set', Thonburi, 'Leelawadee UI', 'Noto Sans Thai',
    'Saysettha OT', 'Lao Sangam MN', DokChampa, 'Noto Sans Lao',
    Tahoma, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sys);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ============================================================
   Buttons
   ============================================================ */
.vs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 17px;
  font-family: var(--font-sys);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-9);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.vs-btn:hover { background: var(--hover-btn); }

.vs-btn--primary {
  color: #fff;
  font-weight: 600;
  background: var(--accent);
  border: 0;
  padding: 10px 18px;
}
.vs-btn--primary:hover { background: var(--accent-hover); }

.vs-btn--sm { padding: 8px 15px; font-size: 13px; }
.vs-btn--sm.vs-btn--primary { padding: 8px 15px; }

.vs-btn--danger {
  color: #fff;
  font-weight: 600;
  background: var(--danger);
  border: 0;
}
.vs-btn--danger:hover { background: var(--danger-hover); }

/* bordered danger (e.g. "Disconnect") */
.vs-btn--danger-outline {
  color: var(--danger);
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--danger-line);
}
.vs-btn--danger-outline:hover { background: var(--danger-soft); }

.vs-btn--ghost {
  color: var(--ink-soft);
  background: none;
  border: 0;
}
.vs-btn--ghost:hover { background: var(--hover); color: var(--ink); }

.vs-btn:disabled,
.vs-btn.is-disabled {
  cursor: default;
  pointer-events: none;
}
.vs-btn--primary:disabled,
.vs-btn--primary.is-disabled { background: var(--accent-disabled); }
.vs-btn:not(.vs-btn--primary):disabled,
.vs-btn:not(.vs-btn--primary).is-disabled { color: var(--muted); opacity: 0.6; }

/* square icon button (36x36 in prototype toolbars) */
.vs-btn--icon {
  width: 36px; height: 36px; padding: 0;
  color: var(--ink-soft);
}
.vs-btn--icon:hover { border-color: var(--accent); color: var(--accent); background: #fff; }

/* ============================================================
   Card
   ============================================================ */
.vs-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-14);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.vs-card__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.vs-card__title {
  margin: 0;
  flex: 1;
  font-family: var(--font-sys);
  font-size: 16px;
  font-weight: 600;
}
.vs-card__body { padding: 22px; }

/* ============================================================
   Forms
   ============================================================ */
.vs-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.vs-label__hint { font-weight: 400; color: var(--muted); }

.vs-input, .vs-select, .vs-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 13px;
  font-family: var(--font-sys);
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-9);
  outline: none;
}
.vs-input::placeholder, .vs-textarea::placeholder { color: var(--muted); }
.vs-input:focus, .vs-select:focus, .vs-textarea:focus { border-color: var(--accent); }

.vs-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='13' height='13' fill='none' stroke='%234B5158' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.4 9.6 12 14.8l5.6-5.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.vs-textarea { line-height: 1.55; resize: vertical; min-height: 84px; }

/* small helper under a field */
.vs-help { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ============================================================
   Toggle (pill switch) — 40x23, knob 17
   ============================================================ */
.vs-toggle {
  position: relative;
  display: inline-block;
  width: 40px; height: 23px;
  flex: 0 0 40px;
  cursor: pointer;
  vertical-align: middle;
}
.vs-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  margin: 0;
  cursor: pointer;
}
.vs-toggle__track {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: var(--toggle-off);
  transition: background 160ms ease;
}
.vs-toggle__track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}
.vs-toggle input:checked + .vs-toggle__track { background: var(--accent); }
.vs-toggle input:checked + .vs-toggle__track::after { transform: translateX(17px); }

/* ============================================================
   Checkbox — 18x18, radius 5
   ============================================================ */
.vs-check {
  position: relative;
  display: inline-flex;
  width: 18px; height: 18px;
  flex: 0 0 18px;
  cursor: pointer;
  vertical-align: middle;
}
.vs-check input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  margin: 0;
  cursor: pointer;
}
.vs-check__box {
  width: 18px; height: 18px;
  box-sizing: border-box;
  border: 1.5px solid var(--line-dash-box);
  border-radius: var(--r-5);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vs-check__box::after {
  content: "";
  width: 12px; height: 12px;
  opacity: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.6 10 17.4 19 7.4'/%3E%3C/svg%3E");
  background-size: 12px 12px;
  background-repeat: no-repeat;
}
.vs-check input:checked + .vs-check__box {
  border: 0;
  background: var(--accent);
}
.vs-check input:checked + .vs-check__box::after { opacity: 1; }

/* ============================================================
   Radio card — selectable option card
   ============================================================ */
.vs-radio-card {
  display: block;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 13px 15px;
  cursor: pointer;
}
.vs-radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.vs-radio-card.is-active,
.vs-radio-card:has(input:checked) {
  border: 1.5px solid var(--accent);
  background: var(--accent-soft);
  padding: 12.5px 14.5px; /* keep box size when border grows 0.5px */
}
.vs-radio-card__title { font-size: 13.5px; font-weight: 600; }
.vs-radio-card__sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* plain round radio (5px accent ring when on) */
.vs-radio {
  display: inline-block;
  width: 18px; height: 18px;
  flex: 0 0 18px;
  box-sizing: border-box;
  border: 1.5px solid var(--line-dash-box);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  vertical-align: middle;
}
.vs-radio.is-active, .vs-radio:checked { border: 5px solid var(--accent); }

/* ============================================================
   Pills (status labels) — 11px/600, 3px 8px, radius 5
   ============================================================ */
.vs-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  padding: 3px 8px;
  border-radius: var(--r-5);
  color: var(--muted);
  background: #EDEEF0;
  white-space: nowrap;
}
.vs-pill--ok     { color: var(--ok-text);  background: var(--ok-soft); }
.vs-pill--warn   { color: var(--warn);     background: var(--warn-soft); }
.vs-pill--danger { color: var(--danger);   background: var(--danger-soft); }
.vs-pill--info   { color: #26307E;         background: var(--accent-soft); }
.vs-pill--pro {
  color: #fff;
  background: var(--accent);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 3px;
}
.vs-pill--upgrade {
  color: #fff;
  background: var(--ch-facebook);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ============================================================
   Chips — channel tags (brand-coloured badge + label)
   ============================================================ */
.vs-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  white-space: nowrap;
}
.vs-chip__badge {
  width: 17px; height: 17px;
  flex: 0 0 17px;
  border-radius: var(--r-5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--muted);
}
.vs-chip--instagram   .vs-chip__badge { background: var(--ch-instagram); }
.vs-chip--whatsapp    .vs-chip__badge { background: var(--ch-whatsapp); }
.vs-chip--tiktok      .vs-chip__badge { background: var(--ch-tiktok); }
.vs-chip--facebook    .vs-chip__badge { background: var(--ch-facebook); }
.vs-chip--telegram    .vs-chip__badge { background: var(--ch-telegram); }
.vs-chip--marketplace .vs-chip__badge { background: var(--ch-marketplace); }

/* soft tag chip (thread-list style: 10.5px on tinted bg) */
.vs-chip--tag {
  border: 0;
  padding: 2px 7px;
  font-size: 10.5px;
  border-radius: var(--r-5);
  color: #26307E;
  background: var(--accent-soft);
}

/* ============================================================
   Table
   ============================================================ */
.vs-tbl {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}
.vs-tbl th {
  padding: 15px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.vs-tbl th:first-child, .vs-tbl td:first-child { padding-left: 22px; }
.vs-tbl th:last-child,  .vs-tbl td:last-child  { padding-right: 22px; }
.vs-tbl td {
  padding: 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--line-faint);
  vertical-align: middle;
}
.vs-tbl tbody tr:last-child td { border-bottom: 0; }
.vs-tbl tbody tr:hover { background: var(--bg-faint); }

/* sortable header */
.vs-tbl th.is-sortable { cursor: pointer; }
.vs-tbl th.is-sortable:hover { color: var(--accent); }
.vs-tbl th.is-sortable::after {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  margin-left: 6px;
  vertical-align: -1px;
  opacity: 0.45;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314161A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.4 9.6 12 14.8l5.6-5.2'/%3E%3C/svg%3E");
  background-size: 12px 12px;
  background-repeat: no-repeat;
  transition: transform 200ms;
}
.vs-tbl th.is-asc::after  { opacity: 1; transform: rotate(180deg); }
.vs-tbl th.is-desc::after { opacity: 1; transform: none; }

/* checkbox column */
.vs-tbl th.vs-tbl__chk, .vs-tbl td.vs-tbl__chk { width: 40px; padding-right: 0; }

/* card wrapper for a table */
.vs-tbl-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-14);
  overflow: hidden;
}

/* ============================================================
   Dropdown menu
   ============================================================ */
.vs-dd { position: relative; display: inline-flex; }
.vs-dd__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-14);
  box-shadow: var(--sh-2);
  padding: 5px;
  z-index: 40;
  display: none;
}
/* child combinator — เมนูซ้อน (nested .vs-dd เช่น language picker ใน My Profile)
   ต้องไม่ถูกเปิดพร้อม parent */
.vs-dd.is-open > .vs-dd__menu { display: block; }
.vs-dd__menu--right { left: auto; right: 0; }
.vs-dd__menu--up { top: auto; bottom: calc(100% + 6px); }
.vs-dd__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  font-size: 13px;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.vs-dd__item:hover { background: var(--hover-soft); }
.vs-dd__item.is-active { font-weight: 600; color: var(--accent); }
.vs-dd__item--danger { color: var(--danger); }
.vs-dd__sep { height: 1px; background: var(--line); margin: 6px 6px; }

/* ============================================================
   Modal
   ============================================================ */
.vs-modal {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 46;
}
.vs-modal.is-open { display: flex; }
.vs-modal__panel {
  width: 470px;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  border-radius: var(--r-16);
  box-shadow: var(--sh-3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.vs-modal__panel--lg { width: 680px; border-radius: var(--r-18); }
.vs-modal__head {
  display: flex;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.vs-modal__title {
  margin: 0;
  flex: 1;
  text-align: center;
  font-family: var(--font-sys);
  font-size: 18px;
  font-weight: 600;
}
.vs-modal__x {
  background: none;
  border: 0;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.vs-modal__x:hover { color: var(--ink); }
.vs-modal__body {
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.vs-modal__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}
.vs-modal__foot > .vs-spacer, .vs-modal__foot > [data-vs-spacer] { margin-left: auto; }

/* ============================================================
   Drawer (right side)
   ============================================================ */
.vs-drawer {
  position: fixed;
  inset: 0;
  background: var(--overlay-drawer);
  display: none;
  justify-content: flex-end;
  z-index: 44;
}
.vs-drawer.is-open { display: flex; }
.vs-drawer__panel {
  width: 480px;
  max-width: 100%;
  height: 100%;
  background: #fff;
  box-shadow: var(--sh-drawer);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.vs-drawer__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.vs-drawer__title {
  margin: 0;
  flex: 1;
  font-family: var(--font-sys);
  font-size: 16px;
  font-weight: 600;
}
.vs-drawer__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 18px; }
.vs-drawer__foot { padding: 16px 18px; border-top: 1px solid var(--line); flex: 0 0 auto; }

/* floating drawer variant (prototype support panel: inset 18, radius 18) */
.vs-drawer__panel--float {
  position: fixed;
  top: 18px; right: 18px; bottom: 18px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-18);
  box-shadow: 0 24px 60px rgba(20,22,26,0.24);
}

/* ============================================================
   Popover (with caret arrow)
   ============================================================ */
.vs-popover {
  position: absolute;
  width: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-14);
  box-shadow: var(--sh-2-pop);
  padding: 8px;
  z-index: 40;
}
.vs-popover__caret {
  position: absolute;
  left: -7px;
  top: 18px;
  width: 13px; height: 13px;
  background: #fff;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.vs-popover--left .vs-popover__caret {
  left: auto; right: -7px;
  border-left: 0; border-bottom: 0;
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
}
.vs-popover__section { padding: 6px 0; border-bottom: 1px solid var(--line); }
.vs-popover__section:last-child { border-bottom: 0; }

/* ============================================================
   Toast
   (no toast exists in the prototype — styled to match the system:
   ink panel, radius 10, level-2 shadow)
   ============================================================ */
.vs-toast-region {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}
.vs-toast {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  background: var(--ink);
  border-radius: 10px;
  box-shadow: var(--sh-2);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.vs-toast.is-in { opacity: 1; transform: none; }
.vs-toast::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex: 0 0 8px;
}
.vs-toast--ok::before { background: var(--ok); }
.vs-toast--danger::before { background: var(--danger); }
.vs-toast--info::before { background: var(--accent-soft); }

/* ============================================================
   Tabs (underline) + Segmented pill
   ============================================================ */
.vs-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line);
}
.vs-tabs__tab {
  background: none;
  border: 0;
  padding: 0 0 11px;
  font-family: var(--font-sys);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.vs-tabs__tab:hover { color: var(--ink); }
.vs-tabs__tab.is-active {
  font-weight: 600;
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.vs-seg {
  display: inline-flex;
  background: #fff;
  border-radius: var(--r-30);
  padding: 4px;
  box-shadow: 0 1px 6px rgba(20,22,26,0.08);
}
.vs-seg__item {
  padding: 8px 18px;
  font-family: var(--font-sys);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: var(--r-30);
  cursor: pointer;
  white-space: nowrap;
}
.vs-seg__item.is-active {
  font-weight: 600;
  color: #fff;
  background: var(--accent);
}

/* ============================================================
   Avatar — initials circles (26 / 30 / 46)
   ============================================================ */
.vs-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  background: #DCE3F5;
  color: #33427E;
  width: 30px; height: 30px; flex: 0 0 30px;
  font-size: 11px;
  user-select: none;
}
.vs-avatar--26 { width: 26px; height: 26px; flex: 0 0 26px; font-size: 10px; }
.vs-avatar--30 { width: 30px; height: 30px; flex: 0 0 30px; font-size: 11px; }
.vs-avatar--46 { width: 46px; height: 46px; flex: 0 0 46px; font-size: 15px; }
/* palette pairs from the prototype */
.vs-avatar--blue   { background: #DCE3F5; color: #33427E; }
.vs-avatar--pink   { background: #F0D9E7; color: #8A3C68; }
.vs-avatar--green  { background: #D9EBDD; color: #21603A; }
.vs-avatar--sand   { background: #F2E6CF; color: #7A5A18; }
.vs-avatar--violet { background: #E4E2F5; color: #443A85; }
.vs-avatar--sky    { background: #DCE9F5; color: #2A6E9E; }
.vs-avatar--grad   { background: linear-gradient(135deg, #DCE3F5, #8FA8CC); color: #33427E; }

/* ============================================================
   Empty state
   ============================================================ */
.vs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 64px 30px 68px;
}
.vs-empty__icon {
  width: 64px; height: 64px;
  border-radius: var(--r-18);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  margin-bottom: 20px;
}
.vs-empty__title { font-family: var(--font-sys); font-size: 20px; font-weight: 600; }
.vs-empty__sub {
  margin: 9px 0 0;
  max-width: 400px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}
.vs-empty .vs-btn { margin-top: 22px; }

/* ============================================================
   Chat bubbles
   ============================================================ */
.vs-bubble {
  max-width: 74%;
  border-radius: 20px;
  padding: 11px 17px;
  font-size: 14px;
  line-height: 1.5;
  cursor: default;
}
.vs-bubble--in {
  align-self: flex-start;
  background: #F1F2F5;
  color: var(--ink);
}
.vs-bubble--out {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-radius: 20px 20px 6px 20px;
}
.vs-bubble--ai {
  align-self: flex-start;
  background: var(--accent-soft);
  color: var(--ink);
}
.vs-bubble--note {
  align-self: flex-end;
  background: var(--note-bg);
  color: var(--note-text);
}

/* message row helper (avatar + bubble) */
.vs-msg { display: flex; align-items: flex-end; gap: 10px; max-width: 74%; }
.vs-msg--out { align-self: flex-end; justify-content: flex-end; }
.vs-msg__meta { font-size: 11px; color: var(--muted); margin: 4px 4px 0; }

/* centered day/time divider */
.vs-daymark { align-self: center; font-size: 11.5px; color: var(--muted); }

/* ============================================================
   App shell — persistent frame (rail 60px / full sidebar 236px)
   Values ported 1:1 from the prototype's inline styles.
   ============================================================ */
.vs-shell {
  width: 100%;
  min-width: 1440px;
  height: 100vh;
  display: flex;
  overflow: hidden;
  background: var(--canvas);
  font-family: var(--font-sys);
  color: var(--ink);
}
.vs-shell__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* logo mark (28 in nav / 30 in rail / 26 in top bars) */
.vs-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sys);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  width: 28px; height: 28px; flex: 0 0 28px;
}
.vs-logo--30 { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; }
.vs-logo--26 { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px; font-size: 12px; }

/* ---------- full sidebar (236px) ---------- */
.vs-shell__nav {
  width: 236px; flex: 0 0 236px;
  box-sizing: border-box;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  min-height: 0;
  overflow-y: auto;
}
.vs-shell__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 6px 22px;
}
.vs-shell__wordmark {
  font-family: var(--font-sys);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* workspace switcher button */
.vs-shell__ws {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 20px;
  background: var(--hover-btn);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sys);
}
.vs-shell__ws:hover { background: var(--hover); }
.vs-shell__ws-name {
  font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vs-shell__ws-sub { font-size: 11px; color: var(--muted); line-height: 1.4; }
.vs-shell__ws-caret { color: var(--muted); font-size: 11px; margin-left: auto; }

/* nav list */
.vs-nav { display: flex; flex-direction: column; gap: 2px; }
.vs-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sys);
  font-size: 14px;
  color: var(--ink-nav);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}
.vs-nav__item:hover { background: var(--hover); color: var(--ink-nav); text-decoration: none; }
.vs-nav__item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.vs-nav__item.is-active:hover { background: var(--accent-soft); color: var(--accent); }
.vs-nav__icon { width: 18px; flex: 0 0 18px; display: flex; justify-content: center; }
.vs-nav__badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
}

/* bottom of the full sidebar */
.vs-shell__collapse-row { margin-top: auto; padding: 0 6px 14px; }
.vs-shell__footsec {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* small square icon button used in both sidebars (30 / 34) */
.vs-iconbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px; flex: 0 0 34px;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.vs-iconbtn:hover { background: var(--hover); color: var(--ink); }
.vs-iconbtn--30 { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; }

/* ---------- rail sidebar (60px) ---------- */
.vs-shell__rail {
  width: 60px; flex: 0 0 60px;
  box-sizing: border-box;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 16px;
  min-height: 0;
  overflow-y: auto;
}
.vs-shell__rail .vs-logo--30 { margin-bottom: 22px; }
.vs-rail__ws { position: relative; margin-bottom: 38px; }
.vs-rail__ws .vs-avatar { cursor: pointer; }
.vs-rail__ws .vs-avatar:hover { box-shadow: 0 0 0 2px var(--accent-soft); }
.vs-rail__plan {
  position: absolute;
  bottom: -6px; left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--accent);
  padding: 1px 4px;
  border-radius: 3px;
}
.vs-rail__plan--free { background: var(--muted); }
.vs-rail__nav { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.vs-rail__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  color: var(--ink-nav);
  background: none;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
}
.vs-rail__item:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.vs-rail__item.is-active { background: var(--accent-soft); color: var(--accent); }
.vs-rail__item.is-active:hover { background: var(--accent-soft); color: var(--accent); }
.vs-rail__dotwrap { position: relative; }
.vs-rail__dot {
  position: absolute;
  top: 4px; right: 3px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid #fff;
  pointer-events: none;
}
.vs-shell__rail .vs-iconbtn--expand { margin-top: auto; }
.vs-rail__profile { margin-top: 18px; }
.vs-rail__help { margin-top: 10px; }
.vs-rail__profile .vs-avatar { cursor: pointer; }
.vs-rail__profile .vs-avatar:hover { box-shadow: 0 0 0 2px var(--accent-soft); }

/* ---------- slim-mode switching (localStorage 'vschats-nav-slim') ---------- */
html.vs-slim .vs-shell__nav { display: none; }
html:not(.vs-slim) .vs-shell__rail { display: none; }

/* ---------- sidebar popovers (fixed next to the sidebar, caret near bottom) ---------- */
.vs-dd__menu.vs-popover { display: none; padding: 8px; }
.vs-dd.is-open > .vs-dd__menu.vs-popover { display: block; }
.vs-popover--nav  { position: fixed; left: 246px; bottom: 14px; top: auto; right: auto; }
.vs-popover--rail { position: fixed; left: 70px;  bottom: 14px; top: auto; right: auto; }
.vs-popover--nav .vs-popover__caret,
.vs-popover--rail .vs-popover__caret { top: auto; bottom: 24px; }

/* profile popover internals */
.vs-profilepop__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
}
.vs-profilepop__name { font-family: var(--font-sys); font-size: 16px; font-weight: 600; }
.vs-profilepop__mail {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
}
.vs-profilepop__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
.vs-profilepop__row:hover { background: var(--hover-soft); color: var(--ink); text-decoration: none; }
.vs-profilepop__rowicon { width: 18px; flex: 0 0 18px; display: flex; justify-content: center; color: var(--ink-soft); }
.vs-profilepop__lang {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.vs-profilepop__signin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
}
.vs-profilepop__signin:hover { background: var(--hover-soft); }

/* language trigger (bordered select-like row inside the popover) */
.vs-langsel {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-9);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-sys);
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.vs-langsel:hover { border-color: var(--accent); }
.vs-langsel svg { margin-left: auto; }

/* button reset so <button>/<form> children can behave as dropdown items */
button.vs-dd__item, form.vs-dd__form > button.vs-dd__item {
  width: 100%;
  background: none;
  border: 0;
  font-family: var(--font-sys);
  font-size: 13px;
  color: var(--ink);
  text-align: left;
}
button.vs-dd__item:hover { background: var(--hover-soft); }
form.vs-dd__form { display: block; margin: 0; }

/* plan badge (Manage Accounts table + workspace switcher) */
.vs-badge-plan {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--muted);
  padding: 3px 9px;
  border-radius: 6px;
  text-transform: uppercase;
}
.vs-badge-plan--pro { background: var(--accent); }

/* ============================================================
   Sysline — centered system event with dashes
   ============================================================ */
.vs-sysline {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.vs-sysline::before, .vs-sysline::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--line-dashed);
}
.vs-sysline__text {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.vs-sysline--ok .vs-sysline__text { color: var(--ok-deep); font-weight: 500; }
