/* ---------- Panel brand (the logo's own colors; tokens.css holds the shared palette) ---------- */
:root {
  --logo-hi: #1E90FD;
  --logo-lo: #0320BC;
  --logo-gradient: linear-gradient(140deg, #1E90FD 0%, #1561E6 48%, #0320BC 100%);
  --logo-soft: linear-gradient(140deg, #EEF6FF 0%, #DCEBFF 100%);
  --hex: path("M10.6 1.8Q14 0 17.4 1.8L25.6 6.2Q29 8 29 12L29 20Q29 24 25.6 25.8L17.4 30.2Q14 32 10.6 30.2L2.4 25.8Q0 24 0 20L0 12Q0 8 2.4 6.2Z");
}

/* Hexagon icon badge, like the logo: soft blue by default, the logo gradient when .solid. */
.hx { flex: none; display: inline-grid; place-items: center; width: 29px; height: 32px; background: var(--logo-soft); color: var(--accent); clip-path: var(--hex); }
.hx.solid { background: var(--logo-gradient); color: #fff; }
.hx.sm { width: 22px; height: 24px; clip-path: path("M8 1.4Q11 0 14 1.4L19.6 4.6Q22 6 22 9L22 15Q22 18 19.6 19.4L14 22.6Q11 24 8 22.6L2.4 19.4Q0 18 0 15L0 9Q0 6 2.4 4.6Z"); }
.hx.lg { width: 36px; height: 40px; clip-path: path("M13.2 2.3Q18 0 22.8 2.3L31.6 7.5Q36 10 36 15L36 25Q36 30 31.6 32.5L22.8 37.7Q18 40 13.2 37.7L4.4 32.5Q0 30 0 25L0 15Q0 10 4.4 7.5Z"); }
.hx.success { background: var(--success-tint); color: var(--success); }
.hx.warn { background: var(--warn-tint); color: var(--warn); }
.hx.danger { background: var(--danger-tint); color: var(--danger); }

/* ---------- App frame ---------- */
.frame { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.app { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }

/* Top-of-app bars (demo / trial) */
.appbar {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 36px; padding: 6px 16px;
  font-size: var(--fs-sm); color: var(--ink-2);
  background: var(--accent-tint); border-bottom: 1px solid var(--accent-tint-2);
  text-align: center;
}
.appbar svg { color: var(--accent); }
.appbar a, .appbar .link-btn { font-weight: 600; }

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--border); background: var(--bg);
  padding: 14px 12px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px; color: var(--ink); text-decoration: none !important; }
.brand-name { font-size: 18.5px; font-weight: 700; letter-spacing: -0.03em; }
.brand-mark { width: 22px; height: 22px; }
.sidebar .brand .brand-mark { display: none; width: 28px; height: 28px; }

.tenant-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 14px 0 10px; padding: 7px 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
  text-align: left; transition: border-color var(--t) var(--ease), background var(--t);
}
.tenant-btn:hover { border-color: var(--border-strong); background: var(--surface); }
.tenant-logo {
  width: 26px; height: 26px; border-radius: 5px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; letter-spacing: 0; flex-shrink: 0;
  background-size: cover; background-position: center;
}
.tenant-meta { min-width: 0; flex: 1; line-height: 1.25; }
.tenant-name { font-size: 14.5px; font-weight: 600; }
.tenant-plan { font-size: 13px; color: var(--muted); }
.tenant-btn svg { color: var(--faint); }

.nav { display: flex; flex-direction: column; overflow-y: auto; flex: 1 1 auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; scroll-margin-bottom: 72px; } /* clear of the pinned Settings row */
.nav-group + .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.nav-group.nav-end { border-top: 0; }
/* Settings stays in view at the bottom while the rest of the menu scrolls. */
.nav-group.nav-end { position: sticky; bottom: 0; margin-top: auto; padding: 10px 0 8px; background: var(--bg); box-shadow: 0 -1px 0 var(--border); }
.nav-group-label { font-size: 13.5px; font-weight: 600; color: var(--muted); padding: 0 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 8px;
  border-radius: 12px; color: var(--ink); font-weight: 500; font-size: 16px;
  text-decoration: none !important; position: relative;
  transition: background var(--t) var(--ease), color var(--t);
}
/* Each item's icon sits in a soft blue hexagon; the open page's turns the logo gradient. */
.nav-ico { flex: none; display: grid; place-items: center; width: 29px; height: 32px; clip-path: var(--hex); background: var(--logo-soft); color: var(--accent); transition: background var(--t), color var(--t); }
.nav-item:hover { background: var(--surface); }
.nav-item.active { background: var(--accent-tint); color: var(--blue-900); font-weight: 600; }
.nav-item.active .nav-ico { background: var(--logo-gradient); color: #fff; }
.nav-count { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item.active .nav-count { color: var(--accent); }
.nav-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.sidebar-foot { border-top: 1px solid var(--border); margin: 8px -12px 0; padding: 12px 12px 0; }
.plan-mini { display: block; padding: 10px; border-radius: var(--r); background: var(--surface); color: inherit; text-decoration: none !important; }
.plan-mini:hover { background: var(--surface-2); }
.plan-mini-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.plan-mini .meter { margin-top: 8px; }

/* ---------- Main + topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; background: var(--bg); }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar); flex-shrink: 0;
  display: flex; align-items: center; gap: 8px; padding: 0 24px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.search-trigger {
  display: flex; align-items: center; gap: 10px;
  width: min(440px, 100%); height: 36px; padding: 0 10px 0 12px;
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r);
  color: var(--faint); font-size: 16px; text-align: left;
  transition: border-color var(--t), background var(--t);
}
.search-trigger:hover { border-color: var(--border); background: var(--bg); }
.search-trigger span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }
.avatar-btn { border: 0; background: none; padding: 2px; border-radius: 50%; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--surface-2); }

.view { width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px 32px 72px; }
.view.wide { max-width: none; }
.view.flush { padding: 0; max-width: none; height: calc(100% - var(--topbar)); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: var(--fs-xl); }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; font-size: 14.5px; color: var(--muted); font-weight: 500; margin-bottom: 10px; text-decoration: none !important; }
.crumb:hover { color: var(--ink); }

.section { margin-top: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 16.5px; }

.scrim { position: fixed; inset: 0; background: rgba(11, 18, 32, .32); z-index: 55; opacity: 0; pointer-events: none; transition: opacity 160ms var(--ease); }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- Tablet: icons with their names underneath ---------- */
@media (max-width: 1023px) {
  .app { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .sidebar { padding: 14px 4px 12px; align-items: center; }
  .brand { padding: 0; justify-content: center; }
  .sidebar .brand .brand-logo { display: none; }
  .sidebar .brand .brand-mark { display: block; }
  .brand-name, .nav-count, .nav-group-label, .tenant-meta, .tenant-btn > svg, .plan-mini { display: none; }
  .tenant-btn { width: auto; padding: 4px; border-color: transparent; }
  .nav { width: 100%; align-items: center; margin: 0; padding: 0; scrollbar-width: none; }
  .nav-group { align-items: center; width: 100%; }
  .nav-group + .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
  .nav-group.nav-end { border-top: 0; }
  .nav-item { flex-direction: column; justify-content: center; gap: 3px; width: 100%; height: auto; padding: 7px 0; }
  .nav-label { font-size: 11.5px; line-height: 1.15; text-align: center; }
  .nav-dot { position: absolute; top: 6px; right: 14px; }
  .sidebar-foot { border: 0; margin: 0; padding: 0; }
  .view { padding: 24px 24px 64px; }
}

/* ---------- Mobile: off-canvas ---------- */
@media (max-width: 767px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 280px; z-index: 60;
    transform: translateX(-102%); transition: transform 200ms var(--ease), visibility 200ms;
    align-items: stretch; padding: 14px 12px 12px; visibility: hidden;
  }
  .sidebar.open { transform: none; visibility: visible; box-shadow: var(--shadow-pop); }
  .brand { padding: 0 8px; justify-content: flex-start; }
  .sidebar .brand .brand-logo { display: block; }
  .sidebar .brand .brand-mark { display: none; }
  .brand-name, .nav-label, .nav-count, .nav-group-label, .tenant-meta, .tenant-btn > svg, .plan-mini { display: revert; }
  .tenant-meta { display: block; }
  .tenant-btn { width: 100%; padding: 7px 8px; border-color: var(--border); }
  .nav { align-items: stretch; margin: 0 -4px; padding: 0 4px; scrollbar-width: auto; }
  .nav-group { align-items: stretch; }
  .nav-group.nav-end { padding-top: 10px; }
  .nav-item { flex-direction: row; gap: 12px; width: auto; height: 44px; padding: 0 8px; justify-content: flex-start; }
  .nav-label { font-size: 16px; text-align: left; }
  .nav-dot { position: static; }
  .sidebar-foot { border-top: 1px solid var(--border); margin: 8px -12px 0; padding: 12px 12px 0; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .search-trigger { width: auto; flex: 1; min-width: 0; }
  .search-trigger kbd { display: none; }
  .view { padding: 20px 16px 56px; }
  .page-head { align-items: flex-start; flex-direction: column; margin-bottom: 20px; }
  .page-head h1 { font-size: var(--fs-lg); }
  .hide-sm { display: none !important; }
  .appbar { font-size: 13px; justify-content: flex-start; }
  .appbar > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
  .appbar a { white-space: nowrap; }
}
@media (max-width: 1023px) { .hide-md { display: none !important; } }

/* Workspace switcher lives in the sidebar footer */
.sidebar-foot .ws-label { font-size: 12.5px; color: var(--faint); font-weight: 500; padding: 0 2px 6px; }
.sidebar-foot .tenant-btn { margin: 0; }
@media (min-width: 768px) and (max-width: 1023px) { .sidebar-foot .ws-label { display: none; } }
.brand + .nav { margin-top: 12px; }

/* ---------- Page titles in plain words: name, "What's this?", one line ---------- */
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.whats-this { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--accent-tint); color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; transition: background var(--t); }
.whats-this:hover { background: var(--accent-tint-2); }
.page-sub { font-size: 17px; color: var(--ink-2); margin-top: 6px; }
.page-sub2 { font-size: 14.5px; color: var(--muted); margin-top: 2px; }

/* Cenbot talking: its face and a speech bubble */
.cb-say { display: flex; align-items: flex-start; gap: 14px; }
.cb-say > img { flex: none; }
.cb-bubble { flex: 1; padding: 14px 16px; border-radius: 4px 16px 16px 16px; background: var(--logo-soft); color: var(--ink); font-size: 16.5px; line-height: 1.5; }
.cb-bubble p + p { margin-top: 6px; }

/* First-visit tour: a ring around a menu group and Cenbot's card beside it */
/* The ring dims everything around the group it points at; with no ring the whole screen dims. */
.tour { position: fixed; inset: 0; z-index: 90; }
.tour.dim { background: rgba(9, 18, 48, .38); }
.tour-ring { position: fixed; border-radius: 16px; box-shadow: 0 0 0 3px #fff, 0 0 0 7px var(--accent), 0 0 0 9999px rgba(9, 18, 48, .38); pointer-events: none; transition: all 220ms var(--ease); }
.tour-card { position: fixed; text-align: left; width: min(360px, calc(100vw - 32px)); padding: 20px; border-radius: 16px; background: var(--bg); box-shadow: var(--shadow-pop); transition: top 220ms var(--ease), left 220ms var(--ease); }
.tour-card.mid { top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); }
.tour-title { font-size: 19.5px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.tour-card p { font-size: 16.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.45; }
.tour-foot { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.tour-dots { display: flex; gap: 6px; flex: 1; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-tint-2); }
.tour-dots i.on { background: var(--accent); }
.tour-pages { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.tour-pages > span { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--ink); }

/* ---------- Customer app menu: soft blue, white hexagon icons, the open page in the logo gradient ----------
   Scoped to .cx-side so the staff console keeps its own sidebar. */
.cx-side { --side-line: rgba(32, 100, 219, .14); background: linear-gradient(180deg, #F1F6FF 0%, #E3EDFF 100%); border-right-color: #D3E1FA; padding: 14px 12px 12px; }
@media (min-width: 1024px) { .app:has(> .cx-side) { --sidebar: 236px; } }
.cx-side .brand { height: 40px; padding: 0 8px; }
.cx-side .brand + .nav { margin-top: 10px; }
.cx-side .nav { scrollbar-width: thin; scrollbar-color: rgba(32, 100, 219, .28) transparent; }
.cx-side .nav-group { gap: 1px; }
.cx-side .nav-group + .nav-group { margin-top: 6px; padding-top: 6px; border-top-color: var(--side-line); }
.cx-side .nav-group.nav-end { border-top: 0; padding: 6px 0 4px; background: #E6EFFF; box-shadow: 0 -1px 0 var(--side-line); }
.cx-side .nav-item { height: 34px; gap: 10px; padding: 0 8px; border-radius: 11px; color: #0E1F4D; font-weight: 500; font-size: 15px; }
/* A smaller hexagon than the page badges, so the menu stays light. */
.cx-side .nav-ico { width: 24px; height: 26px; clip-path: path("M8.8 1.5Q11.6 0 14.4 1.5L21.2 5Q24 6.5 24 9.8L24 16.3Q24 19.5 21.2 21L14.4 24.5Q11.6 26 8.8 24.5L2 21Q0 19.5 0 16.3L0 9.8Q0 6.5 2 5Z"); background: #fff; color: var(--blue-500); }
.cx-side .nav-item:hover { background: rgba(255, 255, 255, .8); }
.cx-side .nav-item:hover .nav-ico { color: var(--blue-700); }
.cx-side .nav-item:focus-visible { outline: 2px solid var(--blue-400); outline-offset: 2px; }
.cx-side .nav-item.active { background: var(--logo-gradient); color: #fff; font-weight: 600; box-shadow: 0 8px 16px -10px rgba(3, 32, 188, .75); }
.cx-side .nav-item.active .nav-ico { background: #fff; color: var(--logo-lo); }
.cx-side .nav-item.active .nav-dot { background: #fff; }
.cx-side .sidebar-foot { border-top-color: var(--side-line); margin: 6px -12px 0; padding: 10px 12px 0; }
.cx-side .sidebar-foot .ws-label { color: #5C6B91; }
.cx-side .tenant-btn { padding: 7px 8px; background: #fff; border-color: #D6E3FA; border-radius: 12px; box-shadow: 0 1px 2px rgba(6, 43, 113, .06); }
.cx-side .tenant-btn:hover { background: #fff; border-color: var(--blue-300); }
@media (max-width: 1023px) {
  .cx-side { padding: 14px 6px 12px; }
  .cx-side .brand { padding: 0; }
  .cx-side .nav-group + .nav-group { margin-top: 8px; padding-top: 8px; }
  .cx-side .nav-item { height: auto; gap: 3px; padding: 6px 2px; border-radius: 11px; }
  .cx-side .sidebar-foot { margin: 0; padding: 0; }
  .cx-side .tenant-btn { padding: 4px; background: transparent; border-color: transparent; box-shadow: none; }
}
@media (max-width: 767px) {
  .cx-side { width: 264px; padding: 14px 12px 12px; }
  .cx-side .brand { padding: 0 8px; }
  .cx-side .nav-group + .nav-group { margin-top: 7px; padding-top: 7px; }
  .cx-side .nav-item { height: 40px; gap: 12px; padding: 0 8px; border-radius: 12px; }
  .cx-side .nav-label { font-size: 15.5px; }
  .cx-side .sidebar-foot { margin: 6px -12px 0; padding: 10px 12px 0; }
  .cx-side .tenant-btn { padding: 7px 8px; background: #fff; border-color: #D6E3FA; box-shadow: 0 1px 2px rgba(6, 43, 113, .06); }
}
