/*
 * filament-feedback — plain CSS, no Tailwind: the host's build never scans this package.
 * Colours come from Filament through --ffb-* variables set inline (Filament 3 stores
 * "r, g, b" triplets, 4 and 5 full colours), or from currentColor so both themes work.
 */

/* Floating button. Override --ffb-launcher-bottom / -left to make room for the app's own UI. */
.ffb-launcher {
    position: fixed;
    bottom: calc(var(--ffb-launcher-bottom, 1.5rem) + env(safe-area-inset-bottom, 0px));
    left: calc(var(--ffb-launcher-left, 1.5rem) + env(safe-area-inset-left, 0px));
    z-index: 30;
}

.ffb-launcher .ffb-launcher-button {
    border-radius: 9999px;
    padding-inline: 1rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.ffb-muted {
    opacity: 0.7;
}

.ffb-small {
    font-size: 0.8125rem;
}

/* A thread: the original post, then replies, oldest first */
.ffb-thread {
    display: grid;
    gap: 0.625rem;
}

.ffb-message {
    display: grid;
    gap: 0.25rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.75rem;
    background: color-mix(in srgb, currentColor 5%, transparent);
    margin-inline-end: 2rem;
}

.ffb-message-team {
    background: color-mix(in srgb, var(--ffb-accent) 12%, transparent);
    margin-inline: 2rem 0;
}

.ffb-message-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.ffb-message-name {
    font-weight: 600;
}

.ffb-message-meta time {
    opacity: 0.65;
}

.ffb-message-body {
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.ffb-textarea {
    display: block;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.875rem;
    resize: vertical;
}

.ffb-textarea:focus {
    outline: none;
    box-shadow: none;
}

/* Inbox: post facts above the thread */
.ffb-thread-panel {
    display: grid;
    gap: 1.25rem;
}

.ffb-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.75rem 1rem;
    margin: 0;
}

.ffb-facts dt {
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.7;
}

.ffb-facts dd {
    margin: 0;
    font-size: 0.875rem;
}

.ffb-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.ffb-link {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Inbox: the mood board */
.ffb-board-scroll {
    overflow-x: auto;
}

.ffb-board {
    width: 100%;
    min-width: 36rem;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ffb-board th,
.ffb-board td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

.ffb-board thead th {
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.7;
}

.ffb-board tbody th {
    font-weight: 600;
}

.ffb-board tbody tr:last-child > * {
    border-bottom: 0;
}

.ffb-board .ffb-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ffb-board .ffb-cell {
    background: var(--ffb-cell, transparent);
}

.ffb-board .ffb-strong {
    font-weight: 600;
}

.ffb-board .ffb-up {
    color: var(--ffb-success);
}

.ffb-board .ffb-down {
    color: var(--ffb-danger);
}

/* Icons drawn by <x-filament::icon>: sized here, the host's Tailwind never sees these views. */
.ffb-icon {
    width: 1rem;
    height: 1rem;
    flex: none;
}

.ffb-icon-sm {
    width: 0.75rem;
    height: 0.75rem;
}

.ffb-icon-lg {
    width: 2rem;
    height: 2rem;
    opacity: 0.6;
}

/* The quick sheet: Filament's modal window, anchored above the Feedback button on wide
   screens and a bottom sheet on phones. Moving the button? Set the same variables on :root. */
@media (min-width: 640px) {
    :has(> .fi-modal-window.ffb-sheet) {
        justify-items: start;
        grid-template-rows: 1fr auto calc(var(--ffb-launcher-bottom, 1.5rem) + 2.5rem);
        padding-inline-start: var(--ffb-launcher-left, 1.5rem);
    }

    .fi-modal-window.ffb-sheet {
        margin-inline: 0 !important;
        transform-origin: bottom left;
    }
}

@media (max-width: 639px) {
    :has(> .fi-modal-window.ffb-sheet) {
        grid-template-rows: 1fr auto 0;
        padding: 3rem 0 0;
    }

    .fi-modal-window.ffb-sheet {
        max-width: none;
        border-end-start-radius: 0;
        border-end-end-radius: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

.ffb-notice {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--ffb-accent, currentColor) 12%, transparent);
    font-size: 0.875rem;
    line-height: 1.4;
}

.ffb-notice > span {
    flex: 1;
}

/* Module chips: the app's own icon beside the label */
.ffb-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.ffb-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    background: color-mix(in srgb, currentColor 7%, transparent);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4rem;
}

.ffb-chip .ffb-icon {
    width: 0.875rem;
    height: 0.875rem;
    opacity: 0.75;
}

/* My feedback: posts on the left, the open thread on the right */
.ffb-page {
    display: grid;
    grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr);
    align-items: start;
    border: 1px solid color-mix(in srgb, currentColor 10%, transparent);
    border-radius: 0.75rem;
    overflow: hidden;
}

.ffb-list {
    display: grid;
    align-content: start;
    max-height: 75vh;
    overflow-y: auto;
    border-inline-end: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

.ffb-item {
    display: grid;
    gap: 0.375rem;
    padding: 0.875rem 1rem;
    text-align: start;
    border-bottom: 1px solid color-mix(in srgb, currentColor 8%, transparent);
    color: inherit;
    font: inherit;
    background: none;
    cursor: pointer;
}

.ffb-item:hover {
    background: color-mix(in srgb, currentColor 4%, transparent);
}

.ffb-item:focus-visible {
    outline: 2px solid var(--ffb-accent, currentColor);
    outline-offset: -2px;
}

.ffb-item-active,
.ffb-item-active:hover {
    background: color-mix(in srgb, var(--ffb-accent, currentColor) 11%, transparent);
}

.ffb-item-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ffb-item-text {
    font-size: 0.875rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ffb-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.ffb-item-replies {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-inline-start: auto;
}

.ffb-dot {
    width: 0.5rem;
    height: 0.5rem;
    margin-inline-start: auto;
    border-radius: 9999px;
    background: #dc2626;
}

.ffb-view {
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
    min-width: 0;
}

.ffb-view-head {
    display: grid;
    gap: 0.875rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid color-mix(in srgb, currentColor 8%, transparent);
}

/* Sent → Seen → Planned → Done, with times */
.ffb-timeline {
    display: flex;
    flex-wrap: wrap;
    /* Dots, no connector lines: a long history wraps without lines dangling at line ends. */
    gap: 0.5rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.75rem;
}

.ffb-timeline li {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}


.ffb-timeline-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: var(--ffb-accent, currentColor);
}

.ffb-timeline-label {
    font-weight: 600;
}

.ffb-timeline time {
    opacity: 0.65;
}

.ffb-fix {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--ffb-success, currentColor) 12%, transparent);
    font-size: 0.875rem;
}

.ffb-fix-actions {
    display: flex;
    gap: 0.5rem;
}

.ffb-fixed {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.ffb-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.5rem;
    padding-top: 0.25rem;
}

.ffb-error {
    font-size: 0.8125rem;
    color: #dc2626;
}

.ffb-empty {
    display: grid;
    justify-items: center;
    gap: 0.5rem;
    max-width: 28rem;
    margin: 2rem auto;
    text-align: center;
    font-size: 0.875rem;
}

/* Reactions under a message */
.ffb-reactions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.25rem;
}

.ffb-react-picker {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.ffb-react-picker[x-cloak] {
    display: none;
}

.ffb-react {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
    border-radius: 9999px;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 0.75rem;
    line-height: 1.25rem;
    cursor: pointer;
}

.ffb-react .ffb-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.ffb-react:hover:not(:disabled) {
    background: color-mix(in srgb, currentColor 6%, transparent);
}

.ffb-react:focus-visible {
    outline: 2px solid var(--ffb-accent, currentColor);
    outline-offset: 2px;
}

.ffb-react[aria-pressed="true"] {
    border-color: var(--ffb-accent, currentColor);
    background: color-mix(in srgb, var(--ffb-accent, currentColor) 14%, transparent);
}

.ffb-react:disabled {
    cursor: default;
}

.ffb-react-add {
    gap: 0.1rem;
    opacity: 0.7;
}

.ffb-react-count {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 767px) {
    .ffb-page {
        grid-template-columns: minmax(0, 1fr);
    }

    .ffb-list {
        max-height: 16rem;
        border-inline-end: 0;
        border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
    }

    .ffb-view {
        padding: 1rem;
    }
}

@media (max-width: 767px) {
    .ffb-timeline {
        flex-direction: column;
    }
}

/* Module picker in the quick sheet: chips for what's picked, a searchable list behind "Add" */
.ffb-picker {
    display: grid;
    gap: 0.5rem;
}

.ffb-picker-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.ffb-picker-chip,
.ffb-picker-add {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2rem;
    padding: 0.25rem 0.375rem 0.25rem 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.ffb-picker-chip {
    background: color-mix(in srgb, currentColor 8%, transparent);
}

.ffb-picker-add {
    padding-inline-end: 0.625rem;
    border: 1px dashed color-mix(in srgb, currentColor 30%, transparent);
    background: none;
    color: inherit;
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

.ffb-picker-add:hover {
    background: color-mix(in srgb, currentColor 5%, transparent);
}

.ffb-picker-remove {
    display: inline-grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 0;
    border-radius: 9999px;
    background: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
}

.ffb-picker-remove:hover {
    opacity: 1;
    background: color-mix(in srgb, currentColor 10%, transparent);
}

.ffb-picker-icon {
    display: inline-flex;
}

.ffb-picker-icon:empty {
    display: none;
}

.ffb-picker-hint {
    font-size: 0.8125rem;
    opacity: 0.65;
}

.ffb-picker-hint kbd,
.ffb-mention-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
}

.ffb-picker-panel {
    display: grid;
    gap: 0.375rem;
    padding: 0.5rem;
    border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    border-radius: 0.75rem;
}

.ffb-picker-panel[x-cloak],
.ffb-mention-list[x-cloak] {
    display: none;
}

/* Doubled class: host form resets (Tailwind forms) paint [type=search] white otherwise. */
.ffb-picker .ffb-picker-search {
    appearance: none;
    box-shadow: none;
    width: 100%;
    padding: 0.4rem 0.625rem;
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    border-radius: 0.5rem;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.875rem;
}

.ffb-picker .ffb-picker-search:focus {
    outline: 2px solid var(--ffb-accent);
    outline-offset: -1px;
}

.ffb-picker-options {
    display: grid;
    max-height: 13.5rem;
    overflow-y: auto;
}

.ffb-picker-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.5rem;
    border: 0;
    border-radius: 0.5rem;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 0.875rem;
    text-align: start;
    cursor: pointer;
}

.ffb-picker-option:hover,
.ffb-mention-list .ffb-picker-option[aria-selected="true"] {
    background: color-mix(in srgb, currentColor 7%, transparent);
}

.ffb-picker-plus {
    margin-inline-start: auto;
    opacity: 0;
    color: var(--ffb-accent);
    transition: opacity 0.15s ease;
}

.ffb-picker-option:hover .ffb-picker-plus,
.ffb-picker-option:focus-visible .ffb-picker-plus {
    opacity: 1;
}

/* Open/close for the picker's list and the # suggestions (Alpine x-transition classes) */
.ffb-t {
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-origin: top left;
}

.ffb-t-out {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
}

.ffb-t-in {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .ffb-t {
        transition: none;
    }
}

.ffb-picker-empty {
    padding: 0.5rem;
    font-size: 0.8125rem;
    opacity: 0.65;
}

/* # suggestions, under the message box */
.ffb-mention-list {
    position: fixed;
    z-index: 60;
    display: grid;
    min-width: 14rem;
    padding: 0.25rem;
    border-radius: 0.75rem;
    background: #fff;
    color: #18181b;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.dark .ffb-mention-list {
    background: #27272a;
    color: #fafafa;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.ffb-mention-text {
    margin-inline-start: auto;
    opacity: 0.55;
}

/* #Module inside a message */
.ffb-mention {
    padding: 0 0.25rem;
    border-radius: 0.25rem;
    background: color-mix(in srgb, var(--ffb-accent, currentColor) 15%, transparent);
    font-weight: 600;
}

/* Unsend: a quiet link in the message header; an unsent reply keeps its place in the thread */
.ffb-message-side {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
}

.ffb-unsend {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    opacity: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.ffb-message:hover .ffb-unsend,
.ffb-unsend:focus-visible {
    opacity: 0.7;
}

@media (hover: none) {
    .ffb-unsend {
        opacity: 0.7;
    }
}

.ffb-unsent {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-style: italic;
    opacity: 0.6;
}

.ffb-composer-hint {
    margin-top: -0.5rem;
    font-size: 0.75rem;
    opacity: 0.6;
}

.ffb-composer-hint kbd {
    font-family: inherit;
    font-weight: 600;
}

/* The sheet's "what is it" boxes: two columns, icon + name + one line */
.ffb-kinds {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.ffb-kind {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
    border-radius: 0.75rem;
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ffb-kind:hover {
    background: color-mix(in srgb, currentColor 4%, transparent);
}

.ffb-kind:focus-visible,
.ffb-mood:focus-visible {
    outline: 2px solid var(--ffb-tone);
    outline-offset: 2px;
}

.ffb-kind[aria-checked="true"] {
    border-color: var(--ffb-tone);
    background: color-mix(in srgb, var(--ffb-tone) 12%, transparent);
}

.ffb-kind-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: color-mix(in srgb, currentColor 7%, transparent);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ffb-kind[aria-checked="true"] .ffb-kind-icon {
    background: var(--ffb-tone);
    color: #fff;
}

.ffb-kind-text {
    display: grid;
    gap: 0.125rem;
    min-width: 0;
}

.ffb-kind-label {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
}

.ffb-kind-hint {
    font-size: 0.75rem;
    line-height: 1.3;
    opacity: 0.65;
}

/* Mood: five equal steps in one row, face above word */
.ffb-moods {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.375rem;
}

.ffb-mood {
    display: grid;
    justify-items: center;
    gap: 0.375rem;
    padding: 0.625rem 0.25rem 0.5rem;
    border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
    border-radius: 0.75rem;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.1;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.ffb-mood:hover {
    background: color-mix(in srgb, currentColor 4%, transparent);
}

.ffb-mood .ffb-mood-icon {
    width: 1.5rem;
    height: 1.5rem;
    opacity: 0.7;
}

.ffb-mood[aria-checked="true"] {
    border-color: var(--ffb-tone);
    background: color-mix(in srgb, var(--ffb-tone) 14%, transparent);
    color: var(--ffb-tone);
}

.ffb-mood[aria-checked="true"] .ffb-mood-icon {
    opacity: 1;
}

/* Phones: the sheet gets a grab handle, the boxes tighten, hints stay one line */
@media (max-width: 639px) {
    .fi-modal-window.ffb-sheet::before {
        content: "";
        display: block;
        width: 2.5rem;
        height: 0.25rem;
        margin: 0.5rem auto 0;
        border-radius: 9999px;
        background: color-mix(in srgb, currentColor 20%, transparent);
    }

    .ffb-kind {
        flex-direction: column;
        gap: 0.375rem;
        padding: 0.625rem;
    }

    .ffb-kind-icon {
        width: 1.75rem;
        height: 1.75rem;
    }

    .ffb-kind-hint {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .ffb-mood {
        padding-inline: 0;
        font-size: 0.6875rem;
    }

    .ffb-mood .ffb-mood-icon {
        width: 1.375rem;
        height: 1.375rem;
    }
}
