.fb-tab {
    position: fixed; top: 50%; right: 0; z-index: 45;
    transform: translateY(-50%);
    display: flex; align-items: center; gap: .4rem;
    writing-mode: vertical-rl;
    padding: .875rem .5rem; border-radius: .375rem 0 0 .375rem;
    background: #0A7FD0; border: 0; color: #fff;
    font-size: .8125rem; font-weight: 600;
    cursor: pointer; box-shadow: 0 1px 2px rgba(10,22,40,.18);
    transition: background-color .15s;
}
.fb-tab:hover { background: #0868AE; }
.fb-tab i, .fb-tab svg { width: .9rem; height: .9rem; transform: rotate(90deg); }
.fb-tab[aria-expanded="true"] { visibility: hidden; }

.fb-panel {
    position: fixed; top: auto; bottom: 5rem; right: 1.25rem; z-index: 52;
    width: min(23rem, calc(100vw - 2rem));
    max-height: calc(100vh - 6.25rem); max-height: calc(100dvh - 6.25rem); overflow-y: auto;
    transform: translateX(calc(100% + 2rem));
    visibility: hidden;
    background: var(--mk-surface); border: 1px solid var(--mk-line); border-radius: .75rem;
    box-shadow: 0 1px 2px rgba(10,22,40,.12), 0 24px 56px -16px rgba(10,22,40,.5);
    color: var(--mk-ink);
    transition: transform .25s cubic-bezier(.4,0,.2,1), visibility 0s linear .25s;
}
.fb-panel.is-open { transform: none; visibility: visible; transition: transform .25s cubic-bezier(.4,0,.2,1), visibility 0s; }
.fb-head { display: flex; align-items: flex-start; gap: .75rem; padding: 1.125rem 1rem 1rem 1.25rem; border-bottom: 1px solid var(--mk-line); }
.fb-head-icon { width: 2.25rem; height: 2.25rem; flex-shrink: 0; border-radius: .625rem; display: flex; align-items: center; justify-content: center; background: var(--mk-brand-soft); color: var(--mk-brand-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mk-brand) 22%, transparent); }
.fb-head-icon svg, .fb-head-icon i { width: 1rem; height: 1rem; }
.fb-head > div:not(.fb-head-actions) { flex: 1 1 auto; min-width: 0; }
.fb-head h3 { font-size: .9375rem; font-weight: 650; color: var(--mk-ink); }
.fb-head p { font-size: .8125rem; color: var(--mk-muted); margin-top: .125rem; line-height: 1.45; }
.fb-close { display: flex; padding: .3rem; border-radius: .25rem; color: var(--mk-faint); background: none; border: 0; cursor: pointer; transition: color .15s, background-color .15s; }
.fb-close:hover { color: var(--mk-ink); background: var(--mk-surface-3); }
.fb-close svg, .fb-close i { width: 1rem; height: 1rem; }
.fb-body { padding: 1rem 1.25rem 0; }
.fb-label { display: block; font-size: .8125rem; font-weight: 600; color: var(--mk-ink); margin: 1rem 0 .5rem; }
.fb-label:first-child { margin-top: 0; }
.fb-moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: .375rem; }
.fb-mood {
    display: flex; align-items: center; justify-content: center; height: 2.75rem;
    font-size: 1.375rem; line-height: 1; border-radius: .5rem; cursor: pointer;
    background: var(--mk-surface-2); border: 1px solid var(--mk-line);
    transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.fb-mood:hover { border-color: var(--mk-line-strong); background: var(--mk-surface-3); }
.fb-mood[aria-pressed="true"] { border-color: var(--mk-brand); background: var(--mk-brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mk-brand) 18%, transparent); }
.fb-moods:has([aria-pressed="true"]) .fb-mood:not([aria-pressed="true"]) { opacity: .55; }
.fb-cats { display: flex; flex-wrap: wrap; gap: .375rem; }
.fb-cat {
    padding: .375rem .75rem; border-radius: 999px; cursor: pointer;
    background: var(--mk-surface); border: 1px solid var(--mk-line-strong); color: var(--mk-muted);
    font-size: .8125rem; font-weight: 500;
    transition: color .15s, border-color .15s, background-color .15s;
}
.fb-cat:hover { color: var(--mk-ink); border-color: var(--mk-ink-2); }
.fb-cat[aria-pressed="true"] { color: var(--mk-brand-text); border-color: var(--mk-brand-line); background: var(--mk-brand-soft); }
.fb-text {
    width: 100%; min-height: 6.5rem; resize: vertical;
    background: var(--mk-surface); border: 1px solid var(--mk-line-strong); border-radius: .5rem;
    padding: .625rem .875rem; color: var(--mk-ink); font-size: .875rem; line-height: 1.5; font-family: inherit; outline: none;
    transition: border-color .15s;
}
.fb-text:focus { border-color: var(--mk-brand-bright); box-shadow: 0 0 0 3px var(--mk-brand-soft); }
.fb-text::placeholder { color: var(--mk-faint); }
.fb-input {
    width: 100%; height: 2.375rem;
    background: var(--mk-surface); border: 1px solid var(--mk-line-strong); border-radius: .5rem;
    padding: 0 .875rem; color: var(--mk-ink); font-size: .875rem; font-family: inherit; outline: none;
    transition: border-color .15s;
}
.fb-input:focus { border-color: var(--mk-brand-bright); box-shadow: 0 0 0 3px var(--mk-brand-soft); }
.fb-input::placeholder { color: var(--mk-faint); }
.fb-optional { font-weight: 400; color: var(--mk-faint); }
.fb-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.fb-privacy { margin-top: .6rem; font-size: .75rem; color: var(--mk-faint); line-height: 1.45; }
.fb-privacy a { color: var(--mk-brand-text); text-decoration: underline; }
.fb-error { display: none; margin-top: .6rem; font-size: .8125rem; color: var(--mk-danger); }
.fb-error.is-visible { display: block; }
.fb-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 1rem -1.25rem 0; padding: .875rem 1.25rem; border-top: 1px solid var(--mk-line); background: var(--mk-surface-2); border-radius: 0 0 .75rem .75rem; }
.fb-hint { font-size: .75rem; color: var(--mk-faint); }
.fb-send {
    display: inline-flex; align-items: center; gap: .4rem;
    height: 2.375rem; padding: 0 1rem; border-radius: .5rem; border: 0; cursor: pointer;
    background: #0A7FD0; color: #fff; font-size: .875rem; font-weight: 600;
    transition: background-color .15s, opacity .15s;
}
.fb-send:hover { background: #0868AE; }
    .fb-send:disabled { opacity: .5; cursor: default; }
.fb-send svg, .fb-send i { width: .9rem; height: .9rem; }
.fb-done { display: none; flex-direction: column; align-items: center; text-align: center; gap: .6rem; padding: 1.75rem 1.25rem 2rem; }
.fb-done-icon { width: 3rem; height: 3rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--mk-success-soft); color: var(--mk-success); }
.fb-done-icon svg, .fb-done-icon i { width: 1.4rem; height: 1.4rem; }
.fb-done h3 { font-size: .9375rem; font-weight: 650; color: var(--mk-ink); }
.fb-done p { font-size: .875rem; color: var(--mk-muted); line-height: 1.5; }
.fb-head-actions { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }
.fb-switch { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .55rem; border-radius: .375rem; border: 0; background: var(--mk-brand-soft); color: var(--mk-brand-text); font-size: .75rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background-color .15s; }
.fb-switch:hover { background: var(--mk-brand-soft); }
.fb-switch svg, .fb-switch i { width: .8rem; height: .8rem; }
.fb-history { display: none; padding: 1rem 1.25rem 1.25rem; }
.fb-history-list { display: flex; flex-direction: column; gap: .625rem; max-height: min(60vh, 26rem); overflow-y: auto; margin-right: -.4rem; padding-right: .4rem; }
.fb-entry { padding: .75rem .875rem; border-radius: .5rem; background: var(--mk-surface-2); border: 1px solid var(--mk-line-strong); transition: border-color .3s; }
.fb-entry.is-highlight { border-color: var(--mk-brand-bright); }
.fb-entry-meta { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .75rem; color: var(--mk-faint); }
.fb-entry-cat { font-weight: 600; color: var(--mk-ink-2); }
.fb-entry-text { font-size: .875rem; color: var(--mk-ink-2); line-height: 1.5; margin-top: .35rem; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.fb-entry-reply { margin-top: .6rem; padding: .625rem .75rem; border-radius: .375rem; background: var(--mk-brand-soft); border: 1px solid var(--mk-brand-line); }
.fb-entry-reply-head { display: flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; color: var(--mk-brand-text); }
.fb-entry-reply-head svg, .fb-entry-reply-head i { width: .75rem; height: .75rem; }
.fb-entry-reply p { font-size: .875rem; color: var(--mk-ink); line-height: 1.5; margin-top: .3rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-entry-pending { margin-top: .5rem; font-size: .75rem; color: var(--mk-faint); }
.fb-history-empty { padding: 1.5rem .5rem; text-align: center; font-size: .875rem; color: var(--mk-faint); }
.fb-panel.is-history .fb-body { display: none; }
.fb-panel.is-history .fb-history { display: block; }
.fb-panel .fb-title-history, .fb-panel.is-history .fb-title-new, .fb-panel .fb-switch-new, .fb-panel.is-history .fb-switch-history { display: none; }
.fb-panel.is-history .fb-title-history, .fb-panel.is-history .fb-switch-new { display: inline-flex; }
.fb-panel.is-history .fb-title-history { display: block; }
.fb-panel.is-sent .fb-head, .fb-panel.is-sent .fb-body, .fb-panel.is-sent .fb-history { display: none; }
.fb-panel.is-sent .fb-done { display: flex; }
@media (max-width: 640px) {
    .fb-tab { top: auto; bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px)); right: env(safe-area-inset-right, 0px); transform: none; }
    .fb-panel { bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px)); right: calc(1rem + env(safe-area-inset-right, 0px)); width: calc(100vw - 2rem); max-height: calc(100dvh - 5.5rem - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px)); transform: translateX(calc(100% + 1.5rem)); }
    .fb-panel.is-open { transform: none; }
}
