/* Hej Danmark — reader chatbot (/chat/). Values from docs/design/chatbot/*.dc.html:
   #ede8e0 page, #e2dbd1 bubbles and callouts, #1a1a1a text, #b8b0a4 lines,
   #5a5a5a secondary text; Playfair Display + Inter as on the rest of the site.
   Desktop: 1240px container, 240px sidebar, 720px conversation column.
   Below 760px the sidebar becomes a drawer behind the "more" button and the
   composer sticks to the bottom. */
:root{
  --bg:#ede8e0;
  --bubble:#e2dbd1;
  --ink:#1a1a1a;
  --line:#b8b0a4;
  --muted:#5a5a5a;
  --dash:#8a8178;
  --serif:'Playfair Display','Songti TC','Songti SC',serif;
  --sans:'Inter','Noto Sans TC','Noto Sans SC',system-ui,sans-serif;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body.chat-page{
  margin:0;min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;
  background:var(--bg);color:var(--ink);font-family:var(--sans);font-size:15px;line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
a{color:var(--ink)}a:hover{color:var(--muted)}
button{font:inherit;cursor:pointer;color:inherit}
[hidden]{display:none!important}
.chat-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.chat-skip{position:absolute;left:-999px;top:8px;background:var(--ink);color:var(--bg);padding:8px 12px;border-radius:8px;z-index:20}
.chat-skip:focus{left:8px}
:focus-visible{outline:2px solid var(--ink);outline-offset:2px}

/* ---------- header ---------- */
.chat-head{
  max-width:1240px;width:100%;margin:0 auto;padding:16px 20px;
  display:flex;align-items:center;gap:16px;
}
.chat-brand{text-decoration:none;font-family:var(--serif);font-size:22px;font-weight:700;line-height:1.2}
.chat-head-title{display:none}
.chat-lang{display:flex;border:1px solid var(--line);border-radius:999px;overflow:hidden;font-size:13px;margin-left:auto}
.chat-lang button{border:0;background:transparent;padding:6px 12px;min-height:32px}
.chat-lang button[aria-pressed="true"]{background:var(--ink);color:var(--bg)}
.chat-more{display:none;border:0;background:transparent;width:40px;height:40px;align-items:center;justify-content:center}

/* ---------- layout ---------- */
.chat-shell{
  max-width:1240px;width:100%;margin:0 auto;padding:0 20px;flex:1;
  display:flex;gap:0 48px;
}
.chat-side{flex:0 0 240px;padding:8px 0 24px;display:flex;flex-direction:column;gap:16px}
.chat-side-top{display:flex;align-items:center;gap:8px}
.chat-side-close{display:none;border:0;background:transparent;width:40px;height:40px;align-items:center;justify-content:center;margin-left:auto}
.chat-new{
  border:1px solid var(--ink);background:transparent;border-radius:10px;padding:10px 14px;min-height:44px;
  font-weight:500;display:flex;align-items:center;gap:10px;flex:1;
}
.chat-new:hover{background:var(--bubble)}
.chat-label{margin:0;font-size:12px;font-weight:400;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.chat-convs{display:flex;flex-direction:column;gap:2px;margin-top:-8px}
.chat-conv{
  border:0;background:transparent;text-align:left;padding:8px 10px;border-radius:8px;font-size:14px;color:var(--muted);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.chat-conv:hover{color:var(--ink)}
.chat-conv.is-current{background:var(--bubble);color:var(--ink)}
.chat-main{flex:1 1 560px;min-width:0;max-width:720px;display:flex;flex-direction:column}

/* ---------- welcome ---------- */
.chat-welcome{padding:24px 0 16px;display:flex;flex-direction:column;gap:28px;flex:1}
.chat-welcome h1{margin:0;font-family:var(--serif);font-size:40px;line-height:1.2;font-weight:600}
.chat-sub{margin:-16px 0 0;color:var(--muted);font-size:15px;max-width:56ch}
.chat-recent{display:flex;flex-direction:column;gap:8px}
#examples{display:flex;flex-direction:column}
.chat-example{
  border:0;border-bottom:1px solid var(--line);background:transparent;text-align:left;
  display:flex;align-items:center;gap:10px;padding:12px 0;font-size:15px;min-height:44px;
}
.chat-example span{flex:1}
.chat-example:hover{color:var(--muted)}
.chat-privacy{margin:0;font-size:12px;color:var(--muted);line-height:1.5}

/* ---------- thread ---------- */
.chat-thread{padding:8px 0 16px;display:flex;flex-direction:column;gap:32px;flex:1}
.chat-user{display:flex;justify-content:flex-end}
.chat-bubble{max-width:78%;background:var(--bubble);border-radius:18px 18px 4px 18px;padding:12px 16px;white-space:pre-wrap;overflow-wrap:anywhere}
.chat-answer{display:flex;flex-direction:column;gap:18px}
.chat-by{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted)}
.chat-badge{
  width:22px;height:22px;border-radius:50%;background:var(--bubble);border:1px solid var(--line);
  display:inline-flex;align-items:center;justify-content:center;font-family:var(--serif);font-weight:700;font-size:11px;color:var(--ink);
}
.chat-lede{margin:0;font-family:var(--serif);font-size:22px;line-height:1.4;font-weight:600}
.chat-md{display:flex;flex-direction:column;gap:12px}
.chat-md p,.chat-md h3{margin:0}
.chat-md h3{font-size:16px;font-weight:600}
.chat-md ul,.chat-md ol{margin:0;padding-left:22px;display:flex;flex-direction:column;gap:8px}
.chat-warn{margin:0;padding:12px 16px;border-left:3px solid var(--ink);background:var(--bubble);border-radius:0 10px 10px 0;font-size:14px}
.chat-sources{display:flex;flex-direction:column;gap:8px}
.chat-src-list{display:flex;flex-wrap:wrap;gap:8px;font-size:13px}
.chat-src{
  text-decoration:none;border:1px solid var(--line);border-radius:999px;padding:6px 12px;
  display:inline-flex;align-items:center;gap:8px;max-width:100%;
}
.chat-src:hover{border-color:var(--ink);color:var(--ink)}
.chat-src-text{display:inline-flex;gap:6px;min-width:0}
.chat-src-from{color:var(--muted);white-space:nowrap}
.chat-src-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-src svg{flex:none;color:var(--muted)}
.chat-handoff{border:1px solid var(--ink);border-radius:12px;overflow:hidden}
.chat-handoff-head{padding:12px 14px;background:var(--ink);color:var(--bg);font-size:13px;font-weight:500;display:flex;align-items:center;gap:8px}
.chat-handoff a{text-decoration:none;display:flex;align-items:center;gap:12px;padding:12px 14px;border-bottom:1px solid var(--line)}
.chat-handoff a:last-child{border-bottom:0}
.chat-handoff a span{flex:1;min-width:0}
.chat-handoff strong{display:block;font-weight:500;font-size:14px}
.chat-handoff small{display:block;font-size:12px;color:var(--muted)}
.chat-disclosure{margin:0;font-size:12px;color:var(--muted)}
.chat-actions{display:flex;align-items:center;gap:2px;color:var(--muted);margin-left:-8px}
.chat-actions button{border:0;background:transparent;border-radius:8px;width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;color:var(--muted)}
.chat-actions button:hover,.chat-actions button[aria-pressed="true"]{background:var(--bubble);color:var(--ink)}
.chat-ack{font-size:12px;margin-left:6px}
.chat-clarify-box{background:var(--bubble);border-radius:18px 18px 18px 4px;padding:12px 16px;max-width:84%}
.chat-clarify-box p{margin:0 0 6px}
.chat-clarify-box ol{margin:0;padding-left:20px}
.chat-refused .chat-md{color:var(--ink)}
.chat-thinking{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:14px}
.chat-thinking-text{transition:opacity .2s ease}
.chat-dots{display:inline-flex;gap:4px}
.chat-dots i{width:6px;height:6px;border-radius:50%;background:var(--muted);animation:chat-blink 1.2s infinite ease-in-out}
.chat-dots i:nth-child(2){animation-delay:.15s}.chat-dots i:nth-child(3){animation-delay:.3s}
@keyframes chat-blink{0%,80%,100%{opacity:.25}40%{opacity:1}}
@media (prefers-reduced-motion:reduce){.chat-dots i{animation:none;opacity:.6}}
.chat-error{margin:0;padding:10px 14px;border:1px solid var(--ink);border-radius:10px;font-size:14px}
.chat-followups{display:flex;flex-wrap:wrap;gap:8px;padding-bottom:8px}
.chat-followups:empty{display:none}
.chat-pill{border:1px solid var(--line);background:transparent;border-radius:999px;padding:8px 14px;min-height:40px;font-size:14px;text-align:left}
.chat-pill:hover{border-color:var(--ink)}

/* ---------- composer ---------- */
.chat-composer{position:sticky;bottom:0;background:var(--bg);padding:12px 0 20px}
.chat-input{display:flex;align-items:flex-end;gap:8px;border:1px solid var(--line);border-radius:16px;background:var(--bg);padding:10px 10px 10px 8px}
.chat-input:focus-within{border-color:var(--ink)}
.chat-input textarea{
  flex:1;border:0;background:transparent;resize:none;outline:none;font:inherit;font-size:15px;line-height:1.5;
  color:var(--ink);min-height:28px;padding:8px 0;max-height:200px;
}
.chat-input textarea::placeholder{color:var(--muted)}
.chat-input button{border:0;background:var(--ink);color:var(--bg);border-radius:10px;width:40px;height:40px;display:inline-flex;align-items:center;justify-content:center;flex:none}
.chat-input button:disabled{opacity:.5;cursor:default}

/* ---------- invite dialog ---------- */
.chat-invite{border:1px solid var(--ink);border-radius:14px;background:var(--bg);color:var(--ink);padding:24px;max-width:360px;width:calc(100% - 32px)}
.chat-invite::backdrop{background:rgba(26,26,26,.35)}
.chat-invite form{display:flex;flex-direction:column;gap:12px}
.chat-invite h2{margin:0;font-family:var(--serif);font-size:22px}
.chat-invite p{margin:0;font-size:14px;color:var(--muted)}
.chat-invite .chat-error{color:var(--ink)}
.chat-invite label{font-size:13px;font-weight:500}
.chat-invite input{font:inherit;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--bg);color:var(--ink);min-height:44px}
.chat-invite button{border:1px solid var(--ink);background:var(--ink);color:var(--bg);border-radius:10px;padding:11px;min-height:44px;font-weight:500}

/* ---------- phase two: account, quota, sign-in, attachments, subscribe ---------- */
.chat-quota{font-size:12px;color:var(--muted);white-space:nowrap}
.chat-lang + .chat-quota{margin-left:0}
.chat-acct{position:relative}
.chat-avatar{
  width:34px;height:34px;border-radius:50%;border:1px solid var(--ink);background:var(--bubble);
  display:inline-flex;align-items:center;justify-content:center;font-family:var(--serif);font-weight:700;font-size:14px;padding:0;
}
.chat-menu{
  position:absolute;right:0;top:calc(100% + 8px);z-index:15;min-width:220px;background:var(--bg);
  border:1px solid var(--ink);border-radius:12px;padding:6px;display:flex;flex-direction:column;
  box-shadow:0 12px 32px rgba(26,26,26,.12);
}
.chat-menu button{border:0;background:transparent;text-align:left;padding:10px 12px;border-radius:8px;font-size:14px;min-height:40px}
.chat-menu button:hover{background:var(--bubble)}
#m-delete-account{color:#8b1a1a}
.chat-signin{border:1px solid var(--ink);border-radius:14px;padding:20px;display:flex;flex-direction:column;gap:12px;max-width:440px}
.chat-signin h2{margin:0;font-family:var(--serif);font-size:22px;line-height:1.25}
.chat-signin p{margin:0;font-size:14px;color:var(--muted)}
.chat-google{
  border:1px solid var(--ink);background:var(--ink);color:var(--bg);border-radius:10px;min-height:44px;padding:10px 14px;
  display:flex;align-items:center;justify-content:center;gap:10px;font-weight:500;
}
.chat-email{display:flex;flex-direction:column;gap:6px}
.chat-email label{font-size:13px;font-weight:500}
.chat-email-row{display:flex;gap:8px}
.chat-email input{flex:1;min-width:0;font:inherit;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--bg);color:var(--ink);min-height:44px}
.chat-email input:focus{border-color:var(--ink);outline:none}
.chat-email button{border:1px solid var(--ink);background:transparent;border-radius:10px;padding:10px 14px;min-height:44px;font-weight:500;white-space:nowrap}
.chat-email button:hover{background:var(--bubble)}
.chat-ok{color:var(--ink)!important;background:var(--bubble);border-radius:10px;padding:10px 14px}
.chat-linkbtn{border:0;background:transparent;padding:4px 0;font-size:13px;color:var(--muted);text-decoration:underline;align-self:flex-start}
.chat-privacy a{color:var(--muted)}
.chat-notice{margin:8px 0 0;padding:10px 14px;background:var(--bubble);border-radius:10px;font-size:14px}
.chat-doc{border:1px solid var(--line);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:4px}
.chat-doc-type{font-size:15px;font-weight:600}
.chat-doc-dl{margin:4px 0 0;padding-left:18px;font-size:14px;display:flex;flex-direction:column;gap:4px}
.chat-doc-date{font-weight:600}
.chat-bubble-file{display:flex;align-items:center;gap:6px;font-size:13px;margin-top:4px}
.chat-bubble-file:first-child{margin-top:0}
.chat-chips{display:flex;flex-wrap:wrap;gap:8px;padding-bottom:8px}
.chat-chip{
  display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:999px;
  padding:4px 6px 4px 10px;font-size:13px;max-width:100%;background:var(--bg);
}
.chat-chip.is-busy{color:var(--muted)}
.chat-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:200px}
.chat-chip small{color:var(--muted);font-size:11px}
.chat-chip button{border:0;background:transparent;width:24px;height:24px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;padding:0}
.chat-chip button:hover{background:var(--bubble)}
.chat-input .chat-attach{background:transparent;color:var(--muted);border-radius:10px}
.chat-input .chat-attach:hover{color:var(--ink);background:var(--bubble)}
.chat-input .chat-attach:disabled{opacity:.4}
.chat-subscribe{
  position:relative;border:1px solid var(--ink);border-radius:14px;padding:20px;margin:8px 0;
  display:flex;flex-direction:column;gap:10px;scroll-margin-top:16px;
}
.chat-subscribe h2{margin:0;font-family:var(--serif);font-size:22px;padding-right:32px}
.chat-subscribe p{margin:0;font-size:14px}
.chat-sub-price{font-weight:600}
.chat-sub-go{border:1px solid var(--ink);background:var(--ink);color:var(--bg);border-radius:10px;min-height:44px;padding:10px 18px;font-weight:500;align-self:flex-start}
.chat-sub-close{position:absolute;top:12px;right:12px;border:0;background:transparent;width:32px;height:32px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center}
.chat-sub-close:hover{background:var(--bubble)}
.chat-confirm p{color:var(--ink)!important;font-size:15px!important}
.chat-confirm-row{display:flex;gap:8px;justify-content:flex-end}
.chat-confirm-row button{flex:1}
.chat-confirm .chat-btn-ghost{background:transparent;color:var(--ink)}

/* ---------- mobile (Mobile.dc.html / Welcome.dc.html) ---------- */
@media (max-width:759px){
  .chat-head{padding:14px 16px 12px;border-bottom:1px solid var(--line);gap:10px}
  .chat-brand{font-size:18px}
  .chat-lang{font-size:12px}
  .chat-lang button{padding:6px 8px;min-height:30px}
  .chat-more{display:inline-flex}
  .chat-quota{display:none}
  .chat-avatar{width:32px;height:32px}
  .chat-email-row{flex-direction:column}
  .chat-signin{padding:16px}
  .chat-shell{padding:0 16px;display:block}
  .chat-side{
    position:fixed;inset:0 0 0 auto;width:min(86vw,320px);z-index:10;background:var(--bg);
    border-left:1px solid var(--line);padding:16px;transform:translateX(100%);transition:transform .2s ease;
    visibility:hidden;
  }
  .chat-side.is-open{transform:none;visibility:visible;box-shadow:-12px 0 32px rgba(26,26,26,.12)}
  .chat-side-close{display:inline-flex}
  .chat-main{max-width:none;min-height:calc(100dvh - 67px)}
  .chat-welcome{padding:28px 0 16px}
  .chat-welcome h1{font-size:30px;line-height:1.25}
  .chat-sub{font-size:14px}
  .chat-example{font-size:14px}
  .chat-thread{gap:18px;padding-top:18px}
  .chat-bubble{max-width:84%;background:var(--ink);color:var(--bg);padding:12px 14px}
  .chat-answer{gap:14px}
  .chat-lede{font-size:19px}
  .chat-md{font-size:14px}
  .chat-md ul,.chat-md ol{padding-left:20px}
  .chat-warn{border:1px solid var(--line);border-left:4px solid var(--ink);border-radius:10px;padding:12px 14px}
  .chat-src-list{flex-direction:column}
  .chat-src{border-radius:10px;padding:10px 12px;display:flex}
  .chat-src-text{flex-direction:column;gap:0;flex:1}
  .chat-src-from{font-size:12px}
  .chat-src-title{font-size:14px;font-weight:500;white-space:normal}
  .chat-actions button{width:40px;height:40px}
  .chat-followups{flex-wrap:nowrap;overflow-x:auto}
  .chat-pill{flex:none}
  .chat-composer{border-top:1px solid var(--line);margin:0 -16px;padding:10px 16px calc(16px + env(safe-area-inset-bottom))}
  .chat-input{border-color:var(--ink);border-radius:24px;padding:6px 6px 6px 8px;align-items:center}
  .chat-input textarea{padding:6px 0}
  .chat-input button{border-radius:50%}
}
@media (max-width:759px) and (prefers-reduced-motion:reduce){.chat-side{transition:none}}
