.pc-sheet { width: min(560px, calc(100vw - 32px)); max-width: none; max-height: var(--sheet-height, calc(100dvh - 24px)); padding: 0; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); overflow: hidden; }
.pc-sheet[open] { display: flex; flex-direction: column; }
.pc-sheet [hidden] { display: none !important; }
.pc-sheet { box-sizing: border-box; font: 14px/1.5 var(--sans); }
.pc-sheet::backdrop { background: var(--overlay, #0008); backdrop-filter: blur(3px); }
.pc-sheet-wide { width: min(980px, calc(100vw - 48px)); }
.pc-sheet .pc-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; margin: 0; padding: 20px 24px; border-bottom: 1px solid var(--border); height: auto; min-height: 0; position: static; width: auto; background: transparent; }
.pc-sheet h2 { min-width: 0; overflow-wrap: anywhere; text-align: left; margin: 0; font-size: 22px; line-height: 1.3; letter-spacing: -.03em; }
.pc-sheet-close { flex-shrink: 0; cursor: pointer; border: 1px solid var(--border); background: transparent; color: inherit; border-radius: 9px; min-height: 40px; padding: 8px 12px; }
.pc-sheet-body { min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 22px 24px; min-height: 0; }
.pc-sheet-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); flex-shrink: 0; }
.pc-sheet-foot:empty { display: none; }
.pc-sheet-foot button { min-height: 40px; justify-content: center; white-space: normal; overflow-wrap: anywhere; }
.pc-sheet button:disabled { cursor: default; opacity: .5; }
.pc-sheet button:disabled:hover { transform: none; }
.pc-sheet-foot button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.pc-sheet-close:hover { background: var(--input); }
.pc-sheet button:focus-visible, .pc-sheet :is(input, textarea, select):focus-visible { outline: 2px solid var(--pc-focus, var(--text)); outline-offset: 2px; }
.pc-sheet-note { font-size: 14px; line-height: 1.6; color: var(--text-2); margin: 0 0 18px; }
.pc-sheet-message { white-space: pre-wrap; line-height: 1.65; margin: 0 0 18px; }
.pc-sheet input, .pc-sheet textarea, .pc-sheet select { box-sizing: border-box; max-width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--input); color: var(--text); font: inherit; }
.pc-sheet input:not([type=checkbox]), .pc-sheet textarea { width: 100%; }
.pc-sheet :is(input, select, textarea):disabled { color: var(--text-2); cursor: default; }
.pc-choice { box-sizing: border-box; min-width: 0; overflow-wrap: anywhere; cursor: pointer; width: 100%; display: flex; justify-content: space-between; align-items: center; text-align: left; gap: 14px; padding: 15px; border: 1px solid var(--border); border-radius: 11px; background: transparent; color: var(--text); font-size: 15px; margin-bottom: 8px; }
.pc-choice[aria-pressed=true], .pc-choice:not(:disabled):hover { background: var(--input); border-color: var(--text-3); }
.pc-choice > .pc-choice-label { min-width: 0; color: inherit; font: inherit; flex: 1; }
.pc-choice > span:not(.pc-choice-label) { color: var(--text-2); font-size: 12px; flex-shrink: 0; }
.pc-mobile-model, .pc-mobile-more { display: none; }
.pc-action-grid { display: grid; gap: 8px; }
.pc-action-grid button { min-height: 48px; overflow-wrap: anywhere; text-align: left; }
.pc-reading .md { max-width: 76ch; margin: 0 auto; line-height: 1.75; font-size: 16px; }
.md-h1 { font-size: 22px; line-height: 1.3; margin: 24px 0 12px; }
.md-h2 { font-size: 18px; line-height: 1.4; margin: 20px 0 10px; }
.md-h3 { font-size: 16px; line-height: 1.45; margin: 18px 0 8px; }
.md .md-h:first-child { margin-top: 0; }
.md p { margin-bottom: 14px; }
.md ul, .md ol { margin-bottom: 16px; }
.md li { margin: 5px 0; }
.md-table-wrap { overflow-x: auto; max-width: 100%; margin: 16px 0; border: 1px solid currentColor; border-color: color-mix(in srgb, currentColor 16%, transparent); border-radius: 10px; }
.md table { width: 100%; border-collapse: collapse; font-size: .94em; white-space: normal; }
.md th, .md td { padding: 10px 12px; text-align: left; border-bottom: 1px solid currentColor; border-bottom-color: color-mix(in srgb, currentColor 12%, transparent); vertical-align: top; min-width: 100px; }
.md th { font-weight: 650; background: color-mix(in srgb, currentColor 5%, transparent); }
.md tr:last-child td { border-bottom: 0; }
.pc-reading .bubble { background: var(--bubble-ai); color: var(--bubble-ai-text); border-radius: 12px; padding: 24px; }
.pc-reading.hide-restoration mark.restored, .pc-reading.hide-restoration .math-restored { border: 0; background: transparent; font-weight: inherit; }
.pc-answer-view { display: inline-flex; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.pc-answer-view button { border: 0; padding: 6px 9px; background: transparent; color: var(--text-2); border-radius: 6px; font-size: 12px; }
.pc-answer-view button[aria-pressed=true] { background: var(--input); color: var(--text); }
.pc-history-search { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.pc-history-search input { min-width: 0; flex: 1 1 170px; }
.pc-history-search select { max-width: 100%; flex: 0 1 180px; }
.pc-history-count { width: 100%; font-size: 12px; color: var(--text-2); margin: 0; }
.conv-main { background: none; border: 0; color: inherit; text-align: left; font: inherit; padding: 0; }
.conv-menu { background: transparent; border: 1px solid transparent; color: var(--text-2); border-radius: 8px; min-width: 40px; min-height: 40px; font-size: 20px; flex-shrink: 0; }
.conv-menu:hover { border-color: var(--border); background: var(--input); }
.pc-undo { position: fixed; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 140; display: flex; align-items: center; gap: 16px; padding: 12px 16px; width: max-content; box-sizing: border-box; max-width: calc(100vw - 32px); border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px #0005; font-size: 14px; }
.pc-undo > span { min-width: 0; overflow-wrap: anywhere; }
.pc-undo button { flex-shrink: 0; min-height: 40px; color: inherit; background: var(--input); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
@media (max-width: 640px) {
  .pc-sheet { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .pc-sheet-wide { width: 100%; }
  .pc-sheet .pc-sheet-head { padding: 17px 18px; }
  .pc-sheet-body { padding: 18px; }
  .pc-sheet-foot { padding: 14px 18px max(16px, env(safe-area-inset-bottom)); }
  .pc-sheet h2 { font-size: 20px; }
  .pc-sheet input, .pc-sheet textarea, .pc-sheet select { font-size: 16px; }
  .pc-mobile-model { display: block; max-width: 165px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 44px; padding: 8px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; }
  #model-select.has-mobile-picker { display: none; }
  .pc-mobile-more { display: inline-flex; min-height: 44px; align-items: center; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--text); padding: 8px 12px; }
  .pc-reading .bubble { padding: 18px; }
  .pc-answer-view { flex-wrap: wrap; }
  .msg-actions { flex-wrap: wrap; gap: 8px; }
  .pc-history-search { position: static; }
  #pe-flows:has(.pf-group.open) { margin-bottom: 0; }
}

.pc-history-search input { width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:9px; background:var(--input); color:var(--text); font:inherit; font-size:14px; }
.pc-restore-comparison { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.pc-restore-comparison section { min-width:0; }
.pc-restore-comparison h3 { font-size:14px; margin:0 0 8px; }
.pc-restore-comparison pre { margin:0; font:14px/1.65 var(--sans); white-space:pre-wrap; overflow-wrap:anywhere; max-height:260px; overflow:auto; background:var(--input); padding:14px; border-radius:10px; }
.pc-correction-form { display:grid; gap:14px; margin-top:18px; }
.pc-correction-form label { display:grid; gap:7px; font-size:14px; }
.pc-reader-underlines { display:flex; align-items:center; min-height:32px; gap:8px; font-size:13px; margin-bottom:16px; }
.pc-sheet .pc-reader-underlines input { width:18px; height:18px; flex-shrink:0; margin:0; accent-color:var(--text); }
.pc-correction-form + .pc-sheet-note { margin: 14px 0 0; scroll-margin-block: 14px; }
.pc-correction-form + .pc-sheet-note:empty { display: none; }
.md .md-align-center { text-align:center; } .md .md-align-right { text-align:right; }
.md-table-wrap:focus-visible { outline:2px solid currentColor; outline-offset:3px; }
@media(max-width:640px) { .pc-restore-comparison { grid-template-columns:1fr; } .pc-history-search input { font-size:16px; } }

.pc-policy-entry { display:flex; margin:0 4px 6px; }
.pc-policy-entry button { font-size:12px; min-height:32px; padding:5px 8px; color:var(--text-2); max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media(max-width:640px) { .pc-policy-entry button { min-height:44px; } }

@media(max-width:640px) { .pc-sheet-close { min-height:44px; min-width:44px; } }

@media(max-width:640px) {
  .header-right #history-btn, .header-right #client-btn, .header-right #new-chat-top, #conv-bar #raw-toggle, .header-right #raw-toggle { display:none !important; }
  #mobile-conversation-menu { min-height:44px; padding:8px 12px; font-size:13px; }
}

.drawer { max-width:100%; }
.drawer > .pc-history-search { padding:12px 20px; flex-shrink:0; }

/* Compact search belongs to the Pro rail, not a separate page-colored panel. */
@media (min-width: 900px) {
  body.pro #sidebar > .pc-history-search {
    position: relative;
    background: transparent;
    padding: 8px 8px 10px;
    gap: 6px;
    margin-top: 2px;
  }
  body.pro #sidebar .pc-history-search input {
    box-sizing: border-box;
    flex-basis: 100%;
    height: 36px;
    padding: 7px 10px 7px 32px;
    border-color: var(--border);
    border-radius: 8px;
    background: color-mix(in srgb, var(--text) 4%, var(--surface));
    font-size: 13px;
    line-height: 20px;
  }
  body.pro #sidebar .pc-history-search input::placeholder { color: var(--text-2); opacity: 1; }
  body.pro #sidebar .pc-history-search input:hover { border-color: var(--border-strong); }
  body.pro #sidebar .pc-history-search input:focus { background: var(--surface); border-color: var(--pc-focus); }
  body.pro #sidebar .pc-history-search::before,
  body.pro #sidebar .pc-history-search::after {
    content: "";
    position: absolute;
    pointer-events: none;
    color: var(--text-3);
  }
  body.pro #sidebar .pc-history-search::before {
    left: 20px;
    top: 20px;
    width: 9px;
    height: 9px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
  }
  body.pro #sidebar .pc-history-search::after {
    left: 29px;
    top: 30px;
    width: 5px;
    height: 1.5px;
    background: currentColor;
    transform: rotate(45deg);
    transform-origin: left center;
  }
  body.pro #sidebar .pc-history-count { padding: 0 2px; line-height: 1.5; }
  /* Keep the live count available to assistive technology when idle. */
  body.pro #sidebar .pc-history-search:has(input:placeholder-shown) .pc-history-count {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
@media (min-width: 900px) and (pointer: coarse) {
  body.pro #sidebar .pc-history-search input { height: 44px; font-size: 16px; }
  body.pro #sidebar .pc-history-search::before { top: 24px; }
  body.pro #sidebar .pc-history-search::after { top: 34px; }
}

/* Conversation overflow actions: an anchored menu on desktop, a short phone sheet. */
.pc-sheet.pc-sheet-actions {
  width: min(264px, calc(100vw - 24px), var(--action-menu-width, 264px));
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 36px #0003;
}
.pc-sheet-actions::backdrop { background: transparent; backdrop-filter: none; }
.pc-sheet.pc-sheet-anchored { position: fixed; margin: 0; }
.pc-sheet.pc-sheet-actions .pc-sheet-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  min-height: 0;
  gap: 12px;
  padding: 12px 12px 10px;
  align-items: center;
}
.pc-sheet-actions h2 {
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: left;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.pc-sheet-actions .pc-sheet-close {
  width: 28px;
  height: 28px;
  min-height: 28px;
  min-width: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--text-2);
  font: 22px/1 var(--sans);
}
.pc-sheet-actions .pc-sheet-close:hover { background: var(--input); color: var(--text); }
.pc-sheet-actions .pc-sheet-body { padding: 6px; }
.pc-sheet-actions .pc-action-grid { gap: 2px; }
.pc-sheet-actions .pc-action-grid button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: 13px/20px var(--sans);
  text-align: left;
}
.pc-sheet-actions .pc-action-grid button:hover { background: var(--input); }
.pc-sheet-actions .pc-action-grid svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--text-2); }
.pc-sheet-actions .pc-action-grid .pc-action-delete {
  margin-top: 5px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 6px 6px;
  padding-top: 10px;
  color: var(--danger);
}
.pc-sheet-actions .pc-action-delete svg { color: inherit; }
@media (max-width: 640px), (pointer: coarse) {
  .pc-sheet.pc-sheet-actions .pc-sheet-head { grid-template-columns: minmax(0, 1fr) 44px; }
  .pc-sheet-actions .pc-sheet-close { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .pc-sheet-actions .pc-action-grid button { min-height: 44px; font-size: 15px; }
}
@media (max-width: 640px) {
  .pc-sheet.pc-sheet-actions { width: 100%; border-radius: 16px 16px 0 0; }
  .pc-sheet-actions::backdrop { background: var(--overlay, #0006); }
  .pc-sheet.pc-sheet-actions .pc-sheet-head { padding: 10px 16px 8px; }
  .pc-sheet-actions h2 { font-size: 15px; }
  .pc-sheet-actions .pc-sheet-body { padding: 6px 10px max(10px, env(safe-area-inset-bottom)); }
}

/* Phone landing: the introduction shares the available vertical space, with
   a compact composer near the bottom. Content can still grow and scroll. */
@media (max-width: 640px) {
  body.centered-idle .wrap > header {
    min-height: 80px;
    padding-top: calc(24px + env(safe-area-inset-top));
    padding-bottom: 12px;
    flex-shrink: 0;
  }
  body:not(.pro).centered-idle .wrap {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  body:not(.pro).centered-idle .hero {
    margin: auto 0;
    padding: 24px 0;
    flex-shrink: 0;
  }
  body.centered-idle #card-1 { flex-shrink: 0; }
  body #card-1 .card-body { position: relative; }
  body #card-1 .row, body.pro.centered-idle #card-1 .row {
    min-height: 0;
    padding: 4px 8px;
    row-gap: 0;
    column-gap: 4px;
    border-top: 0;
    align-items: center;
  }
  body #card-1 #attach-btn { margin: 0; }
  body #card-1 #strict-inline {
    min-height: 44px;
    padding: 0 8px;
    border-color: transparent;
  }
  body #card-1 .pc-policy-entry {
    position: absolute;
    right: 12px;
    bottom: 4px;
    margin: 0;
    max-width: calc(100% - 148px);
    z-index: 1;
  }
  body #card-1 .pc-policy-entry button {
    min-height: 44px;
    padding: 0 4px;
    font-size: 12px;
  }
  body #card-1 #scrub-status { display: none; }
  body.centered-idle #card-1 textarea,
  body.pro.centered-idle #card-1 textarea,
  body:not(.pro).centered-idle #card-1 textarea {
    min-height: 56px;
    padding: 12px 16px 4px;
  }
  body:not(.pro).centered-idle .hero-learn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    margin: 8px 0 0;
    padding: 8px;
    flex-shrink: 0;
  }
}
@media (max-width: 640px) and (max-height: 740px) {
  body:not(.pro).centered-idle .hero .eyebrow { margin-bottom: 10px; }
  body:not(.pro).centered-idle .hero h1 { margin-bottom: 12px; line-height: 1.16; }
  :root body:not(.pro).centered-idle .hero p { font-size: 14px; line-height: 1.55; }
}

/* Touch controls stay generous without increasing the compact action sheet. */
@media (max-width: 640px), (pointer: coarse) {
  .pc-sheet-foot button, .pc-answer-view button, .pc-reader-underlines, .pc-undo button { min-height: 44px; }
  .pc-answer-view button { padding: 9px 12px; }
  .pc-sheet input:not([type=checkbox]), .pc-sheet select { min-height: 44px; }
}

/* Quoted reply passages inherit their current reading surface and text color. */
.md blockquote {
  margin: 1em 0;
  padding: .1em 0 .1em 1em;
  border-inline-start: 3px solid color-mix(in srgb, currentColor 30%, transparent);
  color: inherit;
  min-width: 0;
  overflow-wrap: anywhere;
}
.md blockquote > p:first-child { margin-top: 0; }
.md blockquote > p:last-child { margin-bottom: 0; }

/* Copy is a compact two-item menu anchored to the message action. */
.pc-sheet.pc-sheet-actions.pc-sheet-dropdown {
  width: min(164px, calc(100vw - 24px), var(--action-menu-width, 164px));
  border-radius: 8px;
}
.pc-sheet-dropdown::backdrop { background: transparent; }
.pc-sheet.pc-sheet-dropdown .pc-sheet-head,
.pc-sheet.pc-sheet-dropdown .pc-sheet-foot { display: none; }
.pc-sheet.pc-sheet-dropdown .pc-sheet-body { padding: 4px; }
.pc-sheet.pc-sheet-dropdown .pc-action-grid { gap: 0; }
.pc-sheet.pc-sheet-dropdown .pc-action-grid button {
  min-height: 32px;
  padding: 6px 10px;
  font: 500 12px/20px var(--sans);
}
@media (max-width: 640px) {
  /* Full-width replies read directly on the page; user prompts retain bubbles. */
  body .msg.assistant .msg-inner { width: 100%; max-width: 100%; }
  body .msg.assistant .bubble {
    --bubble-ai-text: var(--text);
    --bubble-ai-accent: var(--text);
    background: transparent;
    color: var(--text);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    width: 100%;
  }
  body .msg.assistant .bubble mark { background: var(--selection); }
  body .msg.assistant .bubble mark.restored {
    background: transparent;
    border-bottom-color: color-mix(in srgb, var(--text) 45%, transparent);
  }
  body .msg.assistant .bubble::selection,
  body .msg.assistant .bubble ::selection { background: var(--selection); }
}

#attach-btn .attach-plus { display: none; }
.pc-model-details { display: grid; gap: 3px; min-width: 0; text-align: left; }
.pc-model-use { font-size: 12px; line-height: 1.45; font-weight: 400; color: var(--text-2); }
@media (max-width: 640px) {
  body #card-1 .pc-policy-entry { display: none; }
  body #attach-btn svg:not(.attach-plus) { display: none; }
  body #attach-btn .attach-plus { display: block; }
  body #card-1 .row, body.pro.centered-idle #card-1 .row {
    grid-template-columns: 36px minmax(0, 1fr) auto 44px;
    column-gap: 2px;
  }
  body #card-1 #attach-btn { width: 36px; min-width: 36px; }
  body #card-1 .pc-mobile-model {
    grid-column: 2; grid-row: 1; width: 100%; max-width: none;
    padding: 0 2px; font-size: 12px; text-align: left;
  }
  body #card-1 #strict-inline, body.pro.centered-idle #card-1 #strict-inline {
    grid-column: 3; grid-row: 1; padding: 0 4px;
    font-size: 11px; white-space: nowrap; min-height: 44px;
  }
  body #card-1 #scrub-btn, body.pro.centered-idle #card-1 #scrub-btn { grid-column: 4; }
}

@media (max-width: 640px) {
  body #card-1 .row, body.pro.centered-idle #card-1 .row {
    grid-template-columns: 36px minmax(0, 1fr) minmax(92px, .8fr) 44px;
  }
  body #card-1 #strict-inline, body.pro.centered-idle #card-1 #strict-inline {
    justify-self: center; transform: translateX(-3px);
  }
  body.chat-active #chat-log.active { margin-bottom: 6px; }
  body.chat-active #chat-log .msg:last-child { margin-bottom: 14px; }
  body #card-1 textarea, body.pro.centered-idle #card-1 textarea,
  body:not(.pro).centered-idle #card-1 textarea,
  body.chat-active #card-1 textarea {
    min-height: calc(1.6em + 20px);
    padding-top: 10px; padding-bottom: 10px;
  }
  .pc-sheet.pc-sheet-top {
    top: 0; bottom: auto; margin: 0;
    border-radius: 0 0 20px 20px;
    border-top: 0; border-bottom: 1px solid var(--border);
    max-height: var(--sheet-height, calc(100dvh - 24px));
  }
  .pc-sheet.pc-sheet-top .pc-sheet-head { padding-top: calc(17px + env(safe-area-inset-top)); }
}

/* Desktop composer: one compact control row below a centered single-line draft. */
body #card-1 #scrub-status { display: none; }
@media (min-width: 641px) {
  body #card-1 textarea, body.pro.centered-idle #card-1 textarea,
  body:not(.pro).centered-idle #card-1 textarea,
  body.chat-active #card-1 textarea,
  body.pro.chat-active #chat-log.active ~ #dock #card-1 textarea {
    min-height: 3.04em;
    padding-top: .72em; padding-bottom: .72em;
  }
  body #card-1 .row, body.pro.centered-idle #card-1 .row {
    min-height: 0; padding-top: 5px; padding-bottom: 5px;
    flex-wrap: nowrap;
  }
  body.chat-active #card-1 .row { padding-top: 1.5px; padding-bottom: 1.5px; }
  body #card-1 .pc-policy-entry { margin: 0; flex: 0 1 150px; max-width: 180px; }
  body #card-1 .pc-policy-entry button {
    min-height: 36px; padding: 7px 8px; border: 1px solid var(--border);
    border-radius: 9px; font: 500 12px var(--sans);
  }
  body #card-1 .row #model-select { flex: 0 1 190px; }
  body #card-1 #strict-inline { flex-shrink: 0; }
}

/* The composer owns focus styling; an inner textarea outline becomes a divider. */
body #card-1 #prompt-input:focus,
body #card-1 #prompt-input:focus-visible { outline: none; }
body #card-1:has(#prompt-input:focus-visible) { border-color: var(--pc-focus, var(--border-strong)); }
@media (min-width: 641px) {
  body #card-1 .row, body.pro.centered-idle #card-1 .row { margin-top: 0; }
}

.pc-sheet.pc-share { width: min(674px, calc(100vw - 24px)); }
.pc-share .pc-sheet-head { padding: 12px 16px; }
.pc-share .pc-sheet-body { padding: 12px 16px; }
.pc-share .pc-sheet-foot { padding: 10px 16px; }
.pc-share .pc-sheet-note { margin: 0; }
.pc-share [hidden] { display: none !important; }
.pc-share-loading { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.pc-share-loading p { margin: 0; }
.pc-share-layout { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.pc-share-fields[hidden] { display: none; }
.pc-share-fields label { display: block; font-weight: 500; margin-bottom: 16px; }
.pc-share-fields textarea { display: block; box-sizing: border-box; width: 100%; margin-top: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--input); color: var(--text); font: 16px/1.5 var(--sans); resize: vertical; }
.pc-share-preview { min-width: 0; position: relative; }
/* Keep the palette on the card itself as well as its preview wrapper: the
   image exporter clones the card directly into document.body. */
.pc-share-preview, .pc-share-card {
  --pc-share-bg: #fff0db;
  --pc-share-text: #231f1a;
  --pc-share-muted: #655a4d;
  --pc-share-inset: #f0e2cf;
  --pc-share-border: #c6bbaa;
  --pc-share-quote: #b9ab96;
  --pc-share-link: #354e68;
}
:root[data-theme="dark"] :is(.pc-share-preview, .pc-share-card) {
  --pc-share-bg: var(--bg);
  --pc-share-text: var(--text);
  --pc-share-muted: var(--text-2);
  --pc-share-inset: var(--input);
  --pc-share-border: var(--border-strong);
  --pc-share-quote: var(--border-strong);
  --pc-share-link: #b8cce0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.pc-share-preview, .pc-share-card) {
    --pc-share-bg: var(--bg);
    --pc-share-text: var(--text);
    --pc-share-muted: var(--text-2);
    --pc-share-inset: var(--input);
    --pc-share-border: var(--border-strong);
    --pc-share-quote: var(--border-strong);
    --pc-share-link: #b8cce0;
  }
}
.pc-share-card { box-sizing: border-box; background: var(--pc-share-bg); color: var(--pc-share-text); border-radius: 12px; padding: 32px; font: 16px/1.55 system-ui, sans-serif; overflow-wrap: anywhere; text-align: left; }
.pc-share-brand { margin-bottom: 26px; color: inherit; }
.pc-share-brand .wordmark { display: inline-flex; align-items: baseline; font: 700 32px/1.1 system-ui, sans-serif; letter-spacing: -1.4px; }
.pc-share-brand .glyph-o { width: 30px; height: 24px; align-self: center; color: inherit; fill: currentColor; }
.pc-share-question { font-weight: 600; margin-bottom: 24px; }
.pc-share-card p { margin: 0 0 12px; }
.pc-share-card h1, .pc-share-card h2, .pc-share-card h3 { font-size: 1.2em; line-height: 1.35; margin: 18px 0 10px; color: inherit; }
.pc-share-card ul, .pc-share-card ol { padding-left: 24px; margin: 10px 0; }
.pc-share-card li { margin: 4px 0; }
.pc-share-card blockquote { margin: 12px 0; padding-left: 16px; border-left: 3px solid var(--pc-share-quote); }
.pc-share-card pre { background: var(--pc-share-inset); color: var(--pc-share-text); padding: 12px; border-radius: 6px; white-space: pre-wrap; }
.pc-share-card code { font: .88em/1.5 monospace; }
.pc-share-card .md-table-wrap { border-color: var(--pc-share-border); overflow: visible; }
.pc-share-card th { background: var(--pc-share-inset); }
.pc-share-card blockquote { border-inline-start-color: var(--pc-share-quote); }
.pc-share-card .katex-display { border-color: var(--pc-share-border); background: transparent; }
.pc-share-card table { width: 100%; border-collapse: collapse; font-size: .9em; }
.pc-share-card th, .pc-share-card td { padding: 7px; border: 1px solid var(--pc-share-border); text-align: left; }
.pc-share-card a { color: var(--pc-share-link); }
.pc-share-card .katex-display { overflow: visible; }
.pc-share-attribution { font-size: 12px; color: var(--pc-share-muted); margin-top: 26px; }
.pc-share-preview .pc-share-edit { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; min-height: 36px; padding: 8px; border: 1px solid var(--pc-share-border); border-radius: 9px; background: var(--pc-share-bg); color: var(--pc-share-text); opacity: 0; transition: opacity .15s; }
.pc-share-edit svg { display: block; width: 20px; height: 20px; }
.pc-share-preview:hover .pc-share-edit, .pc-share-preview:focus-within .pc-share-edit { opacity: 1; }
@media (hover: none) { .pc-share-preview .pc-share-edit { opacity: 1; } }
@media (max-width: 640px) { .pc-share-card:not(.pc-share-export) { padding: 24px 20px; font-size: 15px; } }

/* Pro starter: compact composer with an attached, inset quick-action tray. */
@media (min-width: 641px) {
  body.pro.centered-idle #card-1 { min-height: 0; margin-bottom: 0; }
  body.pro.centered-idle #card-1 .card-body { flex: none; }
  body.pro.centered-idle #pe-flows {
    width: max-content; max-width: calc(var(--idle-w, min(760px, 100%)) - 32px);
    margin-top: -1px; margin-inline: auto;
    padding: 4px 10px; gap: 4px;
    border: 1px solid var(--border); border-top: 0;
    border-radius: 0 0 14px 14px;
    background: color-mix(in srgb, var(--surface) 55%, var(--bg));
  }
  body.pro.centered-idle #pe-flows .pf-label { display: none; }
  body.pro.centered-idle #pe-flows .pf-group { flex: 0 0 auto; }
  body.pro.centered-idle #pe-flows .pf-cat-btn {
    display: grid; grid-template-columns: 16px 10.4ch 10px;
    min-height: 36px; width: auto; padding: 6px 8px; gap: 7px;
    border: 1px solid transparent; border-radius: 7px;
    background: transparent; color: var(--text-2); font-size: 12px;
  }
  body.pro.centered-idle #pe-flows .pf-cat-btn:hover,
  body.pro.centered-idle #pe-flows .pf-group.open .pf-cat-btn {
    background: var(--input); color: var(--text); border-color: var(--border);
  }
  body.pro.centered-idle #pe-flows .pf-cat-btn > span { width: 10.4ch; text-align: left; }
  body.pro.centered-idle #pe-flows .pf-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
  body.pro.centered-idle #pe-flows .pf-group.open .pf-icon { transform: none; }
  body.pro.centered-idle #pe-flows .pf-menu {
    top: calc(100% + 5px); bottom: auto;
    padding-top: 3px; padding-bottom: 3px;
  }
  body.pro.centered-idle #pe-flows .pf-item { padding-top: 6px; padding-bottom: 6px; }
}
@media (max-width: 640px) { .pf-icon { display: none; } }
