/* Hermes – SK palette. One signature element: bot answers are drawn as garment hang-tags (punched hole + stitched edge). */
:root {
  --ink: #0E3A4A; --teal: #1F7A8C; --mist: #E1ECF0; --paper: #F4F8F9; --line: #C9DAE0;
  --text: #16303A; --muted: #5B7580; --warn: #9A5B00; --warn-bg: #FFF3DC; --bad: #A4302A; --thread: #E3A93B;
  --r: 14px; --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--paper); -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overscroll-behavior-y: contain; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--thread); outline-offset: 2px; }
.boot { display: grid; place-items: center; height: 100dvh; color: var(--muted); }

/* brand mark: a hang-tag silhouette */
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; color: var(--ink); }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.mark { width: 30px; height: 38px; background: var(--teal); position: relative; flex: none;
  clip-path: polygon(50% 0, 100% 22%, 100% 100%, 0 100%, 0 22%); border-radius: 3px; }
.mark::after { content: ""; position: absolute; left: 50%; top: 9px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--paper); }
.brand.small .mark { width: 20px; height: 26px; } .brand.small .mark::after { top: 6px; width: 5px; height: 5px; margin-left: -2.5px; }
.brand.small strong { font-size: 1.1rem; color: #fff; }

/* auth */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--ink); }
.auth-card { width: min(420px, 100%); background: var(--paper); border-radius: 18px; padding: 28px 24px; }
.auth h2 { margin: 18px 0 4px; font-size: 1.15rem; color: var(--ink); }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; color: var(--ink); }
input:not([type=checkbox]), textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; font-size: 16px; }
input:focus, textarea:focus { border-color: var(--teal); outline: none; }
.hint { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.error { margin: 0; color: var(--bad); font-size: .9rem; min-height: 1.2em; }
.primary, .secondary { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 0 16px; border-radius: 10px;
  font-weight: 650; font-size: .95rem; text-decoration: none; border: 0; white-space: nowrap; text-align: center; }
.primary { background: var(--teal); color: #fff; }
.secondary { background: var(--mist); color: var(--ink); }
.primary:disabled { opacity: .6; }

/* chat layout */
#app { height: 100dvh; display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; background: var(--ink); color: #fff; }
.bar .brand { margin-right: auto; }
.icon { background: none; border: 0; padding: 8px; border-radius: 10px; color: inherit; display: inline-grid; place-items: center; }
.chip { border: 0; border-radius: 999px; padding: 6px 12px; font-size: .8rem; font-weight: 600; }
.chip.stock { background: rgba(255,255,255,.12); color: #DDEFF3; }
.chip.stock.stale { background: var(--thread); color: #3A2600; }
.thread { flex: 1; overflow-y: auto; padding: 16px 12px 8px; display: flex; flex-direction: column; gap: 14px; }
.empty { margin: auto 0; padding: 8px 4px 24px; }
.empty h2 { margin: 0 0 6px; font-size: 1.3rem; color: var(--ink); letter-spacing: -0.01em; }
.empty p { margin: 0 0 16px; color: var(--muted); line-height: 1.45; max-width: 40ch; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; }
.example { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 14px; font-size: .9rem; text-align: left; color: var(--ink); }

.msg { max-width: min(560px, 92%); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 16px 16px 4px 16px; }
.msg.user .pics { font-size: .8rem; opacity: .8; display: block; margin-top: 4px; }
/* the hang-tag */
.msg.bot { align-self: flex-start; position: relative; background: #fff; padding: 16px 16px 14px 34px; border-radius: 6px 14px 14px 6px;
  box-shadow: 0 1px 0 var(--line), 0 6px 18px -12px rgba(14,58,74,.45); font-variant-numeric: tabular-nums; }
.msg.bot::before { content: ""; position: absolute; inset: 5px 5px 5px 22px; border: 1.5px dashed var(--line); border-radius: 3px 10px 10px 3px; pointer-events: none; }
.msg.bot::after { content: ""; position: absolute; left: 8px; top: 16px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--paper); box-shadow: inset 0 0 0 2px var(--thread); }
.msg.bot b { color: var(--ink); }
.msg.bot i { color: var(--muted); }
.msg.bot.thinking { color: var(--muted); }
.dots span { display: inline-block; animation: blink 1.2s infinite; } .dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots span { animation: none; } }
.msg-actions { display: flex; gap: 8px; margin-top: 10px; white-space: normal; }
.msg-actions button { border: 0; background: var(--mist); color: var(--ink); border-radius: 8px; padding: 6px 10px; font-size: .82rem; font-weight: 600; }

/* composer */
.composer { background: #fff; border-top: 1px solid var(--line); padding: 8px 8px calc(8px + var(--safe-b)); }
.composer form { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { resize: none; max-height: 40vh; min-height: 46px; border-radius: 22px; padding: 11px 16px; }
.attach { color: var(--teal); min-width: 44px; min-height: 46px; }
.send { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--teal); color: #fff; display: grid; place-items: center; }
.send:disabled { opacity: .5; }
.thumbs { display: flex; gap: 8px; padding: 0 4px 8px; overflow-x: auto; }
.thumbs:empty { display: none; }
.thumb { position: relative; flex: none; }
.thumb img { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumb button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 12px; line-height: 1; }

/* menu sheet */
.sheet { position: fixed; inset: 0; background: rgba(14,58,74,.45); display: flex; justify-content: flex-end; z-index: 10; }
.sheet[hidden] { display: none; }
.sheet-panel { width: min(440px, 100%); height: 100%; background: var(--paper); display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
.sheet-body { overflow-y: auto; padding: 8px 16px calc(24px + var(--safe-b)); display: grid; gap: 10px; align-content: start; }
.sheet h3 { margin: 18px 0 0; font-size: 1rem; color: var(--ink); }
.row-btn { text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 13px 14px; font-weight: 600; color: var(--ink); }
.row-btn.quiet { background: none; color: var(--bad); border-color: transparent; margin-top: 12px; }
.pair { display: flex; gap: 8px; flex-wrap: wrap; } .pair > * { flex: 1 1 140px; }
label.file-btn { display: inline-flex; cursor: pointer; font-size: .95rem; }
.result { background: #fff; border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; line-height: 1.45; border-left: 4px solid var(--teal); font-size: .92rem; }
.result.bad { border-left-color: var(--bad); }
.team { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.team li { background: #fff; border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.team .who { display: flex; justify-content: space-between; gap: 8px; font-weight: 650; color: var(--ink); }
.team .meta { color: var(--muted); font-size: .82rem; font-weight: 400; }
.team .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.team .acts button { border: 0; background: var(--mist); color: var(--ink); border-radius: 8px; padding: 6px 10px; font-size: .82rem; font-weight: 600; }
.team li.off { opacity: .55; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; z-index: 20; }
@media (min-width: 760px) { .thread { padding: 24px max(16px, calc(50% - 360px)); } .composer { padding-inline: max(8px, calc(50% - 368px)); } }
