:root {
  color-scheme: light;
  --ink: #1d2b31;
  --ink-soft: #53636a;
  --muted: #7a898e;
  --line: #e1e7e5;
  --paper: #f4f6f3;
  --card: #ffffff;
  --navy: #18313a;
  --teal: #187b74;
  --teal-dark: #12645f;
  --teal-light: #e6f3f0;
  --gold: #c99344;
  --red: #ad4438;
  --red-light: #fff0ed;
  --shadow: 0 18px 50px rgba(28, 51, 57, .08);
  --radius: 16px;
  --sst-widget-bottom: 22px;
  --sst-widget-right: 22px;
  --chaty-pro-bottom: 92px;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-size: 14px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; letter-spacing: -.035em; }
h2 { margin-bottom: 4px; font-size: 17px; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 7px; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.small-note { margin: 18px 0 0; color: var(--muted); font-size: 11px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(ellipse at 18% 10%, rgba(201,147,68,.16), transparent 35%), linear-gradient(140deg,#eef3ef,#e4ece8); }
.login-card { width: min(100%, 440px); padding: 42px; border: 1px solid rgba(255,255,255,.8); border-radius: 22px; background: rgba(255,255,255,.94); box-shadow: 0 28px 85px rgba(26,52,54,.13); }
.login-card h1 { margin: 6px 0 10px; font-size: 26px; }
.login-card > .muted { margin-bottom: 28px; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--teal); color: #fff; font-family: Georgia,serif; font-size: 25px; font-weight: 700; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
label { display: grid; gap: 7px; margin: 14px 0; color: #46555b; font-size: 12px; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #d8e0de; border-radius: 9px; background: #fff; color: var(--ink); outline: none; transition: border-color .16s, box-shadow .16s; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #57a69b; box-shadow: 0 0 0 3px rgba(24,123,116,.11); }
.form-error { margin: 12px 0 0; color: var(--red); font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 25px 16px 18px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 24px; }
.brand .brand-mark { width: 38px; height: 38px; background: #238b80; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 3px; color: #a9babd; font-size: 10px; }
.site-mini-state { margin: 0 7px 20px; padding: 11px 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: rgba(255,255,255,.055); color: #c9d6d6; font-size: 11px; }
.main-nav { display: grid; gap: 4px; }
.nav-item { min-height: 42px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: #bfd0d1; text-align: left; font-size: 12px; transition: background .15s,color .15s; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.11); color: #fff; }
.nav-item.active { box-shadow: inset 3px 0 0 #57c1ae; }
.sidebar-foot { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; margin-top: auto; padding: 13px 8px 0; border-top: 1px solid rgba(255,255,255,.12); color: #b6c6c6; font-size: 10px; }
.sidebar-foot a { color: #83d1c0; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #52c89a; box-shadow: 0 0 0 3px rgba(82,200,154,.14); }
.main-column { min-width: 0; max-width: 1580px; width: 100%; padding: 0 38px 32px; }
.topbar { display: flex; min-height: 104px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.topbar .eyebrow { margin-bottom: 2px; color: #869498; }
.topbar h1 { font-size: 23px; }
.user-tools { display: flex; align-items: center; gap: 15px; }
.env-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid #cfe4dc; border-radius: 999px; background: #f0f8f3; color: #287660; font-size: 10px; font-weight: 700; white-space: nowrap; }
.signed-in-user { color: var(--ink-soft); font-size: 12px; }
.button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 8px; padding: 8px 13px; border: 1px solid transparent; border-radius: 9px; font-size: 11px; font-weight: 750; transition: transform .12s,background .15s,border-color .15s; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover { background: var(--teal-dark); }
.button-secondary { border-color: #cadbd7; background: #fff; color: #22685f; }
.button-secondary:hover { border-color: #85b5aa; background: #f0f8f5; }
.button-quiet { background: transparent; color: var(--ink-soft); }
.button-quiet:hover { background: #eaf0ed; }
.button-light { background: #fff; color: var(--teal-dark); }
.button-light:hover { background: #e8f5f1; }
.button-danger { border-color: #f0c7c1; background: var(--red-light); color: var(--red); }
.button-wide { width: 100%; min-height: 45px; margin-top: 11px; }
.button:disabled { cursor: not-allowed; opacity: .45; }
.notice { position: sticky; z-index: 5; top: 8px; margin: 14px 0 0; padding: 11px 14px; border: 1px solid #cde0d9; border-radius: 10px; background: #eff8f2; color: #236c58; font-size: 12px; box-shadow: var(--shadow); }
.notice.error { border-color: #efc9c4; background: #fff0ed; color: #a83e35; }
.view-panel { padding-top: 25px; }
.welcome-card { display: flex; min-height: 193px; align-items: center; justify-content: space-between; gap: 28px; padding: 28px 32px; border-radius: var(--radius); background: linear-gradient(120deg,#19373e,#24625e 68%,#4b8673); color: #fff; box-shadow: var(--shadow); }
.welcome-card .eyebrow { color: #9ee0ce; }
.welcome-card h2 { margin-bottom: 10px; font-size: 25px; }
.welcome-card p:not(.eyebrow) { max-width: 690px; margin-bottom: 0; color: #d0e2dd; font-size: 12px; }
.welcome-card .button { flex: 0 0 auto; }
.stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin: 18px 0; }
.stat-card { min-height: 108px; padding: 18px 19px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); box-shadow: 0 7px 20px rgba(26,50,54,.025); }
.stat-card .stat-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.stat-card strong { display: block; margin: 8px 0 1px; font-size: 24px; letter-spacing: -.04em; }
.stat-card small { color: var(--muted); font-size: 10px; }
.two-column { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(270px,.75fr); gap: 15px; margin-bottom: 15px; }
.panel-card { min-width: 0; margin-bottom: 15px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: 0 7px 20px rgba(26,50,54,.025); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel-heading > div:first-child { min-width: 0; }
.panel-heading p.muted { margin: 5px 0 0; font-size: 11px; }
.stack-list { display: grid; gap: 9px; }
.stack-item { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #e9eeec; border-radius: 10px; background: #fbfcfb; }
.stack-item strong, .stack-item small { display: block; }
.stack-item strong { font-size: 11px; }
.stack-item small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border: 1px solid #d8e6e1; border-radius: 999px; background: #eff7f3; color: #2a7563; font-size: 9px; font-weight: 800; white-space: nowrap; }
.badge.warn { border-color: #efd8b8; background: #fff7e9; color: #95621d; }
.badge.danger { border-color: #efd0cc; background: #fff2ef; color: #a53b34; }
.badge.neutral { border-color: #e0e5e3; background: #f3f5f4; color: #66767a; }
.site-summary { display: grid; gap: 10px; }
.site-summary-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px; border: 1px solid #e9eeec; border-radius: 10px; }
.site-summary-row strong, .site-summary-row small { display: block; }
.site-summary-row small { color: var(--muted); font-size: 10px; }
.table-wrap { max-width: 100%; overflow: auto; border: 1px solid #e8edeb; border-radius: 11px; }
table { width: 100%; min-width: 620px; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 12px; border-bottom: 1px solid #edf0ef; vertical-align: middle; }
th { background: #f6f8f6; color: #7b898c; font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
td { color: #405056; font-size: 11px; }
tbody tr:last-child td { border-bottom: 0; }
.table-primary { color: var(--ink); font-weight: 750; }
.table-secondary { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.table-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.table-actions .button { min-height: 30px; padding: 5px 8px; font-size: 9px; }
.empty-state { padding: 22px; color: var(--muted); text-align: center; font-size: 11px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.conversation-card { margin-top: 15px; }
.message-history { display: grid; max-height: 380px; gap: 9px; overflow-y: auto; padding: 14px; border: 1px solid #e9eeec; border-radius: 12px; background: #f7f9f7; }
.message { max-width: min(82%,760px); justify-self: start; padding: 10px 12px; border: 1px solid #e2e9e5; border-radius: 12px 12px 12px 3px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
.message.visitor { justify-self: end; border-color: #d1e6df; border-radius: 12px 12px 3px 12px; background: #eaf6f2; }
.message-meta { display: block; margin-bottom: 4px; color: #819092; font-size: 9px; }
.composer { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 11px; margin-top: 14px; }
.composer label { margin: 0; }
.upload-form, .account-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 0 0 17px; padding: 15px; border: 1px dashed #cbd9d5; border-radius: 12px; background: #f8faf8; }
.upload-form label, .account-form label { flex: 1 1 180px; margin: 0; }
.upload-form input[type=file] { min-height: 39px; padding: 6px; font-size: 10px; }
.site-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.site-control-card { padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfb; }
.site-control-card h3 { margin: 0 0 5px; font-size: 14px; }
.site-control-card .origin { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.switch { position: relative; display: inline-flex; width: 43px; height: 24px; flex: 0 0 auto; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { width: 43px; height: 24px; border-radius: 99px; background: #cbd4d1; transition: background .16s; }
.switch-track::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #58676144; content: ""; transition: transform .16s; }
.switch input:checked + .switch-track { background: var(--teal); }
.switch input:checked + .switch-track::after { transform: translateX(19px); }
.switch input:focus-visible + .switch-track { outline: 3px solid #8ac8bd; outline-offset: 3px; }
.json-box { max-width: 480px; max-height: 180px; overflow: auto; padding: 8px 10px; border-radius: 7px; background: #f2f5f3; color: #52636a; font: 10px/1.5 Consolas,monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.page-footer { padding: 20px 4px 0; color: #96a1a3; text-align: center; font-size: 9px; }

.demo-page { min-height: 100vh; padding: 0 0 50px; background: linear-gradient(140deg,#eff4f2,#f9faf8 50%,#e6eeeb); --sst-widget-bottom: 22px; --sst-widget-right: 22px; --chaty-pro-bottom: 96px; }
.demo-header { display: flex; min-height: 78px; align-items: center; justify-content: space-between; padding: 0 max(22px,calc((100% - 1100px)/2)); border-bottom: 1px solid #e1e9e5; background: rgba(255,255,255,.82); }
.demo-header .brand { padding: 0; color: var(--ink); }
.demo-content { max-width: 980px; margin: 64px auto; padding: 0 26px; }
.demo-content h1 { max-width: 760px; margin-bottom: 15px; font-size: clamp(32px,5vw,52px); line-height: 1.12; }
.demo-content > p { max-width: 700px; color: var(--ink-soft); font-size: 15px; }
.demo-facts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-top: 36px; }
.demo-fact { padding: 18px; border: 1px solid #e0e9e5; border-radius: 12px; background: rgba(255,255,255,.75); }
.demo-fact strong { display: block; margin-bottom: 5px; font-size: 12px; }
.demo-fact span { color: var(--muted); font-size: 11px; }
.demo-spacer { max-width: 760px; margin-top: 24px; }
#chaty-pro-sim { position: fixed; z-index: 30; right: 22px; bottom: var(--chaty-pro-bottom); width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: #5477cc; color: white; box-shadow: 0 6px 22px #31477533; font-size: 15px; font-weight: 800; }
.sst-widget-host { position: fixed; z-index: 40; right: var(--sst-widget-right); bottom: var(--sst-widget-bottom); font-family: inherit; }
.sst-widget-toggle { display: grid; width: 58px; height: 58px; place-items: center; border: 3px solid rgba(255,255,255,.72); border-radius: 50%; background: var(--teal); color: #fff; box-shadow: 0 10px 28px rgba(15,78,73,.28); font-size: 11px; font-weight: 800; }
.sst-widget-panel { position: absolute; right: 0; bottom: 72px; display: flex; width: min(360px,calc(100vw - 30px)); height: min(500px,calc(100vh - 130px)); flex-direction: column; overflow: hidden; border: 1px solid #dce7e3; border-radius: 17px; background: #fff; box-shadow: 0 18px 55px rgba(18,49,53,.22); }
.sst-widget-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 15px; background: var(--navy); color: #fff; }
.sst-widget-head strong, .sst-widget-head small { display: block; }
.sst-widget-head strong { font-size: 12px; }
.sst-widget-head small { margin-top: 2px; color: #bdd0cd; font-size: 9px; }
.sst-widget-close { border: 0; background: transparent; color: #fff; font-size: 20px; }
.sst-widget-messages { display: flex; flex: 1; flex-direction: column; gap: 8px; overflow-y: auto; padding: 14px; background: #f5f8f6; }
.sst-widget-message { max-width: 88%; align-self: flex-start; padding: 9px 11px; border: 1px solid #e3eae6; border-radius: 11px 11px 11px 3px; background: #fff; color: #405056; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
.sst-widget-message.visitor { align-self: flex-end; border-color: #d4e8e1; border-radius: 11px 11px 3px 11px; background: #e9f5f0; }
.sst-widget-composer { display: grid; grid-template-columns: 1fr 42px; gap: 7px; padding: 10px; border-top: 1px solid #e7ece9; background: #fff; }
.sst-widget-composer input { min-height: 40px; border-radius: 8px; font-size: 11px; }
.sst-widget-composer button { border: 0; border-radius: 8px; background: var(--teal); color: #fff; font-weight: 800; }
.sst-widget-caption { padding: 0 12px 8px; color: #899598; font-size: 8px; text-align: center; }
.sst-widget-consent { padding: 10px 12px; border-top: 1px solid #e7ece9; background: #f7faf8; color: #344b4b; font-size: 10px; line-height: 1.55; }
.sst-widget-consent[hidden] { display: none; }
.sst-widget-consent p { margin: 4px 0 7px; }
.sst-widget-consent input { width: auto; min-height: 0; vertical-align: middle; }
.sst-widget-consent label { margin-left: 5px; }
.sst-widget-consent-actions { display: flex; gap: 7px; margin-top: 8px; }
.sst-widget-consent-actions button { min-height: 34px; border: 1px solid #bfd1cb; border-radius: 7px; background: #fff; color: #193c3b; font-size: 9px; font-weight: 700; }
.sst-widget-consent-actions .sst-widget-consent-accept { background: var(--teal); border-color: var(--teal); color: #fff; }
.knowledge-scope-select { min-height: 32px; max-width: 155px; font-size: 10px; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 218px minmax(0,1fr); }
  .main-column { padding-right: 24px; padding-left: 24px; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: relative; height: auto; padding: 13px 14px 8px; }
  .brand { padding: 0 2px 11px; }
  .site-mini-state { display: none; }
  .main-nav { display: flex; gap: 5px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: thin; }
  .nav-item { min-width: max-content; min-height: 36px; padding: 0 11px; text-align: center; }
  .nav-item.active { box-shadow: inset 0 -2px 0 #57c1ae; }
  .sidebar-foot { display: none; }
  .main-column { padding: 0 16px 26px; }
  .topbar { min-height: 83px; }
  .topbar h1 { font-size: 19px; }
  .user-tools { gap: 7px; }
  .env-pill { padding: 6px 7px; font-size: 9px; }
  .signed-in-user { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
  .topbar .button { min-height: 34px; padding: 6px 8px; }
  .view-panel { padding-top: 17px; }
  .welcome-card { min-height: auto; flex-direction: column; align-items: flex-start; padding: 22px; }
  .welcome-card h2 { font-size: 20px; }
  .stat-grid { gap: 9px; margin: 12px 0; }
  .stat-card { min-height: 95px; padding: 14px; }
  .stat-card strong { font-size: 21px; }
  .two-column { grid-template-columns: 1fr; gap: 0; }
  .panel-card { padding: 15px; }
  .panel-heading { align-items: flex-start; }
  .panel-heading > .button { flex: 0 0 auto; }
  .site-controls { grid-template-columns: 1fr; }
  .composer { grid-template-columns: 1fr; }
  .composer .button { justify-self: end; }
  .demo-header { min-height: 66px; padding: 0 17px; }
  .demo-content { margin: 42px auto; padding: 0 20px; }
  .demo-facts { grid-template-columns: 1fr; gap: 8px; margin-top: 23px; }
  .demo-page { --sst-widget-right: 15px; --sst-widget-bottom: 17px; --chaty-pro-bottom: 86px; }
  #chaty-pro-sim { right: 15px; }
  .sst-widget-host { right: var(--sst-widget-right); bottom: var(--sst-widget-bottom); }
  .sst-widget-panel { right: 0; bottom: 68px; width: min(360px,calc(100vw - 46px)); height: min(480px,calc(100vh - 118px)); }
}
@media (max-width: 420px) {
  .login-card { padding: 27px 22px; }
  .topbar { align-items: flex-start; padding: 15px 0; }
  .topbar h1 { font-size: 17px; }
  .env-pill { display: none; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stat-card { padding: 12px; }
  .panel-heading { gap: 6px; }
  .panel-heading .button { padding: 6px 7px; }
}
