@font-face {
  font-family: Sora;
  src: url("./assets/sora-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("./assets/geist-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --base: #242933;
  --surface: #2e3440;
  --border: #4c566a;
  --text: #eceff4;
  --muted: #a8b2c2;
  --secondary: #d8dee9;
  --elevated: #3b4252;
  --frost-cyan: #8fbcbb;
  --frost: #88c0d0;
  --error: #f2b6bd;
  font-family: Sora, system-ui, sans-serif;
  background: var(--base);
  color: var(--text);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.7;
}
a {
  color: var(--muted);
  text-underline-offset: 5px;
}
a:hover {
  color: var(--frost);
}
button,
input {
  font: inherit;
}
button,
a,
input {
  outline-offset: 5px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--frost);
}
::selection {
  color: var(--base);
  background: var(--frost);
}
* {
  scrollbar-color: var(--border) var(--base);
}
[hidden] {
  display: none !important;
}
.skip {
  position: absolute;
  top: -90px;
  padding: 12px;
  background: var(--surface);
  z-index: 2;
}
.skip:focus {
  top: 8px;
}
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  padding: 0 max(24px, calc((100vw - 1104px) / 2));
  border-bottom: 1px solid #3b4252;
  gap: 20px;
}
.brand {
  text-decoration: none;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}
.brand span {
  color: var(--frost);
}
.site-header > a:last-child {
  font-size: 13px;
}
main {
  width: min(1104px, 100% - 48px);
  margin: 0 auto;
  flex: 1;
  padding: 58px 0 72px;
}
.entry {
  max-width: 440px;
  margin: 30px auto 72px;
}
h1 {
  font-size: clamp(32px, 4.5vw, 48px);
  line-height: 1.18;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 0 0 22px;
  text-wrap: balance;
}
h2 {
  font-size: 22px;
  line-height: 1.4;
  letter-spacing: -0.025em;
  font-weight: 550;
  margin: 0 0 10px;
}
p {
  color: var(--muted);
  margin: 0 0 24px;
  max-width: 65ch;
}
form {
  margin-top: 30px;
}
label {
  display: block;
  margin: 21px 0 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--secondary);
}
input {
  width: 100%;
  height: 50px;
  background: var(--elevated);
  border: 1px solid #81a1c1;
  border-radius: 2px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  caret-color: var(--frost);
}
input::placeholder {
  color: var(--muted);
}
button {
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid rgb(136 192 208 / 40%);
  border-radius: 2px;
  background: transparent;
  color: var(--frost);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
button:hover {
  background: rgb(136 192 208 / 10%);
  border-color: var(--frost);
}
button:disabled {
  opacity: 0.65;
  cursor: wait;
}
.primary {
  color: var(--base);
  background: var(--frost);
  border-color: var(--frost);
  font-weight: 600;
}
.primary:hover {
  background: var(--frost-cyan);
  border-color: var(--frost-cyan);
}
.entry button.primary {
  width: 100%;
  margin: 26px 0 12px;
}
.help {
  font-size: 13px;
  margin-top: 26px;
}
.field-help {
  font-size: 12px;
  margin: 9px 0 0;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 46px;
}
.page-heading h1 {
  font-size: 36px;
}
.page-heading p {
  margin: 0;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.create-account {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  padding: 30px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.create-account p {
  margin: 0;
  font-size: 14px;
}
.create-account form {
  margin: 0;
}
.create-account label {
  margin-top: 0;
}
.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
}
.inline-form button {
  white-space: nowrap;
  min-height: 50px;
}
.credential {
  background: var(--surface);
  border-radius: 4px;
  padding: 26px;
  margin: 26px 0;
}
.credential p {
  font-size: 14px;
}
dl {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px;
  margin: 20px 0;
}
dt {
  font-size: 13px;
  color: var(--muted);
}
dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: "Geist Mono", ui-monospace, monospace;
}
.account-list {
  margin: 40px 0;
}
.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.list-heading h2 {
  margin: 0;
}
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #3b4252;
  padding: 20px 0;
}
.user-row strong {
  display: block;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.user-row p {
  margin: 3px 0 0;
  font-size: 12px;
}
.user-row .actions {
  justify-content: flex-end;
}
.user-row button {
  font-size: 12px;
}
.availability {
  margin-top: 54px;
  max-width: 680px;
}
.availability h2 {
  font-size: 20px;
}
.availability p {
  font-size: 14px;
}
.notice,
#notice {
  border-radius: 2px;
  padding: 15px 18px;
  background: var(--surface);
  color: var(--text);
  margin: 0 auto 30px;
  max-width: 700px;
}
#notice.error {
  color: var(--error);
}
#list-status {
  font-size: 14px;
}
footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #3b4252;
  color: var(--muted);
  font-size: 12px;
  padding: 22px max(24px, calc((100vw - 1104px) / 2));
  gap: 20px;
}
@media (max-width: 700px) {
  .site-header {
    padding: 0 24px;
  }
  main {
    padding-top: 32px;
  }
  .entry {
    margin: 20px auto 40px;
  }
  h1 {
    font-size: 36px;
  }
  .page-heading {
    display: block;
    margin-bottom: 30px;
  }
  .page-heading .actions {
    margin-top: 22px;
  }
  .create-account {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .user-row {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }
  .user-row .actions {
    justify-content: flex-start;
  }
  dl {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  dd {
    margin-bottom: 10px;
  }
  .credential {
    padding: 22px;
  }
  footer span {
    display: none;
  }
}
@media (max-width: 380px) {
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

textarea { font: inherit; outline-offset: 5px; width: 100%; resize: vertical; min-height: 96px; max-height: 280px; background: var(--surface); color: var(--text); border: 1px solid #81a1c1; border-radius: 2px; padding: 14px 16px; caret-color: var(--frost); }
textarea:focus-visible { outline: 2px solid var(--frost); }
textarea::placeholder { color: var(--muted); }
.chat-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 36px; border-top: 1px solid var(--border); min-height: 65dvh; }
.chat-sidebar { padding: 26px 22px 0 0; border-right: 1px solid var(--border); }
.chat-sidebar > button { width: 100%; }
.history-heading { margin: 30px 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-heading h2 { font-size: 15px; margin: 0; }
.history-heading button { font-size: 12px; padding: 8px; border-color: transparent; }
#history-status { font-size: 12px; margin-bottom: 12px; }
#conversations { display: flex; flex-direction: column; gap: 4px; max-height: 55dvh; overflow-y: auto; padding: 6px; margin: -6px; }
#conversations button { text-align: left; border-color: transparent; color: var(--secondary); padding: 10px 12px; overflow-wrap: anywhere; font-size: 13px; }
#conversations button[aria-current="true"] { color: var(--frost); background: var(--surface); border-color: var(--border); }
.chat-main { min-width: 0; padding-top: 22px; }
.chat-mode main { padding: 28px 0; }
.chat-mode .page-heading { margin-bottom: 24px; }
.chat-mode .page-heading h1 { font-size: 28px; margin-bottom: 8px; }
.chat-mode .page-heading p { font-size: 12px; }
.chat-mode footer { display: none; }
.chat-main { display: flex; flex-direction: column; height: calc(100dvh - 220px); min-height: 430px; }
.chat-sidebar details { margin-top: 24px; }
.chat-sidebar summary { cursor: pointer; color: var(--secondary); font-size: 14px; padding: 10px 0; min-height: 44px; }
.chat-sidebar summary:focus-visible, #messages:focus-visible { outline: 2px solid var(--frost); outline-offset: 3px; }
.chat-sidebar .history-heading { margin-top: 0; }
.chat-heading { flex-shrink: 0; }
#messages { overflow-y: auto; flex: 1; min-height: 100px; padding-right: 12px; }
#chat-empty { flex: 1; }
#composer { flex-shrink: 0; }
#latest-message { align-self: flex-end; font-size: 12px; padding: 6px 12px; }
.chat-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.chat-heading h2 { font-size: 18px; overflow-wrap: anywhere; margin: 0; }
.chat-heading button { padding: 8px 12px; font-size: 12px; }
#chat-empty { padding: 90px 0 65px; max-width: 530px; }
#chat-empty h3 { font-size: clamp(24px, 3vw, 32px); font-weight: 550; line-height: 1.4; letter-spacing: -0.025em; margin: 0 0 18px; }
#chat-empty p { font-size: 14px; }
#messages { padding: 18px 0; }
.message { padding: 24px 0; border-bottom: 1px solid #3b4252; }
.message h3 { font-size: 13px; color: var(--frost); font-weight: 600; margin: 0 0 12px; }
.message.user h3 { color: var(--muted); }
.message-content { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--secondary); line-height: 1.9; }
.message-content pre { white-space: pre; overflow-x: auto; font: 13px/1.7 "Geist Mono", monospace; padding: 16px; background: var(--surface); border-radius: 2px; margin: 16px 0; }
.message-copy { font-size: 12px; margin-top: 12px; padding: 6px 12px; }
.message-state { font-size: 12px; margin: 12px 0 0; color: var(--error); }
#composer { margin-top: 18px; }
#composer label { margin: 0 0 10px; }
.composer-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.composer-actions p { font-size: 11px; margin: 0 auto 0 0; }
#chat-status { min-height: 24px; margin: 16px 0 0; font-size: 13px; color: var(--frost); }
@media (max-width: 700px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .chat-sidebar { border-right: 0; border-bottom: 1px solid var(--border); padding: 20px 0; }
  .history-heading { margin-top: 16px; }
  #conversations { max-height: 170px; }
  .chat-main { padding-top: 0; }
  .chat-main { height: calc(100dvh - 375px); min-height: 420px; }
  .chat-sidebar details { margin-top: 10px; }
  .chat-mode .page-heading .actions { margin-top: 14px; gap: 6px; }
  .chat-mode .page-heading button { font-size: 12px; padding: 8px 12px; }
  #chat-empty { padding: 34px 0 24px; }
  .composer-actions p { flex-basis: 100%; }
}

.chat-mode .site-header, .chat-mode .page-heading { display: none; }
.chat-mode main { width: 100%; padding: 0; margin: 0; }
.chat-mode #notice:not([hidden]) { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 5; width: min(650px, calc(100% - 40px)); }
.chat-layout { grid-template-columns: 272px minmax(0, 1fr); height: 100dvh; min-height: 0; gap: 0; border: 0; }
.chat-sidebar { display: flex; flex-direction: column; padding: 24px 20px; background: var(--surface); min-height: 0; border-right: 1px solid #3b4252; }
.sidebar-brand { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.search-label { margin-top: 24px; font-size: 12px; }
#search-chats { height: 44px; font-size: 12px; padding: 10px 12px; }
.chat-sidebar details { flex: 1; overflow-y: auto; min-height: 0; margin-top: 22px; }
.chat-sidebar .history-heading { margin-bottom: 8px; }
#conversations { max-height: none; }
.sidebar-account { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.sidebar-account p { font-size: 14px; color: var(--text); margin: 0 0 6px; overflow-wrap: anywhere; }
.sidebar-account button { text-align: left; border-color: transparent; padding: 8px 10px; font-size: 12px; }
.sidebar-account a { font-size: 12px; padding: 8px 10px; }
.chat-main { height: 100dvh; min-height: 0; padding: 24px clamp(24px, 5vw, 80px); }
.chat-heading { margin-bottom: 16px; min-height: 44px; }
.chat-heading h2 { flex: 1; color: var(--muted); font-size: 14px; font-weight: 400; }
#messages, #composer, #chat-status, #chat-empty { width: min(780px, 100%); margin-left: auto; margin-right: auto; }
#messages:empty { display: none; }
#chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 0; min-height: 0; }
#chat-empty h3 { font-size: clamp(30px, 3.6vw, 48px); font-weight: 550; line-height: 1.25; margin-bottom: 22px; }
#chat-empty p { font-size: 14px; }
.prompt-suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.prompt-suggestions button { font-size: 12px; padding: 10px 16px; }
#chat-status { margin-top: 8px; min-height: 24px; flex-shrink: 0; }
#composer { margin-top: 10px; }
#composer label { font-size: 12px; }
#composer textarea { min-height: 80px; max-height: 160px; }
.composer-actions { margin-bottom: 0; }
#close-history, #toggle-history, #new-chat-quick { display: none; }
@media (max-width: 700px) {
  .chat-layout { display: block; }
  .chat-main { padding: 16px 20px 20px; }
  .chat-sidebar { display: none; }
  .sidebar-open .chat-sidebar { display: flex; position: fixed; inset: 0 auto 0 0; width: min(300px, 85vw); height: 100dvh; z-index: 8; box-shadow: 10px 0 32px rgb(0 0 0 / 24%); }
  #close-history, #toggle-history, #new-chat-quick { display: block; padding: 8px 10px; font-size: 12px; }
  .chat-heading { gap: 8px; }
  .chat-heading h2 { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #chat-empty h3 { font-size: 32px; }
  #chat-empty p { font-size: 13px; }
  .prompt-suggestions { gap: 8px; }
  .prompt-suggestions button { padding: 8px 12px; }
}

.chat-layout, .chat-main { height: var(--chat-viewport-height, 100dvh); }
#messages, #composer, #chat-status, #chat-empty { max-width: 768px; }
.message.assistant .message-content { white-space: normal; font-size: 16px; line-height: 1.8; }
.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }
.message-content p { margin: 0 0 18px; font-size: inherit; line-height: inherit; color: inherit; }
.message-content h4, .message-content h5, .message-content h6 { color: var(--text); font-size: 18px; line-height: 1.5; margin: 24px 0 12px; }
.message-content ul, .message-content ol { padding-left: 24px; margin: 16px 0; }
.message-content li + li { margin-top: 8px; }
.message-content blockquote { border-left: 2px solid var(--frost); padding-left: 18px; margin: 18px 0; color: var(--muted); }
.message-content :not(pre) > code { font: 0.88em/1.7 "Geist Mono", monospace; background: var(--surface); padding: 2px 5px; border-radius: 2px; }
.code-block { border: 1px solid var(--border); margin: 20px 0; border-radius: 2px; overflow: hidden; }
.code-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); padding: 8px 12px; font-size: 12px; color: var(--muted); }
.code-toolbar button { font-size: 12px; padding: 8px 10px; }
.code-block pre { margin: 0; border-radius: 0; padding: 16px; }
.message-content .code-incomplete { padding: 8px 16px; margin: 0; font-size: 12px; color: var(--muted); background: var(--surface); }
.message-table { max-width: 100%; overflow-x: auto; margin: 20px 0; }
.message-table table { border-collapse: collapse; width: 100%; font-size: 14px; }
.message-table th, .message-table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; min-width: 110px; }
.message-table th { color: var(--text); background: var(--surface); }
#draft-hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
#composer textarea { max-height: 180px; resize: none; }
.message.streaming .message-content::after { content: ""; display: inline-block; width: 6px; height: 16px; margin-left: 5px; background: var(--frost); }
.message.queued .message-content::after { content: "Menunggu jawaban…"; color: var(--muted); font-size: 14px; }
@media (max-width: 700px) {
  .chat-main { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .sidebar-open .chat-sidebar { height: var(--chat-viewport-height, 100dvh); }
  .message.assistant .message-content { font-size: 15px; }
}
