:root { --privacy:#1b1c1f; --warn:#a16207; --mono:ui-monospace,"SF Mono",Menlo,monospace; --speed:1; }
section.privacy-details { border: 0; border-top: 1px solid var(--border, #ddd); border-radius: 0; padding: 18px 0; }
.privacy-conclusion { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; line-height: 1.7; }
.privacy-conclusion strong { font-size: 15px; font-weight: 600; }
.privacy-type-totals, .privacy-cloud-note { font-size: 12px; color: var(--text-muted, #666); }
.privacy-cloud-note { margin-left: auto; }
.privacy-clean { margin-top: 16px; color: var(--text-muted, #666); font-size: 13px; }
.privacy-clean > summary { cursor: pointer; line-height: 1.8; }
.privacy-detail-meta { margin: 8px 0; font-size: 12px; color: var(--text-muted, #666); }
.privacy-detail-body > .privacy-detail-preview { margin-bottom: 10px; }
.privacy-details .privacy-detail-meta .privacy-detail-status { margin-left: 0; }
.privacy-details .privacy-progress[hidden] { display: none; }
.privacy-outgoing { margin-top: 10px; padding: 12px 0; border-top: 1px solid var(--border, #ddd); max-width: 100%; overflow-x: auto; font-size: 14px; line-height: 2; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; }
.ent[role="button"] { cursor: pointer; }
@media(max-width:640px) { .privacy-cloud-note { margin-left: 0; flex-basis: 100%; } .privacy-conclusion { gap: 4px 10px; } }
      /* 扫描光束：本地脱敏进行中 */
      .scan-beam {
        position: absolute; top: 0; bottom: 0; left: 0; width: 84px;
        pointer-events: none; opacity: 0;
        background: linear-gradient(90deg, rgba(32, 33, 36, 0) 0%, rgba(32, 33, 36, 0.09) 82%, rgba(32, 33, 36, 0.45) 97%, var(--privacy) 100%);
        transform: translateX(-84px);
      }
      .bubble.is-scanning .scan-beam {
        opacity: 1;
        animation: beam calc(1150ms / var(--speed)) cubic-bezier(0.45, 0, 0.55, 1) infinite;
      }
      @keyframes beam {
        from { transform: translateX(-84px); }
        to { transform: translateX(var(--beam-end, 600px)); }
      }


      /* 消息下方的保护状态行 */
      .privacy-meta {
        display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
        margin-top: 7px; font-size: 12.5px; color: var(--text-muted); min-height: 24px;
      }
      .privacy-meta[hidden] { display: none; }
      .chat-row.user .privacy-meta { justify-content: flex-end; }
      .pm-status { display: inline-flex; align-items: center; gap: 5px; }
      .pm-status svg { width: 14px; height: 14px; flex-shrink: 0; }
      .pm-status.is-on { color: var(--text); }
      .pm-status.is-warn { color: var(--warn); }
      .pm-status.is-error { color: var(--error); }
      .pm-status.is-busy svg { animation: pulse calc(1100ms / var(--speed)) ease-in-out infinite; }
      @keyframes pulse { 50% { opacity: 0.35; } }
      .pm-toggle { display: inline-flex; padding: 2px; border-radius: 7px; background: var(--bg-hover); }
      .pm-toggle[hidden] { display: none; }
      .pm-toggle button {
        height: 22px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent;
        color: var(--text-muted); font-size: 12px; cursor: pointer;
      }
      .pm-toggle button[aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(32, 33, 36, 0.12); }
      .pm-retry {
        height: 24px; padding: 0 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
        border: 1px solid var(--neutral-action-border); background: var(--neutral-action); color: var(--text);
      }
      .pm-toggle button:focus-visible, .pm-retry:focus-visible { outline: 2px solid rgba(32, 33, 36, 0.45); outline-offset: 1px; }

      /* ---------- 实体：原文层 + 标签层 + 墨条 ---------- */
      .ent { position: relative; display: inline-grid; white-space: nowrap; vertical-align: baseline; border-radius: 4px; outline: none; }
      .ent > .ent-orig, .ent > .ent-plate { grid-area: 1 / 1; justify-self: start; }
      .ent-orig { border-radius: 3px; }
      .ent-plate {
        align-self: center;
        display: inline-flex; align-items: center; gap: 4px;
        padding: 3px 8px 3px 6px; border-radius: 2px;
        font: 500 12.5px/1 var(--mono); letter-spacing: 0.04em;
        color: #f4f3f0; background: var(--privacy);
      }
      .ent-plate svg { width: 10px; height: 10px; flex-shrink: 0; }
      .ent[data-state="orig"] > .ent-plate,
      .ent[data-state="plate"] > .ent-orig,
      .ent[data-state="ink"] > .ent-orig,
      .ent[data-state="ink"] > .ent-plate { visibility: hidden; }
      .ent-ink {
        position: absolute; inset: 1px 0; border-radius: 2px; background: var(--privacy);
        transform: scaleX(0); transform-origin: left center; pointer-events: none;
      }
      .ent.is-found > .ent-orig { background: rgba(32, 33, 36, 0.1); box-shadow: 0 2px 0 var(--privacy); }
      .ent[data-restored] > .ent-orig {
        text-decoration: underline; text-decoration-color: rgba(32, 33, 36, 0.45);
        text-decoration-thickness: 1.5px; text-underline-offset: 4px;
      }
      .ent[data-unresolved] > .ent-plate { color: var(--warn); background: #fff; box-shadow: inset 0 0 0 1.5px var(--warn); }
      .ent:focus-visible { box-shadow: 0 0 0 2px rgba(32, 33, 36, 0.45); }


      .privacy-switch {
        height: 34px; padding: 0 12px 0 9px; border-radius: 8px; cursor: pointer;
        display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px;
        border: 1px solid var(--neutral-action-border); background: var(--neutral-action); color: var(--text-muted);
        transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
      }
      .privacy-switch svg { width: 15px; height: 15px; }
      .privacy-switch .sw-state { font-size: 12px; opacity: 0.85; }
      .privacy-switch[aria-pressed="true"] { color: #f4f3f0; background: var(--privacy); border-color: var(--privacy); }
      .privacy-switch[aria-pressed="true"] .sw-state { opacity: 0.7; }
      .privacy-switch[aria-pressed="false"] .sw-check { display: none; }
      .privacy-switch:disabled { cursor: not-allowed; opacity: 0.55; }
      .privacy-switch:focus-visible, .attach-button:focus-visible { outline: 2px solid rgba(32, 33, 36, 0.45); outline-offset: 2px; }

.bubble.is-scanning { position:relative; overflow:hidden; }
.privacy-meta.is-error { color:#dc2626; }.privacy-meta.is-warn { color:var(--warn); }
.bubble.is-blocked { border:1px dashed #dc262673; }
.privacy-switch { max-width:100%; }.privacy-hint { font-size:12px;color:var(--text-muted);margin:6px 0 0; }
.privacy-confirm { max-width:340px;border:1px solid var(--border);border-radius:10px;padding:16px;color:var(--text);background:var(--bg); }
.privacy-confirm::backdrop { background:#0003; }.privacy-confirm button { padding:6px 12px;margin:0 8px 8px 0; }
@media(max-width:640px){.privacy-switch{font-size:12px;padding:0 7px;gap:4px}.privacy-switch .sw-state{font-size:11px}.ent-plate{font-size:11px;padding:3px 5px}.privacy-meta{gap:5px 8px}}
@media(prefers-reduced-motion:reduce){.bubble.is-scanning .scan-beam{animation:none;opacity:0}.ent,.ent-ink,.pm-status{transition:none!important;animation:none!important}}
/* App shell has broad important button rules; keep prototype states explicit. */
.privacy-switch[aria-pressed="true"] { background:var(--privacy)!important;color:#f4f3f0!important;border-color:var(--privacy)!important; }
.pm-toggle button { background:transparent!important;border:0!important;border-radius:5px!important;color:var(--text-muted)!important; }
.pm-toggle button[aria-pressed="true"] { background:#fff!important;color:var(--text)!important; }
.privacy-switch[hidden] { display: none; }

.privacy-settings { width: min(620px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 24px; box-sizing: border-box; border: 1px solid var(--border, #d9d9d9); border-radius: 14px; background: var(--panel, #fff); color: var(--text, #202020); }
.privacy-settings::backdrop { background: rgb(0 0 0 / .32); }
.privacy-settings h2 { margin: 0 0 10px; font-size: 20px; }
.privacy-settings-hint, .privacy-settings-defaults, .privacy-settings-status { font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.privacy-settings-hint { color: var(--muted, #666); }
.privacy-settings fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.privacy-settings-rule { border-top: 1px solid var(--border, #ddd); padding: 16px 0; display: grid; gap: 10px; }
.privacy-settings-rule label { display: grid; gap: 6px; font-size: 13px; }
.privacy-settings-rule .privacy-settings-check { display: flex; align-items: center; gap: 8px; }
.privacy-settings input[type=text], .privacy-settings textarea { box-sizing: border-box; width: 100%; padding: 9px 10px; border: 1px solid var(--border, #ccc); border-radius: 7px; font: inherit; background: var(--bg, #fff); color: inherit; }
.privacy-settings input[type=text], .privacy-settings textarea { border-color: var(--focus-border, #b9b8b2) !important; }
.privacy-settings input[type=text]:focus, .privacy-settings textarea:focus { border-color: var(--text, #202124) !important; }
.privacy-settings textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.privacy-settings button { cursor: pointer; border: 1px solid var(--border, #ccc); border-radius: 7px; background: transparent; color: inherit; padding: 8px 12px; font: inherit; }
.privacy-settings button:disabled { cursor: default; opacity: .55; }
.privacy-settings .privacy-settings-save { background: #202020; color: white; border-color: #202020; }
.privacy-settings-remove { justify-self: end; font-size: 12px !important; }
.privacy-settings-footer { display: flex; justify-content: end; gap: 8px; margin-top: 18px; }
.privacy-settings-status { min-height: 22px; margin-bottom: 0; }
@media (max-width: 600px) { .privacy-settings { padding: 18px; } }

.privacy-details { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; min-width: 0; background: var(--bg); }
.privacy-details summary, .privacy-restorations summary { cursor: pointer; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.privacy-details > summary { font-weight: 600; }
.privacy-detail-note, .privacy-detail-stats { color: var(--text-muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.privacy-detail-row { border-top: 1px solid var(--border); padding: 12px 0 0; margin-top: 10px; min-width: 0; }
.privacy-detail-row strong { font-weight: 500; }
.privacy-detail-status { display: inline-block; margin-left: 10px; font-size: 12px; color: var(--text-muted); }
.privacy-detail-row[data-status=blocked] .privacy-detail-status { color: var(--error); }
.privacy-detail-row[data-status=send_failed] .privacy-detail-status { color: var(--warn); }
.privacy-detail-row[data-status=sent] .privacy-detail-status { color: var(--success); }
.privacy-detail-body { min-width: 0; }
.privacy-progress { margin: 10px 0 2px 16px; max-width: 560px; cursor: default; }
.privacy-progress[hidden] { display: none; }
.privacy-progress-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text); }
.privacy-progress-percent { font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; }
.privacy-progress-track { height: 5px; margin: 7px 0; background: var(--border); border-radius: 3px; overflow: hidden; position: relative; }
.privacy-progress-fill { position: absolute; inset: 0; background: var(--text, #202124); transform-origin: left; transition: transform .35s ease; overflow: hidden; }
.privacy-progress-step { font-size: 11px; color: var(--text-muted); line-height: 1.7; }
.privacy-progress[data-active=true] .privacy-progress-step::before { content: ''; display: inline-block; width: 5px; height: 5px; margin: 0 6px 1px 0; border-radius: 50%; background: currentColor; animation: privacy-progress-pulse 1.8s ease-in-out infinite; }
.privacy-progress[data-active=true] .privacy-progress-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, #ffffff80 30%, #ffffff80 55%, transparent 55%) 0 0 / 28px 100% repeat-x; animation: privacy-progress-flow 1s linear infinite; }
.privacy-progress[data-indeterminate=true] .privacy-progress-fill { width: 25%; transform: none !important; animation: privacy-progress-wait 2s ease-in-out infinite; }
.privacy-detail-row[data-status=blocked] .privacy-progress-fill { background: var(--error); }
@keyframes privacy-progress-pulse { 50% { opacity: .3; } }
@keyframes privacy-progress-flow { from { background-position-x: 0; } to { background-position-x: 28px; } }
@keyframes privacy-progress-wait { 0%, 100% { translate: 0 0; } 50% { translate: 300% 0; } }
@media (prefers-reduced-motion: reduce) { .privacy-progress *, .privacy-progress *::before, .privacy-progress *::after { animation: none !important; transition: none !important; } }
.privacy-detail-complete { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 8px 12px; font-size: 12px; }
.privacy-detail-preview { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-height: 360px; overflow: auto; margin: 10px 0 0; padding: 14px; border: 1px solid var(--focus-border); border-radius: 7px; background: var(--bg); color: var(--text); font: 13px/1.8 ui-monospace, monospace; }
.privacy-restorations { flex-basis: 100%; min-width: 0; }
.privacy-restoration-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.privacy-restoration-row code { color: var(--text); white-space: pre-wrap; font-size: 12px; }
.privacy-restoration-row.is-unresolved { color: var(--warn); border: 1px solid var(--warn); border-radius: 5px; padding: 8px; }
@media(max-width:600px) { .privacy-details { padding: 10px; } .privacy-detail-status { display: block; margin: 4px 0 0 16px; } .privacy-detail-complete { display: flex; margin-left: 0; } .privacy-restoration-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

.privacy-service-status { margin: 8px 2px 0; font-size: 12px; line-height: 1.5; color: var(--text-secondary, #666); }

/* One quiet disclosure above the answer; animation indicates activity, not %.
   Native details keeps keyboard interaction and collapsed content accessible. */
.process-privacy { margin: 4px 0 24px; min-width: 0; width: 100%; color: var(--text, #202124); }
.process-privacy[hidden] { display: none; }
.process-privacy > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 46px; cursor: pointer; width: fit-content; max-width: 100%; padding: 5px 4px; border-radius: 6px; }
.process-privacy > summary::-webkit-details-marker { display: none; }
.process-privacy > summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .18s ease; margin: 0 5px 0 8px; opacity: .55; flex: 0 0 auto; }
.process-privacy[open] > summary::after { transform: rotate(45deg); }
.process-privacy > summary:hover { background: var(--bg-hover, #f4f4f3); }
.process-privacy > summary:focus-visible { outline: 2px solid var(--focus-border, #777); outline-offset: 3px; }
.process-privacy-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-width: 0; }
.process-privacy-title { font-size: 14px; font-weight: 550; line-height: 1.5; }
.process-privacy-detail { font-size: 12px; color: var(--text-muted, #777); line-height: 1.6; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.process-privacy-icon { width: 18px; height: 18px; position: relative; flex: 0 0 18px; border: 1.5px solid currentColor; border-radius: 6px 6px 9px 9px; opacity: .65; }
.process-privacy-icon::after { content: ''; position: absolute; width: 6px; height: 3px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); top: 5px; left: 4px; }
.process-privacy[data-busy=true] .process-privacy-icon { border-radius: 50%; border-color: var(--border, #ddd); border-top-color: currentColor; animation: process-orbit 1.6s linear infinite; }
.process-privacy[data-busy=true] .process-privacy-icon::after { display: none; }
.process-privacy[data-busy=true][data-protected=true] .process-privacy-icon { border-radius: 6px 6px 9px 9px; border-color: currentColor; animation: privacy-progress-pulse 2.8s ease-in-out infinite; }
.process-privacy[data-busy=true][data-protected=true] .process-privacy-icon::after { display: block; }
.process-privacy[data-busy=true] .process-privacy-title { background: linear-gradient(105deg, var(--text-muted, #777) 30%, var(--text, #202124) 45%, var(--text-muted, #777) 60%) 120% 0 / 260% 100%; background-clip: text; -webkit-background-clip: text; color: transparent; animation: process-shimmer 2.8s ease-in-out infinite; }
.process-privacy[data-phase=error] .process-privacy-icon, .process-privacy[data-phase=stopped] .process-privacy-icon { border-radius: 50%; color: var(--warn, #a16207); }
.process-privacy[data-phase=error] .process-privacy-icon::after, .process-privacy[data-phase=stopped] .process-privacy-icon::after { transform: none; border: 0; width: 2px; height: 7px; top: 4px; left: 6px; background: currentColor; }
.process-privacy-body { padding: 6px 0 6px 27px; border-left: 1px solid var(--border, #e5e5e5); margin: 4px 0 0 8px; min-width: 0; }
.process-privacy[open] > .process-privacy-body { animation: process-reveal .2s ease-out; }
.process-privacy-body .privacy-details { margin-bottom: 0; }
.process-privacy-live { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.assistant-turn:has(> .process-privacy) > .activity { display: none !important; }
@keyframes process-orbit { to { transform: rotate(360deg); } }
@keyframes process-shimmer { to { background-position: -120% 0; } }
@keyframes process-reveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
@media(max-width:600px) { .process-privacy-copy { display: grid; gap: 2px; } .process-privacy-body { padding-left: 12px; } .process-privacy { margin-bottom: 18px; } }
@media(prefers-reduced-motion:reduce) { .process-privacy *, .process-privacy *::after { animation: none !important; transition: none !important; } .process-privacy[data-busy=true] .process-privacy-title { background: none; color: var(--text, #202124); } }
