:root {
  font-family: Inter, Arial, sans-serif;
  color-scheme: light;
  --bg: #fff;
  --surface: #fff;
  --ink: #202124;
  --muted: #73777d;
  --line: #e5e6e8;
  --accent: #f47721;
  --shadow: 0 14px 40px rgba(25, 28, 32, .10), 0 3px 10px rgba(25, 28, 32, .06);
}
* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
button, textarea, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, textarea:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; }
.main { width: min(100%, 920px); min-width: 0; flex: 1; display: flex; flex-direction: column; }
.topbar { height: 58px; flex: 0 0 58px; margin-top: clamp(58px, 9vh, 104px); padding: 0 24px; display: flex; align-items: center; justify-content: center; border: 0; background: #fff; }
.brand { display: flex; align-items: baseline; gap: 8px; color: #202124; text-decoration: none; font-size: 16px; font-weight: 700; letter-spacing: -.04em; }
.brand small { color: #777; font-size: 10px; font-weight: 600; letter-spacing: .08em; }
#status-message { width: min(100%, 920px); margin: 0; padding: 0 24px; font-size: 12px; }
#status-message:not(:empty) { padding-top: 7px; padding-bottom: 7px; background: #fff4e9; border-bottom: 1px solid #e7b37a; }
#status-message.error:not(:empty) { background: #fff0ee; border-color: #da2315; }
.view { display: none; width: 100%; min-width: 0; padding: 14px 24px 22px; margin: 0; }
.view.active { display: block; }
#view-chat.active { display: flex; flex-direction: column; justify-content: center; flex: 1; }
.heading { display: flex; justify-content: center; margin: 0 0 18px; text-align: center; }
.heading h1 { margin: 0; font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -.035em; }
.workbench { display: block; width: 100%; max-width: 760px; min-width: 0; margin: 0 auto; }
.conversation { display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 350px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.conversation-head { min-height: 30px; padding: 0 2px 8px; display: flex; align-items: center; justify-content: flex-end; border: 0; }
.conversation-head h2 { display: none; }
.conversation-head button, .document-tools button { border: 0; background: none; color: var(--muted); padding: 3px 0; font-size: 12px; white-space: nowrap; }
.conversation-head button:hover, .document-tools button:hover { color: var(--ink); }
.messages { flex: 1; min-height: 220px; max-height: min(48vh, 520px); overflow: auto; padding: 20px 10px; display: flex; flex-direction: column; gap: 18px; }
.welcome-message { width: 100%; max-width: 100%; margin: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: #303238; }
.welcome-message p, .message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.55; }
.welcome-message p { font-size: 16px; }
.mascot { display: block; width: 94px; height: 94px; flex: 0 0 94px; object-fit: contain; }
.message { display: flex; align-items: flex-start; gap: 10px; max-width: 82%; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message-mark { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 6px; background: #242629; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.message.user .message-mark { background: var(--accent); color: #fff; }
.message.user p { padding: 10px 13px; border-radius: 7px; background: #f3f4f5; }
.composer { width: 100%; margin: 0; padding: 8px; border: 1px solid #dfe1e4; border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.composer textarea { display: block; width: 100%; min-height: 72px; max-height: 190px; padding: 8px 9px; border: 0; background: transparent; color: var(--ink); font-size: 15px; resize: vertical; outline: 0; }
.composer textarea::placeholder { color: #888b90; }
.composer-tools { display: flex; align-items: center; gap: 8px; padding: 5px 2px 0; border-top: 1px solid #f0f0f0; }
.composer-tools label { display: flex; align-items: center; gap: 5px; color: #666b72; font-size: 12px; white-space: nowrap; }
.composer-tools select { max-width: 142px; padding: 5px 4px; border: 0; background: #fff; color: #34373b; font-size: 12px; }
.ai-toggle input { accent-color: var(--accent); }
button.primary { min-height: 32px; padding: 6px 12px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; }
button.primary:hover { background: #df6715; }
.type-row { width: 100%; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; padding: 10px 0 0; }
.type-row button { padding: 6px 12px; border: 1px solid #e2e3e5; border-radius: 6px; background: #fff; color: #5e6268; font-size: 12px; }
.type-row button.active, .type-row button:hover { border-color: #cfd1d4; background: #f5f5f6; color: #292b30; }
.draft { display: none; margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.workbench.has-draft .draft { display: block; }
.draft-head { padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.draft-head h2 { margin: 0; font-size: 16px; }
.draft-head>p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.extracted { margin: 6px 0 0; }
.extracted>div { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 9px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.extracted dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.extracted dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 14px; }
.empty-fields { margin: 10px 0; color: var(--muted); font-size: 14px; }
.suggestions { padding: 11px 0; border-bottom: 1px solid var(--line); }
.suggestions h3 { margin: 0 0 6px; font-size: 13px; }
.suggestion { padding: 8px 0; border-top: 1px solid #f1f1f1; }
.suggestion strong { font-size: 13px; }.suggestion p { margin: 5px 0; color: #4f5358; font-size: 14px; }.suggestion small { color: var(--muted); font-size: 12px; }
.suggestion button { border: 0; background: none; color: #a94e0b; padding: 4px 0; font-size: 12px; }
.draft-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; margin-top: 13px; }
.draft-actions button { min-height: 34px; padding: 7px 5px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 600; }
.draft-actions button.primary { background: var(--accent); border-color: var(--accent); }
.draft-actions button:disabled { opacity: .65; cursor: default; }
.app-footer { width: 100%; display: flex; justify-content: center; gap: 28px; padding: 14px 16px 20px; }
.app-footer button { padding: 4px; border: 0; background: none; color: #777b80; font-size: 12px; }
.app-footer button:hover, .app-footer button.active { color: #26282d; }
.app-footer .footer-signin { padding: 4px; color: #777b80; font-size: 12px; text-decoration: none; }
.app-footer .footer-signin:hover { color: #26282d; }
.section-heading { margin: 0 0 18px; }.section-heading h1 { margin: 0; font-size: 23px; }.section-heading>p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.document-tools { padding: 9px 0; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.documents-list { margin-top: 8px; display: grid; gap: 8px; }
.document-row { width: 100%; min-width: 0; padding: 11px 13px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); text-align: left; }
.document-row:hover { border-color: #ccc; }.document-row>span { min-width: 0; }.document-row strong,.document-row small { display: block; overflow-wrap: anywhere; }.document-row strong { font-size: 14px; }.document-row small { margin-top: 3px; color: var(--muted); font-size: 12px; }.document-row time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.empty { padding: 18px 0; color: var(--muted); font-size: 14px; }
#view-knowledge>h2 { margin: 20px 0 8px; font-size: 16px; }
.knowledge-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.knowledge-item { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.knowledge-item h2 { margin: 0 0 5px; font-size: 15px; overflow-wrap: anywhere; }.knowledge-item p { margin: 0 0 6px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }.knowledge-item small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; word-break: break-word; }
.catalog-tools { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 7px 12px; margin: 10px 0; }
.catalog-tools input { grid-column: 1/-1; width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 14px; }.catalog-tools span { grid-column: 1/-1; color: var(--muted); font-size: 12px; }
.connection-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.connection-card { padding: 18px; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.connection-card header,.connection-card header>div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }.connection-card header>div { justify-content: flex-start; }
.connection-card h2 { margin: 0; font-size: 16px; }.connection-card header p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.connection-status { color: #767a80; font-size: 12px; }.connection-card.connected .connection-status { color: #23834b; }
.provider-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; font-weight: 700; }.claude-icon { color: #bd5e36; }
.connection-card>label { display: grid; gap: 6px; margin: 22px 0 12px; color: #555a60; font-size: 13px; }
.connection-card input { width: 100%; min-width: 0; padding: 10px; border: 1px solid #dfe1e4; border-radius: 6px; background: #fff; color: #24262a; font-size: 14px; }
.connection-actions { display: flex; flex-wrap: wrap; gap: 7px; }.connection-actions button:not(.primary) { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #41454a; font-size: 12px; }
.connection-note { color: var(--muted); font-size: 12px; }
.document-help { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; padding: 20px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); box-shadow: var(--shadow); }
.document-help::backdrop { background: rgba(20,20,20,.45); }.document-help h2 { margin: 0 0 12px; font-size: 18px; }.document-help form { display: inline; }.document-help form:first-child { float: right; }.document-help .preview iframe { display: block; width: 100%; height: min(70vh,760px); border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.dialog-close { border: 0; background: transparent; color: var(--muted); font-size: 22px; }
@media(max-width: 700px) {
  .topbar { padding: 0 16px; }
  .view { padding: 10px 14px 16px; }
  #view-chat.active { justify-content: center; }
  .heading { margin-bottom: 12px; }.heading h1 { font-size: 20px; }
  .conversation { min-height: 320px; }.messages { min-height: 190px; padding: 16px 5px; }
  .composer-tools { flex-wrap: wrap; gap: 3px; }.composer-tools select { max-width: 120px; }
  .type-row { justify-content: center; gap: 5px; }.type-row button { padding: 6px 9px; white-space: nowrap; }
  .connection-grid,.knowledge-list { grid-template-columns: 1fr; }
  .draft-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }.draft-actions button.primary { grid-column: 1/-1; }
}

/* Centered minimal KUBO composer */
.main { width: min(100%, 900px); }
.topbar { justify-content: center; }
.brand { align-items: baseline; gap: 7px; font-size: 18px; letter-spacing: -.025em; }
.brand strong { font-weight: 650; }
.brand small { color: #555a60; font-size: 13px; font-weight: 500; letter-spacing: 0; }
#status-message { width: min(100%, 720px); margin: 0 auto; padding: 0 18px; color: #a12620; font-size: 12px; }
#status-message:not(:empty) { padding: 3px 18px; background: transparent; border: 0; }
#status-message.error:not(:empty) { background: transparent; border: 0; }
.view { padding-left: 20px; padding-right: 20px; }
#view-chat.active { align-items: center; }
.workbench { display: block; width: 100%; max-width: 680px; margin: 0 auto; }
.conversation { width: 100%; min-height: 0; align-items: center; }
.conversation-head { width: 100%; min-height: 0; padding: 0; }
.conversation-head:has(button[hidden]) { display: none; }
.messages { width: 100%; min-height: 135px; max-height: min(46vh, 480px); padding: 4px 0 18px; align-items: center; }
.messages:not(:has(.message)) { display: none; }
.welcome-message { width: 100%; min-height: 120px; margin: 0; align-items: center; justify-content: center; }
.mascot { width: 112px; height: 112px; flex-basis: 112px; object-fit: contain; }
.composer { width: 100%; padding: 18px 20px 14px; border: 1px solid #e2e4e7; border-radius: 25px; box-shadow: 0 10px 34px rgba(28,32,38,.075); }
.composer textarea { min-height: 78px; max-height: 200px; padding: 0; font-size: 16px; }
.composer-tools { justify-content: flex-end; padding: 8px 0 0; border-top: 0; }
.composer-hint { margin-right: auto; color: #85898e; font-size: 12px; }
.composer button.primary { min-height: 36px; padding: 7px 15px; border-radius: 18px; background: #202124; font-size: 13px; }
.composer button.primary:hover { background: #414348; }
.type-row { width: 100%; justify-content: center; gap: 7px; padding: 11px 0 0; }
.type-row button { padding: 5px 11px; border-radius: 999px; border-color: transparent; background: #f5f6f7; color: #62666b; font-size: 11px; }
.type-row button.active,.type-row button:hover { border-color: #e0e2e5; background: #fff; color: #27292d; }
.app-footer { padding-top: 12px; }

/* KUBO is a small articulated SVG rig: body reveal, elbow and wrist wave. */
.kubo-presence { position:relative; width:100%; height:164px; display:grid; place-items:center; overflow:visible; }
.kubo-rig { display:block; width:138px; height:160px; overflow:visible; opacity:1; }
.kubo-eye { transform-box:fill-box; transform-origin:center; animation:kubo-blink 4.8s linear .3s infinite; }
.kubo-right-upper,.kubo-right-lower,.kubo-hand { transform-box:view-box; }
.kubo-right-upper { transform-origin:128px 127px; }
.kubo-right-lower { transform-origin:157px 130px; }
.kubo-hand { transform-origin:166px 105px; }
.kubo-presence[data-state="hello"] .kubo-rig { animation:kubo-rise 680ms cubic-bezier(.2,.7,.25,1) both; }
.kubo-presence[data-state="hello"] .kubo-right-upper { animation:kubo-lift 2200ms ease-in-out 300ms both; }
.kubo-presence[data-state="hello"] .kubo-right-lower { animation:kubo-elbow 2000ms ease-in-out 420ms both; }
.kubo-presence[data-state="hello"] .kubo-hand { animation:kubo-wave 700ms ease-in-out 760ms 2; }
.kubo-presence[data-state="reply"] .kubo-hand { animation:kubo-wave 700ms ease-in-out; }
@keyframes kubo-rise { from { opacity:0; transform:translateY(26px); } to { opacity:1; transform:translateY(0); } }
@keyframes kubo-lift { 0%,100% { transform:rotate(0); } 25%,75% { transform:rotate(-7deg); } }
@keyframes kubo-elbow { 0%,100% { transform:rotate(0); } 25%,75% { transform:rotate(-5deg); } }
@keyframes kubo-wave { 0%,100% { transform:rotate(0); } 25% { transform:rotate(-17deg); } 75% { transform:rotate(17deg); } }
@keyframes kubo-blink { 0%,60%,63%,100% { transform:scaleY(1); } 61.5% { transform:scaleY(.08); } }
.kubo-message-mark { padding:0; overflow:hidden; background:transparent; }
.kubo-message-mark img { display:block; width:28px; height:28px; object-fit:cover; object-position:center 20%; }
@media(prefers-reduced-motion:reduce) { .kubo-rig,.kubo-right-upper,.kubo-right-lower,.kubo-hand,.kubo-eye { animation:none!important; transform:none!important; opacity:1!important; } }
@media(max-width:700px) {
  .view { padding-left: 14px; padding-right: 14px; }
  .workbench { width: 100%; }
  .composer { padding: 16px 17px 12px; border-radius: 23px; }
  .composer-tools { flex-wrap: nowrap; }
  .type-row { justify-content: center; flex-wrap: wrap; }
}
.connection-card select { width:100%; padding:10px; border:1px solid #dfe1e4; border-radius:6px; background:#fff; color:#24262a; font-size:14px; }
