@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ── Telas (Views) ── */
.view { display: none; min-height: 100vh; padding-bottom: 120px; }
.view.active { display: block; animation: fadeUp .3s ease; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Header App ── */
.app-header {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-dark);
    z-index: 100;
}
.app-header h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.app-header .user-badge {
    background: var(--bg-card);
    border-radius: 30px;
    padding: 6px 14px 6px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.app-header .user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    font-weight: 700;
}

/* ── Bottom Nav ── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 200;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    transition: all .2s;
    border-radius: 12px;
}
.nav-item i { font-size: 22px; }
.nav-item.active { color: var(--primary); }
.nav-item:active { transform: scale(0.92); }

/* ── Scanner Button (center) ── */
.nav-scanner {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border: none;
    color: #fff;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -24px;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    transition: all .2s;
}
.nav-scanner:active { transform: scale(0.9); }

/* ── Cards ── */
.app-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin: 0 20px 16px;
}
.app-card-row {
    display: flex;
    gap: 12px;
    padding: 0 20px;
    margin-bottom: 16px;
    overflow-x: auto;
}
.stat-mini {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px;
    min-width: 130px;
    flex: 1;
    text-align: center;
}
.stat-mini .val { font-size: 24px; font-weight: 800; color: var(--text); }
.stat-mini .lbl { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-mini.primary .val { color: var(--primary); }
.stat-mini.success .val { color: var(--success); }
.stat-mini.warning .val { color: var(--warning); }
.stat-mini.danger .val { color: var(--danger); }

/* ── Quick Actions ── */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 20px; margin-bottom: 20px; }
.quick-btn {
    background: var(--bg-card);
    border: 1.5px solid transparent;
    border-radius: 16px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    color: var(--text);
}
.quick-btn:active { transform: scale(0.96); border-color: var(--primary); }
.quick-btn i { font-size: 28px; display: block; margin-bottom: 8px; }
.quick-btn span { font-size: 13px; font-weight: 600; }
.quick-btn.primary i { color: var(--primary); }
.quick-btn.success i { color: var(--success); }
.quick-btn.warning i { color: var(--warning); }
.quick-btn.info i { color: var(--info); }

/* ── Forms ── */
.app-form { padding: 0 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1.5px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    color: var(--text);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    outline: none;
    transition: all .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.form-group input::placeholder { color: #475569; }

.btn-app {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-app:active { transform: scale(0.97); }
.btn-app-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 16px rgba(37,99,235,0.3); }
.btn-app-success { background: var(--success); color: #fff; }
.btn-app-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid rgba(255,255,255,0.1); }

/* ── Scanner View ── */
.scanner-area {
    margin: 0 20px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    background: #000;
}
.scanner-area video { width: 100%; border-radius: 20px; }
.scanner-result {
    padding: 20px;
    margin: 16px 20px;
    border-radius: 16px;
    text-align: center;
}
.scanner-result.found { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); }
.scanner-result.error { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); }
.scanner-result h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.scanner-result p { font-size: 14px; color: var(--text-muted); }

/* ── Identified Entity Card ── */
.entity-card {
    margin: 16px 20px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    border-left: 4px solid var(--primary);
}
.entity-card .type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.entity-card .type-badge.veiculo { background: rgba(6,182,212,.2); color: var(--info); }
.entity-card .type-badge.funcionario { background: rgba(37,99,235,.2); color: var(--primary); }
.entity-card .type-badge.ativo { background: rgba(245,158,11,.2); color: var(--warning); }
.entity-card h3 { font-size: 18px; font-weight: 700; }
.entity-card .detail { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Status badges ── */
.badge-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.badge-status.disponivel { background: rgba(16,185,129,.15); color: var(--success); }
.badge-status.em_uso { background: rgba(37,99,235,.15); color: var(--primary); }
.badge-status.em_manutencao { background: rgba(245,158,11,.15); color: var(--warning); }

/* ── Login View ── */
.login-view {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 24px;
    padding-bottom: 40px;
}
.login-view .brand {
    text-align: center;
    margin-bottom: 48px;
}
.login-view .brand-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(37,99,235,0.3);
}
.login-view .brand h1 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.login-view .brand p { color: var(--text-muted); font-size: 14px; }

.alert-msg {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}
.alert-msg.error { background: rgba(239,68,68,.15); color: #fca5a5; display: block; }
.alert-msg.success { background: rgba(16,185,129,.15); color: #6ee7b7; display: block; }

/* ── Section title ── */
.section-title {
    padding: 0 20px;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-muted);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 0; }

/* ── Photo capture ── */
.photo-preview {
    width: 100%;
    border-radius: 14px;
    margin-top: 10px;
    display: none;
}
.photo-preview.show { display: block; }

/* ── Meus Itens (Checklist) ── */
.item-card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1.5px solid rgba(255,255,255,0.04);
    transition: all .2s;
    position: relative;
}
.item-card:active { transform: scale(0.98); border-color: rgba(255,255,255,0.1); }
.item-card-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.item-card-body { flex: 1; min-width: 0; }
.item-card-body h4 { font-size: 14px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-card-body .item-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.item-card-body .item-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; margin-top: 4px; }
.item-card-action {
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all .2s;
}
.item-card-action:active { transform: scale(0.9); }
.item-empty {
    text-align: center;
    padding: 32px 16px;
    background: var(--bg-card);
    border-radius: 14px;
    border: 1.5px dashed rgba(255,255,255,0.08);
}
.item-empty i { font-size: 32px; color: var(--text-muted); opacity: 0.4; display: block; margin-bottom: 8px; }
.item-empty p { color: var(--text-muted); font-size: 13px; margin: 0; }
