/* FFleet claims board — self-contained (does not rely on Tailwind utilities) */

.ffleet-claims-page {
    --fc-ink: #0f172a;
    --fc-muted: #64748b;
    --fc-panel: #ffffff;
    --fc-surface: #f1f5f9;
    --fc-border: #e2e8f0;
    --fc-accent: #d97706;
    --fc-accent-hover: #b45309;
    --fc-chip: #e2e8f0;
    --fc-chip-text: #0f172a;
    --fc-danger: #b91c1c;
    --fc-warn: #d97706;
}

.dark .ffleet-claims-page,
.fi-body.fi-panel-admin.fi-dark .ffleet-claims-page,
html.dark .ffleet-claims-page {
    --fc-ink: #f8fafc;
    --fc-muted: #94a3b8;
    --fc-panel: #1e293b;
    --fc-surface: #0f172a;
    --fc-border: rgb(148 163 184 / 0.2);
    --fc-chip: rgb(255 255 255 / 0.12);
    --fc-chip-text: #f8fafc;
}

.ffleet-claims-page * { box-sizing: border-box; }

.ffleet-claims-page {
    width: 100%;
    max-width: none;
    min-width: 0;
}

/* Toolbar */
.fc-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fc-toolbar-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.fc-toggle {
    display: inline-flex;
    border: 1px solid var(--fc-border);
    background: var(--fc-panel);
    border-radius: 0.625rem;
    padding: 0.25rem;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
}

.fc-toggle button {
    border: 0;
    background: transparent;
    color: var(--fc-muted);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.fc-toggle button.is-active {
    background: #0f172a;
    color: #fff;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.2);
}

.dark .fc-toggle button.is-active,
html.dark .fc-toggle button.is-active {
    background: #f8fafc;
    color: #0f172a;
}

.fc-count {
    font-size: 0.875rem;
    color: var(--fc-muted);
}

.fc-count strong {
    color: var(--fc-ink);
    font-weight: 700;
}

.fc-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--fc-border);
    background: var(--fc-panel);
    border-radius: 0.75rem;
    padding: 0.625rem;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
}

.fc-filters input,
.fc-filters select {
    min-width: 11rem;
    flex: 1 1 11rem;
    border: 1px solid var(--fc-border);
    background: var(--fc-surface);
    color: var(--fc-ink);
    border-radius: 0.5rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
}

.fc-filters input { flex: 1.4 1 14rem; min-width: 14rem; }
.fc-filters select { max-width: 16rem; flex: 0 1 14rem; }

.fc-filters .fc-clear {
    border: 0;
    background: transparent;
    color: #b45309;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.fc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.fc-hint {
    font-size: 0.75rem;
    color: var(--fc-muted);
    margin: 0 0 0.75rem;
}

/* SLA badges */
.sla-badge-green,
.sla-badge-yellow,
.sla-badge-orange,
.sla-badge-red {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 9999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.sla-badge-green { background: #d1fae5; color: #065f46; }
.sla-badge-yellow { background: #fef3c7; color: #92400e; }
.sla-badge-orange { background: #ffedd5; color: #9a3412; }
.sla-badge-red { background: #fee2e2; color: #991b1b; animation: fc-pulse 1.5s ease-in-out infinite; }

.dark .sla-badge-green, html.dark .sla-badge-green { background: rgb(16 185 129 / 0.22); color: #a7f3d0; }
.dark .sla-badge-yellow, html.dark .sla-badge-yellow { background: rgb(234 179 8 / 0.22); color: #fde68a; }
.dark .sla-badge-orange, html.dark .sla-badge-orange { background: rgb(249 115 22 / 0.22); color: #fdba74; }
.dark .sla-badge-red, html.dark .sla-badge-red { background: rgb(239 68 68 / 0.25); color: #fecaca; }

@keyframes fc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgb(185 28 28 / 0); }
    50% { box-shadow: 0 0 0 4px rgb(185 28 28 / 0.18); }
}

.sla-warning { border-left: 4px solid #f59e0b !important; background: rgb(255 251 235 / 0.55) !important; }
.sla-critical { border-left: 4px solid #b91c1c !important; background: rgb(254 242 242 / 0.55) !important; }

/* Kanban board — horizontal, full width */
.sinistro-kanban-board,
.fc-board {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
    gap: 0.875rem;
    width: 100%;
    max-width: 100%;
    min-height: calc(100dvh - 16rem);
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 0.75rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
}

.fc-column {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: clamp(240px, 22vw, 360px);
    width: auto;
    max-width: none;
    border: 1px solid var(--fc-border);
    border-radius: 0.75rem;
    background: var(--fc-surface);
    overflow: hidden;
    scroll-snap-align: start;
}

.fc-column-header {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--fc-border);
    background: var(--fc-panel);
}

.fc-column-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.fc-column-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--fc-ink);
}

.fc-column-sub {
    margin: 0;
    font-size: 0.6875rem;
    color: var(--fc-muted);
    font-weight: 500;
}

.sinistro-kanban-count,
.fc-column-count {
    display: inline-flex;
    min-width: 1.5rem;
    height: 1.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0 0.45rem;
    background: var(--fc-chip);
    color: var(--fc-chip-text);
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.fc-column-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    flex: 1 1 auto;
    min-height: 10rem;
    max-height: calc(100dvh - 20rem);
    overflow-y: auto;
}

.fc-empty {
    margin: 0;
    border: 1px dashed var(--fc-border);
    border-radius: 0.625rem;
    background: var(--fc-panel);
    padding: 1.5rem 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--fc-muted);
}

/* Cards */
.fc-card {
    display: block;
    border: 1px solid var(--fc-border);
    border-radius: 0.75rem;
    background: var(--fc-panel);
    padding: 0.875rem;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.06), 0 4px 12px rgb(15 23 42 / 0.04);
    cursor: grab;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.fc-card:hover {
    border-color: rgb(245 158 11 / 0.55);
    box-shadow: 0 4px 16px rgb(15 23 42 / 0.12);
    transform: translateY(-1px);
}

.fc-card:active { cursor: grabbing; }

.fc-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.fc-card-meta { min-width: 0; }

.fc-card-protocol {
    margin: 0;
    font-size: 0.6875rem;
    color: var(--fc-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.fc-card-plate {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--fc-ink);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-card-plate:hover { text-decoration: underline; }

.fc-card-driver {
    margin: 0.15rem 0 0;
    font-size: 0.6875rem;
    color: var(--fc-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-card-report {
    margin: 0 0 0.65rem;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--fc-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fc-card-dl {
    display: grid;
    gap: 0.35rem;
    margin: 0;
}

.fc-card-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.6875rem;
}

.fc-card-row dt {
    margin: 0;
    color: var(--fc-muted);
    font-weight: 500;
}

.fc-card-row dd {
    margin: 0;
    color: var(--fc-ink);
    font-weight: 700;
    text-align: right;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fc-card-row dd.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.fc-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--fc-border);
}

.fc-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    padding: 0.45rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s;
}

.fc-btn-secondary {
    background: var(--fc-surface);
    border-color: var(--fc-border);
    color: var(--fc-ink);
}

.fc-btn-secondary:hover { background: var(--fc-chip); }

.fc-btn-primary {
    background: var(--fc-accent);
    color: #fff;
}

.fc-btn-primary:hover { background: var(--fc-accent-hover); }

.fc-btn.fc-btn-danger {
    background: #b91c1c;
    color: #fff;
}

.fc-btn.fc-btn-danger:hover { background: #991b1b; }

/* List mode */
.fc-list {
    border: 1px solid var(--fc-border);
    border-radius: 0.875rem;
    background: var(--fc-panel);
    overflow: hidden;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
}

.fc-list-table-wrap { overflow-x: auto; }

.fc-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.fc-list thead {
    background: var(--fc-surface);
    color: var(--fc-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.6875rem;
    font-weight: 700;
}

.fc-list th,
.fc-list td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--fc-border);
    vertical-align: middle;
}

.fc-list tbody tr:last-child td { border-bottom: 0; }
.fc-list tbody tr:hover { background: rgb(148 163 184 / 0.08); }

.fc-list a {
    color: var(--fc-ink);
    font-weight: 700;
    text-decoration: none;
}

.fc-list a:hover { text-decoration: underline; }

.fc-list-mobile {
    display: none;
    padding: 0.75rem;
    gap: 0.75rem;
}

.fc-list-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--fc-muted);
}

/* Desktop amplo: colunas dividem a largura toda */
@media (min-width: 1280px) {
    .fc-board {
        min-height: calc(100dvh - 14rem);
    }

    .fc-column {
        flex: 1 1 0;
        min-width: 0;
    }

    .fc-column-body {
        max-height: calc(100dvh - 18rem);
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .fc-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .fc-filters {
        width: 100%;
    }

    .fc-filters input,
    .fc-filters select {
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
    }

    .fc-column {
        flex: 0 0 min(78vw, 320px);
        min-width: min(78vw, 320px);
        max-width: min(78vw, 320px);
    }

    .fc-board {
        min-height: calc(100dvh - 18rem);
        scroll-snap-type: x mandatory;
        gap: 0.75rem;
        padding-inline: 0.125rem;
    }

    .fc-column-body {
        max-height: calc(100dvh - 22rem);
    }
}

/* Mobile */
@media (max-width: 640px) {
    .fc-toolbar-left {
        width: 100%;
        justify-content: space-between;
    }

    .fc-toggle {
        width: 100%;
    }

    .fc-toggle button {
        flex: 1;
        text-align: center;
    }

    .fc-count {
        width: 100%;
    }

    .fc-column {
        flex: 0 0 min(88vw, 300px);
        min-width: min(88vw, 300px);
        max-width: min(88vw, 300px);
    }

    .fc-card-actions {
        flex-direction: column;
    }

    .fc-list-desktop { display: none; }
    .fc-list-mobile { display: flex; flex-direction: column; }

    .fc-board {
        min-height: calc(100dvh - 20rem);
    }

    .fc-column-body {
        max-height: calc(100dvh - 24rem);
    }
}

@media (max-width: 768px) {
    .fc-list-desktop { display: none; }
    .fc-list-mobile { display: flex; flex-direction: column; }
}
