/* ── Face Identity Admin — FEAT-642 ───────────────────────────────────────── */
/* Prefix: fi- */

.fi-page {
    padding: 16px 20px;
    max-width: 1400px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.fi-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.fi-page-title {
    font-size: 1.3rem;
    font-weight: 700;
    white-space: nowrap;
}

.fi-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.fi-filter-dropdown {
    min-width: 150px;
}

.fi-search-input {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--hi-border, #2a3040);
    background: var(--hi-card-bg, #1e2330);
    color: inherit;
    font-size: 0.9rem;
    min-width: 180px;
}

.fi-apply-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    background: var(--hi-accent, #4a9eff);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.fi-apply-btn:hover { background: #3a8eef; }

/* ── KPI strip ──────────────────────────────────────────────────────────── */
.fi-kpi-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.fi-kpi-placeholder {
    font-size: 0.9rem;
    color: var(--hi-muted, #8899aa);
    margin-bottom: 16px;
}

.fi-kpi-tile {
    background: var(--hi-card-bg, #1e2330);
    border-radius: 8px;
    padding: 12px 18px;
    min-width: 130px;
    flex: 1 1 130px;
    text-align: left;
}

.fi-kpi-tile-btn {
    cursor: pointer;
    border: 1px solid transparent;
    color: inherit;
    transition: border-color 0.15s;
    display: block;
    width: 100%;
}

.fi-kpi-tile-btn:hover {
    border-color: var(--hi-accent, #4a9eff);
}

.fi-tile-label {
    font-size: 0.75rem;
    color: var(--hi-muted, #8899aa);
    margin-bottom: 4px;
}

.fi-tile-value {
    font-size: 1.4rem;
    font-weight: 700;
}

/* ── Section card ───────────────────────────────────────────────────────── */
.fi-section-card {
    background: var(--hi-card-bg, #1e2330);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.fi-section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--hi-muted, #8899aa);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 10px;
}

.fi-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.fi-toolbar {
    display: flex;
    gap: 6px;
}

.fi-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Table ──────────────────────────────────────────────────────────────── */
.fi-plain-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.fi-plain-table th,
.fi-plain-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--hi-border, #2a3040);
    white-space: nowrap;
}

.fi-plain-table th {
    font-weight: 600;
    color: var(--hi-muted, #8899aa);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fi-plain-table tbody tr:hover {
    background: rgba(74, 158, 255, 0.06);
}

/* ── Status badges ──────────────────────────────────────────────────────── */
.fi-badge {
    display: inline-block;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ── Row link button (driver name) ─────────────────────────────────────── */
.fi-row-link {
    background: none;
    border: none;
    color: var(--hi-accent, #4a9eff);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    text-align: left;
}

.fi-row-link:hover { text-decoration: underline; }

/* ── Enforce toggle ─────────────────────────────────────────────────────── */
.fi-enforce-on {
    background: rgba(77, 214, 140, 0.15);
    border: 1px solid #4dd68c;
    color: #4dd68c;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}

.fi-enforce-off {
    background: rgba(136, 153, 170, 0.12);
    border: 1px solid #8899aa;
    color: #8899aa;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}

.fi-enforce-on:hover  { background: rgba(77, 214, 140, 0.28); }
.fi-enforce-off:hover { background: rgba(136, 153, 170, 0.22); }

/* ── States ─────────────────────────────────────────────────────────────── */
.fi-empty-state {
    padding: 24px;
    text-align: center;
    color: var(--hi-muted, #8899aa);
    font-style: italic;
}

.fi-error-state {
    padding: 24px;
    color: #e05c5c;
}

/* ── Drawer overlay ─────────────────────────────────────────────────────── */
.fi-drawer-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    justify-content: flex-end;
}

.fi-drawer {
    background: #1a1f2e;
    width: 480px;
    max-width: 96vw;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
}

/* ── Drawer header ──────────────────────────────────────────────────────── */
.fi-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.fi-drawer-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.fi-drawer-close-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--hi-muted, #8899aa);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.fi-drawer-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ── Drawer driver info ─────────────────────────────────────────────────── */
.fi-drawer-driver-info {
    font-size: 0.85rem;
    color: var(--hi-muted, #8899aa);
    padding: 8px 0;
    border-bottom: 1px solid var(--hi-border, #2a3040);
}

/* ── Action buttons ─────────────────────────────────────────────────────── */
.fi-action-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fi-action-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--hi-border, #2a3040);
    background: var(--hi-card-bg, #252c3f);
    color: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 0.15s;
}

.fi-action-btn:hover {
    border-color: var(--hi-accent, #4a9eff);
}

.fi-action-btn-danger {
    border-color: #e05c5c;
    color: #e05c5c;
}

.fi-action-btn-danger:hover {
    background: rgba(224, 92, 92, 0.1);
}

.fi-action-btn-enforce {
    border-color: #4dd68c;
    color: #4dd68c;
}

.fi-action-btn-enforce:hover {
    background: rgba(77, 214, 140, 0.1);
}

/* ── Action input area ──────────────────────────────────────────────────── */
.fi-action-input-area {
    padding: 8px 0;
}

.fi-input-label {
    font-size: 0.82rem;
    color: var(--hi-muted, #8899aa);
    margin-bottom: 4px;
}

.fi-reason-input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--hi-border, #2a3040);
    background: #252c3f;
    color: inherit;
    font-size: 0.85rem;
    resize: vertical;
    min-height: 64px;
}

/* ── Confirm area ───────────────────────────────────────────────────────── */
.fi-confirm-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    flex-wrap: wrap;
}

.fi-confirm-label {
    font-size: 0.88rem;
    font-weight: 600;
}

.fi-confirm-btn {
    padding: 5px 14px;
    border-radius: 6px;
    border: none;
    background: #4dd68c;
    color: #0a1a14;
    font-weight: 700;
    cursor: pointer;
}

.fi-confirm-btn:hover { background: #3dc078; }

.fi-cancel-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--hi-border, #2a3040);
    background: none;
    color: var(--hi-muted, #8899aa);
    cursor: pointer;
}

.fi-cancel-btn:hover { border-color: #8899aa; }

/* ── Feedback ───────────────────────────────────────────────────────────── */
.fi-action-feedback { font-size: 0.88rem; }

.fi-feedback-ok {
    color: #4dd68c;
    font-weight: 600;
}

.fi-feedback-err {
    color: #e05c5c;
    font-weight: 600;
}

/* ── Verdict table ──────────────────────────────────────────────────────── */
.fi-verdict-table {
    font-size: 0.8rem;
}

/* ── Drawer body scrollable ─────────────────────────────────────────────── */
.fi-drawer-body {
    flex: 1;
    overflow-y: auto;
}

/* ── 390px responsive ───────────────────────────────────────────────────── */
@media (max-width: 420px) {
    .fi-kpi-strip {
        flex-direction: column;
    }
    .fi-kpi-tile {
        min-width: 0;
        flex: 1 1 100%;
    }
    .fi-table-wrap {
        overflow-x: scroll;
    }
    .fi-drawer {
        width: 100vw;
    }
    .fi-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .fi-search-input {
        min-width: 0;
        width: 100%;
    }
}

/* ── Theme: light ───────────────────────────────────────────────────────── */
body[data-theme="light"] .fi-kpi-tile,
body[data-theme="light"] .fi-section-card {
    background: #f4f6fb;
}

body[data-theme="light"] .fi-plain-table th,
body[data-theme="light"] .fi-plain-table td {
    border-color: #dde2ee;
}

body[data-theme="light"] .fi-plain-table tbody tr:hover {
    background: rgba(74, 158, 255, 0.06);
}

body[data-theme="light"] .fi-tile-label,
body[data-theme="light"] .fi-section-label,
body[data-theme="light"] .fi-kpi-placeholder,
body[data-theme="light"] .fi-empty-state {
    color: #6677aa;
}

body[data-theme="light"] .fi-tile-value,
body[data-theme="light"] .fi-page-title {
    color: #1a2240;
}

body[data-theme="light"] .fi-search-input {
    background: #fff;
    border-color: #c8d0e0;
    color: #1a2240;
}

body[data-theme="light"] .fi-reason-input {
    background: #fff;
    border-color: #c8d0e0;
    color: #1a2240;
}

/* ── Theme: dark (explicit) ─────────────────────────────────────────────── */
[data-theme="dark"] .fi-kpi-tile,
[data-theme="dark"] .fi-section-card {
    background: #1e2330;
}

[data-theme="dark"] .fi-drawer {
    background: #1a1f2e;
}

[data-theme="dark"] .fi-action-btn {
    background: #252c3f;
    border-color: #2a3040;
}

[data-theme="dark"] .fi-reason-input {
    background: #252c3f;
    border-color: #2a3040;
    color: #c8cdd8;
}

/* ── Theme: light — drawer ──────────────────────────────────────────────── */
body[data-theme="light"] .fi-drawer {
    background: #ffffff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .fi-action-btn {
    background: #f4f6fb;
    border-color: #c8d0e0;
    color: #1a2240;
}

body[data-theme="light"] .fi-action-btn-danger {
    border-color: #c03030;
    color: #c03030;
}

body[data-theme="light"] .fi-action-btn-enforce {
    border-color: #20a060;
    color: #20a060;
}

body[data-theme="light"] .fi-drawer-driver-info {
    border-color: #dde2ee;
    color: #6677aa;
}

body[data-theme="light"] .fi-drawer-title {
    color: #1a2240;
}

body[data-theme="light"] .fi-cancel-btn {
    border-color: #c8d0e0;
    color: #6677aa;
}

body[data-theme="light"] .fi-confirm-label,
body[data-theme="light"] .fi-input-label {
    color: #4455aa;
}

/* FEAT-642 fix2 (CR B2): active KPI tile + clear-filter control */
.fi-kpi-tile-active { border-color: var(--hi-accent, #4a9eff); box-shadow: 0 0 0 2px rgba(74,158,255,.35); }
.fi-kpi-clear-btn { margin-left: .5rem; padding: .25rem .6rem; border: 1px solid var(--border-color, rgba(128,128,128,.4)); border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
