@import url('./colors_and_type.css');
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
body { background: var(--pc-bg); color: var(--pc-text); font-family: var(--pc-font-sans); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* Sidebar */
.sb { background: rgba(7,11,24,0.6); border-right: 1px solid var(--pc-border); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.sb-logo { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin-bottom: 18px; }
.sb-logo span { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.sb-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--pc-text-dim); padding: 14px 10px 8px; }
.sb-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--pc-text-muted); font-size: 13.5px; transition: all .15s; cursor: pointer; border: none; background: transparent; text-align: left; width: 100%; }
.sb-item:hover { background: rgba(255,255,255,0.03); color: var(--pc-text); }
.sb-item.active { background: rgba(79,124,255,0.14); color: #7CA3FF; }
.sb-item .badge { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(79,124,255,0.2); color: #7CA3FF; }

/* Topbar */
.tb { height: 64px; border-bottom: 1px solid var(--pc-border); padding: 0 24px; display: flex; align-items: center; gap: 16px; background: rgba(7,11,24,0.4); }
.tb-search { flex: 1; max-width: 480px; display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--pc-bg-card); border: 1px solid var(--pc-border); border-radius: 10px; color: var(--pc-text-dim); }
.tb-search input { flex: 1; background: transparent; border: none; outline: none; color: var(--pc-text); font-family: inherit; font-size: 13px; }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tb-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--pc-bg-card); border: 1px solid var(--pc-border); display: flex; align-items: center; justify-content: center; color: var(--pc-text-muted); }
.tb-avatar { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg,#D92F24,#111111); color: #fff; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }

/* Views */
.view { padding: 28px 32px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; }
.view-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.015em; }
.view-head .sub { font-size: 13.5px; color: var(--pc-text-muted); margin-top: 4px; }

.card { background: var(--pc-bg-card); border: 1px solid var(--pc-border); border-radius: 14px; padding: 20px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi-label { font-size: 12px; color: var(--pc-text-muted); margin-bottom: 8px; }
.kpi-value { font-size: 26px; font-weight: 700; font-family: var(--pc-font-mono); letter-spacing: -0.02em; margin-bottom: 6px; }
.kpi-delta { font-size: 12px; }
.kpi-delta.up { color: #D92F24; }

/* Dashboard premium insight cards */
.dash-insight-card { transition: box-shadow .18s ease, transform .18s ease; }
.dash-insight-card:hover { box-shadow: 0 12px 30px rgba(17,17,17,.09); transform: translateY(-2px); }
.dash-insight-btn { transition: background .15s ease, border-color .15s ease; }
.dash-insight-btn:hover { background: #ECECEC; border-color: #E0E0E0; }

.btn { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; padding: 9px 14px; border-radius: 10px; border: none; color: #fff; }
.btn-primary { background: linear-gradient(135deg,#D92F24,#111111); box-shadow: 0 4px 14px rgba(79,124,255,0.3); }
.btn-secondary { background: transparent; border: 1px solid var(--pc-border); color: var(--pc-text); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 500; }
.pill.success { background: rgba(217,47,36,0.14); color: #D92F24; border: 1px solid rgba(217,47,36,0.3); }
.pill.warn { background: rgba(245,158,11,0.12); color: #FBBF24; border: 1px solid rgba(245,158,11,0.3); }
.pill.dim { background: rgba(255,255,255,0.04); color: var(--pc-text-muted); border: 1px solid var(--pc-border); }

/* dashboard mobile overflow fix */
html,
body,
#root {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.app {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.app-main,
.app > div:not(.sb) {
  min-width: 0;
  width: 100%;
  max-width: 100vw;
}

.card,
.view,
.tb,
.sb {
  max-width: 100%;
}

@media (max-width: 760px) {
  html,
  body,
  #root {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
  }

  .app {
    display: block !important;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
  }

  .sb {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    max-width: 100vw;
    height: auto;
    min-height: 58px;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--pc-border);
    background: rgba(7,11,24,0.96);
    -webkit-overflow-scrolling: touch;
  }

  .sb-logo {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 6px;
    margin: 0 4px 0 0;
  }

  .sb-logo span {
    display: none !important;
  }

  .sb-logo img {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
  }

  .sb > div {
    display: flex !important;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
  }

  .sb > div:last-child,
  .sb-section,
  .sb-item .badge {
    display: none !important;
  }

  .sb-item {
    width: auto;
    flex: 0 0 auto;
    justify-content: center;
    white-space: nowrap;
    padding: 9px 10px;
    font-size: 12.5px;
  }

  .sb-item svg {
    flex: 0 0 auto;
  }

  .tb {
    width: 100%;
    max-width: 100vw;
    height: auto;
    min-height: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
    overflow-x: hidden;
  }

  .tb > div:first-child,
  .tb-workspace {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
  }

  .tb-search {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .tb-search input {
    min-width: 0;
    width: 100%;
  }

  .tb-actions {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .tb-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .tb-actions .tb-icon,
  .tb-actions .tb-avatar {
    display: none;
  }

  .view {
    width: 100%;
    max-width: 100vw;
    padding: 20px 14px;
    overflow-x: hidden;
  }

  .view-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
  }

  .view-head h1 {
    font-size: 22px;
  }

  .view-actions,
  .view-head > div:last-child {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 8px !important;
  }

  .view-actions .btn,
  .view-head > div:last-child .btn,
  .view-head > .btn {
    width: 100%;
    justify-content: center;
  }

  .kpi-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px;
    width: 100%;
    max-width: 100%;
  }

  .dashboard-grid,
  .training-grid,
  .widget-editor-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100%;
    max-width: 100%;
    gap: 14px !important;
  }

  .card {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    overflow: hidden;
  }

  .conversation-view {
    width: 100%;
    max-width: 100vw;
    height: auto !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    overflow-x: hidden;
  }

  .conversation-list {
    max-height: 340px;
    border-right: 0 !important;
    border-bottom: 1px solid var(--pc-border);
  }

  .conversation-chat {
    min-height: 560px;
  }

  .conversation-chat-head {
    display: grid !important;
    grid-template-columns: auto 1fr;
    gap: 10px !important;
    padding: 14px !important;
  }

  .conversation-chat-head .btn {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
  }

  .visitor-panel {
    display: none !important;
  }

  .app-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
  }

  .app-table-scroll table {
    min-width: 760px;
  }

  .widget-preview-stage {
    min-height: 360px !important;
    padding: 16px !important;
  }

  .widget-preview-card {
    position: relative !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: 320px;
    margin: 64px auto 0;
  }
}

@media (max-width: 380px) {
  .sb {
    padding-left: 8px;
    padding-right: 8px;
  }

  .sb-item {
    font-size: 0;
    width: 42px;
    height: 40px;
    padding: 0;
  }

  .sb-item svg {
    width: 17px;
    height: 17px;
  }

  .view {
    padding-left: 12px;
    padding-right: 12px;
  }

  .tb {
    padding-left: 12px;
    padding-right: 12px;
  }

  .kpi-value {
    font-size: 24px;
  }
}

.embedded-app-view {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.embedded-app-view .pc-section {
  padding-left: 28px;
  padding-right: 28px;
}

.embedded-app-view .pc-container {
  max-width: 1180px;
}

@media (max-width: 760px) {
  .embedded-app-view .pc-section {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
}

.sb-logo {
  color: var(--pc-text);
  text-decoration: none;
}

.sb-logo:hover {
  color: var(--pc-text);
}

.app-workspace-menu {
  position: relative;
  flex: 0 0 auto;
}

.app-workspace-button {
  min-width: 170px;
  justify-content: space-between;
  border: 0;
  background: transparent;
  color: var(--pc-text);
  padding: 8px 10px;
  border-radius: 10px;
}

.app-workspace-button:hover {
  background: rgba(255, 255, 255, 0.04);
}

.app-workspace-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-workspace-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  width: 280px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: #0B1220;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  z-index: 120;
}

.app-workspace-label {
  padding: 7px 9px 9px;
  color: var(--pc-text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.app-workspace-list {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--pc-border);
}

.app-workspace-option,
.app-workspace-actions button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--pc-text-muted);
  text-align: left;
  font-size: 13px;
  padding: 9px 10px;
  border-radius: 10px;
}

.app-workspace-option:hover,
.app-workspace-actions button:hover:not(:disabled) {
  color: var(--pc-text);
  background: rgba(255, 255, 255, 0.06);
}

.app-workspace-option.is-active {
  color: #7CA3FF;
  background: rgba(79, 124, 255, 0.12);
}

.app-workspace-actions {
  display: grid;
  gap: 3px;
  padding-top: 8px;
}

.app-workspace-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-workspace-actions .is-danger {
  color: #FCA5A5;
}

.app-workspace-error {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 10px;
  color: #FBBF24;
  background: rgba(251, 191, 36, 0.08);
  font-size: 12.5px;
}

.app-profile-menu {
  position: relative;
}

.app-profile-button {
  border: 0;
  cursor: pointer;
}

.app-profile-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 240px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: #0B1220;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: hidden;
  z-index: 100;
}

.app-profile-user {
  padding: 10px;
  border-bottom: 1px solid var(--pc-border);
  margin-bottom: 6px;
}

.app-profile-user strong {
  display: block;
  font-size: 13px;
  color: var(--pc-text);
  margin-bottom: 4px;
}

.app-profile-user span {
  display: block;
  font-size: 12px;
  color: var(--pc-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-profile-link,
.app-profile-signout {
  width: 100%;
  display: block;
  border: 0;
  background: transparent;
  color: var(--pc-text-muted);
  text-align: left;
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.app-profile-link:hover,
.app-profile-signout:hover {
  color: var(--pc-text);
  background: rgba(255, 255, 255, 0.06);
}

.app-profile-signout {
  color: #FCA5A5;
}

/* App builder shared pages */
.app-builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.app-builder-two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-builder-stack {
  display: grid;
  gap: 18px;
}

.app-save-notice,
.app-page-feedback {
  margin-bottom: 18px;
}

.app-save-notice {
  padding: 14px 16px;
  border: 1px solid rgba(217, 47, 36, 0.28);
  border-radius: 14px;
  background: rgba(217, 47, 36, 0.09);
  color: var(--pc-text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.app-save-notice a {
  color: #67E8F9;
  font-weight: 700;
  text-decoration: none;
}

.app-save-notice a:hover {
  color: var(--pc-text);
}

.app-builder-preview {
  position: sticky;
  top: 86px;
  min-height: 560px;
  background: rgba(7, 11, 24, 0.6);
  border: 1px solid var(--pc-border);
  border-radius: 18px;
  padding: 24px;
  overflow: hidden;
}

.app-builder-preview-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.5;
}

.app-builder-widget-card {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 340px;
  background: var(--pc-bg-card);
  border: 1px solid var(--pc-border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(2, 6, 23, 0.7), 0 0 0 1px rgba(79, 124, 255, 0.2);
}

.app-builder-widget-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  color: #fff;
}

.app-builder-widget-avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

.app-builder-widget-title {
  font-size: 13px;
  font-weight: 700;
}

.app-builder-widget-status {
  margin-top: 3px;
  font-size: 11px;
  opacity: 0.88;
}

.app-builder-widget-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.app-builder-widget-bubble {
  padding: 10px 13px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--pc-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  font-size: 12.5px;
  line-height: 1.55;
}

.app-builder-widget-starters {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-self: end;
  gap: 8px;
  max-width: 86%;
}

.app-builder-widget-starters button {
  border: 1px solid rgba(79, 124, 255, 0.34);
  border-radius: 15px 15px 4px 15px;
  background: rgba(79, 124, 255, 0.12);
  color: #DBEAFE;
  padding: 7px 10px;
  font-size: 11.5px;
  line-height: 1.35;
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.18);
}

.app-builder-widget-input {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-top: 1px solid var(--pc-border);
}

.app-builder-widget-input span {
  flex: 1;
  color: var(--pc-text-dim);
  font-size: 12px;
  padding: 0 8px;
}

.app-builder-widget-input div {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.embedded-template-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.7fr);
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
}

.embedded-summary-grid,
.app-template-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.embedded-summary-item,
.app-template-overview > div {
  padding: 12px;
  border: 1px solid var(--pc-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.embedded-summary-item span,
.app-template-overview span {
  display: block;
  margin-bottom: 6px;
  color: var(--pc-text-muted);
  font-size: 11px;
}

.embedded-summary-item strong,
.app-template-overview strong {
  display: block;
  color: var(--pc-text);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.app-empty-state {
  display: grid;
  gap: 14px;
  place-items: center;
  text-align: center;
  padding: 44px 24px;
  color: var(--pc-text-muted);
}

.app-empty-state h2 {
  color: var(--pc-text);
  font-size: 22px;
}

.app-empty-state p {
  max-width: 520px;
  line-height: 1.65;
}

.app-empty-icon,
.app-template-create span {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.18), rgba(34, 211, 238, 0.18));
  border: 1px solid rgba(79, 124, 255, 0.35);
  color: #7CA3FF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-empty-actions,
.app-template-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.app-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.app-template-create {
  min-height: 280px;
  display: grid;
  gap: 12px;
  place-items: center;
  text-align: center;
  color: var(--pc-text-muted);
  border-style: dashed;
}

.app-template-create strong {
  color: var(--pc-text);
  font-size: 17px;
}

.app-template-create small {
  max-width: 300px;
  font-size: 13px;
  line-height: 1.55;
}

.app-template-card {
  display: grid;
  gap: 16px;
}

.app-template-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.app-template-head h2 {
  margin-bottom: 6px;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.app-template-head span:not(.pill) {
  color: var(--pc-text-muted);
  font-size: 12px;
  font-family: var(--pc-font-mono);
}

.app-template-code pre {
  min-width: 100%;
  max-height: 170px;
  overflow: auto;
}

.app-danger-button {
  color: #FCA5A5;
}

.app-danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

@media (max-width: 1100px) {
  .app-builder-grid,
  .app-builder-two-col,
  .app-template-grid,
  .embedded-template-name-row {
    grid-template-columns: 1fr;
  }

  .app-builder-preview {
    position: relative;
    top: auto;
    min-height: 420px;
  }

  .app-builder-widget-card {
    position: relative;
    right: auto;
    bottom: auto;
    width: min(340px, 100%);
    margin: 72px auto 0;
  }
}

@media (max-width: 640px) {
  .embedded-summary-grid,
  .app-template-overview {
    grid-template-columns: 1fr;
  }

  .app-template-head,
  .app-template-actions,
  .app-empty-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .app-template-actions .btn,
  .app-empty-actions .btn {
    justify-content: center;
  }
}

.domain-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.domain-item {
  align-items: center;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
}

.domain-item span {
  color: var(--text);
  font-weight: 700;
  word-break: break-word;
}

.domain-item div {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.domain-item button {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
}

.domain-item button:last-child {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(248, 113, 113, 0.3);
}

.domain-empty {
  background: rgba(15, 23, 42, 0.4);
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  padding: 12px;
}

.domain-add-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.domain-add-row .btn {
  min-height: 46px;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .domain-add-row {
    grid-template-columns: 1fr;
  }

  .domain-item {
    align-items: flex-start;
    flex-direction: column;
  }
}

.domain-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 12px;
  color: #fca5a5;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
}


.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field span {
  color: var(--pc-text-muted);
  font-size: 12.5px;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--pc-border);
  border-radius: 11px;
  background: rgba(15,23,42,0.72);
  color: var(--pc-text);
  font: inherit;
  padding: 11px 12px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(79,124,255,0.68);
  box-shadow: 0 0 0 3px rgba(79,124,255,0.14);
}

.user-workspace-list {
  display: grid;
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.user-workspace-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--pc-border);
  border-radius: 10px;
  color: var(--pc-text-muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.grid.two {
  display: grid;
  grid-template-columns: minmax(320px, 0.75fr) minmax(0, 1.25fr);
  gap: 16px;
}

@media (max-width: 1100px) {
  .grid.two {
    grid-template-columns: 1fr;
  }
}

.users-page {
  padding-bottom: 64px;
}

.users-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(620px, 1.5fr);
  gap: 18px;
  align-items: start;
}

.users-form-card,
.users-table-card {
  border-color: rgba(148, 163, 184, 0.16);
}

.users-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.users-card-head h2,
.users-modal h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.users-card-head p,
.users-modal-head p,
.workspace-picker p {
  margin: 6px 0 0;
  color: var(--pc-text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.users-full-field {
  display: block;
  margin-top: 14px;
}

.users-full-field small {
  display: block;
  margin-top: 6px;
  color: var(--pc-text-muted);
  font-size: 12px;
}

.workspace-picker {
  margin-top: 18px;
  border: 1px solid var(--pc-border);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.22);
  padding: 14px;
}

.workspace-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--pc-text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-picker-head span {
  color: var(--pc-text-muted);
  font-weight: 700;
}

.workspace-option-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.workspace-option {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.38);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}

.workspace-option:hover {
  border-color: rgba(56, 189, 248, 0.38);
}

.workspace-option input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
}

.workspace-option-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.workspace-option-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--pc-text);
}

.workspace-option-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--pc-text-muted);
  font-size: 12px;
}

.workspace-option-meta small {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--pc-text);
  background: rgba(15, 23, 42, 0.6);
}

.workspace-empty {
  color: var(--pc-text-muted);
  font-size: 13px;
  padding: 10px 2px;
}

.users-actions-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 18px;
}

.users-alert {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

.users-alert.error {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(127, 29, 29, 0.18);
}

.users-alert.success {
  color: #bbf7d0;
  border-color: rgba(217, 47, 36, 0.24);
  background: rgba(20, 83, 45, 0.16);
}

.users-table-wrap {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.users-table th {
  text-align: left;
  padding: 13px 16px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--pc-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(15, 23, 42, 0.5);
  border-bottom: 1px solid var(--pc-border);
}

.users-table td {
  padding: 15px 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--pc-border);
}

.users-name {
  font-size: 13.5px;
  font-weight: 750;
  color: var(--pc-text);
}

.users-email {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--pc-text-muted);
}

.role-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 750;
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--pc-text);
  background: rgba(15, 23, 42, 0.66);
}

.role-pill.owner {
  border-color: rgba(56, 189, 248, 0.32);
  color: #bae6fd;
}

.role-pill.admin {
  border-color: rgba(167, 139, 250, 0.32);
  color: #ddd6fe;
}

.role-pill.user {
  border-color: rgba(148, 163, 184, 0.22);
  color: #dbeafe;
}

.workspace-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 460px;
}

.workspace-chip {
  display: inline-grid;
  gap: 3px;
  border: 1px solid rgba(148, 163, 184, 0.17);
  border-radius: 12px;
  padding: 7px 10px;
  background: rgba(15, 23, 42, 0.42);
  color: var(--pc-text);
  font-size: 12.5px;
  font-weight: 700;
}

.workspace-chip small {
  color: var(--pc-text-muted);
  font-size: 11px;
  font-weight: 600;
}

.workspace-chip.muted {
  color: var(--pc-text-muted);
}

.users-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn.danger {
  border-color: rgba(248, 113, 113, 0.24);
  color: #fecaca;
}

.btn.danger:hover {
  border-color: rgba(248, 113, 113, 0.42);
}

.users-empty {
  padding: 22px 18px;
  color: var(--pc-text-muted);
  font-size: 13px;
}

.users-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(10px);
}

.users-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  background: #111827;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
  padding: 22px;
}

.users-modal.small {
  width: min(460px, 100%);
}

.users-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--pc-border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.52);
  color: var(--pc-text);
  font-size: 22px;
  cursor: pointer;
}

.users-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.users-delete-copy {
  color: var(--pc-text-muted);
  font-size: 13.5px;
  line-height: 1.55;
}

@media (max-width: 1120px) {
  .users-layout {
    grid-template-columns: 1fr;
  }
}

.users-self-note {
  margin-top: 18px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 14px;
  background: rgba(14, 165, 233, 0.08);
  color: #bae6fd;
  padding: 13px 14px;
  font-size: 13px;
  line-height: 1.5;
}

.app-workspace-default {
  margin-left: auto;
  margin-right: 6px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 999px;
  padding: 1px 7px;
  color: #bae6fd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(14, 165, 233, 0.08);
}

.users-row-actions .btn:disabled,
.users-modal-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.users-row-actions .btn.danger:disabled {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.38);
}

/* Live chat inbox */
.live-inbox-shell{height:100%;min-height:620px;display:grid;grid-template-columns:320px minmax(420px,1fr) 290px;background:var(--bg,#070b16);color:var(--text,#e7eefc);border-top:1px solid rgba(148,163,184,.18)}
.live-inbox-list,.live-inbox-thread,.live-inbox-details{min-width:0;background:rgba(5,10,23,.72)}
.live-inbox-list{border-right:1px solid rgba(148,163,184,.18);display:flex;flex-direction:column}
.live-inbox-thread{border-right:1px solid rgba(148,163,184,.18);display:flex;flex-direction:column}
.live-inbox-details{padding:18px;overflow:auto}
.live-inbox-title,.live-thread-header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px;border-bottom:1px solid rgba(148,163,184,.18)}
.live-inbox-title h2{font-size:16px;margin:0 0 3px}.live-inbox-title p,.live-thread-header span{display:block;margin:0;color:#8fa0bd;font-size:12px}
.icon-button{width:32px;height:32px;border:1px solid rgba(148,163,184,.2);border-radius:9px;background:#0e1728;color:#cbd5e1;cursor:pointer}
.live-inbox-counts{display:flex;gap:7px;padding:12px 14px 4px;overflow:auto}
.live-inbox-counts button{white-space:nowrap;border:1px solid rgba(148,163,184,.18);border-radius:999px;background:transparent;color:#8fa0bd;padding:6px 10px;font-size:11px;cursor:pointer}
.live-inbox-counts button.is-active{background:rgba(79,124,255,.16);border-color:rgba(79,124,255,.55);color:#dbe7ff}
.live-inbox-filters{display:grid;gap:8px;padding:10px 14px 12px}
.live-inbox-filters input,.live-inbox-filters select,.live-detail-section select{width:100%;box-sizing:border-box;border:1px solid rgba(148,163,184,.18);border-radius:9px;background:#0d1627;color:#dbe7ff;padding:9px 10px;font-size:12px;outline:none}
.live-inbox-items{overflow:auto;flex:1}.live-inbox-empty,.live-inbox-placeholder{color:#8fa0bd;text-align:center;padding:40px 22px;font-size:13px}.live-inbox-error{margin:8px 14px;padding:9px 10px;border:1px solid rgba(248,113,113,.35);border-radius:9px;background:rgba(127,29,29,.22);color:#fecaca;font-size:12px}
.live-inbox-item{width:100%;display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:10px;align-items:start;padding:14px;border:0;border-bottom:1px solid rgba(148,163,184,.13);background:transparent;color:inherit;text-align:left;cursor:pointer}
.live-inbox-item:hover,.live-inbox-item.is-active{background:rgba(40,61,105,.28)}.live-inbox-item.is-active{box-shadow:inset 3px 0 0 #d92f24}
.live-inbox-avatar{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:linear-gradient(135deg,#d92f24,#111111);color:#fff;font-weight:700}
.live-inbox-item-copy{min-width:0}.live-inbox-item-copy strong,.live-inbox-item-copy small,.live-inbox-item-copy em{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.live-inbox-item-copy strong{font-size:12px;margin-bottom:5px}.live-inbox-item-copy small{color:#9db0cf;font-size:11px}.live-inbox-item-copy em{font-style:normal;color:#D92F24;font-size:10px;margin-top:7px}.live-inbox-item-meta{text-align:right;color:#7f91ad;font-size:10px}.live-inbox-item-meta b{display:block;width:18px;height:18px;line-height:18px;margin:8px 0 0 auto;border-radius:999px;background:#d92f24;color:white;text-align:center}
.live-thread-header strong{display:block;font-size:14px;margin-bottom:4px}.live-thread-actions{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}.live-thread-actions button,.live-detail-heading button{border:1px solid rgba(148,163,184,.2);border-radius:8px;background:#0e1728;color:#dbe7ff;padding:7px 10px;font-size:11px;cursor:pointer}.live-thread-actions button:disabled,.live-detail-heading button:disabled{opacity:.5;cursor:not-allowed}
.live-thread-messages{flex:1;overflow:auto;padding:22px 24px}.live-thread-message{display:flex;margin:0 0 14px}.live-thread-message>div{max-width:72%;padding:10px 12px;border:1px solid rgba(148,163,184,.14);border-radius:11px;background:#111c30}.live-thread-message.is-visitor{justify-content:flex-end}.live-thread-message.is-visitor>div{background:linear-gradient(135deg,#d92f24,#22b8d6);color:white;border:0}.live-thread-message.is-agent>div{background:#183252;border-color:#2d5d8f}.live-thread-message.is-system>div{background:rgba(22,101,52,.16);border-color:rgba(217,47,36,.25);color:#D92F24}.live-thread-message span{display:block;white-space:pre-wrap;font-size:13px;line-height:1.45}.live-thread-message time{display:block;margin-top:6px;opacity:.64;font-size:9px}
.live-thread-reply{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px;padding:12px;border-top:1px solid rgba(148,163,184,.18)}.live-thread-reply input{border:1px solid rgba(148,163,184,.18);border-radius:9px;background:#0d1627;color:#dbe7ff;padding:10px 12px;outline:none}.live-thread-reply button{display:flex;align-items:center;gap:7px;border:0;border-radius:9px;background:linear-gradient(135deg,#d92f24,#22b8d6);color:#fff;padding:0 15px;font-weight:700;cursor:pointer}.live-thread-reply button:disabled{opacity:.5;cursor:not-allowed}
.live-detail-section{padding:0 0 17px;margin:0 0 17px;border-bottom:1px solid rgba(148,163,184,.16)}.live-detail-section h3{margin:7px 0 8px;font-size:15px}.live-detail-section p{margin:4px 0;color:#9db0cf;font-size:12px;line-height:1.45}.live-detail-label{display:block;color:#71839f;font-size:10px;letter-spacing:.08em;text-transform:uppercase}.live-detail-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}.live-detail-heading .live-detail-label{margin:0}.live-detail-break{overflow-wrap:anywhere}.live-summary{margin-top:10px;padding:11px;border:1px solid rgba(148,163,184,.15);border-radius:9px;background:#0d1627;color:#cbd8ee;font-size:11px;line-height:1.55;white-space:pre-wrap}.live-status{display:inline-flex;margin-top:8px;border-radius:999px;padding:5px 9px;background:rgba(79,124,255,.15);color:#bcd0ff;font-size:11px}.live-status.is-needs_human,.live-status.is-assigned{background:rgba(245,158,11,.15);color:#fcd34d}.live-status.is-closed{background:rgba(100,116,139,.2);color:#cbd5e1}
@media(max-width:1180px){.live-inbox-shell{grid-template-columns:280px minmax(400px,1fr)}.live-inbox-details{display:none}}
@media(max-width:780px){.live-inbox-shell{display:block;min-height:0}.live-inbox-list{height:290px;border-right:0;border-bottom:1px solid rgba(148,163,184,.18)}.live-inbox-thread{height:calc(100vh - 420px);min-height:420px;border-right:0}}

/* Live chat settings */
.live-settings-grid{display:grid;grid-template-columns:minmax(0,1.4fr) repeat(2,minmax(130px,.6fr));gap:12px}
.live-settings-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px}
.live-settings-options.is-two-column{grid-template-columns:repeat(2,minmax(0,1fr))}
.live-settings-options label{display:flex;align-items:flex-start;gap:8px;padding:9px 10px;border:1px solid var(--pc-border);border-radius:10px;color:var(--pc-text);font-size:12px;line-height:1.35}
.live-settings-options input{margin-top:2px}
.live-agent-list{display:grid;gap:8px}.live-agent-row{display:grid;grid-template-columns:minmax(150px,1fr) minmax(130px,.8fr) auto;gap:10px;align-items:center;padding:10px;border:1px solid var(--pc-border);border-radius:12px}.live-agent-row strong,.live-agent-row small{display:block}.live-agent-row strong{font-size:12px}.live-agent-row small{margin-top:3px;color:var(--pc-text-muted);font-size:10px}.live-agent-row label{display:flex;align-items:center;gap:7px;font-size:11px;white-space:nowrap}
@media(max-width:900px){.live-settings-grid,.live-settings-options.is-two-column,.live-agent-row{grid-template-columns:1fr}}

/* Dashboard notifications */
.app-notification-menu{position:relative}.app-notification-button{position:relative;border:1px solid var(--pc-border);cursor:pointer}.app-notification-button>span{position:absolute;right:-5px;top:-6px;min-width:17px;height:17px;padding:0 4px;box-sizing:border-box;border-radius:999px;background:#ef4444;color:#fff;font-size:9px;font-weight:800;line-height:17px;text-align:center}
.app-notification-dropdown{position:absolute;right:0;top:44px;z-index:30;width:340px;max-height:470px;overflow:hidden;border:1px solid var(--pc-border);border-radius:16px;background:#0b1220;box-shadow:0 24px 70px rgba(2,6,23,.48)}.app-notification-head{display:flex;align-items:center;justify-content:space-between;padding:13px 14px;border-bottom:1px solid var(--pc-border)}.app-notification-head strong{font-size:13px}.app-notification-head button,.app-notification-enable{border:0;background:transparent;color:#8fb1ff;font-size:10px;cursor:pointer}.app-notification-enable{width:100%;padding:9px 14px;border-bottom:1px solid var(--pc-border);text-align:left;background:rgba(79,124,255,.08)}.app-notification-list{max-height:390px;overflow:auto}.app-notification-item{display:block;width:100%;padding:12px 14px;border:0;border-bottom:1px solid rgba(148,163,184,.12);background:transparent;color:var(--pc-text);text-align:left;cursor:pointer}.app-notification-item:hover{background:rgba(51,65,85,.32)}.app-notification-item.is-unread{background:rgba(79,124,255,.1);box-shadow:inset 3px 0 0 #d92f24}.app-notification-item strong,.app-notification-item span,.app-notification-item time{display:block}.app-notification-item strong{font-size:12px;margin-bottom:4px}.app-notification-item span{color:var(--pc-text-muted);font-size:11px;line-height:1.4}.app-notification-item time{margin-top:6px;color:#66768e;font-size:9px}.app-notification-empty{padding:30px 16px;color:var(--pc-text-muted);font-size:12px;text-align:center}
@media(max-width:600px){.app-notification-dropdown{position:fixed;right:12px;left:12px;top:70px;width:auto}}


/* Human support inbox viewport */
.app.is-conversations-layout{height:100vh;min-height:0;overflow:hidden}
.app.is-conversations-layout .app-main{height:100vh;min-height:0;overflow:hidden}
.app-content.is-conversations-view{height:calc(100vh - 64px);min-height:0;overflow:hidden!important}
.app-content.is-conversations-view > div:not(.subscription-lock-overlay){height:100%;min-height:0}
.app-content.is-conversations-view .live-inbox-shell{height:100%;min-height:0;overflow:hidden;grid-template-rows:minmax(0,1fr)}
.app-content.is-conversations-view .live-inbox-list,
.app-content.is-conversations-view .live-inbox-thread,
.app-content.is-conversations-view .live-inbox-details{min-height:0}
.live-inbox-list,.live-inbox-thread,.live-inbox-details{min-height:0;overflow:hidden}
.live-inbox-items,.live-thread-messages,.live-inbox-details{overscroll-behavior:contain;scrollbar-gutter:stable}
.live-inbox-details{overflow-y:auto}
.live-thread-header,.live-thread-reply{flex:0 0 auto}
.live-thread-messages{min-height:0;overflow-y:auto}
.live-inbox-items{min-height:0;overflow-y:auto}
.live-thread-actions button.is-danger{border-color:rgba(248,113,113,.4);background:rgba(127,29,29,.22);color:#fecaca}
.live-inbox-load-more{width:calc(100% - 24px);margin:12px;border:1px solid rgba(148,163,184,.2);border-radius:9px;background:#0e1728;color:#cbd5e1;padding:9px 12px;font-size:11px}
.live-inbox-load-more:disabled{opacity:.55;cursor:not-allowed}

@media(max-width:780px){
  .app-content.is-conversations-view{height:calc(100vh - 64px)}
  .app-content.is-conversations-view .live-inbox-shell{display:grid;grid-template-rows:280px minmax(0,1fr)}
  .app-content.is-conversations-view .live-inbox-list{height:auto;min-height:0}
  .app-content.is-conversations-view .live-inbox-thread{height:auto;min-height:0}
}

/* Live typing indicators */
.live-thread-typing{display:flex;align-items:center;gap:8px;width:max-content;max-width:72%;margin:0 0 14px;padding:9px 12px;border:1px solid rgba(148,163,184,.14);border-radius:11px;background:#111c30;color:#9fb2cc;font-size:11px}
.live-thread-typing-dots{display:inline-flex;align-items:center;gap:4px}
.live-thread-typing-dots i{width:6px;height:6px;border-radius:999px;background:#9fb2cc;opacity:.35;animation:live-thread-typing-bounce 1s ease-in-out infinite}
.live-thread-typing-dots i:nth-child(2){animation-delay:.14s}
.live-thread-typing-dots i:nth-child(3){animation-delay:.28s}
@keyframes live-thread-typing-bounce{0%,80%,100%{opacity:.35;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}
