/* System Z / Pastel Pop — shared admin design layer.
   Functional page structure, domain names and live data remain unchanged. */
:root {
  --navy: #302650;
  --navy-2: #443875;
  --blue: #6d43ef;
  --blue-soft: #f0ebff;
  --violet: #6d43ef;
  --orange: #e68850;
  --green: #178662;
  --green-soft: #e3f6ed;
  --red: #d45064;
  --red-soft: #fff0f2;
  --bg: #f7f5fc;
  --surface: #fff;
  --line: #e9e6f1;
  --text: #29243a;
  --muted: #716e81;
  --shadow: 0 4px 18px rgba(56,42,97,.045);
  --shadow-hover: 0 8px 24px rgba(56,42,97,.085);
  --radius: 14px;
}

body { background: var(--bg); color: var(--text); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #7a53f4;
  outline-offset: 2px;
}
.app-icon { fill: currentColor; stroke: none; }
.main-content { background: var(--bg); }
.view { padding: 24px 28px 44px; }

/* Light, fixed navigation with one coherent set of line icons. */
.sidebar {
  width: 232px;
  padding: 14px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid #e9e5f0;
  color: var(--text);
  background: #fff;
  box-shadow: none;
  scrollbar-width: thin;
  scrollbar-color: #e8e2f1 transparent;
}
.sidebar-brand-row {
  position: sticky;
  z-index: 4;
  top: -14px;
  min-height: 56px;
  margin-bottom: 9px;
  padding: 5px 4px 11px;
  background: #fff;
}
.sidebar .brand { gap: 9px; padding: 0; color: var(--text); }
.sidebar .brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: #6d43ef;
  box-shadow: none;
}
.sidebar .brand-mark img { display: none; }
.sidebar .brand-mark::after { content: "Z"; font-size: 18px; font-weight: 900; line-height: 1; }
.sidebar .brand strong { color: #2b2540; font-size: 15px; line-height: 1.1; }
.sidebar .brand span { margin-top: 2px; color: #827b92; font-size: 11px; letter-spacing: .02em; text-transform: none; }
.sidebar-collapse-button {
  width: 27px;
  height: 27px;
  border-color: #e8e3f0;
  border-radius: 7px;
  color: #6c6681;
  background: #f7f5fb;
}
.sidebar-collapse-button:hover { color: #5e39d3; background: #eee9fc; }
.sidebar .main-nav { gap: 2px; }
.sidebar .nav-section-label {
  margin: 13px 10px 5px;
  color: #9993a6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
}
.sidebar .nav-item {
  min-height: 38px;
  gap: 9px;
  padding: 5px 8px;
  border-radius: 8px;
  color: #514e61;
  font-size: 13px;
  font-weight: 630;
  box-shadow: none;
}
.sidebar .nav-item:hover { color: #5e3bce; background: #f6f2ff; }
.sidebar .nav-item.active,
.sidebar .nav-item.group-active {
  color: #4f30b8;
  background: #f0ebff;
  box-shadow: none;
}
.sidebar .nav-item.active::before { display: none; }
.sidebar .nav-icon {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border-radius: 7px;
  color: #6d43ef;
  background: #eee8ff;
}
.sidebar .nav-icon .app-icon { width: 16px; height: 16px; }
.sidebar [data-view="customer360"] .nav-icon,
.sidebar [data-view="miniapp"] .nav-icon { color: #bb6f64; background: #ffece6; }
.sidebar [data-view="appointments"] .nav-icon,
.sidebar [data-view="datahub"] .nav-icon { color: #4089aa; background: #e6f3fa; }
.sidebar [data-view="campaigns"] .nav-icon,
.sidebar [data-view="reports"] .nav-icon { color: #ad8441; background: #fff3d9; }
.sidebar [data-view="zalo"] .nav-icon,
.sidebar [data-view="settings"] .nav-icon { color: #6085b1; background: #e8f0fc; }
.sidebar [data-view="templates"] .nav-icon { color: #8a67bb; background: #f1eafd; }
.sidebar .nav-submenu {
  gap: 2px;
  margin: 2px 0 4px 22px;
  padding-left: 10px;
  border-left-color: #e6def8;
}
.sidebar .nav-submenu button {
  min-height: 34px;
  padding: 5px 7px;
  border-radius: 7px;
  color: #625c72;
  font-size: 12px;
}
.sidebar .nav-submenu button:hover,
.sidebar .nav-submenu button.active { color: #5838bf; background: #f2edff; }
.sidebar .nav-submenu .miniapp-submenu-icon { color: #7957c8; }
.sidebar .sidebar-foot {
  border-color: #eee8f4;
  border-radius: 9px;
  color: #504b61;
  background: #f8f5ff;
  box-shadow: none;
}
.sidebar .sidebar-foot strong { color: #45375e; }
.sidebar .sidebar-foot span { color: #7b708d; }
.sidebar .status-dot { background: #24a877; box-shadow: 0 0 0 3px #def4e9; }
.main-content { margin-left: 232px; width: calc(100% - 232px); }
body.sidebar-collapsed .sidebar { width: 66px; padding-inline: 9px; }
body.sidebar-collapsed .main-content { margin-left: 66px; width: calc(100% - 66px); }
body.sidebar-collapsed .sidebar-brand-row { min-height: 82px; }
body.sidebar-collapsed .sidebar .nav-item { width: 46px; }

/* One page heading, clear primary actions, low-noise surfaces. */
.topbar {
  height: 72px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  box-shadow: none;
}
.topbar .eyebrow { display: none; }
.topbar h1 { margin: 0; color: #28213b; font-size: 22px; letter-spacing: -.03em; }
.connection-badge { border: 1px solid #f1e5ca; color: #946725; background: #fff5dd; font-size: 12px; }
.connection-badge:not(.not-ready) { border-color: #cceedd; color: #187a56; background: #e4f7ed; }
.avatar { border-radius: 50%; background: #eee8ff; color: #5e3bc6; box-shadow: none; }
.account-popover { border-color: var(--line); box-shadow: 0 14px 34px rgba(41,29,76,.14); }
.primary-button {
  border-color: #6d43ef;
  border-radius: 9px;
  color: #fff;
  background: #6d43ef;
  box-shadow: none;
}
.primary-button:hover { border-color: #5833d1; background: #5833d1; transform: none; }
.secondary-button { border-color: #e1dbed; border-radius: 9px; color: #504563; background: #fff; box-shadow: none; }
.secondary-button:hover { border-color: #af9be9; color: #5738bd; background: #fbf9ff; }
.text-button { color: #6340d6; }
.text-button:hover { background: #f0ebff; }
.icon-button { border-radius: 8px; color: #6c607d; background: #f4f1fa; }
.row-icon-action:hover,
.row-icon-action[aria-expanded="true"] { border-color: #d9cbff; color: #5e3ac8; background: #f2edff; }
.section-toolbar { margin-bottom: 15px; }
.section-toolbar h2 { color: #29243a; font-size: 20px; letter-spacing: -.025em; }
.section-toolbar p { color: var(--muted); font-size: 13px; }
.panel,
.table-panel,
.stat-card,
.quick-action-grid > button,
.campaign-card,
.campaign-insights article,
.customer360-insights article,
.history-overview article,
.appointment-insights > button,
.miniapp-offer-kpis article {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow);
}
.panel h3 { color: #2c263d; font-size: 14px; }
.panel p { color: var(--muted); }
.quick-action-grid > button:hover,
.stat-card:hover,
.campaign-card:hover { border-color: #cfc0f5; box-shadow: var(--shadow-hover); }
.stat-grid { gap: 10px; margin: 14px 0; }
.stat-card { min-height: 94px; padding: 13px; gap: 8px; }
.stat-card strong { color: #302549; font-size: 21px; }
.stat-card small { padding-top: 7px; font-size: 11px; }
.stat-icon,
.quick-action-icon,
.empty-icon { box-shadow: none !important; }
.stat-icon { width: 32px; height: 32px; border-radius: 8px; }
.stat-icon .app-icon { width: 17px; height: 17px; }
.stat-icon.blue,
.quick-action-icon.customer { color: #7650df; background: #eee8ff !important; }
.stat-icon.violet,
.quick-action-icon.campaign { color: #d08a5b; background: #ffede3 !important; }
.stat-icon.green,
.quick-action-icon.data { color: #428f7e; background: #dff5eb !important; }
.stat-icon.orange,
.quick-action-icon.history { color: #4a91bd; background: #e5f3fd !important; }
.quick-action-grid { gap: 10px; margin-top: 12px; }
.quick-action-grid > button { min-height: 82px; padding: 12px; }
.quick-action-grid strong { color: #332b49; }
.quick-action-grid small { color: var(--muted); }
.quick-action-grid i { color: #7d60ce; }
.welcome-card {
  min-height: 118px;
  padding: 18px 21px;
  border: 1px solid #e7dcff;
  border-radius: 14px;
  color: #392866;
  background: #eee7ff;
  box-shadow: none;
}
.welcome-card::after { display: none; }
.welcome-card h2 { margin: 8px 0 4px; color: #382566; font-size: 21px; }
.welcome-card p { color: #6c5b8e; font-size: 13px; }
.welcome-card .pill { border-color: #ddd0ff; color: #6446ad; background: #fff9; }
.flow-step { border-color: #ece8f3; background: #faf9fe; }
.flow-step b { color: #6240d5; background: #eee8ff; }
.flow-step strong { color: #352c49; }
.flow-arrow { color: #a99bc8; }
.oa-logo { box-shadow: none; }

/* Tables and forms use the same compact rhythm across all workspaces. */
.table-wrap { border-radius: 0 0 12px 12px; }
.table-tools { border-bottom-color: var(--line); }
th { color: #797185; background: #f8f6fc; }
td { border-top-color: var(--line); }
tbody tr:hover { background: #faf8ff; }
input, select, textarea { accent-color: #6d43ef; }
.search-box,
.select-control,
.form-stack :is(input,select,textarea),
.form-grid :is(input,select,textarea) { border-color: #e2ddeb; border-radius: 8px; }
.search-box:focus-within,
.form-stack :is(input,select,textarea):focus,
.form-grid :is(input,select,textarea):focus { border-color: #a891eb; box-shadow: 0 0 0 3px #eee8ff; }
.status-badge.success,
.tag.success { color: #167550; background: #e4f6eb; }
.status-badge.failed { color: #b43c55; background: #fff0f2; }
.tag.blue { color: #5d3dc7; background: #eee8ff; }
.tag.draft { color: #9a6a28; background: #fff3dc; }
.empty-state { color: var(--muted); }
.empty-icon { color: #6d43ef; background: #eee8ff !important; }
.modal { border: 1px solid #e9e3f2; box-shadow: 0 26px 70px rgba(32,22,62,.2); }
.modal-head { border-bottom-color: var(--line); }
.stepper span.active { background: #6d43ef; box-shadow: 0 0 0 5px #eee8ff; }
.stepper i.active { background: #6d43ef; }

/* Guided first-run state: real readiness, not example numbers. */
.overview-setup {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid #e2d5ff;
  border-radius: 14px;
  background: #f0eaff;
  box-shadow: var(--shadow);
}
.overview-setup-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.overview-setup-heading span { color: #7254bd; font-size: 11px; font-weight: 850; letter-spacing: .12em; }
.overview-setup-heading h2 { margin: 5px 0 3px; color: #34245e; font-size: 20px; letter-spacing: -.03em; }
.overview-setup-heading p { margin: 0; color: #71638a; font-size: 12px; line-height: 1.5; }
.overview-setup-heading > strong { flex: 0 0 auto; padding: 7px 9px; border: 1px solid #d7c5ff; border-radius: 7px; color: #5635b7; background: #fff; font-size: 11px; }
.overview-setup-steps { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.overview-setup-steps button { min-width: 0; display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 11px; border: 1px solid #e5dcf7; border-radius: 9px; color: #342b49; background: rgba(255,255,255,.88); text-align: left; }
.overview-setup-steps button:hover { border-color: #bda9f4; background: #fff; }
.overview-setup-steps button > b { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; color: #6a46d2; background: #eee8ff; font-size: 11px; }
.overview-setup-steps button > span { min-width: 0; display: grid; gap: 2px; }
.overview-setup-steps button strong { font-size: 12px; }
.overview-setup-steps button small { overflow: hidden; color: #82788d; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.overview-setup-steps button em { color: #9a6a28; font-size: 11px; font-style: normal; font-weight: 750; white-space: nowrap; }
.overview-setup-steps button.is-complete > b { color: #167550; background: #e2f5ea; }
.overview-setup-steps button.is-complete em { color: #167550; }
.overview-empty-metrics .stat-grid { display: none; }
#datahub-view .datahub-overview-toolbar h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
#datahub-view .datahub-overview-toolbar p { margin-top: 0; }
#campaigns-view .campaign-insights[hidden],
#miniGameKpis[hidden] { display: none; }

/* Match the login gate and key catalog surfaces to the workspace palette. */
.auth-gate { background: radial-gradient(circle at 18% 12%, #eee6ff, transparent 34%), #f7f5fc; }
.auth-card { border: 1px solid #e4deef; border-radius: 16px; background: #fff; box-shadow: 0 24px 64px rgba(48,38,80,.12); }
.auth-brand-logo { border: 0; border-radius: 10px; background: #6d43ef; box-shadow: none; }
.auth-brand-logo img { display: none; }
.auth-brand-logo::after { content: "Z"; color: #fff; font-size: 20px; font-weight: 900; line-height: 1; }
.auth-form input { border-color: #e2ddeb; background: #fff; }
.auth-form input:focus { border-color: #a891eb; box-shadow: 0 0 0 3px #eee8ff; }
.datahub-overview-metrics article,
.datahub-overview-space,
.datahub-overview-hub { border-color: var(--line); box-shadow: var(--shadow); }
.datahub-overview-space-head { border-bottom-color: var(--line); background: #fbf9ff; }
.datahub-overview-space-title > span,
.datahub-overview-hub-icon { color: #6d43ef; background: #eee8ff; box-shadow: none; }
.datahub-overview-hub:hover { border-color: #bba8f2; box-shadow: var(--shadow-hover); }
.datahub-overview-hub-arrow { color: #6d43ef; background: #f1ecff; }
.datahub-overview-hub-metrics > span { color: #6e6480; background: #f6f2fc; }
.datahub-overview-hub-metrics b { color: #4d3a7c; }
.datahub-overview-table-chips > span { border-color: #e9e3f2; color: #625874; background: #fcfaff; }
.datahub-overview-metrics strong,
.datahub-overview-space-title strong,
.datahub-overview-hub-name strong { color: #302549; }
.datahub-overview-metrics small,
.datahub-overview-space-title small,
.datahub-overview-hub-name small { color: #777084; font-size: 11px; }
.datahub-overview-hub-metrics > span,
.datahub-overview-table-chips > span { font-size: 12px; }
.datahub-overview-table-chips { flex-wrap: wrap; overflow: visible; }
.datahub-overview-table-chips > span { max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
.datahub-overview-space-title strong,
.datahub-overview-hub-name strong { overflow: visible; text-overflow: clip; white-space: normal; }
.datahub-detail .datahub-table-button.active { border-color: #cab9f6; color: #593abf; background: #f2edff; }
.datahub-back-button { border-color: #e2ddeb; color: #6d43ef; }
.datahub-back-button:hover { border-color: #baa6f0; background: #f3efff; }
.mini-game-card { border-color: var(--line); box-shadow: var(--shadow); }
.mini-game-card:hover { box-shadow: var(--shadow-hover); }
.mini-game-card-copy small { color: #6d43ef; font-size: 11px; }
.mini-game-card-copy h3 { color: #302549; font-size: 14px; }
.mini-game-card-copy p { color: #716e81; font-size: 12px; }
.mini-game-preview-footer .app-icon { width: 19px; height: 19px; color: #82798e; }
.mini-game-preview-footer span.active .app-icon { color: #5f3ac6; }
.mini-game-preview-footer small { font-size: 10px; }
.mini-game-coming-row article {
  min-height: 148px;
  grid-template-columns: 160px minmax(0,1fr);
  opacity: 1;
}
.mini-game-coming-phone {
  position: relative;
  width: 160px;
  height: 148px;
  overflow: hidden;
  background: #e8e8e8 url("assets/images/phone-16-pro-max.jpg") center / auto 170px no-repeat;
}
.mini-game-coming-screen {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 56px;
  height: 115px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 9px;
  overflow: hidden;
  color: #fff;
  text-align: center;
  transform: translateX(-50%);
}
.mini-game-coming-screen.wheel { background: linear-gradient(160deg,#a83748,#502b58); }
.mini-game-coming-screen.wheel i {
  width: 42px;
  height: 42px;
  border: 3px solid #fce3b1;
  border-radius: 50%;
  background: conic-gradient(#e8b55f 0 45deg,#fff1c5 45deg 90deg,#c45b67 90deg 135deg,#fff1c5 135deg 180deg,#e8b55f 180deg 225deg,#fff1c5 225deg 270deg,#c45b67 270deg 315deg,#fff1c5 315deg);
  box-shadow: 0 6px 15px rgba(0,0,0,.18);
}
.mini-game-coming-screen.gift { background: linear-gradient(160deg,#7a51ba,#dd8f9a); }
.mini-game-coming-screen.gift .app-icon { width: 34px; height: 34px; color: #fff0ca; }
.mini-game-coming-screen b { max-width: 50px; font-size: 6px; line-height: 1.25; letter-spacing: .04em; }
@media (max-width: 560px) {
  .mini-game-coming-row article { grid-template-columns: 120px minmax(0,1fr); }
  .mini-game-coming-phone { width: 120px; }
}

/* The uploaded iPhone photograph is the presentation frame; game content remains live HTML. */
.mini-game-live-preview {
  position: relative;
  display: block;
  height: 720px;
  min-height: 0;
  scroll-margin-top: 170px;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #e8e8e8 url("assets/images/phone-16-pro-max.jpg") center center / 1380px 920px no-repeat;
}
.mini-game-live-preview .mini-game-preview-phone {
  position: absolute;
  top: 57px;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: 307px;
  height: 628px;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0 0 40px 40px;
  background-color: color-mix(in srgb, var(--preview-accent) 60%, #233943);
  background-image: linear-gradient(180deg, rgba(12,25,31,.48), rgba(12,25,31,.2) 42%, rgba(12,25,31,.62)), var(--preview-background-image);
  background-position: center;
  background-size: cover;
  box-shadow: none;
  transform: translateX(-50%);
}
.mini-game-live-preview .mini-game-preview-top,
.mini-game-live-preview .mini-game-preview-footer { flex: 0 0 auto; }
.mini-game-live-preview .mini-game-preview-scene {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.mini-game-live-preview .mini-game-preview-scene::-webkit-scrollbar { display: none; }
@media (max-width: 720px) {
  .mini-game-live-preview {
    height: 580px;
    background-size: 1120px 747px;
  }
  .mini-game-live-preview .mini-game-preview-phone {
    top: 45px;
    width: 249px;
    height: 515px;
    border-radius: 0 0 33px 33px;
  }
}

/* Domain workspaces retain their controls but share one visual language. */
.customer360-insights article,
.appointment-insights > button,
.zbs-insight-grid article,
.aggregate-report-kpis article,
.mini-game-kpis > div,
.mini-game-admin-card,
.mini-game-config-card { border-color: var(--line); background: #fff; box-shadow: var(--shadow); }
.appointment-insights > button:hover { border-color: #c7b5f4; box-shadow: var(--shadow-hover); }
.appointment-insights > button.active { border-color: #bba8f0; background: #f3efff; box-shadow: 0 0 0 2px #eee7ff; }
.appointment-insights > button:nth-child(1) { background: #ffe7d9; }
.appointment-insights > button:nth-child(2) { background: #dcf6e9; }
.appointment-insights > button:nth-child(3) { background: #e1edff; }
.appointment-insights > button:nth-child(4) { background: #f4f1f9; }
.appointment-insights > button.active { border-color: #bba8f0; box-shadow: 0 0 0 2px #eee7ff; }
.customer360-insights strong,
.appointment-insights strong,
.zbs-insight-grid strong,
.aggregate-report-kpis strong,
.miniapp-offer-kpis strong,
.mini-game-kpis strong,
.mini-game-admin-card h3 { color: #302549; }
.zbs-status-tabs button.active { border-bottom-color: #6d43ef; color: #5636c0; background: #f5f1ff; }
.zbs-status-tabs b { color: #6340d6; }
.zbs-template-table th { color: #736d80; background: #f8f6fc; }
.zbs-name-button:hover strong { color: #5e3bc6; }
.zbs-row-action { border-color: #e1d9f1; color: #6444bd; background: #f9f6ff; }
.zbs-row-action:hover { border-color: #baa5ed; color: #4f32ad; background: #f1ebff; }
.mini-game-admin-card p,
.mini-game-admin-metrics,
.mini-game-kpis span { color: #716e81; font-size: 12px; }
.mini-game-admin-status { font-size: 11px; }
.mini-game-builder-head { border-bottom-color: var(--line); background: rgba(250,248,255,.96); box-shadow: 0 8px 20px rgba(48,38,80,.06); }
.mini-game-builder-head span { color: #6d43ef; font-size: 11px; }
.mini-game-builder-head h3 { color: #302549; }
.mini-game-config-card > header > b { color: #6d43ef; background: #eee8ff; }
.mini-game-config-card > header strong { color: #302549; }
.mini-game-admin-empty { border-color: #ded5ee; color: #716e81; background: #faf8ff; }
.mini-game-coming-row article { border-color: var(--line); }
.mini-game-coming-row strong { color: #302549; font-size: 13px; }
.mini-game-coming-row small { color: #716e81; font-size: 11px; }
.aggregate-report-filters .select-control { border-color: #e2ddeb; color: #302549; }
.aggregate-report-kpis em { font-size: 11px; }
.workflow-toolbar,
.workflow-context-tabs { border-color: var(--line); background: rgba(255,255,255,.96); }
.workflow-palette > button:hover { border-color: #baa5ed; background: #f5f1ff; }
.workflow-node-main:hover,
.workflow-node.selected .workflow-node-main { border-color: #a789e9; }
.workflow-node.selected .workflow-node-main { box-shadow: 0 0 0 3px #eee8ff, 0 10px 26px rgba(48,38,80,.1); }
.workflow-canvas {
  background-color: #fbfaff;
  background-image: radial-gradient(circle, rgba(117,92,166,.21) 1px, transparent 1.2px), linear-gradient(180deg,#fdfcff,#f8f5fc);
  background-size: 18px 18px, 100% 100%;
}
.workflow-datahub-add-column:hover,
.workflow-datahub-column-options > button:hover { border-color: #bba8f0; color: #5d3bc2; background: #f5f1ff; }
.datahub-saved-view-summary > span { border-color: var(--line); background: #faf8ff; }
.datahub-filter-button.active { border-color: #baa5ed; color: #5e3bc6; background: #f1ebff; }
.datahub-filter-button b { background: #6d43ef; }

body.sidebar-collapsed .sidebar .nav-submenu:not([hidden]) {
  border-color: #e6def1;
  background: #fff;
  box-shadow: 0 14px 32px rgba(48,38,80,.16);
}
body.sidebar-collapsed .sidebar .nav-submenu:not([hidden]) button { color: #51495f; font-size: 12px; }
body.sidebar-collapsed .sidebar .nav-submenu:not([hidden]) button:hover,
body.sidebar-collapsed .sidebar .nav-submenu:not([hidden]) button.active { color: #5e3bc6; background: #f1ebff; }
body.sidebar-collapsed .sidebar-collapse-button { border-color: #e1daef; color: #6d43ef; background: #fff; }

@media (max-width: 520px) {
  .auth-gate { background: #fff; }
  .auth-card { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .overview-setup-steps button { grid-template-columns: 28px minmax(0,1fr); }
  .overview-setup-steps button em { grid-column: 2; }
}

@media (min-width: 1024px) and (max-width: 1200px) {
  .sidebar { transform: none; }
  .main-content { margin-left: 232px; width: calc(100% - 232px); }
  .mobile-only { display: none; }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content, body.sidebar-collapsed .main-content { margin-left: 0; width: 100%; }
  .mobile-only { display: grid; }
}

/* Data Hub column creation: creation first, existing-column controls second. */
#dataHubColumnsModal .small-modal { width: min(760px, calc(100vw - 28px)); }
#dataHubColumnsModal .datahub-columns-body { gap: 14px; }
#dataHubColumnsModal .datahub-column-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 11px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid #ddd2f5;
  border-radius: 12px;
  background: #f8f5ff;
}
.datahub-column-form-head strong { display: block; color: #352650; font-size: 15px; }
.datahub-column-form-head small { display: block; margin-top: 3px; color: #786e88; font-size: 12px; }
.datahub-column-form-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
#dataHubColumnForm label { min-width: 0; display: grid; gap: 6px; }
#dataHubColumnForm label > span { color: #514363; font-size: 12px; font-weight: 750; }
#dataHubColumnForm :is(input, select, textarea) { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #d7cee8; border-radius: 8px; color: #332a43; background: #fff; font: inherit; font-size: 13px; }
#dataHubColumnForm textarea { min-height: 94px; resize: vertical; }
.datahub-column-type-hint { margin: 0; color: #756986; font-size: 12px; line-height: 1.45; }
#dataHubColumnForm .datahub-column-options[hidden] { display: none; }
#dataHubColumnForm .datahub-column-options small { color: #867a96; font-size: 11px; font-weight: 500; }
.datahub-column-form-actions { display: flex; justify-content: flex-end; }
.datahub-column-form-actions .primary-button { min-height: 38px; }
#dataHubColumnsModal .datahub-base-columns { border-color: #e8e2f1; background: #fff; }
#dataHubColumnsModal .datahub-custom-column-list { max-height: none; overflow: visible; padding-right: 0; }
#dataHubRecordsTable th:has(.datahub-header-edit) .datahub-column-heading { padding-right: 28px; }
.datahub-header-edit { position: absolute; top: 50%; right: 12px; width: 22px; height: 22px; display: grid; place-items: center; transform: translateY(-50%); border: 0; border-radius: 6px; color: #8670b1; background: transparent; cursor: pointer; }
.datahub-header-edit:hover, .datahub-header-edit:focus-visible { color: #6540d0; background: #ece5ff; }
.datahub-header-edit .app-icon { width: 13px; height: 13px; }
#dataHubColumnsModal .datahub-custom-column { grid-template-columns: minmax(130px, 1fr) 88px 78px 52px 32px 32px 32px; gap: 8px; }
.datahub-column-edit, .datahub-column-edit-placeholder { width: 32px; height: 32px; display: grid; place-items: center; justify-self: end; }
.datahub-column-edit { border: 0; border-radius: 8px; color: #6540d0; background: #f0eaff; cursor: pointer; }
.datahub-column-edit:hover { color: #4527a8; background: #e5dbff; }
.datahub-column-edit .app-icon { width: 16px; height: 16px; }
.datahub-edit-column-modal { width: min(500px, calc(100vw - 28px)); }
.datahub-edit-column-form { display: grid; gap: 16px; padding: 20px 22px 0; }
.datahub-edit-column-form label { display: grid; gap: 7px; color: #514363; font-size: 13px; font-weight: 700; }
.datahub-edit-column-form :is(input, select, textarea) { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid #d7cee8; border-radius: 9px; color: #332a43; background: #fff; font: inherit; font-size: 14px; }
.datahub-edit-column-form textarea { min-height: 94px; resize: vertical; }
.datahub-edit-column-form .datahub-column-options[hidden] { display: none; }
.datahub-edit-column-form .datahub-column-options small { color: #867a96; font-size: 11px; font-weight: 500; }
.datahub-edit-column-notice { margin: 0; padding: 11px 12px; border-radius: 9px; color: #615776; background: #f7f3ff; font-size: 12px; line-height: 1.5; }
.datahub-edit-column-form .modal-actions { margin: 0 -22px; }
@media (max-width: 620px) {
  #dataHubColumnsModal .datahub-custom-column { grid-template-columns: minmax(0, 1fr) 52px 32px 32px 32px; }
  #dataHubColumnsModal .datahub-custom-column code, #dataHubColumnsModal .datahub-custom-column em { display: none; }
}
@media (max-width: 620px) {
  .datahub-column-form-fields { grid-template-columns: 1fr; }
  .datahub-column-form-actions .primary-button { width: 100%; }
}
.datahub-record-choices { min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 12px; border: 1px solid #e4dded; border-radius: 10px; }
.datahub-record-choices legend { padding: 0 5px; color: #514363; font-size: 12px; font-weight: 750; }
.datahub-record-choices label { min-height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid #e8e1f0; border-radius: 8px; background: #fff; font-size: 12px; cursor: pointer; }
.datahub-record-choices input { width: auto !important; min-height: 0 !important; margin: 0; accent-color: #6d43ef; }
.datahub-image-field { display: grid; gap: 8px; }
.datahub-image-field > span { color: #514363; font-size: 12px; font-weight: 750; }
.datahub-image-field > small { color: #82768d; font-size: 11px; }
.datahub-image-current { display: flex; align-items: center; gap: 10px; }
.datahub-image-current img { width: 64px; height: 64px; object-fit: cover; border: 1px solid #e7e0ee; border-radius: 9px; }
.datahub-image-current button { border: 0; color: #ba4255; background: transparent; font-size: 12px; cursor: pointer; }
.datahub-image-link img { width: 46px; height: 46px; object-fit: cover; border: 1px solid #e7e0ee; border-radius: 7px; }
.datahub-choice-chip { display: inline-block; margin: 2px 3px 2px 0; padding: 3px 7px; border-radius: 6px; color: #5e3bc6; background: #f0eaff; font-size: 11px; white-space: nowrap; }
.datahub-rating-cell { color: #dc9a27; letter-spacing: 1px; white-space: nowrap; }
@media (max-width: 760px) {
  .view { padding: 17px 14px 34px; }
  .topbar { height: 66px; padding: 0 14px; }
  .topbar h1 { font-size: 19px; }
  .overview-setup-steps { grid-template-columns: 1fr; }
  .overview-setup-heading { flex-wrap: wrap; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* Layout system: the same navigation rhythm and page anatomy in every area. */
.sidebar { width: 248px; padding: 16px 11px; overflow: hidden; }
.main-content { width: calc(100% - 248px); margin-left: 248px; }
.sidebar-brand-row { min-height: 58px; margin-bottom: 6px; padding: 3px 6px 9px; border-bottom: 1px solid #eeeaf5; }
.sidebar .brand-mark { width: 39px; height: 39px; border-radius: 11px; }
.sidebar .brand-mark::after { font-size: 20px; }
.sidebar .brand strong { font-size: 16px; }
.sidebar .brand span { font-size: 11px; }
.sidebar .main-nav {
  flex: 1 1 auto;
  min-height: 0;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 3px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d9d1e9 transparent;
}
.sidebar .main-nav::-webkit-scrollbar { width: 5px; }
.sidebar .main-nav::-webkit-scrollbar-thumb { border-radius: 5px; background: #d9d1e9; }
.sidebar .sidebar-brand-row { flex: 0 0 auto; }
.sidebar .nav-section-label { margin: 10px 10px 5px; color: #8b829d; font-size: 11px; line-height: 1.4; }
.sidebar .nav-section-label:first-child { margin-top: 5px; }
.sidebar .nav-item { min-height: 39px; gap: 10px; padding: 5px 9px; font-size: 13px; }
.sidebar .nav-item.active { box-shadow: inset 3px 0 #7049e8; }
.sidebar .nav-icon { width: 29px; height: 29px; flex-basis: 29px; border-radius: 8px; }
.sidebar .nav-icon .app-icon { width: 17px; height: 17px; }
.sidebar .nav-submenu { margin: 3px 0 4px 20px; padding-left: 11px; }
.sidebar .nav-submenu button {
  min-height: 35px;
  display: grid;
  grid-template-columns: 27px minmax(0,1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  font-size: 12px;
}
.sidebar .nav-submenu .miniapp-submenu-icon {
  width: 27px;
  height: 27px;
  padding: 5px;
  border-radius: 7px;
  color: #6d43ef;
  background: #eee8ff;
}
.sidebar [data-miniapp-area="offers"] .miniapp-submenu-icon,
.sidebar [data-miniapp-area="promotions"] .miniapp-submenu-icon { color: #b77766; background: #ffede6; }
.sidebar [data-miniapp-area="forms"] .miniapp-submenu-icon { color: #398e83; background: #e1f5ef; }
.sidebar [data-miniapp-area="games"] .miniapp-submenu-icon { color: #b1843f; background: #fff2d8; }
.sidebar .sidebar-foot { flex: 0 0 auto; margin-top: 12px; padding: 11px; }
body.sidebar-collapsed .sidebar { overflow: visible; }
body.sidebar-collapsed .sidebar .main-nav { overflow-x: hidden; overflow-y: auto; }
.topbar { height: 76px; }
.view { padding: 24px 28px 48px; }

:is(#customer360-view,#appointments-view,#zalo-view,#templates-view,#reports-view,#logs-view,#settings-view) > .section-toolbar,
#campaignLibraryView > .section-toolbar,
#dataHubOverview > .section-toolbar,
#dataHubDetail > .section-toolbar,
#miniapp-view [data-miniapp-area-panel] > .section-toolbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 0 0 16px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(105deg,#fff 66%,#f8f4ff);
  box-shadow: var(--shadow);
}
:is(#customer360-view,#appointments-view,#zalo-view,#templates-view,#reports-view,#logs-view,#settings-view) > .section-toolbar > div:first-child,
#campaignLibraryView > .section-toolbar > div:first-child,
#dataHubOverview > .section-toolbar > div:first-child,
#dataHubDetail > .section-toolbar > div:first-child,
#miniapp-view [data-miniapp-area-panel] > .section-toolbar > div:first-child { min-width: 0; flex: 1 1 330px; }
.section-toolbar p { max-width: 650px; margin-top: 0; color: #6e667c; font-size: 13px; line-height: 1.5; }
.section-eyebrow { color: #7052b8; font-size: 11px; letter-spacing: .08em; }
.section-toolbar :is(.primary-button,.secondary-button) { white-space: nowrap; }

:is(.customer360-insights,.appointment-insights,.campaign-insights,.zbs-insight-grid,.miniapp-offer-kpis,.dynamic-page-kpis,.mini-game-kpis,.aggregate-report-kpis,.datahub-overview-metrics) {
  gap: 12px;
  margin-bottom: 16px;
}
:is(.customer360-insights article,.appointment-insights > button,.campaign-insights article,.zbs-insight-grid article,.miniapp-offer-kpis article,.dynamic-page-kpis article,.mini-game-kpis > div,.aggregate-report-kpis article,.datahub-overview-metrics article) {
  min-height: 94px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow);
}
:is(.customer360-metric-icon,.appointment-metric-icon,.insight-icon,.offer-kpi-icon,.report-kpi-icon,.datahub-overview-metric-icon) {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  box-shadow: none;
}
:is(.customer360-metric-icon,.insight-icon.all,.offer-kpi-icon.blue) { color: #6d43ef; background: #eee8ff; }
:is(.appointment-metric-icon.pending,.insight-icon.paused,.offer-kpi-icon.orange) { color: #ae7b37; background: #fff1d7; }
:is(.customer360-metric-icon.identified,.appointment-metric-icon.completed,.insight-icon.live,.offer-kpi-icon.green) { color: #328869; background: #e2f5ea; }
:is(.customer360-metric-icon.linked,.insight-icon.runs,.offer-kpi-icon.cyan) { color: #438fb1; background: #e5f3fb; }
:is(.customer360-metric-icon.attention,.appointment-metric-icon.cancelled) { color: #be6874; background: #fff0f1; }
.customer360-insights article > div > span,
.appointment-insights i,
.miniapp-offer-kpis small,
.datahub-overview-metrics small { color: #766f82; font-size: 11px; }

:is(.customer360-list-panel,.appointment-list-panel,.campaign-list-shell,.zbs-library-panel,.miniapp-offer-list-panel,.datahub-overview-space,.aggregate-report-filters) {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow);
}
:is(.customer360-tools,.appointment-tools,.campaign-list-tools,.miniapp-offer-tools,.table-tools) {
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
:is(.customer360-tools,.appointment-tools,.campaign-list-tools,.miniapp-offer-tools) .search-box { min-width: 220px; }
.table-wrap th { height: 44px; color: #766e82; background: #faf8fd; }
.table-wrap td { height: 52px; }
.empty-state { padding: 34px 20px; }
.empty-state.large { padding: 40px 20px; }

@media (min-width: 1024px) and (max-width: 1200px) {
  .sidebar { width: 248px; transform: none; }
  .main-content { width: calc(100% - 248px); margin-left: 248px; }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content, body.sidebar-collapsed .main-content { width: 100%; margin-left: 0; }
  .mobile-only { display: grid; }
}
@media (max-width: 760px) {
  .view { padding: 16px 14px 36px; }
  .topbar { height: 66px; }
  :is(#customer360-view,#appointments-view,#zalo-view,#templates-view,#reports-view,#logs-view,#settings-view) > .section-toolbar,
  #campaignLibraryView > .section-toolbar,
  #dataHubOverview > .section-toolbar,
  #dataHubDetail > .section-toolbar,
  #miniapp-view [data-miniapp-area-panel] > .section-toolbar { min-height: 0; padding: 16px; align-items: stretch; }
  .section-toolbar :is(.primary-button,.secondary-button) { max-width: 100%; white-space: normal; }
  :is(.customer360-tools,.appointment-tools,.campaign-list-tools,.miniapp-offer-tools) .search-box { min-width: 0; }
}

/* Keep navigation and page states consistent across workspaces. */
[hidden] { display: none !important; }
.sidebar .nav-item.group-active:not(.active) { color: #5e46a8; background: #faf8ff; box-shadow: none; }
.sidebar .nav-submenu { border-left: 1px solid #e5def3; }
.sidebar .nav-submenu button.active { box-shadow: inset 2px 0 #7049e8; }

#customer360-view .section-toolbar > div:first-child::before,
#appointments-view .section-toolbar > div:first-child::before,
#dataHubOverview .section-toolbar > div:first-child::before,
#campaignLibraryView .section-toolbar > div:first-child::before,
#zalo-view > .section-toolbar > div:first-child::before,
#templates-view > .section-toolbar > div:first-child::before,
#reports-view > .section-toolbar > div:first-child::before,
#settings-view > .section-toolbar > div:first-child::before {
  display: block;
  margin-bottom: 5px;
  color: #7052b8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}
#customer360-view .section-toolbar > div:first-child::before { content: "KHÁCH HÀNG"; }
#appointments-view .section-toolbar > div:first-child::before { content: "LỊCH HẸN"; }
#dataHubOverview .section-toolbar > div:first-child::before { content: "DỮ LIỆU"; }
#campaignLibraryView .section-toolbar > div:first-child::before { content: "TỰ ĐỘNG HÓA"; }
#zalo-view > .section-toolbar > div:first-child::before { content: "KẾT NỐI"; }
#templates-view > .section-toolbar > div:first-child::before { content: "ZALO BUSINESS SOLUTIONS"; }
#reports-view > .section-toolbar > div:first-child::before { content: "PHÂN TÍCH"; }
#settings-view > .section-toolbar > div:first-child::before { content: "HỆ THỐNG"; }

:is(.customer360-list-panel,.appointment-list-panel,.campaign-list-shell,.zbs-library-panel,.miniapp-offer-list-panel) .empty-state,
.table-panel .empty-state.show {
  min-height: 226px;
  padding: 28px 20px;
  align-content: center;
}
:is(.miniapp-offer-list-panel,.zbs-library-panel):has(.empty-state:not([hidden])) .table-wrap:has(tbody:empty) { display: none; }
.miniapp-offer-list-panel .empty-state:not([hidden]) { display: grid; justify-items: center; }
.dynamic-page-sidebar:has(#dynamicPageEmpty:not([hidden])) { min-height: 258px; }
.dynamic-page-sidebar #dynamicPageEmpty:not([hidden]) {
  min-height: 172px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  margin: 0;
  padding: 20px;
}
.dynamic-page-sidebar #dynamicPageEmpty strong { color: #3b3350; font-size: 14px; }
.dynamic-page-sidebar #dynamicPageEmpty span { max-width: 340px; color: #817991; font-size: 12px; line-height: 1.5; }
.dynamic-page-kpis > div { background: #fff; border-color: var(--line); box-shadow: var(--shadow); }
.dynamic-page-kpis span { color: #766f82; font-size: 11px; }
.dynamic-page-kpis strong { color: #33294d; font-size: 24px; }
.mini-game-admin-empty { min-height: 226px; border-style: solid; border-color: var(--line); background: #fff; }

/* PDF proposal: one stable rail, with Mini App destinations at the same level. */
.sidebar { padding: 16px 12px 12px; }
.sidebar .main-nav { gap: 1px; }
.sidebar .nav-section-label { margin: 13px 10px 5px; font-size: 10px; letter-spacing: .1em; }
.sidebar .nav-item,
.sidebar .nav-submenu button { min-height: 40px; border-radius: 9px; font-size: 13px; font-weight: 650; }
.sidebar .nav-item.active,
.sidebar .nav-submenu button.active { color: #332064; background: #f0ebff; box-shadow: inset 3px 0 #6d43ef; }
.sidebar .nav-item-parent { display: none; }
.sidebar .nav-submenu { display: grid; gap: 1px; margin: 0; padding: 0; border: 0; }
.sidebar .nav-submenu button { grid-template-columns: 29px minmax(0,1fr); gap: 10px; padding: 5px 9px; color: #514e61; }
.sidebar .nav-submenu .miniapp-submenu-icon { width: 29px; height: 29px; padding: 6px; border-radius: 8px; }
.sidebar .sidebar-foot { grid-template-columns: 34px minmax(0,1fr); align-items: center; gap: 9px; padding: 8px; margin-top: 10px; }
.sidebar .sidebar-account-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin: 0;
  border-radius: 9px;
  color: #6b3d23;
  background: #ffe7d6;
  font-size: 11px;
  font-weight: 800;
}
.sidebar .sidebar-account-copy { min-width: 0; display: grid; gap: 2px; margin: 0; }
.sidebar .sidebar-account-copy strong,
.sidebar .sidebar-account-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .sidebar-account-copy strong { font-size: 12px; }
.sidebar .sidebar-account-copy span { margin: 0; font-size: 10px; }
body.sidebar-collapsed .sidebar .nav-item-parent { display: flex; }
body.sidebar-collapsed .sidebar .sidebar-foot { min-height: 44px; padding: 5px; }
body.sidebar-collapsed .sidebar .sidebar-foot .sidebar-account-copy { display: none; }
body.sidebar-collapsed .sidebar .sidebar-foot::after { display: none; }
body.sidebar-collapsed .sidebar .nav-submenu:not([hidden]) { display: grid; }
@media (max-width: 1023px) {
  body.sidebar-collapsed .sidebar .nav-item-parent { display: none; }
  body.sidebar-collapsed .sidebar .nav-submenu { display: grid; }
  body.sidebar-collapsed .sidebar .sidebar-foot .sidebar-account-copy { display: grid; }
}

/* Campaign library follows the reference's scan-friendly cards. */
.campaign-insights article:nth-child(2) { background: #dcf6e9; }
.campaign-insights article:nth-child(3) { background: #ffe4eb; }
.campaign-insights article:nth-child(1) { background: #f0e9ff; }
.campaign-insights article:nth-child(4) { background: #fff0c8; }
.campaign-list-shell:has(.campaign-card-grid) { overflow: visible; border: 0; background: transparent; box-shadow: none; }
.campaign-list-shell:has(.campaign-card-grid) .campaign-list-tools { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 14px; }
.campaign-card-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.campaign-card {
  min-width: 0;
  min-height: 246px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}
.campaign-card:hover { border-color: #beaaf5; box-shadow: 0 12px 28px rgba(63,44,116,.1); }
.campaign-card-top { display: flex; align-items: center; gap: 7px; }
.campaign-card-source { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; color: #6847a7; background: #f2ebff; font-size: 12px; font-weight: 750; }
.campaign-card-source .app-icon { width: 14px; height: 14px; }
.campaign-card-top .status-badge { margin-right: auto; }
.campaign-card-top .campaign-row-actions { margin-left: auto; }
.campaign-card .campaign-name-link { width: 100%; padding: 0; color: #33294b; font-size: 15px; font-weight: 800; line-height: 1.35; text-align: left; }
.campaign-card .campaign-name-link:hover { color: #6742d6; background: transparent; }
.campaign-card-trigger { margin: 0; color: #777082; font-size: 12px; }
.campaign-card-flow { min-height: 32px; margin: 0; color: #514969; font-size: 12px; line-height: 1.45; }
.campaign-card-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; margin-top: auto; padding: 10px; border-radius: 10px; background: #f7f4fd; }
.campaign-card-stats span { min-width: 0; display: grid; gap: 2px; }
.campaign-card-stats strong { overflow: hidden; color: #2e2446; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.campaign-card-stats small { color: #7d738f; font-size: 11px; }
.campaign-card-open { align-self: flex-end; padding: 3px 0; border: 0; color: #6640d6; background: transparent; font-size: 12px; font-weight: 750; cursor: pointer; }
@media (max-width: 1240px) { .campaign-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) { .campaign-card-grid { grid-template-columns: 1fr; } }

/* Page heading sits on the workspace background, not in another dashboard card. */
@media (min-width: 1024px) {
  .sidebar { inset: 16px auto 16px 16px; width: 248px; border: 1px solid #ede7f5; border-radius: 16px; }
  .main-content { width: calc(100% - 264px); margin-left: 264px; }
  body.sidebar-collapsed .sidebar { width: 66px; }
  body.sidebar-collapsed .main-content { width: calc(100% - 98px); margin-left: 98px; }
  .topbar { height: 68px; border-bottom: 1px solid var(--line); background: var(--bg); box-shadow: none; backdrop-filter: none; }
  .view { padding-top: 12px; }
  :is(#customer360-view,#appointments-view,#zalo-view,#templates-view,#reports-view,#logs-view,#settings-view) > .section-toolbar,
  #campaignLibraryView > .section-toolbar,
  #dataHubOverview > .section-toolbar,
  #dataHubDetail > .section-toolbar,
  #miniapp-view [data-miniapp-area-panel] > .section-toolbar {
    min-height: 55px;
    margin-bottom: 14px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
}

/* Offer cards and stock summary use the PDF's visual hierarchy without sample data. */
.miniapp-offer-list-panel:has(.miniapp-offer-card-layout:not(:empty)) .miniapp-offer-table-wrap { display: none; }
.miniapp-offer-card-layout:not(:empty) { display: grid; grid-template-columns: minmax(0,1fr) 250px; gap: 14px; padding: 16px; }
.miniapp-offer-card-grid { min-width: 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.miniapp-offer-card { min-width: 0; min-height: 230px; display: flex; flex-direction: column; gap: 9px; padding: 16px; border-radius: 14px; color: #30234d; }
.miniapp-offer-card.tone-violet { background: #eee7ff; }
.miniapp-offer-card.tone-green { background: #dcf6e9; }
.miniapp-offer-card.tone-orange { background: #ffe7d8; }
.miniapp-offer-card.tone-blue { background: #dfeeff; }
.miniapp-offer-card-top { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.miniapp-offer-card-top span { padding: 4px 7px; border-radius: 999px; background: rgba(255,255,255,.7); font-size: 11px; font-weight: 750; }
.miniapp-offer-card-value { font-size: 29px; line-height: 1.1; letter-spacing: -.04em; }
.miniapp-offer-card h3 { margin: 0; font-size: 14px; line-height: 1.35; }
.miniapp-offer-card-details { display: grid; gap: 5px; margin-top: auto; padding: 10px; border-radius: 9px; background: rgba(255,255,255,.64); }
.miniapp-offer-card-details span { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.miniapp-offer-card-details b { overflow: hidden; max-width: 60%; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.miniapp-offer-card-actions { display: flex; justify-content: flex-end; gap: 8px; }
.miniapp-offer-card-actions button { min-height: 34px; padding: 5px 10px; border: 1px solid rgba(79,49,150,.18); border-radius: 8px; color: #5f3dbe; background: rgba(255,255,255,.65); font-size: 12px; font-weight: 750; cursor: pointer; }
.miniapp-offer-card-actions button:hover { background: #fff; }
.miniapp-offer-inventory { display: flex; flex-direction: column; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.miniapp-offer-inventory h3 { margin: 0; color: #30274b; font-size: 15px; }
.miniapp-offer-inventory p { color: #82798f; font-size: 12px; }
.miniapp-offer-inventory-item { display: grid; gap: 5px; }
.miniapp-offer-inventory-item > span { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.miniapp-offer-inventory-item small { color: #766c87; }
.miniapp-offer-inventory-item i { height: 6px; overflow: hidden; border-radius: 99px; background: #eeeaf5; }
.miniapp-offer-inventory-item i u { height: 100%; display: block; border-radius: inherit; background: #7149ef; }
.miniapp-offer-inventory-item em { color: #81788e; font-size: 11px; font-style: normal; }
.miniapp-offer-inventory > button { align-self: flex-start; margin-top: auto; padding: 0; border: 0; color: #6640d6; background: transparent; font-size: 12px; font-weight: 750; cursor: pointer; }
@media (max-width: 1280px) { .miniapp-offer-card-layout:not(:empty) { grid-template-columns: 1fr; }.miniapp-offer-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) { .miniapp-offer-card-grid { grid-template-columns: 1fr; } }

/* Appointments keep the existing operational list, with a real-data day board. */
.appointment-toolbar-actions { display: flex; align-items: center; gap: 10px; }
.appointment-view-switch { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.appointment-view-switch button { min-height: 34px; padding: 5px 14px; border: 0; border-radius: 999px; color: #615a70; background: transparent; font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.appointment-view-switch button.active { color: #fff; background: #6d43ef; }
.appointment-day-view { padding: 17px; }
.appointment-day-view[hidden] { display: none; }
.appointment-day-head { display: flex; align-items: center; gap: 9px; margin-bottom: 15px; }
.appointment-day-head label { display: flex; align-items: center; gap: 9px; color: #625a74; font-size: 12px; font-weight: 700; }
.appointment-day-head input { min-height: 35px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; color: #302749; background: #fff; font: inherit; }
.appointment-day-head > span { margin-left: auto; color: #756b88; font-size: 12px; }
.appointment-day-layout { display: grid; grid-template-columns: minmax(0,1fr) 285px; gap: 14px; align-items: stretch; }
.appointment-day-board { min-width: 0; overflow-x: auto; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.appointment-day-grid { min-width: 520px; display: grid; grid-template-columns: 66px repeat(var(--appointment-branch-count,1),minmax(170px,1fr)); gap: 8px; margin-bottom: 8px; }
.appointment-day-grid-head { padding-bottom: 8px; border-bottom: 1px solid var(--line); color: #443958; font-size: 12px; }
.appointment-day-grid-head strong { padding: 10px; border-radius: 8px; background: #f5f2fc; }
.appointment-day-time { padding: 10px 0; color: #55486f; font-size: 12px; }
.appointment-day-slot { min-height: 76px; display: grid; align-content: start; gap: 6px; padding: 5px; border: 1px dashed #e6e0f0; border-radius: 9px; }
.appointment-day-card { width: 100%; display: grid; gap: 4px; padding: 9px; border: 1px solid transparent; border-radius: 8px; color: #3d314f; background: #ffe7d9; text-align: left; cursor: pointer; }
.appointment-day-card.success, .appointment-day-card.ready { background: #def5e9; }
.appointment-day-card.failed { background: #ffe6eb; }
.appointment-day-card.selected { border-color: #7047ee; box-shadow: 0 0 0 2px #eee7ff; }
.appointment-day-card strong { font-size: 12px; }
.appointment-day-card small { overflow: hidden; color: #6d6279; text-overflow: ellipsis; white-space: nowrap; }
.appointment-day-card span { justify-self: start; color: #58476a; font-size: 11px; font-weight: 750; }
.appointment-day-detail { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.appointment-day-detail > small { color: #8a7d99; font-size: 11px; }
.appointment-day-detail h3 { margin: 0; color: #302547; font-size: 19px; }
.appointment-day-detail dl { width: 100%; display: grid; gap: 10px; margin: 0; padding: 14px; border-radius: 10px; background: #f7f4fd; }
.appointment-day-detail dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.appointment-day-detail dt { color: #756a82; }
.appointment-day-detail dd { margin: 0; color: #3b3150; font-weight: 750; text-align: right; }
.appointment-day-detail p { color: #685e75; font-size: 12px; }
.appointment-day-detail > button { width: 100%; margin-top: auto; }
.appointment-day-empty { min-height: 180px; display: grid; place-items: center; padding: 22px; color: #7b7189; font-size: 13px; text-align: center; }
@media (max-width: 1023px) { .appointment-day-layout { grid-template-columns: 1fr; }.appointment-day-detail { min-height: 230px; } }
@media (max-width: 650px) { .appointment-toolbar-actions { flex-wrap: wrap; }.appointment-day-head { flex-wrap: wrap; }.appointment-day-head > span { width: 100%; margin-left: 0; } }
@media (max-width: 760px) {
  .workflow-builder { margin-inline: -14px; }
  :is(#customer360-view,#appointments-view,#zalo-view,#templates-view,#reports-view,#logs-view,#settings-view) > .section-toolbar > div:first-child,
  #campaignLibraryView > .section-toolbar > div:first-child,
  #dataHubOverview > .section-toolbar > div:first-child,
  #dataHubDetail > .section-toolbar > div:first-child,
  #miniapp-view [data-miniapp-area-panel] > .section-toolbar > div:first-child { width: 100%; flex: 0 0 auto; }
}

/* Separate administration workspaces share the same page shell. */
#staff-view > .section-toolbar,
#account-activity-view > .section-toolbar { min-height: 55px; display: flex; align-items: center; margin-bottom: 14px; padding: 0; border: 0; background: transparent; box-shadow: none; }
#staff-view > .section-toolbar h2,
#account-activity-view > .section-toolbar h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#staff-view > .section-toolbar > div:first-child::before,
#account-activity-view > .section-toolbar > div:first-child::before { display: block; margin-bottom: 5px; color: #7052b8; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
#staff-view > .section-toolbar > div:first-child::before { content: "QUẢN TRỊ TÀI KHOẢN"; }
#account-activity-view > .section-toolbar > div:first-child::before { content: "NHẬT KÝ TÀI KHOẢN"; }
#staff-view .settings-access,
#account-activity-view .settings-audit { width: 100%; }
@media (max-width: 760px) {
  #staff-view > .section-toolbar,
  #account-activity-view > .section-toolbar { min-height: 0; padding: 0; }
}

/* Customer 360 keeps its full record modal; the selected real profile is visible beside the list. */
.customer360-workspace:has(.customer360-summary:not([hidden])) { display: grid; grid-template-columns: minmax(0,1fr) 305px; gap: 14px; align-items: start; }
.customer360-summary { min-width: 0; display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.customer360-summary[hidden] { display: none; }
.customer360-summary-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.customer360-summary-head > div { min-width: 0; }
.customer360-summary-head h3 { overflow: hidden; margin: 0 0 3px; color: #2f2547; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.customer360-summary-head small { color: #82788e; font-size: 11px; }
.customer360-summary-loyalty { display: grid; gap: 6px; padding: 18px; border-radius: 12px; color: #fff; background: #7046ed; }
.customer360-summary-loyalty span { font-size: 12px; font-weight: 700; }
.customer360-summary-loyalty strong { font-size: 25px; letter-spacing: -.03em; }
.customer360-summary-loyalty small { color: #eee6ff; font-size: 11px; }
.customer360-summary-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.customer360-summary-flags > span:last-child { padding: 5px 8px; border-radius: 999px; color: #557268; background: #e7f7ee; font-size: 11px; font-weight: 700; }
.customer360-summary dl { display: grid; gap: 9px; margin: 0; }
.customer360-summary dl div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.customer360-summary dt { color: #7f758b; }
.customer360-summary dd { margin: 0; color: #392f4f; font-weight: 750; text-align: right; }
.customer360-summary-activity { padding-top: 10px; border-top: 1px solid var(--line); }
.customer360-summary-activity h4 { margin: 0 0 10px; color: #352a4a; font-size: 13px; }
.customer360-summary-activity p { display: grid; gap: 3px; margin: 0 0 10px; font-size: 12px; }
.customer360-summary-activity small { color: #7b7189; }
.customer360-summary > button { width: 100%; }
@media (max-width: 1250px) { .customer360-workspace:has(.customer360-summary:not([hidden])) { grid-template-columns: 1fr; } }

/* Admin destinations stay compact until the section heading is activated. */
.sidebar .admin-section-toggle {
  width: calc(100% - 20px);
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.sidebar .admin-section-toggle:hover,
.sidebar .admin-section-toggle.group-active { color: #5e3bc6; }
.sidebar .admin-section-toggle .admin-section-icon { display: none; }
.sidebar .admin-section-toggle .admin-section-caret { margin-left: auto; font-size: 18px; font-weight: 600; line-height: 1; transition: transform .18s ease; }
.sidebar .admin-section-toggle[aria-expanded="true"] .admin-section-caret { transform: rotate(90deg); }
.sidebar .admin-nav-group { display: grid; gap: 1px; }
.sidebar .admin-nav-group[hidden],
.sidebar .admin-section-toggle[hidden] { display: none !important; }
body.sidebar-collapsed .sidebar .admin-section-toggle {
  width: 46px;
  height: 40px;
  display: flex;
  justify-content: center;
  margin: 8px 0 0;
  padding: 0;
  border-radius: 9px;
}
body.sidebar-collapsed .sidebar .admin-section-toggle:hover { background: #f0ebff; }
body.sidebar-collapsed .sidebar .admin-section-toggle > span { display: none; }
body.sidebar-collapsed .sidebar .admin-section-toggle .admin-section-icon { width: 20px; height: 20px; display: block; }
@media (max-width: 1023px) {
  body.sidebar-collapsed .sidebar .admin-section-toggle {
    width: calc(100% - 20px);
    height: auto;
    min-height: 28px;
    justify-content: flex-start;
    margin: 13px 10px 5px;
    padding: 3px 0;
    border-radius: 0;
  }
  body.sidebar-collapsed .sidebar .admin-section-toggle > span { display: initial; }
  body.sidebar-collapsed .sidebar .admin-section-toggle .admin-section-icon { display: none; }
}
