:root {
  font-family:"PingFang SC","Microsoft YaHei",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:#0d2a30;
  background:#fff;
  font-size:15px;
  --teal:#157284;
  --dark:#0d4f5a;
  --muted:#52666b;
  --line:#dce3e4;
  --soft:#f1f5f5;
  --chat-width:820px;
}
* {
  box-sizing:border-box;
}
[hidden] {
  display:none!important;
}
body {
  margin:0;
}
button,input,textarea,select {
  font:inherit;
}
button {
  cursor:pointer;
  color:var(--dark);
  background:var(--soft);
  border:1px solid transparent;
  border-radius:10px;
  min-height:42px;
  padding:10px 16px;
  transition:background .15s;
}
button:hover {
  background:#e1ecee;
}
button:disabled {
  opacity:.4;
  cursor:default;
}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible {
  outline:3px solid #5fa9b4;
  outline-offset:3px;
}
a {
  color:var(--teal);
}
main {
  height:100dvh;
  display:flex;
  flex-direction:column;
}
header {
  height:80px;
  padding:0 28px;
  display:flex;
  align-items:center;
  border-bottom:1px solid var(--line);
  flex-shrink:0;
  background:#fff;
  gap:14px;
}
.brand {
  display:flex;
  align-items:center;
  gap:12px;
  font-size:18px;
  font-weight:650;
  letter-spacing:.03em;
}
.brand img {
  width:34px;
  height:38px;
  object-fit:contain;
}
.brand small {
  display:block;
  font-size:10px;
  font-weight:400;
  color:var(--muted);
  letter-spacing:.1em;
  margin-top:4px;
}
.app-grid {
  display:flex;
  flex:1;
  min-height:0;
}
#sidebar {
  width:264px;
  padding:26px 16px 16px;
  flex-shrink:0;
  background:var(--soft);
  display:flex;
  flex-direction:column;
  border-right:1px solid #e6eded;
}
#new-chat {
  background:#fff;
  border:1px solid var(--line);
  text-align:left;
  color:var(--dark);
  box-shadow:0 2px 4px #0d2a3003;
}
#chat-list {
  flex:1;
  overflow:auto;
  margin-top:26px;
}
.chat-row {
  display:flex;
  align-items:center;
  border-radius:9px;
  margin-bottom:4px;
}
.chat-row:hover {
  background:#e3eded;
}
.chat-row button:first-child {
  flex:1;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  text-align:left;
  background:transparent;
  font-size:13px;
  font-weight:400;
  color:#33484d;
  padding:12px;
}
.remove-chat {
  padding:5px;
  background:transparent;
  color:#789095;
  min-height:32px;
  width:28px;
}
footer {
  position:relative;
  border-top:1px solid var(--line);
  padding-top:12px;
}
#profile-toggle {
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  background:transparent;
  padding:9px 5px;
  text-align:left;
  color:#33484d;
}
#profile {
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:13px;
}
.avatar {
  background:#dcebee;
  color:var(--teal);
  width:32px;
  height:32px;
  display:grid;
  place-items:center;
  border-radius:50%;
  flex-shrink:0;
}
.avatar svg {
  width:18px;
  height:18px;
}
.profile-dots {
  margin-left:auto;
  color:#789095;
}
#profile-panel {
  position:absolute;
  bottom:70px;
  left:0;
  width:280px;
  max-width:calc(100vw - 32px);
  padding:18px;
  background:white;
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:0 12px 42px #0d2a301f;
  z-index:30;
}
.profile-panel-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.profile-panel-heading button {
  background:transparent;
  padding:0;
  width:32px;
  min-height:32px;
  color:var(--muted);
  font-size:22px;
}
#profile-name {
  font-weight:600;
}
#profile-account,#permission-summary {
  font-size:12px;
  color:var(--muted);
  line-height:1.7;
}
footer nav {
  display:grid;
  gap:6px;
  border-top:1px solid var(--line);
  padding-top:12px;
}
footer nav button {
  background:transparent;
  text-align:left;
}
#logout {
  color:#a83426;
}
#workspace {
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  min-height:0;
}
.chat-heading {
  padding:22px 34px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-shrink:0;
}
.chat-heading h1 {
  font-size:14px;
  font-weight:500;
  color:var(--muted);
  margin:0;
}
#source-label {
  font-size:11px;
  color:#789095;
  display:flex;
  align-items:center;
  gap:6px;
}
#source-label:before {
  content:"";
  width:5px;
  height:5px;
  border-radius:50%;
  background:#4a9792;
}
#messages {
  flex:1;
  min-height:0;
  overflow-y:auto;
  padding:20px max(32px,calc((100% - var(--chat-width))/2));
  scrollbar-width:thin;
  scrollbar-color:#ccd9da transparent;
}
.welcome {
  min-height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:24px 0 50px;
}
.welcome>img {
  width:52px;
  height:57px;
  object-fit:contain;
  margin-bottom:14px;
}
.welcome-eyebrow {
  font-size:11px;
  color:var(--teal);
  letter-spacing:.16em;
}
.welcome h2 {
  font-size:clamp(21px,2.1vw,29px);
  font-weight:600;
  letter-spacing:-.03em;
  line-height:1.6;
  margin:10px 0;
}
.welcome>p:last-of-type {
  font-size:13px;
  line-height:1.8;
  color:var(--muted);
}
.welcome-tips {
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:10px;
  margin-top:24px;
}
.welcome-tips button {
  font-size:12px;
  border:1px solid var(--line);
  background:#fff;
  border-radius:24px;
  padding:9px 18px;
  min-height:36px;
}
.welcome-tips button:hover {
  background:var(--soft);
  border-color:#b6d2d6;
}
.message {
  line-height:1.85;
  margin:12px 0 32px;
  overflow-wrap:anywhere;
}
.message>strong {
  display:block;
  color:var(--teal);
  font-size:12px;
  font-weight:600;
  margin-bottom:8px;
}
.message.user {
  width:fit-content;
  max-width:85%;
  margin-left:auto;
  background:#e9f1f2;
  border:1px solid #e0ebed;
  border-radius:22px 22px 5px 22px;
  padding:13px 20px;
}
.message.user>strong {
  display:none;
}
.message-content {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.message.assistant {
  padding:8px 0;
}
.sent-attachment {
  display:flex;
  gap:10px;
  align-items:center;
  border:1px solid #c9dadd;
  border-radius:12px;
  background:#fff;
  padding:12px;
  font-size:12px;
  text-decoration:none;
  margin-top:10px;
}
.sent-attachment svg {
  width:24px;
  flex-shrink:0;
}
.composer-wrap {
  width:calc(100% - 64px);
  max-width:var(--chat-width);
  margin:0 auto 16px;
  flex-shrink:0;
}
.composer-feedback {
  font-size:12px;
  line-height:1.65;
  max-height:120px;
  overflow-y:auto;
  padding:0 10px;
  color:var(--muted);
}
.composer-feedback p {
  margin:8px 0;
}
#chat-status:empty,#chat-notice:empty {
  display:none;
}
#chat-notice {
  color:#a83426;
  padding:8px 0;
}
#notice:empty {
  display:none;
}
#notice {
  margin:0;
  padding:12px 28px;
  color:#a83426;
  font-size:13px;
  background:#fff7f4;
}
#chat-form {
  margin:0;
}
.composer-box {
  border:1px solid #c9dadd;
  border-radius:24px;
  padding:14px 14px 10px;
  background:#fff;
  box-shadow:0 4px 24px #0d2a3008;
}
.composer-box:focus-within {
  border-color:#7baeb7;
  box-shadow:0 4px 24px #0d2a3008,0 0 0 2px #1572840a;
}
textarea {
  font:inherit;
  display:block;
  width:100%;
  resize:vertical;
  line-height:1.7;
  padding:12px;
  border:1px solid var(--line);
  border-radius:10px;
}
#prompt {
  min-height:64px;
  max-height:min(180px, 20dvh);
  resize:none;
  overflow-y:auto;
  border:0;
  border-radius:0;
  padding:5px 8px;
  background:transparent;
  color:#0d2a30;
  outline:none;
}
#prompt::placeholder {
  color:#8a9a9e;
}
.composer-actions {
  display:flex;
  align-items:center;
  gap:8px;
  padding-top:10px;
}
.composer-spacer {
  flex:1;
}
.icon-button {
  width:40px;
  height:40px;
  min-height:40px;
  padding:9px;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:transparent;
  color:var(--muted);
}
.icon-button svg {
  width:22px;
  height:22px;
}
.icon-button.primary {
  background:var(--teal);
  color:#fff;
}
.icon-button.primary:hover {
  background:var(--dark);
}
.recording {
  background:#faece9;
  color:#b82105;
}
.composer-hint {
  display:block;
  text-align:center;
  color:#8a9a9e;
  font-size:10px;
  margin-top:12px;
}
#attachments {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  max-height:min(240px, 28dvh);
  overflow:auto;
}
#attachments:empty {
  display:none;
}
.attachment {
  position:relative;
  max-width:100%;
  min-width:130px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--soft);
}
.attachment summary {
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:16px 30px 12px 14px;
  cursor:pointer;
  list-style:none;
  max-width:180px;
}
.attachment summary::-webkit-details-marker {
  display:none;
}
.attachment summary>svg {
  color:var(--teal);
  width:30px;
  height:30px;
}
.attachment-name {
  font-size:12px;
  max-width:100%;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.attachment-remove {
  position:absolute;
  top:4px;
  right:4px;
  padding:5px;
  min-height:26px;
  width:26px;
  background:transparent;
}
.attachment-remove svg {
  width:14px;
  height:14px;
}
.attachment:has(details[open]) {
  width:100%;
}
.attachment-detail {
  padding:0 14px 14px;
}
.attachment-detail p,.attachment-detail small {
  font-size:12px;
  color:var(--muted);
  line-height:1.7;
}
.attachment-detail textarea {
  margin-top:8px;
  max-height:min(180px, 20dvh);
}
.attachment-preview {
  max-width:100%;
  max-height:140px;
  object-fit:contain;
}
.result-card {
  font-size:12px;
  border:1px solid var(--line);
  border-radius:12px;
  margin:16px 0;
  padding:14px;
  color:var(--muted);
  max-width:100%;
  overflow:hidden;
}
.result-card summary {
  cursor:pointer;
}
.result-card pre {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.result-card>div {
  overflow-x:auto;
}
.result-card svg {
  width:100%;
  min-width:400px;
  font-family:inherit;
  font-size:13px;
}
.result-card>a,.result-card>button {
  display:inline-block;
  margin:10px 12px 0 0;
}
table {
  width:100%;
  border-collapse:collapse;
  margin-top:22px;
  white-space:nowrap;
}
th,td {
  text-align:left;
  border-bottom:1px solid var(--line);
  padding:14px 10px;
}
td button {
  padding:7px 12px;
  margin-right:8px;
}
.table-wrap {
  overflow-x:auto;
}
#users {
  flex:1;
  min-width:0;
  padding:32px;
  overflow:auto;
}
h1 {
  font-size:24px;
}
h2 {
  font-size:20px;
}
label {
  display:block;
  margin:18px 0;
}
input:not([type=checkbox]),select {
  display:block;
  width:100%;
  padding:11px;
  border:1px solid #bdced1;
  border-radius:8px;
  font:inherit;
  margin-top:8px;
}
.check {
  display:flex;
  align-items:center;
  gap:10px;
  font-size:12px;
  color:var(--muted);
}
dialog {
  border:1px solid var(--line);
  border-radius:18px;
  padding:24px;
  width:min(480px,95vw);
  max-height:90dvh;
  overflow:auto;
}
dialog::backdrop {
  background:#0d2a3055;
}
.actions {
  display:flex;
  gap:12px;
}
#form-notice {
  color:#a83426;
}
small {
  font-size:12px;
  color:var(--muted);
}
#login {
  width:min(880px,calc(100% - 40px));
  display:grid;
  grid-template-columns:1fr 1fr;
  margin:auto;
  border:1px solid var(--line);
  border-radius:24px;
  overflow:hidden;
  box-shadow:0 24px 80px #0d2a300a;
}
.login-banner {
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  padding:36px;
  color:#fff;
  background:linear-gradient(0deg,#08292ef5,#08292e20),url('/haohai/assets/haohai-factory.jpg') center/cover;
}
.login-banner>span {
  font-size:10px;
  letter-spacing:.18em;
}
.login-banner h2 {
  font-size:29px;
  line-height:1.6;
  margin-bottom:0;
}
.login-banner p {
  font-size:13px;
  color:#c9dadd;
  line-height:1.7;
}
.login-body {
  padding:36px;
}
.login-body>p {
  font-size:13px;
  color:var(--muted);
}
#login-form>button {
  width:100%;
  background:var(--teal);
  color:white;
}
.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}
#toggle-sessions {
  display:none;
}
#drawer-backdrop {
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  background:#0d2a3055;
  z-index:20;
  border-radius:0;
}
@media(min-width:1600px) {
  :root {
    --chat-width:880px;
  }
}
@media(max-width:900px) {
  #sidebar {
    width:230px;
    padding:20px 12px 14px;
  }
  .chat-heading {
    padding:20px 24px;
  }
  .composer-wrap {
    width:calc(100% - 40px);
  }
  #messages {
    padding:20px max(20px,calc((100% - var(--chat-width))/2));
  }
  .chat-heading h1 {
    display:none;
  }
}
@media(max-width:700px) {
  header {
    height:68px;
    padding:0 18px;
  }
  .brand {
    font-size:15px;
    gap:10px;
  }
  .brand img {
    width:28px;
    height:31px;
  }
  .brand small {
    font-size:8px;
  }
  #toggle-sessions {
    display:block;
    padding:8px 10px;
    background:transparent;
    font-size:13px;
  }
  #sidebar {
    position:fixed;
    left:0;
    top:0;
    bottom:0;
    width:280px;
    height:100dvh;
    z-index:21;
    padding:24px 16px;
    transform:translateX(-105%);
    visibility:hidden;
    transition:transform .15s;
  }
  body.drawer-open #sidebar {
    transform:translateX(0);
    visibility:visible;
  }
  .chat-heading {
    padding:16px 20px 4px;
    min-height:34px;
  }
  #source-label {
    font-size:10px;
  }
  #messages {
    padding:14px;
  }
  .message.user {
    max-width:90%;
    padding:11px 16px;
  }
  .message {
    font-size:14px;
  }
  .composer-wrap {
    width:calc(100% - 28px);
    margin-bottom:max(12px,env(safe-area-inset-bottom));
  }
  .composer-box {
    border-radius:22px;
    padding:12px 10px 8px;
  }
  .composer-hint {
    font-size:9px;
    margin-top:9px;
  }
  .welcome {
    padding:16px 12px 30px;
  }
  .welcome h2 {
    font-size:23px;
    max-width:270px;
  }
  .welcome>p:last-of-type {
    font-size:12px;
  }
  .welcome-tips {
    gap:7px;
    margin-top:18px;
  }
  .welcome-tips button {
    font-size:11px;
    padding:8px 12px;
  }
  .welcome>img {
    width:42px;
    height:46px;
  }
  #users {
    padding:24px 18px;
  }
  #login {
    width:calc(100% - 32px);
    grid-template-columns:1fr;
    margin:24px auto;
    overflow-y:auto;
  }
  .login-banner {
    min-height:155px;
    padding:22px 26px;
  }
  .login-banner h2 {
    font-size:24px;
    margin:10px 0 0;
  }
  .login-banner p {
    margin-bottom:0;
  }
  .login-body {
    padding:24px 26px;
  }
  #profile-panel {
    width:248px;
  }
  .attachment summary {
    max-width:145px;
  }
}
@media(prefers-reduced-motion:reduce) {
  * {
    transition:none!important;
    scroll-behavior:auto!important;
  }
}
/* The logged-out page has no workspace; let the login card center vertically. */
main:has(#login:not([hidden])) .app-grid {
  display: none;
}
