
/* Sandy's chat styles are deliberately scoped: the legacy app has global
   aside{} and header{} selectors which otherwise hijack the nested UI. */
.sandy-page {
  --sandy-ink:#302f2d;
  --sandy-soft:#fff9f3;
  --sandy-border:#eaddd1;
  --sandy-orange:#b45b37;
  --sandy-accent:#e8a05a;
  width:100%;
  max-width:1440px;
  min-width:0;
  margin:0 auto;
  color:var(--sandy-ink);
}
.sandy-page > header.sandy-page-header {
  height:auto;
  min-height:130px;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:22px;
  padding:25px 32px;
  margin:0 0 16px;
  background:linear-gradient(112deg,#fff9f1 0%,#fffdfb 65%,#fff4e8 100%);
  border:1px solid var(--sandy-border);
  border-radius:18px;
}
.sandy-page-header > .sandy-avatar {width:76px;height:76px;box-shadow:0 7px 20px #a7674521}
.sandy-page-header > div {min-width:0}
.sandy-page-header .welcome-kicker {display:block;margin:0 0 5px;font-size:10px;color:#a75332}
.sandy-page-header h1 {font-size:clamp(28px,2.8vw,35px);font-weight:500;letter-spacing:-1.2px;line-height:1.15;margin:0 0 7px}
.sandy-page-header p {color:#746860;font-size:14px;line-height:1.5;margin:0}
.sandy-page-header > a {
  margin-left:auto;
  padding:10px 13px;
  text-decoration:none;
  white-space:nowrap;
  border-radius:9px;
  border:1px solid #ecdccf;
  background:#fffdfa;
  font-size:13px;
  font-weight:500;
}
.sandy-page-header > a:hover {background:#fff1e7}
.sandy-avatar {
  display:block;
  flex:none;
  width:46px;
  height:46px;
  border-radius:50%;
  object-fit:cover;
  border:1px solid #efd9be;
  background:#ffedcc;
  box-shadow:0 3px 12px #a7674520;
}
.sandy-status {
  display:flex;
  align-items:center;
  gap:14px;
  min-height:68px;
  margin:0 0 16px;
  padding:12px 18px;
  border:1px solid var(--sandy-border);
  border-radius:13px;
  background:#fffdfb;
}
.sandy-status > div {flex:1;min-width:0}
.sandy-status strong {display:block;font-weight:600;font-size:13px}
.sandy-status p {font-size:12px;color:#7e7167;margin:4px 0 0;overflow-wrap:anywhere}
.sandy-status button {padding:8px 13px;font-size:12px;flex:none}
.sandy-dot {display:block;width:11px;height:11px;border-radius:50%;flex:none;background:#a9a19b}
.sandy-dot.configured {background:#d6a042;box-shadow:0 0 0 4px #faedcf}
.sandy-dot.verified {background:#438c66;box-shadow:0 0 0 4px #e1f1e6}
.sandy-warning,.sandy-error,.sandy-notice {padding:12px 16px;margin:0 0 15px;border-radius:11px;font-size:13px;line-height:1.5}
.sandy-warning {background:#fff6e8;border:1px solid #ecd2a8;color:#745529}
.sandy-error {background:#fff0ee;border:1px solid #e6b1a9;color:#892d27}
.sandy-notice {background:#eaf6ef;border:1px solid #badbcb;color:#235c3b}
.sandy-warning button {font-size:12px;padding:7px 10px;margin:5px 0 0 7px}
.sandy-layout {
  isolation:isolate;
  display:grid;
  grid-template-columns:minmax(205px,238px) minmax(0,1fr);
  gap:0;
  width:100%;
  min-height:650px;
  overflow:hidden;
  border:1px solid var(--sandy-border);
  border-radius:17px;
  background:#fff;
  box-shadow:0 12px 36px #76523a09;
}
/* These overrides prevent the global aside rule from creating a second
   fixed navigation rail and leaving the chat in the wrong grid column. */
.sandy-page .sandy-layout > aside.sandy-sidebar {
  position:static;
  inset:auto;
  display:flex;
  flex-direction:column;
  width:auto;
  min-width:0;
  height:auto;
  max-height:calc(100dvh - 265px);
  min-height:0;
  padding:20px 13px;
  margin:0;
  overflow:auto;
  background:#faf7f3;
  border:0;
  border-right:1px solid #eee2d9;
  border-radius:0;
  z-index:auto;
}
.sandy-sidebar-head {display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:16px;padding:0 4px}
.sandy-sidebar-head h3 {font-size:13px;letter-spacing:.2px;font-weight:600;margin:0}
.sandy-sidebar-head button {
  display:flex;align-items:center;gap:5px;
  border:1px solid #e6d8cc;
  border-radius:8px;
  padding:8px 12px;
  background:white;
  font-size:12px;
}
.sandy-chat-link {
  flex:none;
  display:block;
  width:100%;
  padding:12px 11px;
  margin:0 0 5px;
  background:transparent;
  border:1px solid transparent;
  border-radius:10px;
  text-align:left;
}
.sandy-chat-link:hover,.sandy-chat-link.active {background:#fff; border-color:#eadbd0}
.sandy-chat-link.active {box-shadow:0 2px 9px #74492f0b}
.sandy-chat-link strong {display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:13px;font-weight:500}
.sandy-chat-link span {display:block;color:#877b72;font-size:11px;margin-top:4px}
.sandy-sidebar > .muted {padding:2px 6px}
.sandy-page .sandy-layout > .sandy-main {
  grid-column:2;
  display:flex;
  flex-direction:column;
  width:100%;
  min-width:0;
  min-height:650px;
  max-height:calc(100dvh - 265px);
  margin:0;
  overflow:hidden;
  background:#fff;
  border:0;
  border-radius:0;
}
.sandy-thread {
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:30px clamp(24px,4vw,62px);
  scrollbar-color:#e5d7cb transparent;
}
.sandy-welcome {
  width:100%;
  max-width:760px;
  margin:clamp(24px,5vh,64px) auto 40px;
  text-align:center;
}
.sandy-welcome > .sandy-avatar {width:95px;height:95px;margin:0 auto 19px;box-shadow:0 8px 24px #b9773c24}
.sandy-welcome h2 {font-size:clamp(26px,2.6vw,34px);letter-spacing:-.9px;font-weight:500;margin:0 0 12px}
.sandy-welcome p {max-width:490px;margin:0 auto;color:#6f655d;font-size:15px;line-height:1.65}
.sandy-prompts {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:32px 0 0}
.sandy-prompts button {
  min-height:92px;
  padding:17px;
  background:#fffdfa;
  border:1px solid #eaded4;
  border-radius:12px;
  color:#53463e;
  font-size:13px;
  line-height:1.5;
  text-align:left;
  transition:border-color .12s,box-shadow .12s,transform .12s;
}
.sandy-prompts button:hover {background:#fff8f1;border-color:#e2b893;box-shadow:0 4px 12px #7c513510;transform:translateY(-1px)}
.sandy-messages {max-width:900px;margin:auto}
.sandy-message {display:flex;gap:13px;align-items:flex-start;max-width:100%;margin:0 0 26px}
.sandy-message > div:last-child {min-width:0;flex:1}
.sandy-message .sandy-avatar {width:42px;height:42px}
.sandy-message-head {display:flex;align-items:center;gap:12px;margin:0 0 7px}
.sandy-message-head strong {font-size:13px;font-weight:600}
.sandy-message-head span {color:#97877b;font-size:11px}
.sandy-message-text {font-size:14px;line-height:1.75;margin:0;overflow-wrap:anywhere}
.sandy-markdown > :first-child {margin-top:0}
.sandy-markdown > :last-child {margin-bottom:0}
.sandy-markdown p {margin:0 0 12px}
.sandy-markdown ul,.sandy-markdown ol {margin:10px 0 14px;padding-left:24px}
.sandy-markdown li {margin:4px 0}
.sandy-markdown li > p {margin:4px 0}
.sandy-markdown h3,.sandy-markdown h4,.sandy-markdown h5,.sandy-markdown h6 {margin:20px 0 9px;line-height:1.4;font-size:16px;font-weight:600;letter-spacing:normal}
.sandy-markdown code {font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.9em;background:#f5efe8;border-radius:4px;padding:2px 5px;overflow-wrap:anywhere}
.sandy-markdown pre {max-width:100%;overflow:auto;background:#f7f2ec;border:1px solid #eaddd1;border-radius:9px;padding:12px 14px;line-height:1.55;white-space:pre}
.sandy-markdown pre code {display:block;background:none;padding:0;overflow-wrap:normal}
.sandy-markdown blockquote {margin:12px 0;padding:2px 14px;border-left:3px solid #d3aa88;color:#746860}
.sandy-markdown a {text-decoration:underline;text-underline-offset:3px}
.sandy-markdown hr {border:0;border-top:1px solid #eaddd1;margin:18px 0}
.sandy-markdown .sandy-table-scroll {max-width:100%;overflow:auto;margin:12px 0}
.sandy-markdown table {border-collapse:collapse;width:100%;font-size:13px}
.sandy-markdown th,.sandy-markdown td {border:1px solid #eaddd1;padding:8px 10px;text-align:left;vertical-align:top}
.sandy-markdown th {background:#faf5ee;font-weight:600}
.sandy-from-ai {padding:7px 4px}
.sandy-from-user {
  margin-left:auto;
  width:min(100%,780px);
  padding:17px;
  background:#fff7f0;
  border:1px solid #f0dfd2;
  border-radius:15px;
}
.sandy-user-avatar {display:flex;align-items:center;justify-content:center;width:39px;height:39px;flex:none;background:#eee7df;color:#685b51;border-radius:50%;font-size:11px;font-weight:500}
.sandy-usage {margin:14px 0 0;font-size:12px}
.sandy-usage summary {color:#a05a3f}
.sandy-usage p {line-height:1.8;overflow-wrap:anywhere;background:#fcfaf7;padding:10px;border-radius:9px;margin:8px 0 0}
#sandy-form {
  flex:none;
  margin:0;
  padding:19px clamp(22px,4vw,58px) 17px;
  border-top:1px solid #eee4dc;
  background:#fff;
}
#sandy-form > label {font-size:12px;font-weight:600;margin:0 0 7px;color:#65574f}
#sandy-message {
  width:100%;
  min-height:82px;
  max-height:180px;
  padding:14px 16px;
  margin:0;
  resize:vertical;
  font-size:14px;
  line-height:1.55;
  color:#302f2d;
  border:1px solid #ddcbc0;
  border-radius:12px;
  background:#fffefa;
}
#sandy-message:focus {border-color:#c5805c;outline:2px solid #ecd4bf;outline-offset:1px}
.sandy-compose {display:flex;align-items:center;justify-content:space-between;gap:16px;margin:12px 0 8px}
.sandy-compose label {display:flex;align-items:center;gap:7px;margin:0;font-size:12px;font-weight:400;color:#75695e}
.sandy-compose input[type=checkbox] {width:17px;height:17px;margin:0;accent-color:#bc6946}
.sandy-compose button {padding:11px 23px;font-size:13px;white-space:nowrap;border-radius:10px}
#sandy-form > p.muted {font-size:11px;line-height:1.5;margin:0;max-width:780px}
.sandy-boundary {margin:14px 0 0;color:#82766c;font-size:11px;line-height:1.6;max-width:980px}
@media(max-width:1150px) {
  .sandy-layout {grid-template-columns:205px minmax(0,1fr)}
  .sandy-page > header.sandy-page-header {padding:22px 25px}
  .sandy-prompts {gap:9px}
  .sandy-prompts button {padding:12px}
}
@media(max-width:1080px) {
  .sandy-layout {grid-template-columns:minmax(0,1fr);min-height:0}
  .sandy-page .sandy-layout > aside.sandy-sidebar {
    grid-column:1;
    display:block;
    max-height:125px;
    overflow-x:auto;
    padding:12px;
    border:0;
    border-bottom:1px solid #eee2d9;
  }
  .sandy-sidebar-head {margin-bottom:8px}
  .sandy-chat-link {display:inline-block;vertical-align:top;max-width:200px;width:200px;margin:0 6px 3px 0}
  .sandy-page .sandy-layout > .sandy-main {grid-column:1;min-height:580px;max-height:none}
  .sandy-thread {min-height:370px;padding:24px}
  .sandy-prompts {grid-template-columns:1fr}
  .sandy-prompts button {min-height:56px}
  .sandy-welcome {margin:38px auto}
}
@media(max-width:520px) {
  .sandy-page > header.sandy-page-header {padding:17px;gap:12px;flex-wrap:wrap;min-height:0}
  .sandy-page-header > .sandy-avatar {width:56px;height:56px}
  .sandy-page-header h1 {font-size:24px}
  .sandy-page-header p {font-size:12px}
  .sandy-page-header > a {margin-left:68px;padding:7px 10px;font-size:12px}
  .sandy-status {gap:9px;padding:11px 12px;min-height:0}
  .sandy-status strong {font-size:12px}
  .sandy-status p {font-size:11px}
  .sandy-status button {padding:7px;font-size:11px}
  .sandy-thread {padding:19px 15px}
  .sandy-welcome > .sandy-avatar {width:78px;height:78px}
  .sandy-welcome h2 {font-size:27px}
  .sandy-message {gap:9px}
  .sandy-message .sandy-avatar {width:34px;height:34px}
  .sandy-from-user {padding:12px}
  #sandy-form {padding:14px}
  .sandy-compose {align-items:stretch;flex-direction:column}
  .sandy-compose button {width:100%}
}
