* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #0C2321;
    min-height: 100vh;
}
a { color: #016F63; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg,#02A896,#016F63); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    padding: 32px 28px;
    width: 100%;
    max-width: 380px;
}
.logo { text-align: center; margin-bottom: 24px; }
.logo h1 { font-size: 1.6rem; color: #0C2321; }
.logo h1 span { color: #016F63; }
.logo p { color: #64748b; font-size: .9rem; margin-top: 4px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: #02A896; }
.login-footer { text-align: center; margin-top: 20px; font-size: .8rem; color: #94a3b8; }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: .9rem; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdfa; color: #016F63; border: 1px solid #99f6e4; }

/* App shell */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 { font-size: 1.1rem; }
.topbar a.sair { font-size: .85rem; color: #64748b; text-decoration: none; }
.container { max-width: 620px; margin: 0 auto; padding: 20px 16px 100px; }

.indicadores {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}
.indicador {
    flex: 1;
    padding: 10px 12px;
    text-align: center;
    text-decoration: none;
    border-right: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.indicador:last-child { border-right: none; }
.indicador-label { font-size: .68rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .03em; }
.indicador-valor { font-size: .95rem; font-weight: 700; color: #0C2321; }
.indicador-urgente .indicador-valor { color: #dc2626; }

.menu-principal {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 4px;
    padding: 0 16px;
    overflow-x: auto;
}
.menu-principal a {
    padding: 12px 14px;
    font-size: .85rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.menu-principal a.ativo { color: #016F63; border-bottom-color: #016F63; }

.filtros { display: flex; gap: 8px; margin-bottom: 16px; }
.filtros a {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    color: #64748b;
    background: #f1f5f9;
}
.filtros a.ativo { background: #016F63; color: #fff; }

.resumo-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
}
.resumo-box .valor-grande { font-size: 2rem; font-weight: 700; color: #016F63; margin: 6px 0; }
.resumo-box .sub { color: #64748b; font-size: .85rem; }
.seletor-periodo { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.seletor-periodo select {
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .9rem;
}
.info-box {
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: .85rem;
    color: #016F63;
    margin-bottom: 16px;
}
.info-box.aviso { background: #fffbeb; border-color: #fde68a; color: #92400e; }

.tabela-iva { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .85rem; }
.tabela-iva th { text-align: left; color: #64748b; font-weight: 600; padding: 6px 4px; border-bottom: 1px solid #e2e8f0; }
.tabela-iva td { padding: 6px 4px; border-bottom: 1px solid #f1f5f9; }
.tabela-iva th:not(:first-child), .tabela-iva td:not(:first-child) { text-align: right; }

/* Scan page */
.scan-wrap { text-align: center; }
.camera-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 20px auto;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 1 / 1;
}
.camera-box video { width: 100%; height: 100%; object-fit: cover; }
.camera-box .scan-frame {
    position: absolute; inset: 12%;
    border: 3px solid rgba(2,168,150,.8);
    border-radius: 12px;
    pointer-events: none;
}
.scan-hint { color: #64748b; font-size: .9rem; margin: 12px 0; }

/* Despesa card */
.despesa-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 14px;
}
.despesa-card .linha { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 6px; }
.despesa-card .linha span:first-child { color: #64748b; }
.despesa-card .total { font-size: 1.3rem; font-weight: 700; color: #016F63; margin: 10px 0; }
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-pendente { background: #fffbeb; color: #b45309; }
.badge-confirmado { background: #f0fdfa; color: #016F63; }

.fab {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 560px;
    width: calc(100% - 32px);
}

.empty-state { text-align: center; color: #94a3b8; padding: 60px 20px; }
