:root {
  color-scheme: light;
  --ink: #20211f;
  --muted: #5c6059;
  --faint: #6b6e68;
  --line: #dfe1db;
  --paper: #fff;
  --canvas: #f6f6f3;
  --accent: #ffcb35;
  --accent-soft: #fff3c5;
  --warn: #963f30;
  font: 400 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; }
main {
  display: flex;
  min-height: 0;
  height: 100%;
  max-width: 1600px;
  margin-inline: auto;
}
button, input, select, textarea { font: inherit; color: inherit; }
button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { opacity: .48; cursor: default; }
@media (hover:hover) {
  button:not(:disabled):hover { background: var(--canvas); }
}
:where(button, input, textarea, select, a, summary):focus-visible {
  outline: 2px solid #8b6500;
  outline-offset: 2px;
}
strong, summary { font-weight: 600; }
small { display: block; color: var(--faint); font-size: 12px; }
summary { cursor: pointer; }
[hidden] { display: none !important; }
.primary {
  color: var(--ink);
  background: var(--accent);
  border-color: transparent;
  font-weight: 600;
}
@media (hover:hover) {
  .primary:not(:disabled):hover { background: #f6bf21; }
}
#chat { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
#timeline { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#status, #queueStatus {
  margin: 0;
  color: var(--warn);
  font-size: 13px;
}
#status:not(:empty), #queueStatus:not(:empty) { padding: 8px 16px; }
.more { display: block; margin: 12px auto; }
.field {
  display: grid;
  grid-template-columns: minmax(88px, 38%) minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.field span:first-child { color: var(--muted); }
#sheet {
  width: min(480px, calc(100vw - 40px));
  padding: 0;
  max-height: 88vh;
  max-height: 88dvh;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgb(32 33 31 / 12%);
}
#sheet[open] { display: flex; flex-direction: column; }
#sheet::backdrop { background: rgb(23 24 21 / 32%); }
#sheet > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
#sheetTitle { font-size: 20px; line-height: 1.35; overflow-wrap: anywhere; }
#close {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--muted);
  border-color: transparent;
}
#sheetBody {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  padding: 20px 24px;
}
#sheetBody > button { margin: 4px; }
#sheetBody > button.card { display: block; width: 100%; text-align: left; margin: 8px 0; }
#sheetBody img, #sheetBody video { display: block; max-width: 100%; max-height: 58vh; margin-inline: auto; }
#sheetBody .recordSearch, #sheetBody > select, #sheetBody > textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  margin-bottom: 12px;
}
#sheetBody > textarea { min-height: 80px; resize: vertical; }
#sheet[data-kind="auto-settings"] { width: min(860px, calc(100vw - 48px)); max-height: 90dvh; }
#sheet[data-kind="auto-settings"] #sheetBody { display: flex; flex: 1 1 auto; overflow: hidden; padding: 0; }
@media (max-width:700px) {
  #sheet, #sheet[data-kind="auto-settings"] {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
    border-width: 1px 0 0;
  }
  #sheet > header { padding: 12px 16px; }
  #sheetTitle { font-size: 18px; }
  #sheetBody { padding: 16px 16px max(20px, env(safe-area-inset-bottom)); }
  #close { width: 40px; height: 40px; }
}
