:root {
  --ink: #17211f;
  --ink-soft: #52615d;
  --muted: #788681;
  --line: #dce4e1;
  --line-soft: #edf1ef;
  --surface: #ffffff;
  --surface-soft: #f5f8f7;
  --canvas: #eef3f1;
  --green: #176b58;
  --green-dark: #105447;
  --green-light: #dff1eb;
  --coral: #c95d49;
  --amber: #b98222;
  --blue: #3c6e9d;
  --shadow: 0 14px 40px rgba(22, 45, 38, 0.09);
  --sidebar: 248px;
  --topbar: 64px;
  font-family:
    Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue",
    Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
[role="button"],
.upload-zone {
  touch-action: manipulation;
}

button {
  color: inherit;
}

button,
select,
label[for],
input[type="checkbox"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(23, 107, 88, 0.2);
  outline-offset: 2px;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.hidden {
  display: none !important;
}

.auth-view {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(520px, 1.1fr);
  min-height: 100vh;
  background: var(--surface);
}

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: clamp(32px, 5vw, 72px);
  overflow: hidden;
  color: white;
  background:
    linear-gradient(145deg, rgba(10, 45, 40, 0.95), rgba(20, 94, 76, 0.91)),
    radial-gradient(circle at 20% 80%, rgba(233, 174, 85, 0.45), transparent 38%),
    #174d42;
}

.auth-brand::after {
  position: absolute;
  right: -100px;
  bottom: -130px;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  content: "";
  box-shadow:
    0 0 0 65px rgba(255, 255, 255, 0.035),
    0 0 0 130px rgba(255, 255, 255, 0.025);
  pointer-events: none;
}

.auth-brand > div:first-of-type {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: var(--green-dark);
  background: #eaf6f1;
  font-weight: 800;
  font-size: 21px;
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  color: white;
  background: var(--green);
  font-size: 18px;
}

.brand-name {
  margin: 0;
  font-size: 21px;
  font-weight: 750;
}

.brand-region {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.auth-promise {
  position: relative;
  z-index: 1;
  max-width: 590px;
  margin: auto 0 42px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-promise .eyebrow {
  color: #a9d5c8;
}

.auth-promise h1 {
  max-width: 580px;
  margin: 0;
  font-size: clamp(38px, 4.5vw, 62px);
  font-weight: 750;
  line-height: 1.13;
  letter-spacing: 0;
}

.auth-promise > p:last-child {
  max-width: 550px;
  margin: 25px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 16px;
  line-height: 1.85;
}

.auth-features {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.auth-contact-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.mobile-auth-contact {
  display: none;
}

.contact-surface-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.contact-surface-heading > svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.contact-surface-heading > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.contact-surface-heading strong,
.contact-surface-heading span {
  overflow-wrap: anywhere;
}

.contact-surface-heading strong {
  font-size: 17px;
  line-height: 1.35;
}

.contact-surface-heading span {
  color: inherit;
  opacity: 0.78;
  font-size: 12px;
  line-height: 1.5;
}

.site-contact-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.site-contact-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 68px;
  min-width: 0;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.site-contact-item > svg {
  width: 19px;
  height: 19px;
  color: #a9d5c8;
}

.site-contact-item > span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.site-contact-item small {
  color: inherit;
  opacity: 0.7;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.site-contact-item a,
.site-contact-item span > button {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
}

.contact-qr-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: inherit;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.contact-qr-button svg {
  width: 17px;
}

.contact-qr-only {
  font-size: 13px;
  font-weight: 700;
}

.contact-empty {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  opacity: 0.66;
  font-size: 13px;
}

.contact-empty svg {
  width: 14px;
}

.feature-line {
  display: flex;
  gap: 10px;
}

.feature-line svg {
  margin-top: 2px;
  color: #9bd0c1;
}

.feature-line strong,
.feature-line span {
  display: block;
}

.feature-line strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.feature-line span {
  color: rgba(255, 255, 255, 0.57);
  font-size: 11px;
  line-height: 1.5;
}

.auth-foot {
  position: absolute;
  right: 34px;
  bottom: 22px;
  margin: 0;
  color: rgba(255, 255, 255, 0.34);
  font-size: 10px;
}

.auth-panel {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 80px 32px 40px;
  background: #fbfcfc;
}

.auth-topbar {
  position: absolute;
  top: 24px;
  right: 30px;
}

.auth-form-wrap {
  width: 100%;
  min-width: 0;
  max-width: 440px;
}

.mobile-brand {
  display: none;
}

.auth-heading h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
}

.auth-heading p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.segmented {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segmented button {
  display: flex;
  min-height: 38px;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
}

.segmented button.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 2px 8px rgba(24, 45, 39, 0.08);
}

.auth-tabs {
  margin: 26px 0 24px;
}

.auth-form {
  display: grid;
  gap: 17px;
}

.field {
  position: relative;
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap > svg {
  position: absolute;
  left: 13px;
  z-index: 1;
  width: 17px;
  color: #7d8b87;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cfd9d5;
  border-radius: 7px;
  color: var(--ink);
  background: white;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

.input-wrap input {
  padding-right: 44px;
  padding-left: 42px;
}

textarea {
  min-height: 110px;
  padding: 12px;
  resize: vertical;
  line-height: 1.65;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #a7b7b1;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(23, 107, 88, 0.1);
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.input-action {
  position: absolute;
  right: 5px;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--ink-soft);
  background: transparent;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr 148px;
  gap: 12px;
  align-items: end;
}

.captcha-box {
  position: relative;
  height: 52px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #cad5d1;
  border-radius: 7px;
  background: #eff4f1;
}

.captcha-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 160ms ease;
}

.captcha-box.is-loading img {
  opacity: 0.18;
}

.captcha-box.is-loading > svg {
  animation: captcha-spin 900ms linear infinite;
}

.captcha-box.has-error {
  border-color: #bd3d3d;
  background: #fff2f0;
}

@keyframes captcha-spin {
  to {
    transform: rotate(360deg);
  }
}

.captcha-box svg {
  position: absolute;
  right: 5px;
  bottom: 4px;
  width: 13px;
  height: 13px;
  color: rgba(23, 33, 31, 0.6);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--green);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease;
}

.primary-button {
  border: 1px solid var(--green);
  color: white;
  background: var(--green);
}

.primary-button:hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.secondary-button {
  border: 1px solid #cbd7d3;
  color: var(--ink);
  background: white;
}

.secondary-button:hover {
  border-color: #a9bab4;
  background: var(--surface-soft);
}

.danger-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid #a84343;
  border-radius: 6px;
  color: white;
  background: #a84343;
  font-size: 11px;
  font-weight: 700;
}

.danger-button:hover {
  background: #8f3535;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.wide {
  width: 100%;
}

.text-button,
.inline-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

.text-button:hover,
.inline-link:hover {
  color: var(--green-dark);
}

.language-switch {
  padding: 8px;
  color: var(--ink-soft);
}

.demo-access {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.demo-access > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.demo-access svg {
  width: 15px;
}

.demo-access button {
  padding: 0;
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.app-view {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fbfcfc;
}

.sidebar-brand {
  display: flex;
  height: var(--topbar);
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand > div:nth-child(2) {
  display: grid;
}

.sidebar-brand strong {
  font-size: 16px;
}

.sidebar-brand span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.sidebar-close {
  display: none;
  margin-left: auto;
}

.main-nav {
  flex: 1;
  padding: 16px 11px;
  overflow-y: auto;
}

.nav-label {
  margin: 17px 10px 7px;
  color: #95a19d;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.nav-label:first-child {
  margin-top: 2px;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  margin: 2px 0;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 13px;
  text-align: left;
}

.nav-item:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.nav-item.active {
  color: var(--green-dark);
  background: var(--green-light);
  font-weight: 700;
}

.nav-item.active::before {
  position: absolute;
  left: 0;
  width: 3px;
  height: 20px;
  border-radius: 0 2px 2px 0;
  background: var(--green);
  content: "";
}

.nav-badge {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--green);
  background: white;
  font-size: 9px;
  font-weight: 800;
}

.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid var(--line);
}

.credit-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 11px 10px;
  border: 1px solid #d9e7e2;
  border-radius: 7px;
  background: #f0f7f4;
}

.credit-mini span,
.credit-mini strong {
  display: block;
}

.credit-mini span {
  color: var(--muted);
  font-size: 10px;
}

.credit-mini strong {
  margin-top: 3px;
  font-size: 17px;
}

.credit-mini .icon-button {
  width: 30px;
  height: 30px;
  color: white;
  background: var(--green);
}

.profile-button {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
}

.profile-button:hover {
  background: var(--surface-soft);
}

.avatar,
.topbar-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  background: #3e6e63;
  font-size: 11px;
  font-weight: 750;
}

.profile-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.profile-copy strong,
.profile-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy strong {
  font-size: 12px;
}

.profile-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.profile-button > svg {
  width: 16px;
  color: var(--muted);
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: var(--topbar);
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 252, 0.94);
  backdrop-filter: blur(12px);
}

.mobile-menu {
  display: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumb svg {
  width: 14px;
}

.breadcrumb strong {
  color: var(--ink);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.language-pill {
  display: flex;
  height: 34px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: white;
  font-size: 11px;
  font-weight: 700;
}

.notification-button {
  position: relative;
}

.notification-button > span {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border: 1px solid white;
  border-radius: 50%;
  background: var(--coral);
}

.topbar-avatar {
  cursor: pointer;
}

.page-content {
  max-width: 1540px;
  min-height: calc(100vh - var(--topbar));
  margin: 0 auto;
  padding: 28px clamp(20px, 3vw, 46px) 50px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 25px;
}

.page-heading h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.2;
}

.page-heading > div > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.dashboard-heading .eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  text-transform: none;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric {
  min-width: 0;
  padding: 20px 22px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.metric-top svg {
  width: 18px;
  color: var(--green);
}

.metric > strong {
  display: block;
  margin-top: 12px;
  overflow: hidden;
  font-size: 27px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric > p {
  display: flex;
  min-height: 17px;
  align-items: center;
  gap: 4px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.metric > p svg {
  width: 13px;
}

.metric > p b {
  color: var(--ink-soft);
}

.positive {
  color: var(--green) !important;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.7fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 73px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: 15px;
}

.panel-heading p,
.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.recent-list {
  min-height: 360px;
}

.recent-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: start;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.recent-item:last-child {
  border-bottom: 0;
}

.recent-source {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 7px;
  color: var(--blue);
  background: #e9f1f7;
  font-size: 11px;
  font-weight: 800;
}

.recent-source.openrice {
  color: var(--coral);
  background: #faece9;
}

.recent-content {
  min-width: 0;
}

.recent-content > p {
  margin: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-reply {
  margin-top: 7px !important;
  color: var(--muted);
  font-size: 11px !important;
}

.recent-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
  color: #8b9894;
  font-size: 9px;
}

.sentiment-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--green);
}

.sentiment-dot.negative {
  background: var(--coral);
}

.recent-time {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  min-height: 330px;
  place-content: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 30px;
  height: 30px;
  margin: 0 auto 9px;
}

.empty-state p {
  margin: 0 0 14px;
  font-size: 12px;
}

.dashboard-aside {
  display: grid;
  gap: 18px;
}

.quick-start {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  justify-content: space-between;
  padding: 21px;
  border-radius: 8px;
  color: white;
  background: #1f554b;
}

.section-icon,
.plan-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 7px;
  color: var(--green);
  background: var(--green-light);
}

.quick-start .section-icon {
  color: #134d40;
  background: #cde9df;
}

.quick-start h2 {
  margin: 13px 0 7px;
  font-size: 17px;
}

.quick-start p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  line-height: 1.6;
}

.quick-start .secondary-button {
  border-color: white;
}

.setup-progress {
  padding-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.panel-heading.compact {
  min-height: auto;
  border-bottom: 0;
}

.setup-progress .progress-track {
  margin: 0 20px 12px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: #e6ece9;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 300ms ease;
}

.setup-item {
  display: flex;
  width: calc(100% - 24px);
  min-height: 35px;
  align-items: center;
  gap: 9px;
  margin: 2px 12px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 11px;
  text-align: left;
}

.setup-item:hover {
  background: var(--surface-soft);
}

.setup-item svg {
  width: 15px;
  color: #a0aaa7;
}

.setup-item.complete {
  color: var(--muted);
  text-decoration: line-through;
}

.setup-item.complete svg {
  color: var(--green);
}

.cost-pill,
.admin-badge {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid #d9e5e0;
  border-radius: 6px;
  color: var(--green-dark);
  background: #f1f8f5;
  font-size: 11px;
  font-weight: 700;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(360px, 0.97fr);
  min-height: 680px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.studio-input,
.studio-result {
  padding: 24px;
}

.studio-result {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #f8faf9;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.step-number {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  color: white;
  background: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.section-title-row h2 {
  margin: 0;
  font-size: 14px;
}

.section-title-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.input-tabs {
  width: 300px;
  margin: 20px 0 16px;
}

.upload-zone {
  display: grid;
  min-height: 190px;
  place-content: center;
  border: 1px dashed #aabdb6;
  border-radius: 8px;
  background: #f9fbfa;
  color: var(--ink-soft);
  text-align: center;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.upload-zone:hover,
.upload-zone.dragging {
  border-color: var(--green);
  background: #f0f7f4;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 8px;
  color: var(--green);
  background: var(--green-light);
}

.upload-zone strong {
  font-size: 12px;
}

.upload-zone small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.image-preview {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 36px;
  gap: 11px;
  align-items: center;
  margin-top: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.image-preview img {
  width: 48px;
  height: 48px;
  border-radius: 5px;
  object-fit: cover;
}

.image-preview div {
  display: grid;
  min-width: 0;
}

.image-preview strong,
.image-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview strong {
  font-size: 11px;
}

.image-preview span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.top-gap {
  margin-top: 15px;
}

.char-count {
  position: absolute;
  right: 11px;
  bottom: 9px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

.settings-title {
  margin-top: 23px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

.studio-options {
  margin-top: 17px;
  border-top: 1px solid var(--line);
}

.studio-options summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  list-style: none;
}

.studio-options summary::-webkit-details-marker {
  display: none;
}

.studio-options summary svg {
  width: 16px;
  color: var(--green);
}

.studio-options[open] summary {
  color: var(--green-dark);
}

.preference-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 17px;
}

.output-format {
  display: flex;
  min-height: 39px;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: #f8faf9;
}

.output-format svg {
  width: 16px;
  color: var(--green);
}

.output-format > span {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
}

.output-format small {
  color: var(--muted);
}

.generate-button {
  height: 48px;
  min-width: 0;
  margin-top: 0;
}

.generate-button kbd {
  margin-left: auto;
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.27);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.07);
  font-family: inherit;
  font-size: 9px;
}

.reply-length-control {
  --range-start: 13.76%;
  --range-end: 25.69%;
  padding: 2px 0 8px;
}

.length-range-heading,
.length-range-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.length-range-heading {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.length-range-heading strong {
  color: var(--green-dark);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.dual-range {
  position: relative;
  height: 32px;
  margin-top: 5px;
}

.dual-range-rail {
  position: absolute;
  top: 14px;
  right: 0;
  left: 0;
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(
      to right,
      #dce5e1 0 var(--range-start),
      var(--green) var(--range-start) var(--range-end),
      #dce5e1 var(--range-end) 100%
    );
}

.dual-range input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 32px;
  margin: 0;
  appearance: none;
  pointer-events: none;
  background: transparent;
}

.dual-range input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: transparent;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -7px;
  appearance: none;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green-dark), 0 2px 5px rgba(25, 69, 58, 0.22);
  cursor: grab;
  pointer-events: auto;
}

.dual-range input[type="range"]::-moz-range-track {
  height: 4px;
  background: transparent;
}

.dual-range input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green-dark), 0 2px 5px rgba(25, 69, 58, 0.22);
  cursor: grab;
  pointer-events: auto;
}

.length-range-scale {
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.generate-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 19px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.result-title h2 {
  margin: 0;
  font-size: 15px;
}

.result-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.simple-merchant .merchant-advanced {
  display: none !important;
}

.simple-merchant #page-studio .eyebrow,
.simple-merchant #page-studio .sentiment-row,
.simple-merchant #page-studio .rag-note,
.simple-merchant #page-studio .analysis-details {
  display: none;
}

.simple-merchant #page-studio .page-heading {
  margin-bottom: 16px;
}

.simple-merchant #page-studio .page-heading h1 {
  font-size: 24px;
}

.simple-merchant .studio-layout {
  min-height: 620px;
}

.simple-merchant .studio-result {
  background: white;
}

.simple-merchant .section-title-row .step-number {
  display: none;
}

.result-actions .copied,
.table-actions .copied {
  color: white;
  border-color: var(--green);
  background: var(--green);
}

.status-pill,
.sentiment,
.topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 9px;
}

.status-pill {
  color: var(--muted);
  background: #e9eeec;
  white-space: nowrap;
}

.status-pill > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #97a49f;
}

.status-pill.complete {
  color: var(--green-dark);
  background: var(--green-light);
}

.status-pill.complete > span {
  background: var(--green);
}

.result-empty,
.result-loading,
.result-error {
  display: grid;
  flex: 1;
  place-content: center;
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

.result-empty > span,
.result-error > span {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 15px;
  place-items: center;
  border: 1px solid #d7e4df;
  border-radius: 50%;
  color: var(--green);
  background: white;
}

.result-empty > span svg {
  width: 25px;
  height: 25px;
}

.result-empty h3,
.result-loading h3,
.result-error h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.result-empty p,
.result-loading p,
.result-error p {
  max-width: 320px;
  margin: 9px auto 0;
  font-size: 11px;
  line-height: 1.6;
}

.result-error > span {
  border-color: #ead3ce;
  color: #a34f3e;
  background: #fff8f6;
}

.result-error .secondary-button {
  width: max-content;
  margin: 18px auto 0;
}

.status-pill.error {
  color: #913c30;
  background: #fae9e5;
}

.status-pill.error > span {
  background: #a34f3e;
}

.ai-loader {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 17px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green);
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(23, 107, 88, 0.2);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(23, 107, 88, 0);
  }
}

.loading-line {
  width: 230px;
  height: 4px;
  margin: 18px auto 0;
  overflow: hidden;
  border-radius: 2px;
  background: #dfe7e4;
}

.loading-line span {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  animation: scan 1.2s infinite ease-in-out;
}

@keyframes scan {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(230%);
  }
}

.result-output {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  margin-top: 24px;
}

.result-language-tabs {
  width: 240px;
  margin-bottom: 13px;
}

.sentiment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.sentiment {
  color: var(--green-dark);
  background: var(--green-light);
}

.sentiment.negative {
  color: #9a4233;
  background: #fae9e5;
}

.sentiment svg {
  width: 13px;
}

.topic-tag {
  color: var(--ink-soft);
  background: #e9eeec;
}

.result-editor {
  flex: 1;
}

.result-editor textarea {
  min-height: 300px;
  flex: 1;
  background: white;
}

.reply-char-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.reply-char-count.valid {
  color: var(--green);
}

.reply-char-count.invalid {
  color: #a34f3e;
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 12px;
}

.delivery-note,
.rag-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 10px;
}

.delivery-note {
  padding: 9px 10px;
  border: 1px solid #cfe1da;
  border-radius: 5px;
  color: var(--green-dark);
  background: #f3f9f6;
}

.rag-note {
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.delivery-note svg,
.rag-note svg {
  width: 14px;
  flex: 0 0 auto;
  color: var(--green);
}

.analysis-details {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.analysis-details summary {
  display: flex;
  min-height: 39px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  list-style: none;
}

.analysis-details summary::-webkit-details-marker {
  display: none;
}

.analysis-details summary svg {
  width: 14px;
  color: var(--green);
}

.analysis-details > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}

.analysis-details section {
  min-width: 0;
  padding: 11px;
}

.analysis-details section + section {
  border-left: 1px solid var(--line);
}

.analysis-details b {
  font-size: 9px;
}

.analysis-details p {
  max-height: 100px;
  margin: 6px 0 0;
  overflow: auto;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.knowledge-summary {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.business-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.business-logo {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  color: white;
  background: #b95645;
  font-size: 21px;
  font-weight: 750;
}

.business-profile > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.business-profile span,
.knowledge-health span {
  color: var(--muted);
  font-size: 9px;
}

.business-profile h2 {
  margin: 4px 0;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.business-profile p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.knowledge-health {
  padding: 20px;
}

.knowledge-health > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.knowledge-health strong {
  font-size: 16px;
}

.knowledge-health p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.search-field {
  position: relative;
  display: flex;
  width: min(360px, 100%);
  align-items: center;
}

.search-field svg {
  position: absolute;
  left: 12px;
  z-index: 1;
  width: 16px;
  color: var(--muted);
}

.search-field input {
  padding-left: 37px;
}

.filter-actions select,
.filter-bar > select {
  min-width: 145px;
}

.knowledge-list {
  display: grid;
  gap: 8px;
}

.knowledge-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.knowledge-type {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 6px;
  color: var(--blue);
  background: #e9f1f7;
}

.knowledge-type.product {
  color: var(--coral);
  background: #faece9;
}

.knowledge-type.policy {
  color: var(--amber);
  background: #faf2df;
}

.knowledge-type.faq {
  color: var(--green);
  background: var(--green-light);
}

.knowledge-copy {
  min-width: 0;
}

.knowledge-copy h3 {
  margin: 0 0 5px;
  font-size: 12px;
}

.knowledge-copy p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
  color: #94a09c;
  font-size: 9px;
}

.enabled-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--green);
}

.enabled-label::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.knowledge-actions {
  display: flex;
  align-items: center;
}

.toggle {
  position: relative;
  width: 34px;
  height: 19px;
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: #cbd5d1;
  transition: background 160ms ease;
}

.toggle::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: transform 160ms ease;
}

.toggle:checked {
  background: var(--green);
}

.toggle:checked::after {
  transform: translateX(15px);
}

.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #f8faf9;
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fbfcfc;
}

.cell-truncate {
  max-width: 310px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-replies {
  display: grid;
  max-width: 340px;
  gap: 5px;
}

.history-replies > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.history-replies b {
  min-width: 22px;
  color: var(--green);
  font-size: 8px;
}

.history-copy-label {
  display: none;
}

.result-count {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 10px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.pagination-bar > span {
  min-width: 88px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.history-detail-modal {
  width: min(1040px, calc(100vw - 36px));
}

.history-detail-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 0;
}

.history-detail-body > section {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.history-detail-body > section:nth-child(2n) {
  border-right: 0;
}

.history-detail-body .history-detail-wide {
  grid-column: 1 / -1;
  border-right: 0;
}

.history-full-text {
  min-height: 88px;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.history-full-text.reply {
  color: var(--ink);
  font-size: 12px;
}

.history-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
}

.history-meta-grid > div {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.history-meta-grid span {
  color: var(--muted);
  font-size: 8px;
}

.history-meta-grid strong {
  overflow-wrap: anywhere;
  font-size: 10px;
}

.history-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.history-analysis-grid article {
  min-width: 0;
  padding: 11px 12px;
  border-left: 3px solid var(--green);
  background: var(--surface-soft);
}

.history-analysis-grid article strong {
  font-size: 10px;
}

.history-analysis-grid article p {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.history-structured-details {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.history-structured-details details {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.history-structured-details summary {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.history-structured-details pre {
  max-height: 300px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.platform-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.platform-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--blue);
}

.platform-dot.openrice {
  background: var(--coral);
}

.empty-table {
  display: grid;
  min-height: 260px;
  place-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-table svg {
  width: 28px;
  height: 28px;
  margin: 0 auto;
}

.balance-band {
  display: flex;
  min-height: 160px;
  align-items: center;
  justify-content: space-between;
  padding: 27px 32px;
  border-radius: 8px;
  color: white;
  background: #1b4f45;
}

.balance-band span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.balance-band > div:first-child > strong {
  display: block;
  margin: 7px 0;
  font-size: 38px;
}

.balance-band p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: rgba(255, 255, 255, 0.63);
  font-size: 10px;
}

.balance-band p svg {
  width: 13px;
}

.usage-ring {
  position: relative;
  display: grid;
  width: 100px;
  height: 100px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#e8b55f var(--usage, 0%), rgba(255, 255, 255, 0.13) 0);
}

.usage-ring::before {
  position: absolute;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: #1b4f45;
  content: "";
}

.usage-ring span {
  z-index: 1;
  display: grid;
  text-align: center;
}

.usage-ring strong {
  color: white;
  font-size: 18px;
}

.usage-ring small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 8px;
}

.section-heading {
  margin: 27px 0 13px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.price-card {
  position: relative;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.price-card.popular {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}

.popular-label {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 7px;
  border-radius: 4px;
  color: var(--green-dark);
  background: var(--green-light);
  font-size: 8px;
  font-weight: 750;
}

.price-card h3 {
  margin: 16px 0 8px;
  font-size: 14px;
}

.price-card > strong {
  font-size: 25px;
}

.price-card > p {
  margin: 13px 0 4px;
  color: var(--muted);
  font-size: 11px;
}

.price-card > p b {
  color: var(--ink);
  font-size: 18px;
}

.price-card > small {
  display: block;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 9px;
}

.monthly-heading {
  margin-top: 32px;
}

.monthly-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.monthly-row > div {
  display: flex;
  align-items: center;
  gap: 14px;
}

.plan-icon.dark {
  color: white;
  background: var(--ink);
}

.monthly-row h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.monthly-row p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.monthly-price strong {
  font-size: 20px;
}

.monthly-price > span {
  margin-right: 10px;
  color: var(--muted);
  font-size: 10px;
}

.admin-badge {
  color: #8d5320;
  border-color: #ead9bd;
  background: #fbf3e6;
}

.admin-metrics {
  margin-bottom: 18px;
}

.ai-config-panel {
  margin-bottom: 18px;
}

.config-badge {
  padding: 5px 8px;
  border-radius: 5px;
  color: #8d5320;
  background: #fbf0dd;
  font-size: 9px;
  font-weight: 750;
}

.config-badge.configured {
  color: var(--green-dark);
  background: var(--green-light);
}

.ai-config-form {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr;
  gap: 14px;
  padding: 20px;
}

.ai-endpoint-field {
  grid-column: span 2;
}

.local-key-file {
  display: flex;
  min-height: 70px;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px dashed #b8c9c3;
  border-radius: 6px;
  background: #f8faf9;
}

.local-key-file > svg {
  width: 19px;
  color: var(--green);
}

.local-key-file > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.local-key-file b {
  font-size: 10px;
}

.local-key-file code {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-key-file small {
  color: var(--muted);
  font-size: 9px;
}

.ai-config-form .field > small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.ai-config-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 4px;
}

.prompt-library-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.prompt-library-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.prompt-library-stats > span {
  display: grid;
  gap: 5px;
  padding: 15px 20px;
  border-right: 1px solid var(--line);
}

.prompt-library-stats > span:last-child {
  border-right: 0;
}

.prompt-library-stats small {
  color: var(--muted);
  font-size: 9px;
}

.prompt-library-stats strong {
  color: var(--ink);
  font-size: 21px;
}

.prompt-library-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.prompt-library-toolbar select {
  min-height: 38px;
}

.prompt-template-list {
  display: grid;
}

.prompt-template-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.prompt-template-item:last-child {
  border-bottom: 0;
}

.prompt-template-copy {
  min-width: 0;
}

.prompt-template-title-row,
.prompt-template-meta,
.prompt-template-actions {
  display: flex;
  align-items: center;
}

.prompt-template-title-row {
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-template-title-row h3 {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
}

.prompt-template-id,
.prompt-template-style {
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--muted);
  background: #eef2f0;
  font-size: 8px;
}

.prompt-template-copy > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.prompt-template-meta {
  flex-wrap: wrap;
  gap: 6px;
}

.prompt-template-meta small {
  color: var(--muted);
  font-size: 8px;
}

.prompt-template-actions {
  align-self: center;
  gap: 8px;
}

.prompt-template-pagination {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
}

.prompt-template-pagination .icon-button:disabled {
  opacity: 0.35;
}

.admin-rag-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.65fr);
  gap: 18px;
  margin-bottom: 18px;
}

.admin-rag-center {
  min-width: 0;
  overflow: hidden;
}

.admin-rag-heading select {
  width: min(300px, 100%);
}

.admin-rag-profile {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8faf9;
}

.admin-rag-profile > div:nth-child(2) {
  min-width: 0;
}

.admin-rag-profile span {
  color: var(--muted);
  font-size: 9px;
}

.admin-rag-profile h3 {
  margin: 4px 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-rag-profile p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.rag-score-block {
  display: grid;
  min-width: 80px;
  text-align: right;
}

.rag-score-block strong {
  margin-top: 3px;
  color: var(--green);
  font-size: 20px;
}

.admin-rag-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.admin-rag-toolbar > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rag-checklist-wrap {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.section-heading.inline-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 13px;
}

.section-heading.inline-heading h3 {
  margin: 0;
  font-size: 13px;
}

.section-heading.inline-heading > span {
  color: var(--green);
  font-size: 11px;
  font-weight: 750;
}

.rag-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.rag-check-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: white;
  font-size: 10px;
}

.rag-check-item svg {
  width: 15px;
  color: #9ba7a3;
}

.rag-check-item.complete {
  color: var(--green-dark);
  border-color: #cfe2db;
  background: #f1f8f5;
}

.rag-check-item.complete svg {
  color: var(--green);
}

.rag-entry-heading {
  padding: 17px 20px 0;
}

.admin-rag-list {
  max-height: 520px;
  overflow-y: auto;
}

.admin-rag-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
}

.admin-rag-item:first-child {
  border-top: 0;
}

.admin-rag-item .knowledge-type {
  width: 34px;
  height: 34px;
}

.admin-rag-copy {
  min-width: 0;
}

.admin-rag-copy h4 {
  margin: 0 0 5px;
  font-size: 11px;
}

.admin-rag-copy p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.admin-rag-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
  color: #899692;
  font-size: 8px;
}

.priority-tag {
  padding: 2px 5px;
  border-radius: 3px;
  color: #8d5320;
  background: #fbf0dd;
}

.admin-rag-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.rag-learning {
  align-self: start;
  padding: 21px;
  border: 1px solid #d8e3df;
  border-radius: 8px;
  background: #f8fbfa;
}

.learning-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.learning-heading > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 7px;
  color: white;
  background: var(--ink);
}

.learning-heading p {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 9px;
  font-weight: 750;
}

.learning-heading h2 {
  margin: 0;
  font-size: 15px;
}

.learning-lead {
  margin: 16px 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.65;
}

.learning-steps {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  counter-reset: rag-step;
  list-style: none;
}

.learning-steps li {
  position: relative;
  min-height: 34px;
  padding-left: 31px;
  counter-increment: rag-step;
}

.learning-steps li::before {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green);
  content: counter(rag-step);
  font-size: 9px;
  font-weight: 750;
}

.learning-steps b,
.learning-steps span {
  display: block;
}

.learning-steps b {
  margin-bottom: 3px;
  font-size: 10px;
}

.learning-steps span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.learning-test {
  margin: 17px 0;
  padding: 13px;
  border-left: 3px solid var(--coral);
  border-radius: 0 6px 6px 0;
  background: white;
}

.learning-test > span {
  color: var(--coral);
  font-size: 9px;
  font-weight: 750;
}

.learning-test blockquote {
  margin: 8px 0;
  color: var(--ink);
  font-size: 10px;
  line-height: 1.55;
}

.learning-test p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.metric .status-text {
  font-size: 21px;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.status-dot.amber {
  background: var(--amber);
}

.admin-users .panel-heading {
  min-height: 82px;
}

.admin-view-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 16px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.admin-view-tabs button {
  display: inline-flex;
  min-width: 142px;
  min-height: 48px;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: white;
  font-size: 11px;
  font-weight: 700;
}

.admin-view-tabs button:last-child {
  border-right: 0;
}

.admin-view-tabs button.active {
  color: var(--green-dark);
  background: var(--green-light);
}

.admin-view-tabs button svg {
  width: 15px;
}

.compact-search {
  width: 260px;
}

.admin-table-wrap {
  border: 0;
  border-radius: 0 0 8px 8px;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-cell .avatar {
  width: 30px;
  height: 30px;
  font-size: 9px;
}

.user-cell span:last-child {
  display: grid;
}

.user-cell strong {
  font-size: 11px;
}

.user-cell small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.role-pill,
.plan-pill,
.active-pill {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 4px;
  color: var(--ink-soft);
  background: #e9eeec;
  font-size: 9px;
}

.role-pill.admin {
  color: #8d5320;
  background: #fbf0dd;
}

.active-pill {
  color: var(--green-dark);
  background: var(--green-light);
}

.active-pill.suspended {
  color: #8f3535;
  background: #f8e7e5;
}

.redeem-panel,
.credit-ledger-panel {
  margin-top: 18px;
}

.redeem-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(310px, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 20px 22px 22px;
}

.redeem-captcha-row {
  margin: 0;
}

.credit-ledger-list,
.security-event-list,
.code-batch-list {
  display: grid;
}

.credit-ledger-item,
.security-event,
.code-batch-item {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
}

.credit-ledger-item {
  grid-template-columns: 32px minmax(0, 1fr) auto;
}

.ledger-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-light);
}

.ledger-icon.debit {
  color: #9b493d;
  background: #f8e8e5;
}

.ledger-icon svg {
  width: 15px;
}

.credit-ledger-item > div,
.ledger-amount {
  display: grid;
  gap: 3px;
}

.credit-ledger-item strong {
  font-size: 11px;
}

.credit-ledger-item small {
  color: var(--muted);
  font-size: 9px;
}

.ledger-amount {
  justify-items: end;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 750;
}

.ledger-amount.debit {
  color: #9b493d;
}

.admin-security-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 16px;
  margin: 16px 0;
}

.security-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.security-summary > span {
  display: grid;
  gap: 5px;
  padding: 13px 16px;
  border-right: 1px solid var(--line);
}

.security-summary > span:last-child {
  border-right: 0;
}

.security-summary small {
  color: var(--muted);
  font-size: 9px;
}

.security-summary strong {
  font-size: 17px;
}

.security-event-list {
  max-height: 390px;
  overflow: auto;
}

.security-event {
  grid-template-columns: 30px minmax(0, 1fr) auto;
}

.security-event > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-light);
}

.security-event.warning > span {
  color: #8d6421;
  background: #fbf0dd;
}

.security-event.critical > span {
  color: #973f3f;
  background: #f8e7e5;
}

.security-event svg {
  width: 14px;
}

.security-event div {
  display: grid;
  gap: 3px;
}

.security-event strong {
  font-size: 10px;
}

.security-event small,
.security-event time {
  color: var(--muted);
  font-size: 9px;
}

.code-batch-form {
  display: grid;
  gap: 12px;
  padding: 17px 18px;
  border-top: 1px solid var(--line);
}

.generated-code-result {
  display: grid;
  gap: 10px;
  padding: 15px 18px;
  border-top: 1px solid var(--line);
  background: #f7faf8;
}

.generated-code-result > div:first-child {
  display: grid;
  gap: 2px;
}

.generated-code-result strong {
  color: #8f3535;
  font-size: 11px;
}

.generated-code-result span {
  color: var(--muted);
  font-size: 9px;
}

.generated-code-result textarea {
  width: 100%;
  resize: vertical;
  font-family: Consolas, monospace;
  font-size: 11px;
  line-height: 1.6;
}

.code-batch-list {
  max-height: 340px;
  overflow: auto;
}

.code-batch-item {
  grid-template-columns: minmax(0, 1fr) auto auto 32px;
}

.code-batch-item > div:first-child {
  display: grid;
  gap: 3px;
}

.code-batch-item strong {
  font-size: 10px;
}

.code-batch-item small {
  color: var(--muted);
  font-size: 9px;
}

.batch-counts {
  display: flex;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
}

.account-monitor {
  display: grid;
  min-width: 120px;
  gap: 3px;
}

.account-monitor span {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
}

.account-monitor span.risk {
  color: #9b493d;
  font-weight: 700;
}

.account-monitor svg {
  width: 11px;
}

@media (max-width: 1050px) {
  .redeem-form {
    grid-template-columns: 1fr 1fr;
  }

  .redeem-form > button {
    width: 100%;
    grid-column: 1 / -1;
  }

  .admin-security-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .redeem-form {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .redeem-form > button {
    grid-column: auto;
  }

  .security-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .security-summary > span:nth-child(2) {
    border-right: 0;
  }

  .security-summary > span:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .code-batch-item {
    grid-template-columns: minmax(0, 1fr) 32px;
  }

  .code-batch-item .batch-counts,
  .code-batch-item .active-pill {
    grid-column: 1 / -1;
  }

  .security-event {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .security-event time {
    grid-column: 2;
  }

  .credit-ledger-item {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .ledger-amount {
    grid-column: 2;
    justify-items: start;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 25, 22, 0.56);
  backdrop-filter: blur(3px);
}

.modal {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.small-modal {
  width: min(470px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
}

.modal-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.modal-body {
  display: grid;
  gap: 17px;
  padding: 22px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 5px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.toggle-row span {
  display: grid;
}

.toggle-row strong {
  font-size: 12px;
}

.toggle-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.toggle-row input {
  width: 34px;
  height: 19px;
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: #cbd5d1;
}

.toggle-row input::after {
  display: block;
  width: 13px;
  height: 13px;
  margin: 3px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: transform 160ms ease;
}

.toggle-row input:checked {
  background: var(--green);
}

.toggle-row input:checked::after {
  transform: translateX(15px);
}

.profile-menu {
  position: fixed;
  top: 58px;
  right: 24px;
  z-index: 80;
  width: 225px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.profile-menu > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-bottom: 1px solid var(--line);
}

.profile-menu p {
  display: grid;
  min-width: 0;
  margin: 0;
}

.profile-menu strong,
.profile-menu small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu strong {
  font-size: 11px;
}

.profile-menu small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.profile-menu > button {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 9px;
  margin-top: 3px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  font-size: 11px;
}

.profile-menu > button:hover {
  background: var(--surface-soft);
}

.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
}

.toast {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 7px;
  background: white;
  box-shadow: var(--shadow);
  animation: toast-in 220ms ease;
}

.toast.error {
  border-left-color: var(--coral);
}

.toast svg {
  width: 17px;
  color: var(--green);
}

.toast.error svg {
  color: var(--coral);
}

.toast span {
  font-size: 11px;
  line-height: 1.5;
}

.toast button {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.sidebar-scrim {
  display: none;
}

@media (max-width: 1100px) {
  .auth-view {
    grid-template-columns: minmax(360px, 0.75fr) minmax(480px, 1fr);
  }

  .auth-features {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .feature-line:nth-child(3) {
    display: none;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-aside {
    grid-template-columns: 1fr 1fr;
  }

  .studio-layout {
    grid-template-columns: 1fr;
  }

  .studio-result {
    min-height: 600px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .admin-rag-layout {
    grid-template-columns: 1fr;
  }

  .ai-config-form {
    grid-template-columns: 1fr 1fr;
  }

  .ai-endpoint-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar: 58px;
  }

  .auth-view {
    display: block;
    background: #fbfcfc;
  }

  .auth-brand {
    display: none;
  }

  .auth-panel {
    min-height: 100vh;
    padding: 80px 22px 35px;
  }

  .mobile-auth-contact {
    display: grid;
    width: 100%;
    min-width: 0;
    max-width: 440px;
    gap: 16px;
    margin-top: 24px;
    padding: 20px 0 4px;
    border-top: 1px solid var(--line);
    color: var(--ink);
  }

  .mobile-auth-contact .contact-surface-heading > svg,
  .mobile-auth-contact .site-contact-item > svg {
    color: var(--green);
  }

  .mobile-auth-contact .site-contact-links {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .mobile-auth-contact .site-contact-item {
    width: 100%;
    min-width: 0;
    border-color: var(--line);
    background: #f5f8f7;
  }

  .mobile-auth-contact .contact-qr-button {
    color: var(--green-dark);
    background: var(--green-light);
  }

  .mobile-brand {
    display: block;
    margin: 0 0 15px !important;
    color: var(--green) !important;
    font-size: 14px !important;
    font-weight: 800;
  }

  .mobile-brand span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
  }

  .sidebar {
    width: min(280px, calc(100vw - 42px));
    transform: translateX(-102%);
    transition: transform 220ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close,
  .mobile-menu {
    display: inline-grid;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(18, 30, 26, 0.42);
  }

  .sidebar.open + .sidebar-scrim {
    display: block;
  }

  .app-main {
    margin-left: 0;
  }

  .topbar {
    padding: 0 15px;
  }

  .breadcrumb > span,
  .breadcrumb > svg {
    display: none;
  }

  .page-content {
    padding: 22px 16px 40px;
  }

  .knowledge-summary {
    grid-template-columns: 1fr;
  }

  .business-profile {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .auth-panel {
    place-items: start center;
  }

  .auth-heading h2 {
    font-size: 26px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .captcha-row {
    grid-template-columns: minmax(0, 1fr) 126px;
  }

  .demo-access {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .topbar-actions {
    gap: 2px;
  }

  .language-pill {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .language-pill span {
    display: none;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
  }

  .page-heading > button {
    width: 100%;
  }

  .page-heading h1 {
    font-size: 25px;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric {
    min-height: 134px;
    padding: 16px;
  }

  .metric > strong {
    font-size: 22px;
  }

  .dashboard-aside {
    grid-template-columns: 1fr;
  }

  .recent-item {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 14px;
  }

  .recent-time {
    display: none;
  }

  .studio-input,
  .studio-result {
    padding: 18px 15px;
  }

  .simple-merchant .page-content {
    padding-top: 16px;
  }

  .simple-merchant #page-studio .page-heading {
    gap: 10px;
  }

  .simple-merchant #page-studio .page-heading h1 {
    font-size: 22px;
  }

  .simple-merchant #page-studio .page-heading > div > p:last-child {
    max-width: 330px;
  }

  .simple-merchant .cost-pill {
    min-height: 30px;
  }

  .simple-merchant .studio-layout {
    min-height: 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .simple-merchant .upload-zone {
    min-height: 160px;
  }

  .simple-merchant .upload-zone strong {
    font-size: 13px;
  }

  .studio-result {
    min-height: 540px;
  }

  .input-tabs {
    width: 100%;
  }

  .preference-grid {
    grid-template-columns: 1fr;
  }

  .result-language-tabs {
    width: 100%;
  }

  .analysis-details > div {
    grid-template-columns: 1fr;
  }

  .analysis-details section + section {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .generate-button kbd {
    display: none;
  }

  .generate-actions {
    grid-template-columns: 1fr;
  }

  .result-header {
    align-items: flex-start;
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .simple-merchant .result-actions {
    grid-template-columns: 1fr;
  }

  .simple-merchant .result-actions .primary-button {
    min-height: 50px;
    grid-row: 1;
    font-size: 13px;
  }

  #page-history .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  #page-history table,
  #page-history tbody,
  #page-history tr,
  #page-history td {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  #page-history table {
    table-layout: fixed;
  }

  #page-history thead {
    display: none;
  }

  #page-history tbody {
    display: grid;
    gap: 12px;
  }

  #page-history tr {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
  }

  #page-history td {
    padding: 5px 0;
    border: 0;
  }

  #page-history td:first-child {
    color: var(--muted);
    font-size: 10px;
  }

  #page-history td:nth-child(5) {
    display: none;
  }

  #page-history .cell-truncate {
    max-width: none;
    overflow: visible;
    line-height: 1.55;
    text-overflow: clip;
    white-space: normal;
  }

  #page-history .history-replies {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-top: 4px;
    padding: 9px;
    box-sizing: border-box;
    border-radius: 6px;
    background: var(--surface-soft);
  }

  #page-history .history-replies > span {
    width: 100%;
    min-width: 0;
    align-items: flex-start;
  }

  #page-history .history-replies > span > .cell-truncate {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #page-history .table-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  #page-history [data-history-copy],
  #page-history [data-history-detail] {
    width: auto;
    min-width: 112px;
    height: 44px;
    gap: 7px;
    padding: 0 14px;
  }

  #page-history .history-copy-label {
    display: inline;
    white-space: nowrap;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .filter-bar select {
    width: 100%;
  }

  .knowledge-item {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 13px;
  }

  .knowledge-type {
    width: 34px;
    height: 34px;
  }

  .knowledge-actions {
    grid-column: 2;
  }

  .balance-band {
    min-height: 140px;
    padding: 22px;
  }

  .usage-ring {
    width: 82px;
    height: 82px;
  }

  .usage-ring::before {
    width: 64px;
    height: 64px;
  }

  .monthly-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .monthly-price {
    width: 100%;
    justify-content: space-between;
  }

  .monthly-price .primary-button {
    min-width: 96px;
  }

  .admin-users .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-config-panel .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .prompt-library-panel .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-config-form {
    grid-template-columns: 1fr;
    padding: 15px;
  }

  .ai-endpoint-field {
    grid-column: auto;
  }

  .ai-config-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .prompt-library-stats {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .prompt-library-stats > span {
    padding: 12px;
  }

  .prompt-library-stats strong {
    font-size: 17px;
  }

  .prompt-library-toolbar {
    grid-template-columns: 1fr;
    padding: 13px 15px;
  }

  .prompt-template-item {
    grid-template-columns: 1fr;
    padding: 14px 15px;
  }

  .prompt-template-actions {
    justify-content: flex-end;
  }

  .admin-rag-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-rag-heading select {
    width: 100%;
  }

  .admin-rag-profile {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    padding: 15px;
  }

  .admin-rag-profile > button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .rag-score-block {
    min-width: 58px;
  }

  .admin-rag-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 13px 15px;
  }

  .admin-rag-toolbar > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .admin-rag-toolbar > .primary-button {
    width: 100%;
  }

  .rag-checklist-wrap {
    padding: 15px;
  }

  .rag-checklist {
    grid-template-columns: 1fr;
  }

  .rag-entry-heading {
    padding-right: 15px;
    padding-left: 15px;
  }

  .admin-rag-item {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 13px 15px;
  }

  .admin-rag-actions {
    grid-column: 2;
  }

  .compact-search {
    width: 100%;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: calc(100vh - 28px);
    border-radius: 8px 8px 0 0;
  }

  .profile-menu {
    top: 52px;
    right: 12px;
  }
}

@media (max-width: 390px) {
  .metric {
    padding: 14px 12px;
  }

  .metric-top {
    font-size: 10px;
  }

  .metric-top svg {
    display: none;
  }

  .captcha-row {
    grid-template-columns: 1fr 112px;
  }

  .captcha-box {
    width: 112px;
  }

  .business-profile {
    align-items: flex-start;
  }

  .business-profile .text-button span {
    display: none;
  }
}

.app-view:not(.hidden) .page-content {
  padding-bottom: 132px;
}

.app-contact-dock {
  position: fixed;
  z-index: 24;
  right: 0;
  bottom: 0;
  left: var(--sidebar);
  display: flex;
  align-items: center;
  min-height: 92px;
  gap: 20px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -8px 24px rgba(27, 49, 43, 0.07);
  backdrop-filter: blur(14px);
}

.app-contact-dock .contact-surface-heading {
  width: 220px;
  flex: 0 0 auto;
}

.app-contact-dock .contact-surface-heading > svg {
  color: var(--green);
}

.app-contact-dock .site-contact-links {
  flex: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: visible;
}

.app-contact-dock .site-contact-item {
  min-width: 0;
  border-color: var(--line);
  background: #f6f8f7;
}

.app-contact-dock .site-contact-item > svg {
  color: var(--green);
}

.app-contact-dock .contact-qr-button {
  color: var(--green-dark);
  background: var(--green-light);
}

.app-contact-dock.contact-dock-empty {
  min-height: 54px;
}

.site-settings-panel {
  margin: 16px 0;
}

.site-settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.site-settings-section {
  min-width: 0;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.site-settings-section + .site-settings-section {
  border-left: 1px solid var(--line);
}

.site-contact-fields,
.site-content-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.site-content-fields .field-wide {
  grid-column: 1 / -1;
}

.qr-editor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.qr-editor {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfb;
}

.qr-editor > span {
  font-size: 9px;
  font-weight: 700;
}

.qr-editor img {
  display: none;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px dashed var(--line);
  background: white;
}

.qr-editor img.has-image {
  display: block;
}

.qr-editor input[type="file"] {
  width: 100%;
  min-width: 0;
  padding: 6px;
  font-size: 8px;
}

.qr-editor .text-button {
  justify-content: flex-start;
  color: #9b493d;
  font-size: 9px;
}

.site-settings-approval {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.8fr) auto;
  align-items: end;
  gap: 12px;
  padding: 16px 18px 19px;
  border-top: 1px solid var(--line);
  background: #f8faf9;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-modal {
  width: min(1120px, calc(100vw - 36px));
}

.customer-modal-body {
  padding: 0;
}

.customer-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.customer-summary-grid article {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 15px 18px;
  border-right: 1px solid var(--line);
}

.customer-summary-grid article:last-child {
  border-right: 0;
}

.customer-summary-grid svg {
  width: 18px;
  color: var(--green);
}

.customer-summary-grid span {
  display: grid;
  gap: 2px;
}

.customer-summary-grid small {
  color: var(--muted);
  font-size: 9px;
}

.customer-summary-grid strong {
  font-size: 18px;
}

.customer-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customer-detail-grid > section {
  min-width: 0;
  min-height: 270px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.customer-detail-grid > section:nth-child(2n) {
  border-right: 0;
}

.customer-profile-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 0 18px 18px;
}

.customer-profile-list > div {
  min-width: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.customer-profile-list dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 8px;
}

.customer-profile-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 10px;
  font-weight: 650;
}

.customer-activity-list {
  max-height: 310px;
  overflow: auto;
}

.customer-activity-list article {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
}

.customer-activity-list article > svg {
  width: 15px;
  color: var(--green);
}

.customer-activity-list article > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.customer-activity-list strong,
.customer-activity-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-activity-list strong {
  font-size: 10px;
}

.customer-activity-list small {
  color: var(--muted);
  font-size: 8px;
}

.customer-activity-list b {
  font-size: 10px;
}

.customer-activity-list b.credit {
  color: var(--green-dark);
}

.customer-activity-list b.debit {
  color: #9b493d;
}

.customer-history-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 8px;
  padding: 0 18px 10px;
}

.customer-history-tools .search-field,
.customer-history-tools select {
  width: 100%;
}

.customer-history-entry small {
  white-space: normal;
  display: -webkit-box;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.compact-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-height: 46px;
  padding: 7px 14px;
  border-top: 1px solid var(--line);
}

.compact-pagination span {
  min-width: 46px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.customer-activity-empty {
  display: grid;
  min-height: 150px;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
}

.customer-activity-empty svg {
  width: 19px;
}

.contact-qr-modal .modal-body {
  display: grid;
  place-items: center;
}

.contact-qr-image {
  width: min(320px, 78vw);
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--line);
  background: white;
}

.one-time-secret {
  display: grid;
  gap: 10px;
}

.one-time-secret > span {
  color: var(--muted);
  font-size: 10px;
}

.one-time-secret code {
  display: block;
  overflow-wrap: anywhere;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green-dark);
  background: var(--green-light);
  font-size: 18px;
  font-weight: 800;
  user-select: all;
}

.security-notice {
  margin: 0;
  padding: 11px 12px;
  border-left: 3px solid var(--amber);
  color: var(--ink-soft);
  background: #fff8eb;
  font-size: 10px;
  line-height: 1.6;
}

@media (max-width: 1180px) {
  .app-contact-dock {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .app-contact-dock .contact-surface-heading {
    width: auto;
  }

  .app-contact-dock .site-contact-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-settings-form {
    grid-template-columns: 1fr;
  }

  .site-settings-section + .site-settings-section {
    border-left: 0;
  }

  .site-settings-approval {
    grid-template-columns: 1fr 1fr;
  }

  .site-settings-approval .primary-button {
    width: 100%;
  }
}

@media (min-width: 901px) and (max-height: 800px) {
  .auth-brand {
    padding-top: 30px;
    padding-bottom: 28px;
  }

  .auth-promise {
    margin-top: 72px;
    margin-bottom: 22px;
    flex-shrink: 0;
  }

  .auth-promise h1 {
    font-size: 46px;
    line-height: 1.1;
  }

  .auth-promise > p:last-child {
    margin-top: 15px;
    font-size: 14px;
    line-height: 1.65;
  }

  .auth-contact-panel {
    gap: 9px;
    padding-top: 15px;
  }

  .auth-panel {
    align-content: start;
    padding-top: 56px;
    padding-bottom: 20px;
    overflow-y: auto;
  }

  .auth-heading h2 {
    font-size: 27px;
  }

  .auth-heading p {
    margin-top: 6px;
  }

  .auth-tabs {
    margin-top: 19px;
    margin-bottom: 18px;
  }

  .auth-form {
    gap: 13px;
  }
}

@media (max-width: 760px) {
  .app-view:not(.hidden) .page-content {
    padding-bottom: 210px;
  }

  .app-contact-dock {
    left: 0;
    display: grid;
    width: auto;
    max-width: 100vw;
    min-width: 0;
    max-height: 42vh;
    gap: 7px;
    padding: 8px 10px 10px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-contact-dock .contact-surface-heading {
    width: auto;
  }

  .app-contact-dock .site-contact-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    gap: 7px;
  }

  .app-contact-dock .site-contact-item {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 58px;
    gap: 7px;
    padding: 7px 8px;
  }

  .app-contact-dock .site-contact-item > span {
    gap: 2px;
  }

  .app-contact-dock .contact-qr-button {
    width: 30px;
    height: 30px;
  }

  .qr-editor-grid,
  .site-contact-fields,
  .site-content-fields,
  .site-settings-approval,
  .customer-summary-grid,
  .customer-detail-grid,
  .history-detail-body,
  .history-meta-grid,
  .history-analysis-grid {
    grid-template-columns: 1fr;
  }

  .qr-editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-content-fields .field-wide,
  .site-settings-approval {
    grid-column: auto;
  }

  .customer-summary-grid article,
  .customer-detail-grid > section,
  .history-detail-body > section {
    border-right: 0;
  }

  .history-detail-body .history-detail-wide {
    grid-column: auto;
  }

  .history-structured-details {
    grid-column: auto;
  }

  .customer-history-tools {
    grid-template-columns: 1fr;
  }

  .pagination-bar {
    justify-content: space-between;
  }

  .customer-summary-grid article {
    border-bottom: 1px solid var(--line);
  }

  .customer-profile-list {
    grid-template-columns: 1fr;
  }

  .modal-header-actions .secondary-button span {
    display: none;
  }

  .auth-contact-panel .site-contact-links {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .auth-contact-panel .site-contact-item {
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .app-view:not(.hidden) .page-content {
    padding-bottom: 220px;
  }

  .app-contact-dock {
    max-height: 46vh;
  }
}

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