:root {
  --product-canvas: #f3f5f7;
  --product-surface: #ffffff;
  --product-surface-soft: #f8fafb;
  --product-ink: #18202b;
  --product-muted: #687383;
  --product-line: #dde2e8;
  --product-line-strong: #c8d0d9;
  --product-nav: #161f2e;
  --product-nav-hover: #222e40;
  --product-accent: #9a7540;
  --product-accent-soft: #f4ede2;
  --product-positive: #13705b;
  --product-positive-soft: #e8f4f0;
  --product-alert: #ae433f;
  --product-shadow: 0 10px 28px rgba(20, 30, 43, 0.07);
}

body.formal-ui-refresh {
  background: var(--product-canvas);
  color: var(--product-ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}

body.formal-ui-refresh button,
body.formal-ui-refresh a,
body.formal-ui-refresh input,
body.formal-ui-refresh select,
body.formal-ui-refresh textarea {
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

body.formal-ui-refresh button:not(:disabled):active {
  transform: translateY(1px);
}

body.formal-ui-refresh input,
body.formal-ui-refresh select,
body.formal-ui-refresh textarea {
  border-color: var(--product-line);
  background: #fff;
}

body.formal-ui-refresh input:hover,
body.formal-ui-refresh select:hover,
body.formal-ui-refresh textarea:hover {
  border-color: var(--product-line-strong);
}

body.formal-ui-refresh input:focus,
body.formal-ui-refresh select:focus,
body.formal-ui-refresh textarea:focus {
  border-color: #55708f;
  box-shadow: 0 0 0 3px rgba(49, 94, 140, 0.12);
}

body.formal-ui-refresh ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body.formal-ui-refresh ::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: #aeb7c3;
  background-clip: padding-box;
}

body.formal-ui-refresh ::-webkit-scrollbar-track {
  background: transparent;
}

/* Headquarters */
body.formal-ui-refresh .app-shell {
  grid-template-columns: 244px minmax(0, 1fr);
}

body.formal-ui-refresh .sidebar {
  padding: 20px 14px 14px;
  background: var(--product-nav);
}

body.formal-ui-refresh .brand {
  min-height: 58px;
  gap: 11px;
  padding: 0 8px 18px;
}

body.formal-ui-refresh .brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #f3e5ca;
  font-size: 12px;
}

body.formal-ui-refresh .nav-item,
body.formal-ui-refresh .utility-button {
  position: relative;
  min-height: 44px;
  border-radius: 6px;
}

body.formal-ui-refresh .nav-item .nav-icon,
body.formal-ui-refresh .utility-button .nav-icon {
  width: 24px;
  color: #9ba8b7;
  font-size: 12px;
  text-align: center;
}

body.formal-ui-refresh .nav-item.is-active::before,
body.formal-ui-refresh .utility-button.is-active::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--product-accent);
  content: "";
}

body.formal-ui-refresh .nav-item.is-active,
body.formal-ui-refresh .utility-button.is-active {
  background: #f7f3eb;
  color: #1b2533;
}

body.formal-ui-refresh .topbar {
  min-height: 64px;
  padding: 10px 26px;
  background: rgba(255, 255, 255, 0.97);
}

body.formal-ui-refresh .workspace-tabs {
  min-height: 48px;
  padding: 7px 26px;
}

body.formal-ui-refresh .content-shell {
  padding: 22px 26px 28px;
}

body.formal-ui-refresh .metric-card,
body.formal-ui-refresh .store-metrics > *,
body.formal-ui-refresh .beauty-os-metric,
body.formal-ui-refresh .management-card,
body.formal-ui-refresh .customer-card,
body.formal-ui-refresh .panel,
body.formal-ui-refresh .agent-panel {
  border-color: var(--product-line);
  border-radius: 7px;
  background: var(--product-surface);
  box-shadow: none;
}

body.formal-ui-refresh .metric-card:hover,
body.formal-ui-refresh .management-card:hover,
body.formal-ui-refresh .customer-card:hover {
  border-color: #c1cad4;
  box-shadow: var(--product-shadow);
}

body.formal-ui-refresh table thead,
body.formal-ui-refresh .management-table-head {
  background: #f5f7f9;
  color: #526071;
}

body.formal-ui-refresh table tbody tr:hover,
body.formal-ui-refresh .management-table-row:hover {
  background: #fafbfd;
}

/* Store workstation */
body.formal-ui-refresh .teacher-app {
  background: var(--product-canvas);
}

body.formal-ui-refresh .teacher-inbox-page {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  padding: 22px 26px 26px;
}

body.formal-ui-refresh .teacher-head {
  min-height: 78px;
  padding: 0 0 16px;
  color: var(--product-ink);
}

body.formal-ui-refresh .teacher-head h1 {
  color: var(--product-ink);
  font-size: 28px;
}

body.formal-ui-refresh .teacher-head span {
  color: var(--product-muted);
}

body.formal-ui-refresh .teacher-head button,
body.formal-ui-refresh .head-button-stack button:last-child {
  min-height: 38px;
  border: 1px solid var(--product-line);
  border-radius: 6px;
  color: var(--product-ink);
  background: #fff;
  box-shadow: none;
}

body.formal-ui-refresh .teacher-head button:first-child {
  border-color: var(--product-nav);
  color: #fff;
  background: var(--product-nav);
}

body.formal-ui-refresh .teacher-mode-tabs {
  gap: 3px;
  margin: 0 0 14px;
  padding: 4px;
  border-color: var(--product-line);
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}

body.formal-ui-refresh .teacher-mode-tabs button {
  border: 0;
  border-radius: 5px;
  color: var(--product-muted);
  background: transparent;
}

body.formal-ui-refresh .teacher-mode-tabs button.is-active {
  color: #fff;
  background: var(--product-nav);
  box-shadow: none;
}

body.formal-ui-refresh .teacher-metrics {
  gap: 0;
  border: 1px solid var(--product-line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

body.formal-ui-refresh .teacher-metrics div {
  min-height: 74px;
  border: 0;
  border-right: 1px solid var(--product-line);
  border-radius: 0;
  box-shadow: none;
}

body.formal-ui-refresh .teacher-metrics div:last-child {
  border-right: 0;
}

body.formal-ui-refresh .teacher-inbox-layout {
  gap: 12px;
}

body.formal-ui-refresh .teacher-customer-list,
body.formal-ui-refresh .teacher-conversation-panel,
body.formal-ui-refresh .teacher-customer-insight {
  border-color: var(--product-line);
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}

body.formal-ui-refresh .teacher-chat div {
  border-color: var(--product-line);
  background: #fff;
  box-shadow: none;
}

/* Agent workspace */
body.formal-ui-refresh .agent-shell {
  grid-template-columns: 232px minmax(0, 1fr);
  background: var(--product-canvas);
}

body.formal-ui-refresh .agent-sidebar {
  padding: 24px 16px 16px;
  background: var(--product-nav);
}

body.formal-ui-refresh .agent-sidebar strong {
  font-size: 20px;
}

body.formal-ui-refresh .agent-tabs {
  gap: 4px;
}

body.formal-ui-refresh .agent-tabs button {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 6px;
  color: #c9d2dd;
}

body.formal-ui-refresh .agent-tabs button:hover {
  background: var(--product-nav-hover);
  color: #fff;
}

body.formal-ui-refresh .agent-tabs button.is-active {
  color: #172033;
  background: #f4ead8;
}

body.formal-ui-refresh .agent-main {
  padding: 24px 28px 30px;
}

body.formal-ui-refresh .agent-head {
  align-items: center;
  padding: 0 0 22px;
  border: 0;
  border-bottom: 1px solid var(--product-line);
  background: transparent;
}

body.formal-ui-refresh .agent-head h1 {
  font-size: 28px;
}

body.formal-ui-refresh .agent-kpis {
  grid-template-columns: repeat(4, minmax(86px, 104px));
}

body.formal-ui-refresh .agent-kpis div {
  min-height: 74px;
  border-color: var(--product-line);
  border-radius: 7px;
}

body.formal-ui-refresh .agent-kpis b {
  color: var(--product-ink);
}

body.formal-ui-refresh .agent-overview-hero {
  padding-top: 24px;
}

body.formal-ui-refresh .agent-overview-metrics {
  gap: 10px;
}

body.formal-ui-refresh .agent-overview-metrics > div,
body.formal-ui-refresh .agent-panel,
body.formal-ui-refresh .agent-card {
  border-color: var(--product-line);
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}

body.formal-ui-refresh .agent-health-list > div {
  border-color: var(--product-line);
  background: #f9fafb;
}

/* Customer: mobile-first conversation surface */
body.formal-ui-refresh .customer-app {
  background: #e9edf1;
}

body.formal-ui-refresh .customer-shell {
  border-color: #d9dfe5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 52px rgba(21, 31, 44, 0.15);
}

body.formal-ui-refresh .customer-chat-head,
body.formal-ui-refresh .simple-entry-head {
  min-height: 72px;
  border-bottom: 1px solid var(--product-line);
  color: var(--product-ink);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: none;
  backdrop-filter: blur(14px);
}

body.formal-ui-refresh .customer-chat-head h1,
body.formal-ui-refresh .simple-entry-head h1 {
  color: var(--product-ink);
}

body.formal-ui-refresh .customer-chat-head span,
body.formal-ui-refresh .simple-entry-head span {
  color: var(--product-muted);
}

body.formal-ui-refresh .customer-head-actions button {
  min-height: 34px;
  border: 1px solid var(--product-line);
  border-radius: 6px;
  color: #354253;
  background: #fff;
  box-shadow: none;
}

body.formal-ui-refresh .customer-head-actions button.is-active,
body.formal-ui-refresh .customer-head-actions button:last-child {
  border-color: #273649;
  color: #fff;
  background: #273649;
}

body.formal-ui-refresh .customer-entry-brand-strip {
  min-height: 150px;
  border-radius: 0;
}

body.formal-ui-refresh .customer-entry-dialog,
body.formal-ui-refresh .customer-entry-assistant,
body.formal-ui-refresh .customer-bubble {
  border-color: var(--product-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

body.formal-ui-refresh .customer-timeline {
  background: #f6f7f9;
}

body.formal-ui-refresh .customer-message.is-user .customer-bubble {
  border-color: #26364b;
  background: #26364b;
}

body.formal-ui-refresh .customer-tools {
  border-top: 1px solid var(--product-line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -10px 24px rgba(20, 30, 43, 0.05);
}

body.formal-ui-refresh .customer-composer.social-composer,
body.formal-ui-refresh .entry-composer {
  gap: 8px;
}

body.formal-ui-refresh .customer-composer input,
body.formal-ui-refresh .entry-composer input {
  min-height: 46px;
  border-color: var(--product-line-strong);
  border-radius: 8px;
  background: #fff;
}

body.formal-ui-refresh .composer-round,
body.formal-ui-refresh .entry-icon-button,
body.formal-ui-refresh .composer-voice,
body.formal-ui-refresh .entry-voice-button,
body.formal-ui-refresh .composer-send,
body.formal-ui-refresh .entry-send-button {
  border-radius: 8px;
}

body.formal-ui-refresh .composer-send,
body.formal-ui-refresh .entry-send-button {
  background: #1b2738;
}

/* Login surfaces */
body.formal-ui-refresh .auth-page,
body.formal-ui-refresh .teacher-login,
body.formal-ui-refresh .agent-login {
  background: #eef1f4;
}

body.formal-ui-refresh .auth-card,
body.formal-ui-refresh .login-card,
body.formal-ui-refresh .agent-login-card {
  border: 1px solid var(--product-line);
  border-top: 3px solid var(--product-accent);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 54px rgba(20, 30, 43, 0.12);
}

@media (max-width: 960px) {
  body.formal-ui-refresh .app-shell {
    display: block;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    overflow-x: clip;
  }

  body.formal-ui-refresh .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 12px;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }

  body.formal-ui-refresh .brand {
    min-height: 38px;
    padding: 0;
    border-bottom: 0;
  }

  body.formal-ui-refresh .brand-mark {
    width: 32px;
    height: 32px;
  }

  body.formal-ui-refresh .side-nav {
    grid-column: 1 / -1;
    display: flex;
    gap: 4px;
    max-width: 100%;
    padding-bottom: 1px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body.formal-ui-refresh .side-nav::-webkit-scrollbar {
    display: none;
  }

  body.formal-ui-refresh .nav-item {
    width: auto;
    min-height: 36px;
    flex: 0 0 auto;
    padding: 0 11px;
  }

  body.formal-ui-refresh .nav-item .nav-icon {
    display: none;
  }

  body.formal-ui-refresh .utility-button {
    display: none;
  }

  body.formal-ui-refresh .main-area {
    width: 100%;
    min-width: 0;
  }

  body.formal-ui-refresh .topbar {
    min-height: 48px;
    position: static;
    align-items: center;
    flex-direction: row;
    padding: 6px 12px;
  }

  body.formal-ui-refresh .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  body.formal-ui-refresh .topbar .subscription-button,
  body.formal-ui-refresh .topbar .search-box,
  body.formal-ui-refresh .topbar .icon-button {
    display: none;
  }

  body.formal-ui-refresh .workspace-tabs {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body.formal-ui-refresh .workspace-tabs::-webkit-scrollbar {
    display: none;
  }

  body.formal-ui-refresh .content-shell,
  body.formal-ui-refresh .agent-main {
    padding-right: 16px;
    padding-left: 16px;
  }

  body.formal-ui-refresh .teacher-inbox-page {
    padding: 14px;
  }
}

@media (max-width: 720px) {
  body.formal-ui-refresh .agent-shell {
    display: block;
  }

  body.formal-ui-refresh .agent-sidebar {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  body.formal-ui-refresh .agent-head {
    align-items: stretch;
  }

  body.formal-ui-refresh .teacher-head {
    padding-top: calc(12px + env(safe-area-inset-top));
  }

  body.formal-ui-refresh .teacher-head h1 {
    font-size: 24px;
  }

  body.formal-ui-refresh .teacher-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.formal-ui-refresh .teacher-metrics div:nth-child(2) {
    border-right: 0;
  }

  body.formal-ui-refresh .teacher-metrics div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--product-line);
  }

  body.formal-ui-refresh .customer-shell {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.formal-ui-refresh *,
  body.formal-ui-refresh *::before,
  body.formal-ui-refresh *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
